- 两融 SDK
- credit_buying_on_margin - 融资买入
- credit_short_selling - 融券卖出
- credit_repay_cash_directly - 直接还款
- credit_repay_share_directly - 直接还券
- credit_get_collateral_instruments - 查询担保证券
- credit_get_borrowable_instruments - 查询可融标的证券
- credit_get_borrowable_instruments_positions - 查询券商融券账户头寸
- credit_get_contracts - 查询融资融券合约
- credit_get_cash - 查询融资融券资金
- credit_repay_share_by_buying_share - 买券还券
- credit_repay_cash_by_selling_share - 卖券还款
- credit_buying_on_collateral - 担保品买入
- credit_selling_on_collateral - 担保品卖出
- credit_collateral_in - 担保品转入
- credit_collateral_out - 担保品转出
两融 SDK
python两融SDK包含在gm3.0.126版本及以上版本,不需要引入新库
融资融券暂时仅支持实盘委托,不支持仿真交易
credit_buying_on_margin - 融资买入
函数原型:
credit_buying_on_margin(position_src, symbol, volume, price, order_type=OrderType_Limit, order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| position_src | int | 头寸来源 取值参考 PositionSrc |
| order_type | int | 委托类型 取值参考 OrderType |
| order_duration | int | 委托时间属性 取值参考 OrderDuration |
| order_qualifier | int | 委托成交属性 取值参考 OrderQualifier |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:
请参考 order 返回值字段说明
示例代码
credit_buying_on_margin(position_src=PositionSrc_L1, symbol='SHSE.600000', volume=100, price=10.67)
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b853062-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 863549, tzinfo=tzfile('PRC')) 200 0 0 0 0 0 0 0 0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_short_selling - 融券卖出
函数原型
credit_short_selling(position_src, symbol, volume, price, order_type=OrderType_Limit, order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| position_src | int | 头寸来源 取值参考 PositionSrc |
| order_type | int | 委托类型 取值参考 OrderType |
| order_duration | int | 委托时间属性 取值参考 OrderDuration |
| order_qualifier | int | 委托成交属性 取值参考 OrderQualifier |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:
请参考 order 返回值字段说明
示例代码
credit_short_selling(position_src=PositionSrc_L1, symbol='SHSE.600000', volume=100, price=10.67, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b853062-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 863549, tzinfo=tzfile('PRC')) 201 0 0 0 0 0 0 0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_repay_cash_directly - 直接还款
函数原型:
credit_repay_cash_directly(amount, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| amount | float | 还款金额 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:dict
| 字段 | 类型 | 说明 |
|---|---|---|
| actual_repay_amount | float | 实际还款金额 |
| account_id | str | 账号id |
| account_name | str | 账户名称 |
示例代码:
credit_repay_cash_directly(amount=10000.00, account_id='')
示例返回值:
actual_repay_amount account_id account_name------------------- ------------------------------------ ------------10000.0 8f30e83f-a7c5-11ea-b510-309c231d28bd 001515018318
credit_repay_share_directly - 直接还券
函数原型
credit_repay_share_directly(symbol, volume, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:[dict]
请参考 order 返回值字段说明
示例代码
credit_repay_share_directly(symbol='SHSE.600000', volume=100, account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail price stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ----- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b86685e-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 871536, tzinfo=tzfile('PRC')) 204 0 0 0 0 0 0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None........ ......
credit_get_collateral_instruments - 查询担保证券
查询担保证券,可做担保品股票列表
函数原型:
credit_get_collateral_instruments(account_id='', df=False)
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
| df | bool | 是否返回dataframe格式数据。默认 False, 返回list[dict] |
返回值:
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的 |
| pledge_rate | float | 折算率 |
示例代码
credit_get_collateral_instruments(account_id='', df=False)
示例返回值
symbol pledge_rate----------- -----------SHSE.010107 0.9SHSE.010303 0.9.......... ...
credit_get_borrowable_instruments - 查询可融标的证券
查询标的证券,可做融券标的股票列表
函数原型:
credit_get_borrowable_instruments(position_src, account_id='', df=False)
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| position_src | int | 头寸来源 取值参考 PositionSrc |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
| df | bool | 是否返回dataframe格式数据。默认 False, 返回list[dict] |
返回值:list[dict]
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的 |
| margin_rate_for_cash | float | 融资保证金比率 |
| margin_rate_for_security | float | 融券保证金比率 |
示例代码
credit_get_borrowable_instruments(position_src=PositionSrc_L1, account_id='', df=False)
示例返回值
symbol margin_rate_for_cash margin_rate_for_security----------- -------------------- ------------------------SHSE.510050 1.0 0.6SHSE.510160 1.0 0.6........... ... ...
credit_get_borrowable_instruments_positions - 查询券商融券账户头寸
查询券商融券账户头寸,可用融券的数量
函数原型:
credit_get_borrowable_instruments_positions(position_src, account_id='', df=False)
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| position_src | int | 头寸来源 取值参考 PositionSrc |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
| df | bool | 是否返回dataframe格式数据。默认 False, 返回list[dict] |
返回值:
当df = True时, 返回dataframe
当df = False时, 返回list[dict]
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的 |
| balance | float | 证券余额 |
| available | float | 证券可用金额 |
示例代码
credit_get_borrowable_instruments_positions(position_src=PositionSrc_L1, account_id='', df=False)
示例返回值
symbol balance available----------- ------- -----------SHSE.600166 700.0 700.0SHSE.688002 2000.0 2000.0.......... ...... ......
credit_get_contracts - 查询融资融券合约
函数原型:
credit_get_contracts(position_src, account_id='', df=False)
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| position_src | int | 头寸来源 取值参考 PositionSrc |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
| df | bool | 是否返回dataframe格式数据。默认 False, 返回list[dict] |
返回值:
当df = True时, 返回dataframe
当df = False时, 返回list[dict]
| 字段 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的 |
| ordersno | str | 委 托 号 |
| creditdirect | str | 融资融券方向, ‘0’表示融资, ‘1’表示融券 |
| orderqty | float | 委托数量 |
| matchqty | float | 成交数量 |
| orderamt | float | 委托金额 |
| orderfrzamt | float | 委托冻结金额 |
| matchamt | float | 成交金额 |
| clearamt | float | 清算金额 |
| lifestatus | str | 合约状态 |
| creditrepay | float | T日之前归还金额 |
| creditrepayunfrz | float | T日归还金额 |
| fundremain | float | 应还金额 |
| stkrepay | float | T日之前归还数量 |
| stkrepayunfrz | float | T日归还数量 |
| stkremain | float | 应还证券数量 |
| stkremainvalue | float | 应还证券市值 |
| fee | float | 融资融券息、费 |
| overduefee | float | 逾期未偿还息、费 |
| fee_repay | float | 己偿还息、费 |
| punifee | float | 利息产生的罚息 |
| punifee_repay | float | 己偿还罚息 |
| rights | float | 未偿还权益金额 |
| overduerights | float | 逾期未偿还权益 |
| rights_repay | float | 己偿还权益 |
| lastprice | float | 最新价 |
| profitcost | float | 浮动盈亏 |
| sno | str | 合约编号 |
| punidebts | float | 逾期本金罚息 |
| punidebts_repay | float | 本金罚息偿还 |
| punidebtsunfrz | float | 逾期本金罚息 |
| punifeeunfrz | float | 逾期息费罚息 |
| punirights | float | 逾期权益罚息 |
| punirights_repay | float | 权益罚息偿还 |
| punirightsunfrz | float | 逾期权益罚息 |
| feeunfrz | float | 实时偿还利息 |
| overduefeeunfrz | float | 实时偿还逾期利息 |
| rightsqty | float | 未偿还权益数量 |
| overduerightsqty | float | 逾期未偿还权益数量 |
| orderdate | int | 委托日期,时间戳类型 |
| lastdate | int | 最后一次计算息费日期,时间戳类型 |
| closedate | int | 合约全部偿还日期,时间戳类型 |
| sysdate | int | 系统日期,时间戳类型 |
| enddate | int | 负债截止日期,时间戳类型 |
| oldenddate | int | 原始的负债截止日期,时间戳类型 |
示例代码
credit_get_contracts(position_src=PositionSrc_L1, account_id='', df=False)
示例返回值
symbol ordersno creditdirect orderqty matchamt clearamt lifestatus enddate fundremain fee rights profitcost sno rightsqty orderdate matchqty orderamt orderfrzamt oldenddate creditrepay creditrepayunfrz stkrepay stkrepayunfrz stkremain stkremainvalue overduefee fee_repay punifee punifee_repay overduerights rights_repay lastprice sysdate lastdate closedate punidebts punidebts_repay punidebtsunfrz punifeeunfrz punirights punirights_repay punirightsunfrz feeunfrz overduefeeunfrz overduerightsqty----------- -------- ------------ -------- -------- -------- ---------- -------- ---------- ----- --------- ---------- -------- --------- --------- -------- -------- ----------- ---------- ----------- ---------------- -------- ------------- --------- -------------- ---------- --------- ------- ------------- ------------- ------------ --------- ------- -------- --------- --------- --------------- -------------- ------------ ---------- ---------------- --------------- -------- --------------- ----------------SZSE.159937 115906 0 59600.0 217957.2 217957.2 0 20200823 220666.32 32.69 220666.32 11112.52 15211131 59600.0 0 0.0 0.0 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0........... ......
credit_get_cash - 查询融资融券资金
函数原型:
credit_get_cash(account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:dict
| 字段 | 类型 | 名称 |
|---|---|---|
| fundintrrate | float | 融资利率 |
| stkintrrate | float | 融券利率 |
| punishintrrate | float | 罚息利率 |
| creditstatus | str | 信用状态 |
| marginrates | float | 维持担保比例 |
| realrate | float | 实时担保比例 |
| asset | float | 总资产 |
| liability | float | 总负债 |
| marginavl | float | 保证金可用数 |
| fundbal | float | 资金余额 |
| fundavl | float | 资金可用数 |
| dsaleamtbal | float | 融券卖出所得资金 |
| guaranteeout | float | 可转出担保资产 |
| gagemktavl | float | 担保证券市值 |
| fdealavl | float | 融资本金 |
| ffee | float | 融资息费 |
| ftotaldebts | float | 融资负债合计 |
| dealfmktavl | float | 应付融券市值 |
| dfee | float | 融券息费 |
| dtotaldebts | float | 融券负债合计 |
| fcreditbal | float | 融资授信额度 |
| fcreditavl | float | 融资可用额度 |
| fcreditfrz | float | 融资额度冻结 |
| dcreditbal | float | 融券授信额度 |
| dcreditavl | float | 融券授信额度 |
| dcreditfrz | float | 融券额度冻结 |
| rights | float | 红利权益 |
| serviceuncomerqrights | float | 红利权益(在途) |
| rightsqty | float | 红股权益 |
| serviceuncomerqrightsqty | float | 红股权益(在途) |
| acreditbal | float | 总额度 |
| acreditavl | float | 总可用额度 |
| acashcapital | float | 所有现金资产(所有资产、包括融券卖出) |
| astkmktvalue | float | 所有证券市值(包含融资买入、非担保品) |
| withdrawable | float | 可取资金 |
| netcapital | float | 净资产 |
| fcreditpnl | float | 融资盈亏 |
| dcreditpnl | float | 融券盈亏 |
| fcreditmarginoccupied | float | 融资占用保证金 |
| dcreditmarginoccupied | float | 融券占用保证金 |
| collateralbuyableamt | float | 可买担保品资金 |
| repayableamt | float | 可还款金额 |
| dcreditcashavl | float | 融券可用资金 |
示例代码
credit_get_cash(account_id='')
示例返回值
marginrates realrate asset liability marginavl fundbal fundavl guaranteeout gagemktavl fdealavl ffee ftotaldebts dfee fcreditbal fcreditavl dcreditbal dcreditavl acreditbal acreditavl account_id account_name rid fundintrrate stkintrrate punishintrrate creditstatus dsaleamtbal dealfmktavl dtotaldebts fcreditfrz dcreditfrz rights serviceuncomerqrights rightsqty serviceuncomerqrightsqty acashcapital astkmktvalue withdrawable netcapital fcreditpnl dcreditpnl fcreditmarginoccupied dcreditmarginoccupied collateralbuyableamt repayableamt dcreditcashavl----------- -------- ------------- ---------- ----------------- ------------- ------------- ------------ ----------- ---------- ------ ----------- ---- ---------- ------------------ ---------- ---------- ---------- ----------- ------------------------------------ ---------------- ------------------------------------ ------------- ----------- -------------- ------------ ----------- ----------- ----------- ---------- ------------ --------- --------------------- --------- ------------------------ ------------ ------------ ------------ ---------- ---------- ---------- --------------------- --------------------- -------------------- ------------ --------------229.5157 229.5157 1001926287.62 4356531.11 1994995956.360447 1002066280.62 2002149925.25 988838893.26 -4483562.29 4307241.23 668.89 4307910.12 1.28 8000000.0 3683189.8499999996 8000000.0 8000001.0 16000000.0 11683190.85 8f30e83f-a7c5-11ea-b510-309c231d28bd 001515018318 3978e606-0fc0-43ec-87b0-01887fa280c5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
credit_repay_share_by_buying_share - 买券还券
函数原型
credit_repay_share_by_buying_share(symbol, volume, price, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| order_type | int | 参见订单委托类型 |
| order_duration | int | 参见 委托时间属性 |
| order_qualifier | str | 参见 委托成交属性 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:
请参考 order 返回值字段说明
示例代码
credit_repay_share_by_buying_share(symbol='SHSE.600000', volume=100, price=10.67, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown,account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b857e02-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 865536, tzinfo=tzfile('PRC')) 202 0 0 0 0 0 0 0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_repay_cash_by_selling_share - 卖券还款
函数原型
credit_repay_cash_by_selling_share(symbol, volume, price, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| order_type | int | 参见订单委托类型 |
| order_duration | int | 参见 委托时间属性 |
| order_qualifier | str | 参见 委托成交属性 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:
请参考 order 返回值字段说明
示例代码
credit_repay_cash_by_selling_share(symbol='SHSE.600000', volume=100, price=10.67, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown,account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b85a50a-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 866535, tzinfo=tzfile('PRC')) 203 0 0 0 0 0 0 0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_buying_on_collateral - 担保品买入
函数原型
credit_buying_on_collateral(symbol, volume, price,order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| order_type | int | 参见订单委托类型 |
| order_duration | int | 参见 委托时间属性 |
| order_qualifier | str | 参见 委托成交属性 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:list[dict]
请参考 order 返回值字段说明
示例代码
credit_buying_on_collateral(symbol='SHSE.600000', volume=100, price=10.67, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown,account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b861a31-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 869534, tzinfo=tzfile('PRC')) 207 0 0 0 0 0 0 0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_selling_on_collateral - 担保品卖出
函数原型
credit_selling_on_collateral(symbol, volume, price,order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| price | float | 价格 |
| order_type | int | 参见订单委托类型 |
| order_duration | int | 参见 委托时间属性 |
| order_qualifier | str | 参见 委托成交属性 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:list[dict]
请参考order 返回值字段说明
示例代码
credit_selling_on_collateral(symbol='SHSE.600000', volume=100, price=10.67, order_type=OrderType_Limit,order_duration=OrderDuration_Unknown,order_qualifier=OrderQualifier_Unknown,account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status price volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ----- ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b861a31-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 10.67 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 869534, tzinfo=tzfile('PRC')) 208 0 0 0 0 0 0 0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None
credit_collateral_in - 担保品转入
函数原型
credit_collateral_in(symbol, volume, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:list[dict]
请参考 order 返回值字段说明
示例代码
credit_collateral_in(symbol='SHSE.600000', volume=100, account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail price stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ----- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b868f72-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 872536, tzinfo=tzfile('PRC')) 209 0 0 0 0 0 0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None...... ......
credit_collateral_out - 担保品转出
函数原型
credit_collateral_out(symbol, volume, account_id='')
参数:
| 参数名 | 类型 | 说明 |
|---|---|---|
| symbol | str | 标的代码 |
| volume | int | 数量 |
| account_id | str | 账号id,不填或留空,表示使用默认账号,否则使用指定账号 |
返回值:list[dict]
请参考 order 返回值字段说明
示例代码
credit_collateral_out(symbol='SHSE.600000', volume=100, account_id='')
示例返回值
strategy_id account_id cl_ord_id symbol order_type status volume created_at order_business account_name order_id ex_ord_id algo_order_id side position_effect position_side order_duration order_qualifier order_src ord_rej_reason ord_rej_reason_detail price stop_price order_style value percent target_volume target_value target_percent filled_volume filled_vwap filled_amount filled_commission updated_at------------------------------------ ------------------------------------ ------------------------------------ ----------- ---------- ------ ------ ----------------------------------------------------------------------- -------------- ------------ -------- --------- ------------- ---- --------------- ------------- -------------- --------------- --------- -------------- --------------------- ----- ---------- ----------- ----- ------- ------------- ------------ -------------- ------------- ----------- ------------- ----------------- ----------3af55cb8-a7c5-11ea-b510-309c231d28bd 8f30e83f-a7c5-11ea-b510-309c231d28bd 2b868f72-a7c9-11ea-b510-309c231d28bd SHSE.600000 1 10 100 datetime.datetime(2020, 6, 6, 15, 41, 44, 872536, tzinfo=tzfile('PRC')) 210 0 0 0 0 0 0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0 0.0 0.0 0.0 None...... ......