update example
This commit is contained in:
parent
c616f9c5d9
commit
93dfcf165f
@ -57,23 +57,25 @@ if __name__ == "__main__":
|
||||
positions = get_positions(STRATEGY)
|
||||
print("当前持仓:", positions)
|
||||
# 模拟输出:
|
||||
# {'data': [], 'success': True}
|
||||
|
||||
|
||||
# 示例:买入中国银行1000股,价格3.45
|
||||
result = buy("601988.SH", 3.45, 1000, STRATEGY)
|
||||
result = buy("601988.SH", 3.45, 3000, STRATEGY)
|
||||
print("买入结果:", result)
|
||||
# 模拟输出:
|
||||
#{'data': {'message': '模拟买入 - 代码: 601988.SH, 价格: 3.45, 数量: 3000', 'order_id': 'simulation'}, 'success': True}
|
||||
|
||||
|
||||
# 示例:卖出中国银行1000股,价格3.48
|
||||
result = sell("601988.SH", 3.48, 1000, STRATEGY)
|
||||
print("卖出结果:", result)
|
||||
# 模拟输出:
|
||||
|
||||
# {'data': {'message': '模拟卖出 - 代码: 601988.SH, 价格: 3.48, 数量: 1000', 'order_id': 'simulation'}, 'success': True}
|
||||
|
||||
# 示例:再次查询持仓变化
|
||||
positions = get_positions(STRATEGY)
|
||||
print("交易后持仓:", positions)
|
||||
# 模拟输出:
|
||||
|
||||
# {'data': [{'601988.SH': {'closeable_amount': 2000, 'total_amount': 2000}}], 'success': True}
|
||||
|
Loading…
x
Reference in New Issue
Block a user