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 ==============~~~~~