포지션 완화

This commit is contained in:
2026-05-09 14:52:02 +09:00
parent 79d99ab799
commit 0d098403f1

4
bot.py
View File

@@ -104,6 +104,10 @@ def on_trade(message: dict, orderman: OrderManager, state: StateManager):
if p_vale + 1 < p_valbz - 1: if p_vale + 1 < p_valbz - 1:
print("Good") print("Good")
if (p_vale + 1) * SZ + FEE < (p_valbz - 1) * SZ: 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.buy("VALE", p_vale + 1, -SZ) orderman.buy("VALE", p_vale + 1, -SZ)
orderman.convert("VALE", SZ) orderman.convert("VALE", SZ)
orderman.sell("VALBZ", p_valbz - 1, SZ) orderman.sell("VALBZ", p_valbz - 1, SZ)