Skip to content
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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
Copy link
Author

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:

"""
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:
}:
Comment on lines -163 to +165
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CexTrader.get_account_balance refactored with the following changes:

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"]:
Comment on lines -208 to +207
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CexTrader.get_account_position refactored with the following changes:

return f"{positions}"
return "No Position"

Expand Down
Loading