¿ªÔÆÌåÓý

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"



? ??

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