Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Sep 15, 2024
1 parent 6e7c713 commit 7486437
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions exchange/_bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
)
Expand Down

0 comments on commit 7486437

Please sign in to comment.