This commit is contained in:
2026-05-09 14:45:21 +09:00
parent f46aeee181
commit b1b851dd8d

View File

@@ -14,7 +14,6 @@ class OrderManager:
"MS": 100, "MS": 100,
"WFC": 100, "WFC": 100,
"XLF": 100, "XLF": 100,
} }
self.exchange = exchange self.exchange = exchange
@@ -53,13 +52,14 @@ class OrderManager:
# (print문은 필요시 주석 해제하여 로깅 용도로 사용하세요) # (print문은 필요시 주석 해제하여 로깅 용도로 사용하세요)
# print("전송 제한 초과! 주문이 무시되었습니다.") # print("전송 제한 초과! 주문이 무시되었습니다.")
return False return False
print("전송 시도: ", action_type, kwargs)
# 전송 조건 통과 시 실제 통신 수행 # 전송 조건 통과 시 실제 통신 수행
if action_type == "add": if action_type == "add":
size = kwargs["size"] size = kwargs["size"]
if self.future_positions[kwargs["symbol"]] + size > self.POSITIONS_LIMIT[kwargs["symbol"]]: if (
self.future_positions[kwargs["symbol"]] + size
> self.POSITIONS_LIMIT[kwargs["symbol"]]
):
return False return False
print(f"주문 전송: {kwargs}")
self.future_positions[kwargs["symbol"]] += size self.future_positions[kwargs["symbol"]] += size
self.exchange.send_add_message(**kwargs) self.exchange.send_add_message(**kwargs)
@@ -81,9 +81,9 @@ class OrderManager:
price=price, price=price,
size=size, size=size,
) )
def convert(self, symbol: str, size: int): def convert(self, symbol: str, size: int):
if symbol == "VALE": if symbol == "VALE":
target = "VALBZ"
self.future_positions["VALE"] -= size self.future_positions["VALE"] -= size
self.future_positions["VALBZ"] += size self.future_positions["VALBZ"] += size
self.positions["VALE"] -= size self.positions["VALE"] -= size
@@ -118,4 +118,4 @@ class OrderManager:
self.orders[order_id]["quantity"] = new_size self.orders[order_id]["quantity"] = new_size
def check_pos_limit(self, symbol: str) -> bool: def check_pos_limit(self, symbol: str) -> bool:
return abs(self.positions[symbol]) < self.POSITIONS_LIMIT[symbol] return abs(self.positions[symbol]) < self.POSITIONS_LIMIT[symbol]