您现在的位置是:首页 >技术教程 >QMT获取持仓对象所有属性和属性值网站首页技术教程
QMT获取持仓对象所有属性和属性值
#encoding:gbk
import pandas as pd
import numpy as np
import talib
import datetime
def init(ContextInfo):
ContextInfo.accID='80041016'
ContextInfo.set_account(ContextInfo.accID)
position_list=get_trade_detail_data(ContextInfo.accID,'STOCK','POSITION')
for i in position_list:
print('-'*30)
for attr in dir(i):
if attr[0:2]=='m_':
print(attr,getattr(i,attr))
def handlebar(ContextInfo):
pass
输出结果
m_bIsToday True
m_dAvgOpenPrice 11.87924050025
m_dCloseAmount 0.0
m_dCloseProfit 0.0
m_dFloatProfit -799.999999999983
m_dInstrumentValue 446800.0
m_dLastPrice 11.17
m_dLastSettlementPrice 0.0
m_dMargin 0.0
m_dMarketValue 446800.0
m_dOpenCost 475169.62
m_dOpenPrice 11.87924050025
m_dPositionCost 475169.62
m_dPositionProfit -28369.619999999995
m_dProfitRate -0.05970419573540917
m_dRealUsedMargin 0.0
m_dRedemptionVolume 0
m_dReferenceRate 0.0
m_dRoyalty 0.0
m_dSettlementPrice 11.17
m_dSingleCost 0.0
m_dStaticHoldMargin 1.7976931348623157e+308
m_dStockLastPrice 1.7976931348623157e+308
m_dStructFundVol 0
m_dTotalCost 0.0
m_eFutureTradeType 48
m_eSideFlag 0
m_nCanUseVolume 40000
m_nCidIncrease -334297547
m_nCidIsDelist -1175584696
m_nCidRateOfCurrentLine 808464384
m_nCidRateOfTotalValue 1395536178
m_nCloseVolume 0
m_nCoveredVolume 0
m_nDirection 48
m_nEnableExerciseVolume -1
m_nFrozenVolume 0
m_nHedgeFlag 49
m_nLegId 0
m_nOnRoadVolume 0
m_nOptCombUsedVolume 0
m_nPREnableVolume 40000
m_nSettledAmt 0
m_nStrategyID 5837400765440865603
m_nVolume 40000
m_nYesterdayVolume 40000
m_strAccountID 80041016
m_strAccountKey 2____10103____1000____49____80041016____
m_strComTradeID
m_strExchangeID SH
m_strExchangeName 上证所
m_strExpireDate
m_strInstrumentID 600305
m_strInstrumentName 恒顺醋业
m_strOpenDate
m_strProductID
m_strProductName
m_strStockHolder A430576056
m_strTradeID
m_strTradingDay 20230427
m_xtTag None
对照文档好好理解每个属性的意思吧。