Itraday 1min Crypto bars

Hey I’m new here,

I tried to create a code to get as fast as possible 1 min bars, and I get some but there can be 5 min delay…
Is it normal? I suppose there is no bars because there is no price movement right?

Here is my code :

# Create a data stream client
client = CryptoDataStream(api_key=API_KEY, secret_key=SECRET_KEY)

async def on_bar(bar):
    """Callback function to handle new bars."""
    print(bar)
    print(f"Symbol: {bar.symbol}, Time: {bar.timestamp}, Open: {bar.open}, High: {bar.high}, Low: {bar.low}, Close: {bar.close}, Volume: {bar.volume}")

client.subscribe_bars(on_bar, "BTC/USD")

client.run()

Hey :wave:

Yes, it’s possible that if the price doesn’t change much for 5 minutes, no bar is generated.

ok thank you!
So I suppose it is quite normal If you trade low liquidity market in the middle of the night.

Help me understand-- if I log into robinhood, the price for BTC/USD changes every second. But on Alpaca, it’s very often 5 minutes between price updates on latest quote, latest bars – is this expected behavior?

Yes. Alpaca provides market data from its own crypto exchange. The latest quote shows the current best bid & ask on the exchange and bars are generated from the quotes (and some possible trades). It is possible, that it doesn’t change for minutes, if no orders (internal or external) are changing it.