开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

API data not the same as TWS data?


 

Hi there. I'm retrieving data from stocks using a Python script and the methods?tickPrice, tickSize and updateMktDepthL2
?
It looks like it is working, but checking the data I get from the API is not?similar at all to the data shown in TWS (or other apps). I'm wondering if I'm doing things right. I have been?reading about this on the internet and it happens to be a common?subject. I know I should count with some deviation, the bars I could build with fetched?data are not going to be exactly?the same as the TWS bars, but the samples I have checked are far away from being close.?
?
I'm trying to build?a system that takes data from the order book and trades (prices) to make a study, but with the provided?accuracy is impossible. I don't need a 100% accuracy, let's say a 98% will be fine.?
?
By the way, I haven't found any documentation about the retrieved data, is there someone who can give me a link or confirm my understanding is right:
?
05/09/2024 15:29:59.427 HBAN tickPrice reqId: 3 tickType: BID price: 14.85 attrib: CanAutoExecute: 1 PastLimit: 0 PreOpen: 0
05/09/2024 15:29:59.427 HBAN tickSize reqId: 3 tickType: BID_SIZE size: 2300
?
The first line means an order has been filled in the BID side at 14.85? ?
The second line means the order had a size of 2300
So the last crossed price will be 14.85?
The same is true for ASK side orders.
?
05/09/2024 15:30:00.275 HBAN tickPrice reqId: 3 tickType: LAST price: 14.85 attrib: CanAutoExecute: 0 PastLimit: 0 PreOpen: 0
05/09/2024 15:30:00.276 HBAN tickSize reqId: 3 tickType: LAST_SIZE size: 2300?
?
This is much more tricky, it could be: 1) a confirmation of the previous trade, so they are always redundant, 2) Market orders crossed with other market orders
Could anyone confirm?
?
Thank you,

Join [email protected] to automatically receive all group messages.