Alcapa Current quote price is way off from market price

Hello,

I’m building a trading software and I selected Alpaca as broker as I understood this is one of the best option for API trading, however I face a blocking issue, that is price data is far off!

I understand that I can pay 99$ for quality historical quotes via sip feed, but I would still expect some decent data, at least for current market price on the free version.

I’m using the following code (with alpaca-py) to retrieve current market price:

            from alpaca.data.historical import StockHistoricalDataClient
            from alpaca.data.requests import StockLatestQuoteRequest

            

            # Create data client for market data
            data_client = StockHistoricalDataClient(
                api_key=self.settings["api_key"],
                secret_key=self.settings["api_secret"]
            )
            

            # Normalize input to list for uniform processing
            is_single_symbol = isinstance(symbol_or_symbols, str)
            symbols_list = [symbol_or_symbols] if is_single_symbol else symbol_or_symbols            

            # Get latest quotes - Alpaca natively supports bulk fetching
            request = StockLatestQuoteRequest(symbol_or_symbols=symbols_list)
            quotes = data_client.get_stock_latest_quote(request)

Now i’m getting things which are completely messed up, like Netflix (NFLX) price bid is 1000$ (WTF?), while the price on alpaca site is 1,109.36$

I’ve made a script that compares bid/ask for both paper (account 1) and live (account 2) accounts, the price is exactly the same:

========================================================================================================================
PRICE COMPARISON RESULTS
========================================================================================================================

Bid/Ask Price Comparison (Sorted by Spread)
┏━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃ Account 1 ┃ Account 1 ┃ Account 1 ┃ Account 2 ┃ Account 2 ┃ Account 2 ┃ Bid ┃ Ask ┃ ┃
┃ Symbol ┃ Bid ┃ Ask ┃ Spread % ┃ Bid ┃ Ask ┃ Spread % ┃ Diff % ┃ Diff % ┃ Notes ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ SHOP │ $140.0000 │ $178.6100 │ 24.237% │ $140.0000 │ $178.6100 │ 24.237% │ +0.000% │ +0.000% │ │
│ NFLX │ $1000.0000 │ $1110.0000 │ 10.427% │ $1000.0000 │ $1110.0000 │ 10.427% │ +0.000% │ +0.000% │ │
│ META │ $688.0000 │ $760.0000 │ 9.945% │ $688.0000 │ $760.0000 │ 9.945% │ +0.000% │ +0.000% │ │
│ TXN │ $160.0000 │ $176.0000 │ 9.524% │ $160.0000 │ $176.0000 │ 9.524% │ +0.000% │ +0.000% │ │
│ ANET │ $152.0600 │ $157.3300 │ 3.407% │ $152.0600 │ $157.3300 │ 3.407% │ +0.000% │ +0.000% │ │
│ UNH │ $365.0000 │ $376.0000 │ 2.969% │ $365.0000 │ $376.0000 │ 2.969% │ +0.000% │ +0.000% │ │
│ AVGO │ $363.8000 │ $374.0000 │ 2.765% │ $363.8000 │ $374.0000 │ 2.765% │ +0.000% │ +0.000% │ │
│ SNOW │ $268.7800 │ $275.0000 │ 2.288% │ $268.7800 │ $275.0000 │ 2.288% │ +0.000% │ +0.000% │ │
│ ARM │ $174.6400 │ $178.0000 │ 1.906% │ $174.6400 │ $178.0000 │ 1.906% │ +0.000% │ +0.000% │ │
│ CRWD │ $544.3800 │ $553.5100 │ 1.663% │ $544.3800 │ $553.5100 │ 1.663% │ +0.000% │ +0.000% │ │
│ BILL │ $50.0000 │ $50.7800 │ 1.548% │ $50.7300 │ $50.7800 │ 0.099% │ +1.460% │ +0.000% │ │
│ TSM │ $297.0000 │ $300.0000 │ 1.005% │ $297.0000 │ $300.0000 │ 1.005% │ +0.000% │ +0.000% │ │
│ ADBE │ $361.8700 │ $364.9100 │ 0.837% │ $361.8700 │ $364.9100 │ 0.837% │ +0.000% │ +0.000% │ │
│ MSFT │ $541.1800 │ $545.5000 │ 0.795% │ $541.1800 │ $545.5000 │ 0.795% │ +0.000% │ +0.000% │ │
│ BABA │ $177.3500 │ $178.6000 │ 0.702% │ $177.3800 │ $177.4200 │ 0.023% │ +0.017% │ -0.661% │ │
│ COST │ $921.8700 │ $925.0100 │ 0.340% │ $921.8700 │ $925.0100 │ 0.340% │ +0.000% │ +0.000% │ │
│ ARLP │ $24.4200 │ $24.5000 │ 0.327% │ $24.4200 │ $24.5000 │ 0.327% │ +0.000% │ +0.000% │ │
│ TMUS │ $220.7400 │ $221.2400 │ 0.226% │ $220.7400 │ $220.7900 │ 0.023% │ +0.000% │ -0.203% │ │
│ GAIN │ $14.0900 │ $14.1200 │ 0.213% │ $14.0900 │ $14.1200 │ 0.213% │ +0.000% │ +0.000% │ │

I hope I’m doing something wrong and there’s a way to get proper live prices, because otherwise I don’t see how one can build a working strategy relying on this api.

@Bastien_Migette It sounds from your post that you are not subscribed to Algo Trader Plus market data and are using the free Basic data. The real time Basic data (eg latest quotes) only includes quotes and trades and aggregated bars which executed on the IEX exchange. Only about 2-3% of all trades execute on the IEX exchange so it is expected to be incomplete and can often vary a lot from full market SIP data. It’s primarily included for testing and generally shouldn’t be used for live trade decisions. The SIP data is full market data and includes all quotes and trades. For a description of the difference check out the documentation here.

That is why you are seeing the large differences. Note that the free Basic plan has access to all full market data older than the most recent 15 minutes (exact same data as the paid subscription). Simply specify feed=sip.

One option, without having an Algo Trader Plus subscription, is to use feed='delayed_sip'. This returns full market SIP quotes but simply delayed 15 minutes. That may work for some use cases. Something like this:

request = StockLatestQuoteRequest(symbol_or_symbols=symbols_list, feed='delayed_sip')

You also mentioned “[your script] compares bid/ask for both paper (account 1) and live (account 2) accounts, the price is exactly the same”. That’s expected. The APIs always return the same data whether you use paper or live account keys. Any keys from any of your accounts will work and access the same data. Why? Your market data subscription (whether Algo Trader Plus or the free Basic plan) is tied to your owner ID. The only reason API keys are used to fetch data is so the system 1) can find the account associated with the keys 2) lookup the owner ID of that account then 3) lookup which data subscription is associated with that owner ID. Since all accounts (paper and live) held by an owner have the same owner ID, any API keys can be used (paper or live) to access market data. It will be the same data.

Hope that helps.

1 Like

Thanks, I ended up with delayed_sip which is fine for my use case.
I’d still belive it would make sense to have up to date latest quality quote even on free plan, and limit historical data from SIP exchange to premium though :slight_smile:

1 Like