From 74864374a01ac664e4cd2c25d82b811b18882166 Mon Sep 17 00:00:00 2001 From: m5l14i11 Date: Sun, 15 Sep 2024 13:29:21 +0300 Subject: [PATCH] upd --- exchange/_bybit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exchange/_bybit.py b/exchange/_bybit.py index b6d3e9a6..996ddf62 100644 --- a/exchange/_bybit.py +++ b/exchange/_bybit.py @@ -98,11 +98,11 @@ def cancel_order(self, order_id: str, symbol: Symbol): def fetch_trade( self, symbol: Symbol, side: PositionSide, since: int, size: float, limit: int ): - last_trades = [ + last_trades = ( trade for trade in self.connector.fetch_my_trades(symbol.name, limit=limit * 2) if trade["timestamp"] >= since - ] + ) def round_down_to_minute(timestamp): return datetime.utcfromtimestamp(timestamp // 1000).replace( @@ -114,7 +114,7 @@ def round_down_to_minute(timestamp): opposite_side = "buy" if side == PositionSide.SHORT else "sell" trade_stack = sorted( - [trade for trade in last_trades if trade["side"] == opposite_side], + (trade for trade in last_trades if trade["side"] == opposite_side), key=lambda trade: trade["timestamp"], reverse=True, )