Sidechair

request.earnings()

Browse the reference

Requests earnings data for a symbol: reported, estimated or standardised earnings per share.

Try it in the editor

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

Pine Script
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 float

Arguments

NameTypeDefaultDescription
tickerseries stringrequiredThe symbol to read. syminfo.tickerid is the chart's own symbol.
fieldseries stringearnings.actualWhich figure to return: earnings.actual, earnings.estimate or earnings.standardized.
gapssimple barmerge_gapsbarmerge.gaps_offbarmerge.gaps_on leaves na between reports. barmerge.gaps_off carries the last value forward.
lookaheadsimple barmerge_lookaheadbarmerge.lookahead_offbarmerge.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_symbolinput boolfalseWhen true, an unknown symbol returns na.
currencyseries stringthe symbol's own currencyCurrency 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

Pine ScriptEarnings surpriseOpen in editor
//@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