Title: Binance api auth ПОМОГИТЕ пожалуйста
Post by: viktoriadevchulja on October 23, 2020, 05:53:19 PM
Здравствуйте, решила перейти на binance, помогите пожалуйста, внесите корректировки в код, использую код битмекса для авторизации https://github.com/BitMEX/sample-market-maker/blob/master/market_maker/auth/APIKeyAuthWithExpires.py from requests.auth import AuthBase import time from market_maker.auth.APIKeyAuth import generate_signature
class APIKeyAuthWithExpires(AuthBase):
"""Attaches API Key Authentication to the given Request object. This implementation uses `expires`."""
def __init__(self, apiKey, apiSecret): """Init with Key & Secret.""" self.apiKey = apiKey self.apiSecret = apiSecret
def __call__(self, r): """ Called when forming a request - generates api key headers. This call uses `expires` instead of nonce. This way it will not collide with other processes using the same API Key if requests arrive out of order. For more details, see https://www.bitmex.com/app/apiKeys """ # modify and return the request expires = int(round(time.time()) + 5) # 5s grace period in case of clock skew r.headers['api-expires'] = str(expires) r.headers['api-key'] = self.apiKey r.headers['api-signature'] = generate_signature(self.apiSecret, r.method, r.url, expires, r.body or '')
return r
Title: Re: Binance api auth ПОМОГИТЕ пожалуйста
Post by: TradeJedi on August 28, 2022, 08:38:26 AM
Привет.
А что не так с готовым решением?
https://github.com/binance/binance-futures-connector-python https://github.com/binance/binance-connector-python
|