Skip to content

Commit

Permalink
Add long bot autoswitch to margin short bot
Browse files Browse the repository at this point in the history
  • Loading branch information
carkod committed Jul 5, 2023
1 parent 62382c5 commit 0b2da53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions api/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from tools.handle_error import handle_binance_errors, json_response, json_response_error
from py3cw.request import Py3CW


class IsolateBalanceError(Exception):
pass
class BinanceApi:
"""
Binance API URLs
Expand Down Expand Up @@ -128,8 +129,10 @@ def get_isolated_balance(self, symbol=None):
Use isolated margin account is preferrable,
because this is the one that supports the most assets
"""
info = self.signed_request(url=self.isolated_account_url, payload={"symbols": symbol})
info = self.signed_request(url=self.isolated_account_url, payload={"symbol": symbol})
assets = info["assets"]
if len(assets) == 0:
raise IsolateBalanceError("Hit symbol 24hr restriction or not available at the moment")
return assets

class BinbotApi(BinanceApi):
Expand Down
1 change: 0 additions & 1 deletion api/deals/margin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from tools.round_numbers import (
round_numbers,
supress_notation,
supress_trailling,
round_numbers_ceiling,
)

Expand Down

0 comments on commit 0b2da53

Please sign in to comment.