附录
# XtQuant数据字典
# 交易市场(market)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.SH_MARKET | 0 | 上海市场 |
| xtconstant.SZ_MARKET | 1 | 深圳市场 |
# 账号类型(account_type)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.FUTURE_ACCOUNT | 1 | 期货账号 |
| xtconstant.SECURITY_ACCOUNT | 2 | 证券账号 |
| xtconstant.CREDIT_ACCOUNT | 3 | 信用账号 |
| xtconstant.HUGANGTONG_ACCOUNT | 7 | 沪港通账号 |
| xtconstant.SHENGANGTONG_ACCOUNT | 11 | 深港通账号 |
# 委托类型(order_type)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.STOCK_BUY | 23 | 证券买入 |
| xtconstant.STOCK_SELL | 24 | 证券卖出 |
| xtconstant.CREDIT_BUY | 23 | 担保品买入 |
| xtconstant.CREDIT_SELL | 24 | 担保品卖出 |
| xtconstant.CREDIT_FIN_BUY | 27 | 融资买入 |
| xtconstant.CREDIT_SLO_SELL | 28 | 融券卖出 |
| xtconstant.CREDIT_BUY_SECU_REPAY | 29 | 买券还券 |
| xtconstant.CREDIT_DIRECT_SECU_REPAY | 30 | 直接还券 |
| xtconstant.CREDIT_SELL_SECU_REPAY | 31 | 卖券还款 |
| xtconstant.CREDIT_DIRECT_CASH_REPAY | 32 | 直接还款 |
| xtconstant.CREDIT_FIN_BUY_SPECIAL | 40 | 专项融资买入 |
| xtconstant.CREDIT_SLO_SELL_SPECIAL | 41 | 专项融券卖出 |
| xtconstant.CREDIT_BUY_SECU_REPAY_SPECIAL | 42 | 专项买券还券 |
| xtconstant.CREDIT_DIRECT_SECU_REPAY_SPECIAL | 43 | 专项直接还券 |
| xtconstant.CREDIT_SELL_SECU_REPAY_SPECIAL | 44 | 专项卖券还款 |
| xtconstant.CREDIT_DIRECT_CASH_REPAY_SPECIAL | 45 | 专项直接还款 |
# 报价类型(price_type)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.LATEST_PRICE | 5 | 最新价 |
| xtconstant.FIX_PRICE | 11 | 限价 |
| xtconstant.MARKET_SH_CONVERT_5_CANCEL | 42 | 上海最优五档即时成交剩余撤销 |
| xtconstant.MARKET_SH_CONVERT_5_LIMIT | 43 | 上海最优五档即时成交剩余转限价 |
| xtconstant.MARKET_PEER_PRICE_FIRST | 44 | 对手方最优价格(上交所股票、深交所股票和深交所期权有效) |
| xtconstant.MARKET_MINE_PRICE_FIRST | 45 | 深圳本方最优价格(上交所股票、深交所股票和深交所期权有效) |
| xtconstant.MARKET_SZ_INSTBUSI_RESTCANCEL | 46 | 深圳即时成交剩余撤销 |
| xtconstant.MARKET_SZ_CONVERT_5_CANCEL | 47 | 深圳最优五档即时成交剩余撤销 |
| xtconstant.MARKET_SZ_FULL_OR_CANCEL | 48 | 深圳全额成交或撤销 |
# 委托状态(order_status)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.ORDER_UNREPORTED | 48 | 未报 |
| xtconstant.ORDER_WAIT_REPORTING | 49 | 待报 |
| xtconstant.ORDER_REPORTED | 50 | 已报 |
| xtconstant.ORDER_REPORTED_CANCEL | 51 | 已报待撤 |
| xtconstant.ORDER_PARTSUCC_CANCEL | 52 | 部成待撤 |
| xtconstant.ORDER_PART_CANCEL | 53 | 部撤 |
| xtconstant.ORDER_CANCELED | 54 | 已撤 |
| xtconstant.ORDER_PART_SUCC | 55 | 部成 |
| xtconstant.ORDER_SUCCEEDED | 56 | 已成 |
| xtconstant.ORDER_JUNK | 57 | 废单 |
| xtconstant.ORDER_UNKNOWN | 255 | 未知 |
# 账号状态(account_status)
| 枚举变量名 | 值 | 含义 |
|---|---|---|
| xtconstant.ACCOUNT_STATUS_INVALID | -1 | 无效 |
| xtconstant.ACCOUNT_STATUS_OK | 0 | 正常 |
| xtconstant.ACCOUNT_STATUS_WAITING_LOGIN | 1 | 连接中 |
| xtconstant.ACCOUNT_STATUSING | 2 | 登陆中 |
| xtconstant.ACCOUNT_STATUS_FAIL | 3 | 失败 |
| xtconstant.ACCOUNT_STATUS_INITING | 4 | 初始化中 |
| xtconstant.ACCOUNT_STATUS_CORRECTING | 5 | 数据刷新校正中 |
| xtconstant.ACCOUNT_STATUS_CLOSED | 6 | 收盘后 |
| xtconstant.ACCOUNT_STATUS_ASSIS_FAIL | 7 | 穿透副链接断开 |
| xtconstant.ACCOUNT_STATUS_DISABLEBYSYS | 8 | 系统停用(总线使用-密码错误超限) |
| xtconstant.ACCOUNT_STATUS_DISABLEBYUSER | 9 | 用户停用(总线使用) |
# XtQuant数据结构说明
# 资产XtAsset
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| cash | float | 可用金额 |
| frozen_cash | float | 冻结金额 |
| market_value | float | 持仓市值 |
| total_asset | float | 总资产 |
# 委托XtOrder
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| stock_code | str | 证券代码,例如"600000.SH" |
| order_id | int | 订单编号 |
| order_sysid | str | 柜台合同编号 |
| order_time | int | 报单时间 |
| order_type | int | 委托类型,参见数据字典 |
| order_volume | int | 委托数量 |
| price_type | int | 报价类型 |
| price | float | 委托价格 |
| traded_volume | int | 成交数量 |
| traded_price | float | 成交均价 |
| order_status | int | 委托状态,参见数据字典 |
| status_msg | str | 委托状态描述,如废单原因 |
| strategy_name | str | 策略名称 |
| order_remark | str | 委托备注 |
# 成交XtTrade
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| stock_code | str | 证券代码 |
| order_type | int | 委托类型,参见数据字典 |
| traded_id | str | 成交编号 |
| traded_time | int | 成交时间 |
| traded_price | float | 成交均价 |
| traded_volume | int | 成交数量 |
| traded_amount | float | 成交金额 |
| order_id | int | 订单编号 |
| order_sysid | str | 柜台合同编号 |
| strategy_name | str | 策略名称 |
| order_remark | str | 委托备注 |
# 持仓XtPosition
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| stock_code | str | 证券代码 |
| volume | int | 持仓数量 |
| can_use_volume | int | 可用数量 |
| open_price | float | 平均建仓成本 |
| market_value | float | 市值 |
# 异步下单委托反馈XtOrderResponse
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| order_id | int | 订单编号 |
| strategy_name | str | 策略名称 |
| order_remark | str | 委托备注 |
| seq | int | 异步下单的请求序号 |
# 异步约券委托反馈XtAppointmentResponse
| 属性 | 类型 | 注释 |
|---|---|---|
| account_id | str | 资金账号 |
| order_sysid | str | 柜台合同编号,失败为-1 |
| error_id | int | 错误编号 |
| error_msg | str | 错误信息 |
| seq | int | 异步下单的请求序号 |
# 异步撤单委托反馈XtCancelOrderResponse
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| order_id | int | 订单编号 |
| order_sysid | str | 柜台委托编号 |
| cancel_result | int | 撤单结果 |
| seq | int | 异步撤单的请求序号 |
# 下单失败错误XtOrderError
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| order_id | int | 订单编号 |
| error_id | int | 下单失败错误码 |
| error_msg | str | 下单失败具体信息 |
| strategy_name | str | 策略名称 |
| order_remark | str | 委托备注 |
# 撤单失败错误XtCancelError
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| order_id | int | 订单编号 |
| market | int | 交易市场 0:上海 1:深圳 |
| order_sysid | str | 柜台委托编号 |
| error_id | int | 下单失败错误码 |
| error_msg | str | 下单失败具体信息 |
# 信用账号资产XtCreditDetail
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| m_nStatus | int | 账号状态 |
| m_nUpdateTime | int | 更新时间 |
| m_nCalcConfig | int | 计算参数 |
| m_dFrozenCash | float | 冻结金额 |
| m_dBalance | float | 总资产 |
| m_dAvailable | float | 可用金额 |
| m_dPositionProfit | float | 持仓盈亏 |
| m_dMarketValue | float | 总市值 |
| m_dFetchBalance | float | 可取金额 |
| m_dStockValue | float | 股票市值 |
| m_dFundValue | float | 基金市值 |
| m_dTotalDebt | float | 总负债 |
| m_dEnableBailBalance | float | 可用保证金 |
| m_dPerAssurescaleValue | float | 维持担保比例 |
| m_dAssureAsset | float | 净资产 |
| m_dFinDebt | float | 融资负债 |
| m_dFinDealAvl | float | 融资本金 |
| m_dFinFee | float | 融资息费 |
| m_dSloDebt | float | 融券负债 |
| m_dSloMarketValue | float | 融券市值 |
| m_dSloFee | float | 融券息费 |
| m_dOtherFare | float | 其它费用 |
| m_dFinMaxQuota | float | 融资授信额度 |
| m_dFinEnableQuota | float | 融资可用额度 |
| m_dFinUsedQuota | float | 融资冻结额度 |
| m_dSloMaxQuota | float | 融券授信额度 |
| m_dSloEnableQuota | float | 融券可用额度 |
| m_dSloUsedQuota | float | 融券冻结额度 |
| m_dSloSellBalance | float | 融券卖出资金 |
| m_dUsedSloSellBalance | float | 已用融券卖出资金 |
| m_dSurplusSloSellBalance | float | 剩余融券卖出资金 |
###负债合约StkCompacts
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| compact_type | int | 合约类型 |
| cashgroup_prop | int | 头寸来源 |
| exchange_id | int | 证券市场 |
| open_date | int | 开仓日期 |
| business_vol | int | 合约证券数量 |
| real_compact_vol | int | 未还合约数量 |
| ret_end_date | int | 到期日 |
| business_balance | float | 合约金额 |
| businessFare | float | 合约息费 |
| real_compact_balance | float | 未还合约金额 |
| real_compact_fare | float | 未还合约息费 |
| repaid_fare | float | 已还息费 |
| repaid_balance | float | 已还金额 |
| instrument_id | str | 证券代码 |
| compact_id | str | 合约编号 |
| position_str | str | 定位串 |
# 融资融券标的CreditSubjects
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| slo_status | int | 融券状态 -48: 正常 -49: 暂停 -50: 作废 |
| fin_status | int | 融资状态 -48: 正常 -49: 暂停 -50: 作废 |
| exchange_id | int | 证券市场 |
| slo_ratio | float | 融券保证金比例 |
| fin_ratio | float | 融资保证金比例 |
| instrument_id | str | 证券代码 |
# 可融券数据CreditSloCode
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| cashgroup_prop | int | 头寸来源 |
| exchange_id | int | 证券市场 |
| enable_amount | int | 融券可融数量 |
| instrument_id | str | 证券代码 |
# 标的担保品CreditAssure
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| assure_status | int | 是否可做担保 -48: 正常 -49: 暂停 -50: 作废 |
| exchange_id | int | 证券市场 |
| assure_ratio | float | 担保品折算比例 |
| instrument_id | str | 证券代码 |
# 账号状态XtAccountStatus
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| status | int | 账号状态,参见数据字典 |
# 账号信息XtAccountInfo
| 属性 | 类型 | 注释 |
|---|---|---|
| account_type | int | 账号类型,参见数据字典 |
| account_id | str | 资金账号 |
| broker_type | int | 同 account_type |
| platform_id | int | 平台号 |
| account_classification | int | 账号分类 |
| login_status | int | 账号状态,参见数据字典 |
上次更新: 2023/10/12, 10:46:32

