Appearance
基金交易
etf实物申赎
order_etf-etf 实物申赎
仅仿真/实盘中可使用。
函数
python
order_etf(etf_code, amount, trade_type, cash_list, stock_list, account)参数
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| etf_code | str | - | ETF 代码 |
| amount | int | - | 申购/赎回数量 |
| trade_type | str | - | 'esg' 申购;'ehh' 赎回 |
| cash_list | list[str] | - | 仅申购使用:需要现金替代的金额列表 |
| stock_list | list[str] | - | 仅申购使用:需要现金替代的代码列表 |
| account | int | - | 指定第几个账户:1 为第一个,2 为第二个……按顺序 |
注意
- 回测时只有一个账户,account 参数无效。
- 仿真/实盘时,account 与界面上添加的账户顺序对应。
- 如果策略里设置的账户数多于界面上添加的账户数,默认使用超出范围的账户会直接报错;如需修改参考 set_option()。
返回值
| 返回类型 | 说明 |
|---|---|
| str | 成功:返回 order_id |
| None | 失败:返回 None |
举例
python
order_id = order_etf(
etf_code='510300',
amount=1000000,
trade_type='esg',
cash_list=['1000', '2000'],
stock_list=['sh600000', 'sz000001'],
account=1
)
print(order_id)
# 输出示例(成功):
# ZLT-ORDER-20240925-000001
# 输出示例(失败):
# None