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

v3 is here #1420

Open
dfrankmv opened this issue Jul 26, 2024 · 1 comment
Open

v3 is here #1420

dfrankmv opened this issue Jul 26, 2024 · 1 comment

Comments

@dfrankmv
Copy link

dfrankmv commented Jul 26, 2024

Binance has released a v3 for some endpoint (today July 24th). See the changelog https://binance-docs.github.io/apidocs/futures/en/#get-position-margin-change-history-trade

Can we pass the version as a parameter?

@tsunamilx
Copy link

tsunamilx commented Aug 7, 2024

I think the project is dead, we are on our own to maintain the lib.
I usually add/overwrite api methods by using my own client extending the original client class, for example (I am using AsyncClient):

from binance import AsyncClient


class AsyncClient2(AsyncClient):

    # the new methods
    async def futures_account_config(self, **params):
        return await self._request_futures_api('get', 'accountConfig', signed=True, version=1, data=params)

     async def futures_symbol_config(self, **params):
        return await self._request_futures_api('get', 'symbolConfig', signed=True, version=1, data=params)

    # the v3 methods
    async def futures_account_balance(self, **params):
        return await self._request_futures_api('get', 'balance', signed=True, version=3, data=params)

    async def futures_position_information(self, **params):
        return await self._request_futures_api('get', 'positionRisk', signed=True, version=3, data=params)

    def _create_futures_api_uri(self, path: str, version=1) -> str:
        url = self.FUTURES_URL
        if self.testnet:
            url = self.FUTURES_TESTNET_URL
        return f'{url}/v{version}/{path}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants