diff --git a/src/example_trade.py b/src/example_trade.py index c88dbed..92c4573 100644 --- a/src/example_trade.py +++ b/src/example_trade.py @@ -1,7 +1,7 @@ import requests # 服务器地址 -URL = "http://localhost:9527/yu" +URL = "http://trader.biggerfish.tech:9527/yu" def buy(code: str, price: float, amount: int) -> dict: """买入股票 @@ -41,6 +41,7 @@ def sell(code: str, price: float, amount: int) -> dict: response = requests.post(f"{URL}/sell", json=data) return response.json() + if __name__ == "__main__": # 示例:买入中国银行1000股,价格3.45 result = buy("601988.SH", 3.45, 1000) @@ -48,4 +49,5 @@ if __name__ == "__main__": # 示例:卖出中国银行1000股,价格3.48 result = sell("601988.SH", 3.48, 1000) - print("卖出结果:", result) \ No newline at end of file + print("卖出结果:", result) + \ No newline at end of file