get_marginsec_open_amount - 融券标的最大可卖数量查询
get_marginsec_open_amount 是 PTrade 中用于融券标的最大可卖数量查询的接口。
提示
live-or-trading-module-only
原型
get_marginsec_open_amount(security, price=None, cash_group=None)
释义
get_marginsec_open_amount 是 PTrade 中用于融券标的最大可卖数量查询的接口。
研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。
参数
| 参数 | 是否必填 | 官方原始定义 |
|---|---|---|
security |
是 | security |
price |
否 | price=None |
cash_group |
否 | cash_group=None |
返回值
正常返回一个dict类型对象,key为股票代码,values为最大数量。异常返回空dict,如{}(dict[str:int])
{'600570.SS': 2500}
示例
def initialize(context):
g.security = '600030.SS'
set_universe(g.security)
def handle_data(context, data):
security = g.security
# 查询中信证券最大可融券卖出数量
marginsec_open_dict = get_marginsec_open_amount(security)
if marginsec_open_dict is not None:
log.info(marginsec_open_dict.get(security))
详细说明
get_marginsec_open_amount(security, price=None, cash_group=None)
使用场景
该函数仅支持PTrade客户端可用,仅在两融交易模块可用。
接口说明
该接口用于融券标的最大可卖数量查询。
注意事项
无
参数详细说明
security:股票代码(str);
price:限定价格(float);
cash_group:两融头寸性质(int),1为普通头寸,2为专项头寸,该字段不入参默认表示普通头寸;
返回值
正常返回一个dict类型对象,key为股票代码,values为最大数量。异常返回空dict,如{}(dict[str:int])
{'600570.SS': 2500}