-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💥 preparing framework for multi exchange support (Sourcery refactored) #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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): | ||
|
@@ -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: | ||
}: | ||
Comment on lines
-163
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
balance_str = "".join( | ||
f"{iterator}: {value} \n" | ||
for iterator, value in filtered_balance.items() | ||
|
@@ -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"]: | ||
Comment on lines
-208
to
+207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
return f"{positions}" | ||
return "No Position" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
CexTrader.get_quote
refactored with the following changes:self
(instance-method-first-arg-name
)