在ibapi包的client.py脚本中提供了方法reqAccountSummary,该方法可以请求以下标签信息
accountountType
gatway.api.client.reqAccountSummary(1001,"All","TotalCashValue") gatway.api.client.reqAccountSummary(1001,"All","accountountType") gatway.api.client.reqAccountSummary(1001,"All","NetLiquidation") gatway.api.client.reqAccountSummary(1001,"All","TotalCashValue") gatway.api.client.reqAccountSummary(1001,"All","SettledCash") gatway.api.client.reqAccountSummary(1001,"All","AccruedCash") gatway.api.client.reqAccountSummary(1001,"All","BuyingPower") gatway.api.client.reqAccountSummary(1001,"All","EquityWithLoanValue") gatway.api.client.reqAccountSummary(1001,"All","GrossPositionValue") gatway.api.client.reqAccountSummary(1001,"All","RegTEquity") gatway.api.client.reqAccountSummary(1001,"All","SMA") gatway.api.client.reqAccountSummary(1001,"All","InitMarginReq") gatway.api.client.reqAccountSummary(1001,"All","MaintMarginReq") gatway.api.client.reqAccountSummary(1001,"All","AvailableFunds") gatway.api.client.reqAccountSummary(1001,"All","Cushion") gatway.api.client.reqAccountSummary(1001,"All","FullInitMarginReq") gatway.api.client.reqAccountSummary(1001,"All","FullMaintMarginReq") gatway.api.client.reqAccountSummary(1001,"All","FullAvailableFunds") gatway.api.client.reqAccountSummary(1001,"All","FullExcessLiquidity") gatway.api.client.reqAccountSummary(1001,"All","LookAheadNextChange") gatway.api.client.reqAccountSummary(1001,"All","LookAheadInitMarginReq") gatway.api.client.reqAccountSummary(1001,"All","LookAheadMaintMarginReq") gatway.api.client.reqAccountSummary(1001,"All","LookAheadAvailableFunds") gatway.api.client.reqAccountSummary(1001,"All","LookAheadExcessLiquidity") gatway.api.client.reqAccountSummary(1001,"All","HighestSeverity") gatway.api.client.reqAccountSummary(1001,"All","DayTradesRemaining") gatway.api.client.reqAccountSummary(1001,"All","Leverage") gatway.api.client.reqAccountSummary(1001,"All","$LEDGER") gatway.api.client.reqAccountSummary(1001,"All","$LEDGER")
但是该函数不直接返回请求标签对应的账户信息,而是通过ibapi包下的wrapper.py脚本中的
accountSummary()方法,将请求的信息写入日志文件,所以可以在此处设置成员变量接受这些信息,需要确认一下totalchashvalue是不是净值的意思,如果是的话,直接获取该值就行了
可以直接在此处调用http方法把各标签对应的值传递到服务器
解决了净值传输的问题,当前持仓细节放在后面
下面的任务是追踪一个交易订单指令下达时,整个的交易执行流程,以及交易执行结果【成功还是失败,失败的话,需要报告交易失败的原因】
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)