jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

How to use custom API calls #662

Open enriquepiatti opened 3 years ago

enriquepiatti commented 3 years ago

Is possible to call for example this method?
https://binance-docs.github.io/apidocs/futures/en/#top-trader-long-short-ratio-positions
it works fine with a simple request like:
https://www.binance.com/futures/data/globalLongShortAccountRatio?symbol=BTCUSDT&period=5m

brunosaldivar commented 1 year ago

This work for me:

const getLongShortRatio = async (symbol) => {
    const url = 'https://fapi.binance.com/futures/data/globalLongShortAccountRatio';
    return new Promise((resolve, reject) => {
        binance.signedRequest(url, {symbol: 'BTCUSDT',period: '5m'}, (error, data) => {
            if (error) {
                reject(error);
            } else {
                resolve(data);
            }
        });
    });