interactive brokers - Getting positions of your portfolio using python ibPy library -
i using ibpy positions of portfolio. understand can do:
from ib.opt import ibconnection tws = ibconnection( host = 'localhost',port= 7496, clientid = 123) tws.reqaccountupdates(true,'accountnumber')
and supposed use updateportfolio()
in way, don't know how.
thanks
tws.reqaccountupdates(true,'accountnumber')
send string "acctnumber" when meant variable. notice string send actual (fake)account number.
then need register callback messages you're interested in.
from ib.opt import ibconnection, message def acct_update(msg): print(msg) con = ibconnection(clientid=1) con.register(acct_update, message.updateaccountvalue, message.updateaccounttime, message.updateportfolio) con.connect() con.reqaccountupdates(true,'du000000') #don't forget disconnect somehow when done #con.disconnect()
Comments
Post a Comment