In real time, I can access to bid and ask prices and sizes through the data market stream (wss://stream.data.sandbox.alpaca.markets/{version}/{feed}), this is ok.
However, where the “100” comes from ? I understand that this is the pound of the latest calculated price, but it varies from 100 to 1000 etc…
The “price” is never exactly known before execution and an order is filled. Trading is not like buying something at Target where everything has a price tag. However, typically buy orders fill at the current ‘Ask’ (ie the lowest price someone is willing to sell for) and sell orders fill at the current ‘Bid’ (ie the highest price someone is willing to pay). The image you have above is simply the current Ask and Bid prices.
”In real time, I can access to bid and ask prices and sizes through the data market stream (wss://stream.data.sandbox.alpaca.markets/{version}/{feed}), this is ok.”
That sandbox endpoint is for users of the Broker APIs. If you stream data with websockets use one of the endpoints with a base URL of wss://stream.data.alpaca.markets. See the docs here for more description. However, typically quotes are fetched with the REST APIs like get_latest_quote.
However, where the “100” comes from ? I understand that this is the pound of the latest calculated price, but it varies from 100 to 1000 etc…
That value is simply the size (in 100s of shares) of the last quote. The person quoting is willing to trade that many shares at that price. Typically that isn’t relevant for a specific trade. It doesn’t impact price.
Also, what “Latest price” stands for ?
The ‘latest price’ is the price which the last trade executed at. It’s interesting, but won’t impact the price your order will fill. Your order will typically fill at the bid or ask.
How can I get this real time data?
To get real time data you need to subscribe to market data. You can get that (conveniently) from Alpaca, but there are also other data providers such as Polygon and Intrinio. All have the same underlying data. Take a look here for Alpaca’s market data subscriptions. Only the Algo Trader Plus provides full market real time data.