Public API
A python class to send the public APIs.
The private API is a class to send API requests without authorization, e.g. get the price of some symbol in Binance spot market and etc.
It is initialized prior to your code as a variable named publicAPI
.
Currently, the public API is available for terminal only for now. We will support this in analytics/python mode too in the future.
Common Functions
The common functions are the methods of the public API, available for (almost) any exchanges we support. By using these functions, you can easily switch the exchanges you want to send API request to.
Every common function has its first argument as an exchange. It specifies which exchange should the request be sent to. For example, you can get the up-to-date price of BTCUSDT in Binance spot by publicAPI.recent_price('binance', 'BTCUSDT')
, while publicAPI.recent_price('binance_um_futures', 'BTCUSDT')
returns the price of BTCUSDT perpetual in Binance USDⓈ-M futures.
For now, the available exchanges are,
binance
: Binance Spotbinance_um_futures
: Binance USDⓈ-M Futuresbinance_cm_futures
: Binance COIN-M Futures
1. Get Current Price
It is a function to get to the up-to-date price of a symbol in the selected exchange.
Arguments
exchange
: (string). The name of the exchangesymbol
: (string) The name of the symbol.
Returns
float
Last updated