Skip to content

Bug in timestamp calculation! #472

Open

Description

@MegaManSE

I have been receiving this error:
balance 400 Bad Request {"code":-1100,"msg":"Illegal characters found in parameter 'timestamp'; legal range is '^[0-9]{1,20}$'."}

Looking through node-binance-api I see there is an unhanded situation with timestamp storage:

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); callback( error, response ); } );

Both places where timeOffset are set do not consider the possibility that there could be an error in the response and response.serverTime could be invalid. This then causes a cascade of errors with every call that uses timeOffset until it's fetched again.

Activity

  1. jaggedsoft commented on Aug 6, 2020

    @jaggedsoft
    Collaborator

    sounds like a job for !isNaN or parseInt, thanks for your report

  2. MegaManSE commented on Aug 6, 2020

    @MegaManSE
    Author

    No problem, thanks for creating this package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions