get_margin_contractreal - 实时合约流水查询
get_margin_contractreal 是 PTrade 中用于实时合约流水查询的接口。
提示
live-or-trading-module-onlybroker-or-counter-dependent
原型
get_margin_contractreal()
释义
get_margin_contractreal 是 PTrade 中用于实时合约流水查询的接口。
研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。
参数
官方结构化目录未列出独立参数。请以本页函数签名和下方官方原文为准。
返回值
正常返回一个DataFrame类型字段,columns为每个合约所包含的信息(相应字段无数据时返回None),异常返回None
实时合约流水包含以下信息:
init_date:交易日期(str:int);
compact_id:合约编号(str:str);
client_id:客户编号(str:str);
money_type:币种类别(str:str);
exchange_type:交易类别,仅包含1和2(str:str);
entrust_no:委托编号(str:str);
compact_type:合约类别(str:str);
stock_code:证券代码(str:str);
business_flag:业务标志(str:int);
occur_balance:发生金额(str:float);
post_balance:后资金额(str:float);
occur_amount:发生数量(str:float);
post_amount:后证券额(str:float);
示例
def initialize(context):
g.security = '600570.SS'
set_universe(g.security)
def handle_data(context, data):
# 获取实时流水
df = get_margin_contractreal()
log.info(df)
详细说明
get_margin_contractreal()
使用场景
该函数仅支持PTrade客户端可用,仅在两融交易模块可用,对接金证集中,金证快订、云订柜台暂不支持该函数。
接口说明
该接口用于实时合约流水查询。
注意事项
无
参数详细说明
无
返回值
正常返回一个DataFrame类型字段,columns为每个合约所包含的信息(相应字段无数据时返回None),异常返回None
实时合约流水包含以下信息:
init_date:交易日期(str:int);
compact_id:合约编号(str:str);
client_id:客户编号(str:str);
money_type:币种类别(str:str);
exchange_type:交易类别,仅包含1和2(str:str);
entrust_no:委托编号(str:str);
compact_type:合约类别(str:str);
stock_code:证券代码(str:str);
business_flag:业务标志(str:int);
occur_balance:发生金额(str:float);
post_balance:后资金额(str:float);
occur_amount:发生数量(str:float);
post_amount:后证券额(str:float);
occur_fare:发生费用(str:float);
post_fare:后余费用(str:float);
occur_interest:发生利息(str:float);
post_interest:后余利息(str:float);
remark:备注(str:str);
init_date compact_id client_id ... post_interest remark
0 20250218 20250131234567 339200779 ... 58.2 利息
1 20250219 20250131232321 339200779 ... 61.3 利息
2 20250220 20250131232131 339200779 ... 77.1 利息