Websocket minute bars - receiving duplicate bars

The server sometimes (multiple times per market day) sends me duplicate minutes bars but with slightly different volume data. For example:

Bar({   'close': 121.2199,
    'high': 121.25,
    'low': 121.06,
    'open': 121.07,
    'symbol': 'AAPL',
    'timestamp': 1617031500000000000,
    'volume': 233197})

Bar({   'close': 121.2199,
    'high': 121.25,
    'low': 121.06,
    'open': 121.07,
    'symbol': 'AAPL',
    'timestamp': 1617031500000000000,
    'volume': 233198})

Can anyone tell me why this happens?

This is probably an updated bar. Sometimes trade data is delayed from an exchange and alpaca will send out an ‘updated’ bar to reflect the new information.

1 Like

Ah I see. Thanks. Maybe they should add a flag or something to the bar to reflect this.

I use the timestamp as a kind of UUID for this purpose.