Requests earnings data for a symbol: reported, estimated or standardised earnings per share.
request.earnings returns the figure from the latest earnings report as of each bar, so the value holds steady until the next report arrives.
Choose the figure with field: earnings.actual for the reported value, earnings.estimate for the analysts' expectation, or earnings.standardized for the actual value on a comparable basis.
Syntax
request.earnings(ticker: series string, field: series string (optional), gaps: simple barmerge_gaps (optional), lookahead: simple barmerge_lookahead (optional), ignore_invalid_symbol: input bool (optional), currency: series string (optional)) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| ticker | series string | required | The symbol to read. syminfo.tickerid is the chart's own symbol. |
| field | series string | earnings. | Which figure to return: earnings.actual, earnings.estimate or earnings.standardized. |
| gaps | simple barmerge_gaps | barmerge. | barmerge.gaps_on leaves na between reports. barmerge.gaps_off carries the last value forward. |
| lookahead | simple barmerge_lookahead | barmerge. | barmerge.lookahead_off waits for a report to be on record. barmerge.lookahead_on stamps each report onto the earlier bars of its period, which uses data from the future. |
| ignore_invalid_symbol | input bool | false | When true, an unknown symbol returns na. |
| currency | series string | the symbol's own currency | Currency to convert the figure to. |
Returns
series float: the earnings figure, or na where none is known.
Remarks
- Only stocks have earnings; other symbol types return na.
- On Sidechair: fundamental data is not available yet. The call warns once and returns na.
Example
//@version=6
indicator("Earnings surprise")
actual = request.earnings(syminfo.tickerid, earnings.actual)
estimate = request.earnings(syminfo.tickerid, earnings.estimate)
plot(actual - estimate, "Surprise", color = color.green, style = plot.style_columns)See also
Not on Sidechair yet