From e3934bcdf9b898c8f8bdb8665e9e06fca9ac7bad Mon Sep 17 00:00:00 2001 From: zhiyong Date: Thu, 22 May 2025 23:02:59 +0800 Subject: [PATCH] update config --- examples/example_trade.py | 12 ++++++------ src/config.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/example_trade.py b/examples/example_trade.py index d611fdd..275038e 100644 --- a/examples/example_trade.py +++ b/examples/example_trade.py @@ -1,8 +1,8 @@ import requests # 服务器地址 -# URL = "http://trader.biggerfish.tech:9527/yu" -URL = "http://localhost:9527/yu" +URL = "http://trader.biggerfish.tech:9527/yu" +# URL = "http://localhost:9527/yu" # 策略名称常量 STRATEGY = "香港证券ETF网格" @@ -105,7 +105,7 @@ def check_health() -> str: 健康状态 """ response = requests.get(f"{URL}/healthcheck") - return response.text + return response.json() if __name__ == "__main__": @@ -124,13 +124,13 @@ if __name__ == "__main__": print("账户余额:", balance) # 示例:买入中国银行1000股,价格3.45 - result = buy("601988.SH", 3.45, 3000) + result = buy("513090.SH", 3.45, 3000) print("买入结果:", result) # 模拟输出: #{'data': {'message': '模拟买入 - 代码: 601988.SH, 价格: 3.45, 数量: 3000', 'order_id': 'simulation'}, 'success': True} # 示例:卖出中国银行1000股,价格3.48 - result = sell("601988.SH", 3.48, 1000) + result = sell("513090.SH", 3.48, 1000) print("卖出结果:", result) # 模拟输出: # {'data': {'message': '模拟卖出 - 代码: 601988.SH, 价格: 3.48, 数量: 1000', 'order_id': 'simulation'}, 'success': True} @@ -150,7 +150,7 @@ if __name__ == "__main__": # {'data': [{'601988.SH': {'closeable_amount': 2000, 'total_amount': 2000}}], 'success': True} # 示例:清除策略持仓数据 - result = clear_strategy("测试策略名") + result = clear_strategy(STRATEGY) print("清除策略持仓结果:", result) # 模拟输出: # {'message': "成功清除策略 '追梦投资港股ETF' 的持仓数据", 'success': True} diff --git a/src/config.py b/src/config.py index 0042faf..fc11054 100644 --- a/src/config.py +++ b/src/config.py @@ -9,7 +9,7 @@ class Config: # Trading settings TRADE_TIMEOUT = 5 # 交易超时时间(秒) - SIMULATION_MODE = True + SIMULATION_MODE = False # Trading hours MARKET_OPEN_TIME = "09:10"