开云体育

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

Re: Pulling reqMktData for multiple tickers


 

So leaving the +1 in:

for tickerId in range(1, len(tickers)+1):?

was giving me an IndexError: list index out of range

So I removed the +1 and this is what I get. I get 3 threads running. But I'm still only getting prints from the last ticker FB

I attached an example screenshot of my Spyder screen. I tried to just attach the photo, but it kept making the photo which was 1500 x 900 way too small to read once it uploaded. And when I would adjust the already uploaded photo to 1500 x 900 it stretched the small photo and made it blurry... lol... and also here is a the code from my ticktype

------------------------

def tickPrice(self, reqId, tickType, price, attrib):
? ? ? ? if tickType == 1 and reqId == tickerId:
? ? ? ? ? ? self.bidprice = {"ReqId": reqId, "TickType": tickType, "Price": price, "Attrib": attrib}
? ? ? ? ? ? print("The current bid price is: ", price)
? ? ? ? ? ??
? ? ? ? elif tickType == 2 and reqId == tickerId:
? ? ? ? ? ? self.askprice = {"ReqId": reqId, "TickType": tickType, "Price": price, "Attrib": attrib}
? ? ? ? ? ? print("The current ask price is: ", price)
? ? ? ? ? ??
? ? ? ? elif tickType == 4 and reqId == tickerId:
? ? ? ? ? ? self.lastprice = {"ReqId": reqId, "TickType": tickType, "Price": price, "Attrib": attrib}
? ? ? ? ? ? print("The current last price is: ", price)? ? ? ? ? ??
? ? ? ? ? ??
? ? ? ? ? ? '''NOTES: BID Price = 1, ASK Price = 2, Last Price = 4'''

-----------------

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