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 769 forks source link

exchangeInfo single symbol #850

Open pdoria opened 2 years ago

pdoria commented 2 years ago

Made a small change to exchangeInfo() so it supports returning info on a single symbol:

`/**

mr-smit commented 2 years ago

by the way, you can modify this npm library without changing it,

for example, I needed api to disable "spotBNBBurn" , which this library dont have, but api have it, so I used javascript ability to modify any function:

        let binance = new Binance().options({});

        binance.disable_bnb_fee = (req_type) => {
            let parameters = Object.assign( {"spotBNBBurn":false} );
            return new Promise((resolve, reject) => {
                callback = (error, response) => {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(response);
                    }
                }
                binance.signedRequest('https://api.binance.com/sapi/v1/bnbBurn', parameters, callback, req_type);
            });
        }

and then you can run it:


        let ret;
        try {
            ret = await binance.disable_bnb_fee('GET');
        }catch(err){
            console.log("err", err);
        }

        if(ret.spotBNBBurn != false){
            try {
                ret = await binance.disable_bnb_fee('POST');
            }catch(err){
                console.log("err", err);
            }
            console.log("Setting BNB fee to disabled");
        }