diff --git a/alpaca/entities.go b/alpaca/entities.go index cd1d8f5..8496153 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -182,10 +182,12 @@ type AccountActvity struct { } type PortfolioHistory struct { - Arrays []interface{} `json:"arrays"` - Attributes []map[string]string `json:"attributes"` - Timeframe RangeFreq `json:"timeframe"` - BaseValue float64 `json:"base_value"` + BaseValue decimal.Decimal `json:"base_value"` + Equity []decimal.Decimal `json:"equity"` + ProfitLoss []decimal.Decimal `json:"profit_loss"` + ProfitLossPct []decimal.Decimal `json:"profit_loss_pct"` + Timeframe RangeFreq `json:"timeframe"` + Timestamp []int64 `json:"timestamp"` } type PlaceOrderRequest struct { diff --git a/alpaca/rest.go b/alpaca/rest.go index 38bbf53..13e9629 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -216,7 +216,17 @@ func (c *Client) GetPortfolioHistory(startDate, endDate *time.Time, period *Hist } q.Set("extended", strconv.FormatBool(extended)) - return &PortfolioHistory{}, nil + resp, err := c.get(u) + if err != nil { + return nil, err + } + + portfolioHistory := PortfolioHistory{} + if err = unmarshal(resp, &portfolioHistory); err != nil { + return nil, err + } + + return &portfolioHistory, nil } // ListPositions lists the account's open positions.