Open ArieArepunk opened 11 months ago
you can custom the Client, use CustomClient
to replace Client
:
class CustomClient(Client):
def _create_futures_api_uri(self, path: str, version: int = 1) -> str:
url = self.FUTURES_URL
if self.testnet:
url = self.FUTURES_TESTNET_URL
v_path = self.FUTURES_API_VERSION
if version == 2:
v_path = self.FUTURES_API_VERSION2
return url + '/' + v_path + '/' + path
def _request_futures_api(
self, method, path, signed=False, version=1, **kwargs
) -> Dict:
uri = self._create_futures_api_uri(path, version=version)
return self._request(method, uri, signed, True, **kwargs)
def futures_account_balance(self, **params):
"""Get futures account balance
https://binance-docs.github.io/apidocs/futures/en/#future-account-balance-user_data
"""
return self._request_futures_api('get', 'balance', True, version=2, data=params)
def futures_account(self, **params):
"""Get current account information.
https://binance-docs.github.io/apidocs/futures/en/#account-information-user_data
"""
return self._request_futures_api('get', 'account', True, version=2, data=params)
def futures_position_information(self, **params):
"""Get position information
https://binance-docs.github.io/apidocs/futures/en/#position-information-user_data
"""
return self._request_futures_api(
'get', 'positionRisk', True, version=2, data=params
)
if i use async client . i must do this with async client too becouse i have the same problem but i use async and client too i my code
you can custom the Client, use
CustomClient
to replaceClient
:class CustomClient(Client): def _create_futures_api_uri(self, path: str, version: int = 1) -> str: url = self.FUTURES_URL if self.testnet: url = self.FUTURES_TESTNET_URL v_path = self.FUTURES_API_VERSION if version == 2: v_path = self.FUTURES_API_VERSION2 return url + '/' + v_path + '/' + path def _request_futures_api( self, method, path, signed=False, version=1, **kwargs ) -> Dict: uri = self._create_futures_api_uri(path, version=version) return self._request(method, uri, signed, True, **kwargs) def futures_account_balance(self, **params): """Get futures account balance https://binance-docs.github.io/apidocs/futures/en/#future-account-balance-user_data """ return self._request_futures_api('get', 'balance', True, version=2, data=params) def futures_account(self, **params): """Get current account information. https://binance-docs.github.io/apidocs/futures/en/#account-information-user_data """ return self._request_futures_api('get', 'account', True, version=2, data=params) def futures_position_information(self, **params): """Get position information https://binance-docs.github.io/apidocs/futures/en/#position-information-user_data """ return self._request_futures_api( 'get', 'positionRisk', True, version=2, data=params )
Thank you
When i run my code it's fine, but when about 1-2 hour i got the error. Can someone help me please?