From 02f67a24242943b56f41ce822e7dfa5e720f16d0 Mon Sep 17 00:00:00 2001 From: zhiyong Date: Tue, 29 Apr 2025 17:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0web=20api=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/example_trade.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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