Skip to content

Commit

Permalink
Allow GetFinancials to pull annual data as well
Browse files Browse the repository at this point in the history
  • Loading branch information
actfong committed Jan 13, 2019
1 parent 77870e7 commit a8b5d23
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,15 @@ func (c *Client) GetEarnings(symbol string) (*EarningsReport, error) {
}

// GetFinancials Pulls income statement, balance sheet
// and cash flow data from the four most recent reported quarters.
func (c *Client) GetFinancials(symbol string) (*FinancialsReport, error) {
// and cash flow data from the four most recent reported periods.
// The default period is "quarter", unless "annual" is provided
func (c *Client) GetFinancials(symbol string, period_optional ...string) (*FinancialsReport, error) {
var result *FinancialsReport
err := c.getJSON("/stock/"+symbol+"/financials", nil, &result)
period := "quarter"
if len(period_optional) > 0 && period_optional[0] == "annual" {
period = "annual"
}
err := c.getJSON("/stock/"+symbol+"/financials"+"?period="+period, nil, &result)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a8b5d23

Please sign in to comment.