Skip to content

Alpaca Market Data Bar Updates not supported #166

@bryantharris

Description

@bryantharris

It appears looking at the code that there's no way to receive Bar updates (revisions to a previously returned Bar that has changed due to late settling trades). Would it be possible to add?

From Alpaca's Documentation

Bars are calculated, and available, 1 second after the close of each minute (eg the 9:31 bar is calculated at 9:32:01). Because trade data can be delivered up to 10 seconds after the actual execution, the bar is then recalculated after 30 seconds (eg the 9:31 bar is re-calculated at 9:32:30) and will include any trades received after the initial calculation.

Their documentation shows that at the 30s mark it should be possible to receive a revised Bar object (source real-time-stock-pricing-data)

Minute Bars (bars)

Minute bars are emitted right after each minute mark. They contain the trades from the previous minute. Trades from pre-market and aftermarket are also aggregated and sent out on the bars channel.

Note: Understanding which trades are excluded from minute bars is crucial for accurate data analysis. For more detailed information on how minute bars are calculated and excluded trades, please refer to this article Stock Minute Bars.

Updated Bars (updatedBars)

Updated bars are emitted after each half-minute mark if a “late” trade arrived after the previous minute mark. For example if a trade with a timestamp of 16:49:59.998 arrived right after 16:50:00, just after 16:50:30 an updated bar with t set to 16:49:00 will be sent containing that trade, possibly updating the previous bar’s closing price and volume.

Attribute Type Description
T string message type: “b”, “d” or “u”
S string symbol
o number open price
h number high price
l number low price
c number close price
v int volume
t string RFC-3339 formatted timestamp

Example

{
  "T": "b",
  "S": "SPY",
  "o": 388.985,
  "h": 389.13,
  "l": 388.975,
  "c": 389.12,
  "v": 49378,
  "t": "2021-02-22T19:15:00Z"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions