get_enslo_security_info - 融券信息查询
get_enslo_security_info 是 PTrade 中用于融券信息查询的接口。
提示
live-or-trading-module-only
原型
get_enslo_security_info(cash_group=None)
释义
get_enslo_security_info 是 PTrade 中用于融券信息查询的接口。
研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。
参数
| 参数 | 是否必填 | 官方原始定义 |
|---|---|---|
cash_group |
否 | cash_group=None |
返回值
正常返回一个dict类型对象,key为股票代码,values为dict,包含返回的相关字段信息,如(dict[{}, {}])。异常返回None(NoneType)。
包含以下信息(相应字段无数据时返回None):
exchange_type: 交易类别, 仅包含1和2(str);
slo_ratio: 融券保证金比例(float);
enable_amount: 可用数量(int);
real_buy_amount: 回报买入数量(int);
real_sell_amount: 回报卖出数量(int);
slo_status: 融券状态,包括"0":正常,"1":暂停,"2":作废(str);
cashgroup_prop: 两融头寸性质,包括"1":普通,"2":专项(str);
{'688001.SS': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 100000000000000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '1'}, '010303.SS': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 100000000000000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '1'}, '810004': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 10000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '9'}}
示例
def initialize(context):
g.security = '600570.SS'
set_universe(g.security)
def handle_data(context, data):
# 获取最新的融券信息
h = get_enslo_security_info()
log.info(h)
详细说明
get_enslo_security_info(cash_group=None)
使用场景
该函数仅支持PTrade客户端可用,仅在两融交易模块可用。
接口说明
该接口用于获取融券信息。
注意事项
无
参数详细说明
cash_group:两融头寸性质(int),1为普通头寸,2为专项头寸,该字段不入参默认表示普通头寸;
返回值
正常返回一个dict类型对象,key为股票代码,values为dict,包含返回的相关字段信息,如(dict[{}, {}])。异常返回None(NoneType)。
包含以下信息(相应字段无数据时返回None):
exchange_type: 交易类别, 仅包含1和2(str);
slo_ratio: 融券保证金比例(float);
enable_amount: 可用数量(int);
real_buy_amount: 回报买入数量(int);
real_sell_amount: 回报卖出数量(int);
slo_status: 融券状态,包括"0":正常,"1":暂停,"2":作废(str);
cashgroup_prop: 两融头寸性质,包括"1":普通,"2":专项(str);
{'688001.SS': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 100000000000000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '1'}, '010303.SS': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 100000000000000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '1'}, '810004': {'slo_status': '0', 'real_buy_amount': 0, 'cashgroup_prop': '1', 'enable_amount': 10000, 'slo_ratio': 0.6, 'real_sell_amount': 0, 'exchange_type': '9'}}