From e3cc9fc4d8a8b5ea6c2827f99d37ad7213615b47 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 9 May 2026 14:59:25 +0900 Subject: [PATCH] bidir --- bot.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index e3f5e35..d254bb5 100644 --- a/bot.py +++ b/bot.py @@ -111,7 +111,15 @@ def on_trade(message: dict, orderman: OrderManager, state: StateManager): orderman.buy("VALE", p_vale + 1, -SZ) orderman.sell_convert("VALE", SZ) orderman.sell("VALBZ", p_valbz - 1, SZ) - + elif p_vale - 1 > p_valbz + 1: + print("Good") + if (p_vale - 1) * SZ - FEE > (p_valbz + 1) * SZ: + if abs(orderman.positions["VALE"] - SZ) > orderman.POSITIONS_LIMIT["VALE"] or abs(orderman.positions["VALBZ"] + SZ) > orderman.POSITIONS_LIMIT["VALBZ"]: + print("포지션 제한으로 인해 주문이 무시되었습니다.") + return + orderman.sell("VALE", p_vale - 1, -SZ) + orderman.buy_convert("VALE", SZ) + orderman.buy("VALBZ", p_valbz + 1, SZ) # ~~~~~============== PROVIDED CODE ==============~~~~~