Code: def updatePortfolio(self, contract, position, marketPrice, marketValue, averageCost, unrealizedPNL, realizedPNL, accountName): self.myvariable = position Code: def cxlAccountUpdates(self): self.connection.reqAccountUpdates(False,"DU666") PM me. I will write it for you
Good news: I was able to successfully install swigibipy on home machine and I am working through your example
hi globalarbtrader your website has been a great reading example. I am learning Python also and it's fun. I was running your script using a code I created for myself: ibcontract = IBcontract() ibcontract.secType = "OPT" ibcontract.expiry = "20160115" ibcontract.symbol = "MSFT" ans = client.get_IB_market_data(ibcontract) However, inside wrapper_v3.py I get error: line 212, in get_IB_market_data self.cb.init_tickdata(tickerid) AttributeError: 'IBWrapper' object has no attribute 'init_tickdata' Can you provide some hints regarding this ?
First of all I assume that test3_IB works okay ( you should always check the official test code works before trying to modify it yourself). It would probably be be easier if you started with the test code and modified it rather than writing your own from scratch. You must be missing some code. Can you give me *all* the code in your script up to this point (i.e. how do you define 'client') plus the full traceback when it fails. Can you also give me the results of running dir(client) and dir(client.cb) GAT
Hi globalarbtrader I played around more with your code and seems like test3_IB works great in pulling historical data for futures. It however gives error when I try the following ibcontract2 = IBcontract() ibcontract2.secType = "STK" ibcontract2.symbol="MSFT" ans2=client.get_IB_historical_data(ibcontract2) print ans2 ibcontract3 = IBcontract() ibcontract2.secType = "OPT" ibcontract2.expiry="20160219" ibcontract2.symbol="MSFT" ans3=client.get_IB_historical_data(ibcontract3) print ans3 I am wondering what the required fields when I want to pull the option and stock historical data.
Probably the exchange and strike respectively. But I hope someone else can tell you for sure as I don't trade these
Hello GAT, I was wondering how you determine in IB if a market is closed? What specific things do you look for. For example when I query the BBO for a closed market it gives me negative prices. Is this consistent for a closed market? Is it a reliable?
I don't know if this is reliable. My code checks for zero or negative prices, and treats them the same - as an 'untradeable' market. I don't care if a market is closed, or just happens to have no liquidity at that moment. GAT