INNER CODE UNIT · Python
compress_order_depths
pe049395/IMC-Prosperity-2024 · submissions/round5.py:61
def compress_order_depths(self, order_depths: dict[Symbol, OrderDepth]) -> dict[Symbol, list[Any]]:
compressed = {}
for symbol, order_depth in order_depths.items():
compressed[symbol] = [order_depth.buy_orders, order_depth.sell_orders]
return compressed
def compress_trades(self, trades: dict[Symbol, list[Trade]]) -> list[list[Any]]:
compressed = []
for arr in trades.values():
for trade in arr:
compressed.append([
trade.symbol,
trade.price,
trade.quantity,
trade.buyer,
trade.seller,
trade.timestamp,