Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Sep 14, 2023
1 parent d9b40d2 commit b9721d9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cefi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def get_quotes(self, symbol):
quotes.append(f"🏦 {exchange_name}: Error fetching quote - {e}")
return "\n".join(quotes)

async def get_quote(cex, symbol):
async def get_quote(self, symbol):
"""
Return a quote for a symbol
of a given exchange ccxt object
Expand All @@ -125,7 +125,7 @@ async def get_quote(cex, symbol):
Returns:
quote
"""
ticker = cex.fetchTicker(symbol)
ticker = self.fetchTicker(symbol)
return ticker.get("last") or ""

async def get_account_balances(self):
Expand Down Expand Up @@ -160,10 +160,9 @@ async def get_account_balance(self, cex):
"""
raw_balance = cex.fetch_free_balance()
filtered_balance = {
if filtered_balance := {
k: v for k, v in raw_balance.items() if v is not None and v > 0
}
if filtered_balance:
}:
balance_str = "".join(
f"{iterator}: {value} \n"
for iterator, value in filtered_balance.items()
Expand Down Expand Up @@ -205,8 +204,7 @@ async def get_account_position(self, cex):
"""
positions = cex.fetch_positions()
positions = [p for p in positions if p["type"] == "open"]
if positions:
if positions := [p for p in positions if p["type"] == "open"]:
return f"{positions}"
return "No Position"

Expand Down

0 comments on commit b9721d9

Please sign in to comment.