返回列表 发布新帖

get_trade_detail_data 返回值异常

26 0
def get_avaliable(accountid, datatype):
    result = 0
    resultlist = get_trade_detail_data(accountid, datatype, "ACCOUNT")
    for obj in resultlist:
        # print("账户ID:", obj.m_strAccountID, "总资产:", obj.m_dBalance, "可用金额:", obj.m_dAvailable)
        print(f'总资产: {obj.m_dBalance:.2f}, 净资产: {obj.m_dAssureAsset:.2f}, 总市值: {obj.m_dInstrumentValue:.2f}', 
        f'总负债: {obj.m_dTotalDebit:.2f}, 可用金额: {obj.m_dAvailable:.2f}, 盈亏: {obj.m_dPositionProfit:.2f}')
        result = obj.m_dAvailable       # 可用金额,指账户中可用于交易和提取的资金金额
    return result


def get_holdings(accountid, datatype):
    holdinglist = {}
    resultlist = get_trade_detail_data(accountid, datatype, "POSITION")
    for obj in resultlist:
        # print("股票代码:", obj.m_strInstrumentID, "市场类型:", obj.m_strExchangeID, "可用余额:", obj.m_nCanUseVolume)
        print(f'股票代码: {obj.m_strInstrumentID}, 市场类型: {obj.m_strExchangeID}, 证券名称: {obj.m_strInstrumentName}, 持仓量: {obj.m_nVolume}, 可用数量: {obj.m_nCanUseVolume}',f'成本价: {obj.m_dOpenPrice:.2f}, 市值: {obj.m_dInstrumentValue:.2f}, 持仓成本: {obj.m_dPositionCost:.2f}, 盈亏: {obj.m_dPositionProfit:.2f}')
        holdinglist[obj.m_strInstrumentID + "." + obj.m_strExchangeID] = obj.m_nCanUseVolume    # 可用余额
    return holdinglist

image.png

为什么这几个值很异常?

回复

您需要登录后才可以回帖 登录 | 立即注册

客服专线

400-080-8112

用思考的速度交易,用真诚的态度合作,我们是认真的!
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2025 迅投QMT社区 版权所有 All Rights Reserved. 京ICP备2025122616号-3
关灯 快速发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表