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 938374d commit 7186794
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions exchange/_bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,8 @@ def close_half_position(self, symbol: Symbol, side: PositionSide):
@retry(max_retries=MAX_RETRIES, handled_exceptions=EXCEPTIONS)
def fetch_position(self, symbol: Symbol, side: PositionSide):
positions = self.connector.fetch_positions([symbol.name])
side = str(side).lower()
position = next(
iter([position for position in positions if position["side"] == side]),
(p for p in positions if p["side"] == str(side).lower()),
None,
)

Expand All @@ -263,9 +262,7 @@ def fetch_account_balance(self, currency: str):

@cached(TTLCache(maxsize=300, ttl=120))
def fetch_future_symbols(self):
markets = self._fetch_futures_market()
symbols = [self._create_symbol(market) for market in markets]
return symbols
return [self._create_symbol(market) for market in self._fetch_futures_market()]

def fetch_ohlcv(
self,
Expand Down Expand Up @@ -325,11 +322,9 @@ def _fetch_ohlcv(self, symbol, timeframe, start_time, current_limit):

@retry(max_retries=MAX_RETRIES, handled_exceptions=EXCEPTIONS)
def _fetch_futures_market(self):
markets = self.connector.fetch_markets()

return [
market_info
for market_info in markets
for market_info in self.connector.fetch_markets()
if market_info["linear"]
and market_info["type"] != "future"
and market_info["settle"] == "USDT"
Expand Down

0 comments on commit 7186794

Please sign in to comment.