跳到正文
PTrade
PTrade两融、期货与专业交易

get_margin_entrans_amount

该接口用于现券还券数量查询。

原型

get_margin_entrans_amount(security, cash_group=None)

适用环境

该函数仅支持PTrade客户端可用,仅在两融交易模块可用。

释义

该接口用于现券还券数量查询。

注意事项

无

参数

security:

股票代码(str);

cash_group:

两融头寸性质(int),1为普通头寸,2为专项头寸,该字段不入参默认表示普通头寸;

返回值

正常返回一个dict类型对象,key为股票代码,values为最大数量。异常返回空dict,如{}(dict[str:int])

{'600570.SS': 1300}

示例

def initialize(context):
    g.security = '600030.SS'
    set_universe(g.security)

def handle_data(context, data):
    security = g.security
    # 查询该证券最大可现券还券数量
    margin_entrans_dict = get_margin_entrans_amount(security)
    if margin_entrans_dict is not None:
        log.info(margin_entrans_dict.get(security))

本页目录