¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

tickByTickBidAsk bid size is alway is equal to ask size


 

I am requesting tick-by-tick bid ask data for SPY. In what arrives bid size is always equal to ask size. Is this expected behaviour or a bug?
Here is my code:

from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from ibapi.ticktype import TickTypeEnum
import time
import datetime
import threading
?
class TestApp(EWrapper, EClient):
? ? def __init__(self):
? ? ? ? EClient.__init__(self, self)
? ? ? ? ? ? ? ?
?
? ? def error(self, reqId, errorCode, errorString):
? ? ? ? print("Error: ", reqId, " ", errorCode, " ", errorString)
?
? ? def tickByTickBidAsk(self, reqId, time, bidPrice, askPrice,
? ? ? ? ?bidSize, askSize, tickAttribBidAsk):
? ? ? ? super().tickByTickBidAsk(reqId, time, bidPrice, askPrice, bidSize,
? ? ? ? ? ? askSize, tickAttribBidAsk)
? ? ? ? print("BidAsk. ReqId:", reqId,
? ? ? ? ? ? "Time:", datetime.datetime.fromtimestamp(time).strftime("%Y%m%d %H:%M:%S"),
? ? ? ? ? ? "BidPrice:", bidPrice, "AskPrice:", askPrice, "BidSize:", bidSize,
? ? ? ? ? ? "AskSize:", askSize, "BidPastLow:", tickAttribBidAsk.bidPastLow,?
? ? ? ? ? ? ? "AskPastHigh:", tickAttribBidAsk.askPastHigh)? ??
? ? ? ? print("_______________________\n")
? ? ? ??
? ??
contract2 = Contract()
contract2.symbol = "SPY"
contract2.secType = "STK"
contract2.exchange = "SMART"
contract2.currency = "USD"
contract2.primaryExchange = "ARCA"



? ??


 

Have you verified in TWS/IBGW API logs that TWS/IBGW indeed always send the same value for askSize and bidSize in tickByTickBidAsk callbacks for SPY? It would be time for a ticket with IBKR if that is what you find.

More likely, though, wires got somehow crossed within your client application and you might want to trace the call path through the API and your client code one more time.

´³¨¹°ù²µ±ð²Ô


 

Thank you so much! I did not realize that I can check logs.?

From what I see on log (rather Client) tab:?

19:05:45:004 -> ---,99-1-3-1661195145-413.05-413.07-1200-1200-0-
19:05:45:004 -> ---,99-1-3-1661195145-413.05-413.07-1100-1100-0-
19:05:45:004 -> ---,99-1-3-1661195145-413.05-413.07-1000-1000-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-900-900-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-900-900-0-
19:05:45:004 -> ---,99-1-3-1661195145-413.05-413.07-1000-1000-0-
19:05:45:004 -> ---,99-1-3-1661195145-413.05-413.07-1100-1100-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-900-900-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-800-800-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-700-700-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-700-700-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-700-700-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-800-800-0-
19:05:45:004 -> ---*99-1-3-1661195145-413.05-413.07-900-900-0-
19:05:45:026 <- 98-1-

So indeed bid and ask sizes are the same.

Let me try to find where I can file API bug report


 

In these cases, the API log or IBGW client tab are definitely the first place you want to check.

Did you try a different version of TWS/IBGW?

´³¨¹°ù²µ±ð²Ô


 

I just update IBGW to the most recent version: 10.12.2u. The issue is still present. Logs confirm it.


 

´³¨¹°ù²µ±ð²Ô

Do you by any chance know how to file a bug report. I sent email at [email protected],? (whatever i found online), but now quite sure if this is the best way to reach developers?



 

That email is probably a good start. You could also file a ticket from the account management function when you are logged into your "real" account in the Client Web Portal. I believe "API" was one of the ticket categories last time I filed a ticket.

´³¨¹°ù²µ±ð²Ô