jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

futures api

anwarrassool opened this issue · comments

when interacting with the futures api

When using the futures api
e.g
return binance.futuresAccount((error, data) => {
if (error) return error;
this.#accountinfo = data;
if (this.#accountinfo) return this.#accountinfo;
else return {};
});

i get the following error

"msg": "Mandatory parameter 'timestamp' was not sent, was empty/null, or malformed."

calling useServerTime
binance.useServerTime() returns 404

looking at your code

    if ( Binance.options.useServerTime ) {
        publicRequest( base + 'v3/time', {}, function ( error, response ) {
            Binance.info.timeOffset = response.serverTime - new Date().getTime();
            //Binance.options.log("server time set: ", response.serverTime, Binance.info.timeOffset);
            if ( callback ) callback();
        } );
    } else if ( callback ) callback();

when setting the url in the options for futures the useServerTime request ends up being https://fapi.binance.com/fapi/v3/time which doesnt exist and instead it should be it should be https://fapi.binance.com/fapi/v1/time

AND using binance.futuresTime() has no effect in trying to resolve the error

issue can be closed ..

i figure out how to use it

binance.setOption("callback", await binance.futuresTime());
return binance.futuresPositionRisk((error, data) => {
  if (error) return error;
  this.#positions = data;
  if (this.#positions) return this.#positions;
  else return {};
});

for anyone that had the same problem sepcif the server time via callback.

you should update your documentation to show this, i spent 5 hours trying to figure this out by diggin in your code :)