Python-binance: How do I pull data for BTCUSD Perpetual

Created on 24 Nov 2020  路  3Comments  路  Source: sammchardy/python-binance

I am new to Python, would anyone be kind enough to guide me in pulling data for BTCUSD Perpetual?

The only relevant post I found from the web is: https://stackoverflow.com/questions/63963411/what-are-the-symbols-used-in-binances-dapi-coin-futures-api

However, I do not know how I can proceed. I am using a macOS and PyCharm

Most helpful comment

@oliver-zehentleitner
Hey Oliver, thank you for your respond.

Found a way to get perpetual data (FYI for those who need it). Since I am only interested in Coin-M futures, I changed the endpoint.

binance_api = "API-KEY"
binance_secret = "API-SECRET"
client = Client(binance_api, binance_secret)
client.FUTURES_URL = 'https://dapi.binance.com/dapi'

All 3 comments

As far as I know, support for those endpoints are not implemented in python-binance or any other lib i know - neither rest nor websocket.

Here are the official docs from binance: https://binance-docs.github.io/apidocs/delivery/en/#change-log

I want to do a websocket implementation of binance coin futures for an other python lib and started this issue: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/134

@oliver-zehentleitner
Hey Oliver, thank you for your respond.

Found a way to get perpetual data (FYI for those who need it). Since I am only interested in Coin-M futures, I changed the endpoint.

binance_api = "API-KEY"
binance_secret = "API-SECRET"
client = Client(binance_api, binance_secret)
client.FUTURES_URL = 'https://dapi.binance.com/dapi'

binance_api = "API-KEY"
binance_secret = "API-SECRET"
client = Client(binance_api, binance_secret)
client.FUTURES_URL = 'https://dapi.binance.com/dapi'

The same as above, but for websocket:

@python client = Client(api_key, api_secret) bm = BinanceSocketManager(client) bm.FSTREAM_URL = `'wss://dapi.binance.com/'`

For COIN-M testenet, bm.FSTREAM_URL = 'wss://dstream.binancefuture.com'

Was this page helpful?
0 / 5 - 0 ratings