niXman / binapi

Binance API C++ implementation
Apache License 2.0
241 stars 83 forks source link

Webrequest issue : "Timestamp for this request is outside of the recvWindow." #48

Closed mehmetisl closed 2 years ago

mehmetisl commented 2 years ago

Hello, First of all i would like to thank you for the API, it is really useful.

There is no problem with websocket, but when I run the Asynchronous example you mentioned.

int main() {
    const std::string pk = "xxx";
    const std::string sk = "xxx";

    boost::asio::io_context ioctx;
    binapi::rest::api api(
        ioctx
        , "api.binance.com"
        , "443"
        , pk
        , sk
        , 10000 // recvWindow
    );

    auto account = api.account_info();
    if (!account) {
        std::cerr << "account info error: " << account.errmsg << std::endl;
        return EXIT_FAILURE;
    }

    std::cout << "account info: " << account.v << std::endl << std::endl;

    return EXIT_SUCCESS;
}

I get the following error. "Timestamp for this request is outside of the recvWindow." I have tried with different recvWindow values (20000,60000) but the result was the same. Is there a way that i can control what is the created timestamp on the request ? or any other way to change created timestamp ?

niXman commented 2 years ago

hi,

can you please show me the content of the data string at this line?: https://github.com/niXman/binapi/blob/master/src/api.cpp#L231

mehmetisl commented 2 years ago

hi, get_current_ms_epoch() content is : 1641313662795 data content is : timestamp=636155723&recvWindow=60000

mehmetisl commented 2 years ago

I have tried to use data+= std::to_string( get_current_ms_epoch()); instead of local to_string lambda expression but, then program is crashing with out exception.

niXman commented 2 years ago

get_current_ms_epoch() content is : 1641313662795

did you mean the return value?

data content is : timestamp=636155723&recvWindow=60000

I don't understand how this can be... if the return value of get_current_ms_epoch() is 1641313662795, then the data should have timestamp=1641313662795&recvWindow=60000

niXman commented 2 years ago

which compiler and OS are you using?

mehmetisl commented 2 years ago

OS : Windows 10 , Compiler : VS 2022 Preview , C++20, x86

mehmetisl commented 2 years ago

did you mean the return value?

Yes

I don't understand how this can be... if the return value of get_current_ms_epoch() is 1641313662795, then the data should have timestamp=1641313662795&recvWindow=60000

Yes you are right but it seems it is not. Do you have any comment why program is crashing when the time stamp is correct value on data string. I mean when data is like this timestamp=1641313662795&recvWindow=60000 it is crashing, and there is no any exception

niXman commented 2 years ago

hmm... maybe this problem only concerns the MSVC compiler and its snprintf() implementation features... I've never built this project using MSVC.

I have tried to use data+= std::to_string( get_current_ms_epoch()); instead of local to_string lambda expression but, then program is crashing with out exception.

very strange... does the MSVC compiler support using std::to_string() with an argument of type std::uint64_t ?

niXman commented 2 years ago

Yes you are right but it seems it is not. Do you have any comment why program is crashing when the time stamp is correct value on data string. I mean when data is like this timestamp=1641313662795&recvWindow=60000 it is crashing, and there is no any exception

that is, does the program crash not on the std::to_string(get_current_ms_epoch()) line?

niXman commented 2 years ago

could you tell me which line the program is crashing on?

mehmetisl commented 2 years ago

it is compiling without any problem, exe is crashing.

niXman commented 2 years ago

then just run the program in debug mode.

mehmetisl commented 2 years ago

very strange... does the MSVC compiler support using std::to_string() with an argument of type std::uint64_t ?

yes MSVC supports it.

mehmetisl commented 2 years ago

then just run the program in debug mode.

Assertion failed: json.is_valid(), file C:\Users\Jho\source\repos\Binapi\Binapi\api.cpp, line 266

niXman commented 2 years ago

great!

please show me the content of the strbuf var on this line: https://github.com/niXman/binapi/blob/master/src/api.cpp#L260

mehmetisl commented 2 years ago

strbuf = {"makerCommission":10,"takerCommission":10,"buyerCommission":0,"sellerCommission":0,"canTrade":true,"canWithdraw":true,"canDeposit":true,"updateTime":1641262398584,"accountType":"SPOT","balances":[{"asset":"BTC","free":"0.00000000","locked":"0.00000000"},{"asset":"LTC","free":"0.00005990","locked":"0.00000000"},{"asset":"ETH","free":"0.00000000","locked":"0.00000000"},{"asset":"NEO","free":"0.00000000","locked":"0.00000000"},{"asset":"BNB","free":"0.00000000","locked":"0.00000000"},{"asset":"QTUM","free":"0.00000000","locked":"0.00000000"},{"asset":"EOS","free":"0.00000000","locked":"0.00000000"},{"asset":"SNT","free":"0.00000000","locked":"0.00000000"},{"asset":"BNT","free":"0.00000000","locked":"0.00000000"},{"asset":"GAS","free":"0.00000000","locked":"0.00000000"},{"asset":"BCC","free":"0.00000000","locked":"0.00000000"},{"asset":"USDT","free":"0.00000000","locked":"0.00000000"},{"asset":"HSR","free":"0.00000000","locked":"0.00000000"},{"asset":"OAX","free":"0.00000000","locked":"0.00000000"},{"asset":"DNT","free":"0.00000000","locked":"0.00000000"},{"asset":"MCO","free":"0.00000000","locked":"0.00000000"},{"asset":"ICN","free":"0.00000000","locked":"0.00000000"},{"asset":"ZRX","free":"0.00000000","locked":"0.00000000"},{"asset":"OMG","free":"0.00000000","locked":"0.00000000"},{"asset":"WTC","free":"0.00000000","locked":"0.00000000"},{"asset":"YOYO","free":"0.00000000","locked":"0.00000000"},{"asset":"LRC","free":"0.00000000","locked":"0.00000000"},{"asset":"TRX","free":"0.00000000","locked":"0.00000000"},{"asset":"SNGLS","free":"0.00000000","locked":"0.00000000"},{"asset":"STRAT","free":"0.00000000","locked":"0.00000000"},{"asset":"BQX","free":"0.00000000","locked":"0.00000000"},{"asset":"FUN","free":"0.00000000","locked":"0.00000000"},{"asset":"KNC","free":"0.00000000","locked":"0.00000000"},{"asset":"CDT","free":"0.00000000","locked":"0.00000000"},{"asset":"XVG","free":"0.00000000","locked":"0.00000000"},{"asset":"IOTA","free":"0.00000000","locked":"0.00000000"},{"asset":"SNM","free":"0.00000000","locked":"0.00000000"},{"asset":"LINK","free":"0.00000000","locked":"0.00000000"},{"asset":"CVC","free":"0.00000000","locked":"0.00000000"},{"asset":"TNT","free":"0.00000000","locked":"0.00000000"},{"asset":"REP","free":"0.00000000","locked":"0.00000000"},{"asset":"MDA","free":"0.00000000","locked":"0.00000000"},{"asset":"MTL","free":"0.00000000","locked":"0.00000000"},{"asset":"SALT","free":"0.00000000","locked":"0.00000000"},{"asset":"NULS","free":"0.00000000","locked":"0.00000000"},{"asset":"SUB","free":"0.00000000","locked":"0.00000000"},{"asset":"STX","free":"0.00000000","locked":"0.00000000"},{"asset":"MTH","free":"0.00000000","locked":"0.00000000"},{"asset":"ADX","free":"0.00000000","locked":"0.00000000"},{"asset":"ETC","free":"0.00000000","locked":"0.00000000"},{"asset":"ENG","free":"0.00000000","locked":"0.00000000"},{"asset":"ZEC","free":"0.00000000","locked":"0.00000000"},{"asset":"AST","free":"0.00000000","locked":"0.00000000"},{"asset":"GNT","free":"0.00000000","locked":"0.00000000"},{"asset":"DGD","free":"0.00000000","locked":"0.00000000"},{"asset":"BAT","free":"0.00000000","locked":"0.00000000"},{"asset":"DASH","free":"0.00000000","locked":"0.00000000"},{"asset":"POWR","free":"0.00000000","locked":"0.00000000"},{"asset":"BTG","free":"0.00000000","locked":"0.00000000"},{"asset":"REQ","free":"0.00000000","locked":"0.00000000"},{"asset":"XMR","free":"0.00000000","locked":"0.00000000"},{"asset":"EVX","free":"0.00000000","locked":"0.00000000"},{"asset":"VIB","free":"0.00000000","locked":"0.00000000"},{"asset":"ENJ","free":"0.00000000","locked":"0.00000000"},{"asset":"VEN","free":"0.00000000","locked":"0.00000000"},{"asset":"ARK","free":"0.00000000","locked":"0.00000000"},{"asset":"XRP","free":"0.00000000","locked":"0.00000000"},{"asset":"MOD","free":"0.00000000","locked":"0.00000000"},{"asset":"STORJ","free":"0.00000000","locked":"0.00000000"},{"asset":"KMD","free":"0.00000000","locked":"0.00000000"},{"asset":"RCN","free":"0.00000000","locked":"0.00000000"},{"asset":"EDO","free":"0.00000000","locked":"0.00000000"},{"asset":"DATA","free":"0.00000000","locked":"0.00000000"},{"asset":"DLT","free":"0.00000000","locked":"0.00000000"},{"asset":"MANA","free":"0.00000000","locked":"0.00000000"},{"asset":"PPT","free":"0.00000000","locked":"0.00000000"},{"asset":"RDN","free":"0.00000000","locked":"0.00000000"},{"asset":"GXS","free":"0.00000000","locked":"0.00000000"},{"asset":"AMB","free":"0.00000000","locked":"0.00000000"},{"asset":"ARN","free":"0.00000000","locked":"0.00000000"},{"asset":"BCPT","free":"0.00000000","locked":"0.00000000"},{"asset":"CND","free":"0.00000000","locked":"0.00000000"},{"asset":"GVT","free":"0.00000000","locked":"0.00000000"},{"asset":"POE","free":"0.00000000","locked":"0.00000000"},{"asset":"BTS","free":"0.00000000","locked":"0.00000000"},{"asset":"FUEL","free":"0.00000000","locked":"0.00000000"},{"asset":"XZC","free":"0.00000000","locked":"0.00000000"},{"asset":"QSP","free":"0.00000000","locked":"0.00000000"},{"asset":"LSK","free":"0.00000000","locked":"0.00000000"},{"asset":"BCD","free":"0.00000000","locked":"0.00000000"},{"asset":"TNB","free":"0.00000000","locked":"0.00000000"},{"asset":"ADA","free":"0.00000000","locked":"0.00000000"},{"asset":"LEND","free":"0.00000000","locked":"0.00000000"},{"asset":"XLM","free":"0.00000000","locked":"0.00000000"},{"asset":"CMT","free":"0.00000000","locked":"0.00000000"},{"asset":"WAVES","free":"0.00000000","locked":"0.00000000"},{"asset":"WABI","free":"0.00000000","locked":"0.00000000"},{"asset":"GTO","free":"0.00000000","locked":"0.00000000"},{"asset":"ICX","free":"0.00000000","locked":"0.00000000"},{"asset":"OST","free":"0.00000000","locked":"0.00000000"},{"asset":"ELF","free":"0.00000000","locked":"0.00000000"},{"asset":"AION","free":"0.00000000","locked":"0.00000000"},{"asset":"WINGS","free":"0.00000000","locked":"0.00000000"},{"asset":"BRD","free":"0.00000000","locked":"0.00000000"},{"asset":"NEBL","free":"0.00000000","locked":"0.00000000"},{"asset":"NAV","free":"0.00000000","locked":"0.00000000"},{"asset":"VIBE","free":"0.00000000","locked":"0.00000000"},{"asset":"LUN","free":"0.00000000","locked":"0.00000000"},{"asset":"TRIG","free":"0.00000000","locked":"0.00000000"},{"asset":"APPC","free":"0.00000000","locked":"0.00000000"},{"asset":"CHAT","free":"0.00000000","locked":"0.00000000"},{"asset":"RLC","free":"0.00000000","locked":"0.00000000"},{"asset":"INS","free":"0.00000000","locked":"0.00000000"},{"asset":"PIVX","free":"0.00000000","locked":"0.00000000"},{"asset":"IOST","free":"0.00000000","locked":"0.00000000"},{"asset":"STEEM","free":"0.00000000","locked":"0.00000000"},{"asset":"NANO","free":"0.00000000","locked":"0.00000000"},{"asset":"AE","free":"0.00000000","locked":"0.00000000"},{"asset":"VIA","free":"0.00000000","locked":"0.00000000"},{"asset":"BLZ","free":"0.00000000","locked":"0.00000000"},{"asset":"SYS","free":"0.00000000","locked":"0.00000000"},{"asset":"RPX","free":"0.00000000","locked":"0.00000000"},{"asset":"NCASH","free":"0.00000000","locked":"0.00000000"},{"asset":"POA","free":"0.00000000","locked":"0.00000000"},{"asset":"ONT","free":"0.00000000","locked":"0.00000000"},{"asset":"ZIL","free":"0.00000000","locked":"0.00000000"},{"asset":"STORM","free":"0.00000000","locked":"0.00000000"},{"asset":"XEM","free":"0.00000000","locked":"0.00000000"},{"asset":"WAN","free":"0.00000000","locked":"0.00000000"},{"asset":"WPR","free":"0.00000000","locked":"0.00000000"},{"asset":"QLC","free":"0.00000000","locked":"0.00000000"},{"asset":"GRS","free":"0.00000000","locked":"0.00000000"},{"asset":"CLOAK","free":"0.00000000","locked":"0.00000000"},{"asset":"LOOM","free":"0.00000000","locked":"0.00000000"},{"asset":"BCN","free":"0.00000000","locked":"0.00000000"},{"asset":"TUSD","free":"0.00000000","locked":"0.00000000"},{"asset":"ZEN","free":"0.00000000","locked":"0.00000000"},{"asset":"SKY","free":"0.00000000","locked":"0.00000000"},{"asset":"THETA","free":"0.00000000","locked":"0.00000000"},{"asset":"IOTX","free":"0.00000000","locked":"0.00000000"},{"asset":"QKC","free":"0.00000000","locked":"0.00000000"},{"asset":"AGI","free":"0.00000000","locked":"0.00000000"},{"asset":"NXS","free":"0.00000000","locked":"0.00000000"},{"asset":"SC","free":"0.00000000","locked":"0.00000000"},{"asset":"NPXS","free":"0.00000000","locked":"0.00000000"},{"asset":"KEY","free":"0.00000000","locked":"0.00000000"},{"asset":"NAS","free":"0.00000000","locked":"0.00000000"},{"asset":"MFT","free":"0.00000000","locked":"0.00000000"},{"asset":"DENT","free":"0.00000000","locked":"0.00000000"},{"asset":"IQ","free":"0.00000000","locked":"0.00000000"},{"asset":"ARDR","free":"0.00000000","locked":"0.00000000"},{"asset":"HOT","free":"0.00000000","locked":"0.00000000"},{"asset":"VET","free":"0.00000000","locked":"0.00000000"},{"asset":"DOCK","free":"0.00000000","locked":"0.00000000"},{"asset":"POLY","free":"0.00000000","locked":"0.00000000"},{"asset":"VTHO","free":"0.00000000","locked":"0.00000000"},{"asset":"ONG","free":"0.00000000","locked":"0.00000000"},{"asset":"PHX","free":"0.00000000","locked":"0.00000000"},{"asset":"HC","free":"0.00000000","locked":"0.00000000"},{"asset":"GO","free":"0.00000000","locked":"0.00000000"},{"asset":"PAX","free":"0.00000000","locked":"0.00000000"},{"asset":"RVN","free":"0.00000000","locked":"0.00000000"},{"asset":"DCR","free":"0.00000000","locked":"0.00000000"},{"asset":"USDC","free":"0.00000000","locked":"0.00000000"},{"asset":"MITH","free":"0.00000000","locked":"0.00000000"},{"asset":"BCHABC","free":"0.00000000","locked":"0.00000000"},{"asset":"BCHSV","free":"0.00000000","locked":"0.00000000"},{"asset":"REN","free":"0.00000000","locked":"0.00000000"},{"asset":"BTT","free":"0.00000000","locked":"0.00000000"},{"asset":"USDS","free":"0.00000000","locked":"0.00000000"},{"asset":"FET","free":"0.00000000","locked":"0.00000000"},{"asset":"TFUEL","free":"0.00000000","locked":"0.00000000"},{"asset":"CELR","free":"0.00000000","locked":"0.00000000"},{"asset":"MATIC","free":"0.00000000","locked":"0.00000000"},{"asset":"ATOM","free":"0.00000000","locked":"0.00000000"},{"asset":"PHB","free":"0.00000000","locked":"0.00000000"},{"asset":"ONE","free":"0.00000000","locked":"0.00000000"},{"asset":"FTM","free":"0.00000000","locked":"0.00000000"},{"asset":"BTCB","free":"0.00000000","locked":"0.00000000"},{"asset":"USDSB","free":"0.00000000","locked":"0.00000000"},{"asset":"CHZ","free":"0.75300000","locked":"246.00000000"},{"asset":"COS","free":"0.00000000","locked":"0.00000000"},{"asset":"ALGO","free":"0.00000000","locked":"0.00000000"},{"asset":"ERD","free":"0.00000000","locked":"0.00000000"},{"asset":"DOGE","free":"0.00000000","locked":"0.00000000"},{"asset":"BGBP","free":"0.00000000","locked":"0.00000000"},{"asset":"DUSK","free":"0.00000000","locked":"0.00000000"},{"asset":"ANKR","free":"0.00000000","locked":"0.00000000"},{"asset":"WIN","free":"0.00000000","locked":"0.00000000"},{"asset":"TUSDB","free":"0.00000000","locked":"0.00000000"},{"asset":"COCOS","free":"0.00000000","locked":"0.00000000"},{"asset":"PERL","free":"0.00000000","locked":"0.00000000"},{"asset":"TOMO","free":"0.00000000","locked":"0.00000000"},{"asset":"BUSD","free":"0.26959850","locked":"0.00000000"},{"asset":"BAND","free":"0.00000000","locked":"0.00000000"},{"asset":"BEAM","free":"0.00000000","locked":"0.00000000"},{"asset":"HBAR","free":"0.00000000","locked":"0.00000000"},{"asset":"XTZ","free":"0.00000000","locked":"0.00000000"},{"asset":"NGN","free":"0.00000000","locked":"0.00000000"},{"asset":"DGB","free":"0.00000000","locked":"0.00000000"},{"asset":"NKN","free":"0.00000000","locked":"0.00000000"},{"asset":"GBP","free":"0.00000000","locked":"0.00000000"},{"asset":"EUR","free":"0.00000000","locked":"0.00000000"},{"asset":"KAVA","free":"0.00000000","locked":"0.00000000"},{"asset":"RUB","free":"0.00000000","locked":"0.00000000"},{"asset":"UAH","free":"0.00000000","locked":"0.00000000"},{"asset":"ARPA","free":"0.00000000","locked":"0.00000000"},{"asset":"TRY","free":"13.38575990","locked":"0.00000000"},{"asset":"CTXC","free":"0.00000000","locked":"0.00000000"},{"asset":"AERGO","free":"0.00000000","locked":"0.00000000"},{"asset":"BCH","free":"0.00000000","locked":"0.00000000"},{"asset":"TROY","free":"0.00000000","locked":"0.00000000"},{"asset":"BRL","free":"0.00000000","locked":"0.00000000"},{"asset":"VITE","free":"0.00000000","locked":"0.00000000"},{"asset":"FTT","free":"0.00000000","locked":"0.00000000"},{"asset":"AUD","free":"0.00000000","locked":"0.00000000"},{"asset":"OGN","free":"0.00000000","locked":"0.00000000"},{"asset":"DREP","free":"0.00000000","locked":"0.00000000"},{"asset":"BULL","free":"0.00000000","locked":"0.00000000"},{"asset":"BEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"ETHBULL","free":"0.00000000","locked":"0.00000000"},{"asset":"ETHBEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"XRPBULL","free":"0.00000000","locked":"0.00000000"},{"asset":"XRPBEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"EOSBULL","free":"0.00000000","locked":"0.00000000"},{"asset":"EOSBEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"TCT","free":"0.00000000","locked":"0.00000000"},{"asset":"WRX","free":"0.00000000","locked":"0.00000000"},{"asset":"LTO","free":"0.00000000","locked":"0.00000000"},{"asset":"ZAR","free":"0.00000000","locked":"0.00000000"},{"asset":"MBL","free":"0.00000000","locked":"0.00000000"},{"asset":"COTI","free":"0.00000000","locked":"0.00000000"},{"asset":"BKRW","free":"0.00000000","locked":"0.00000000"},{"asset":"BNBBULL","free":"0.00000000","locked":"0.00000000"},{"asset":"BNBBEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"HIVE","free":"0.00000000","locked":"0.00000000"},{"asset":"STPT","free":"0.00000000","locked":"0.00000000"},{"asset":"SOL","free":"0.00000000","locked":"0.00000000"},{"asset":"IDRT","free":"0.00","locked":"0.00"},{"asset":"CTSI","free":"0.00000000","locked":"0.00000000"},{"asset":"CHR","free":"0.00000000","locked":"0.00000000"},{"asset":"BTCUP","free":"0.00000000","locked":"0.00000000"},{"asset":"BTCDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"HNT","free":"0.00000000","locked":"0.00000000"},{"asset":"JST","free":"0.00000000","locked":"0.00000000"},{"asset":"FIO","free":"0.00000000","locked":"0.00000000"},{"asset":"BIDR","free":"0.00","locked":"0.00"},{"asset":"STMX","free":"0.00000000","locked":"0.00000000"},{"asset":"MDT","free":"0.00000000","locked":"0.00000000"},{"asset":"PNT","free":"0.00000000","locked":"0.00000000"},{"asset":"COMP","free":"0.00000000","locked":"0.00000000"},{"asset":"IRIS","free":"0.00000000","locked":"0.00000000"},{"asset":"MKR","free":"0.00000000","locked":"0.00000000"},{"asset":"SXP","free":"0.00000000","locked":"0.00000000"},{"asset":"SNX","free":"0.00000000","locked":"0.00000000"},{"asset":"DAI","free":"0.00000000","locked":"0.00000000"},{"asset":"ETHUP","free":"0.00000000","locked":"0.00000000"},{"asset":"ETHDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"ADAUP","free":"0.00000000","locked":"0.00000000"},{"asset":"ADADOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"LINKUP","free":"0.00000000","locked":"0.00000000"},{"asset":"LINKDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"DOT","free":"0.00752000","locked":"12.46000000"},{"asset":"RUNE","free":"0.00000000","locked":"0.00000000"},{"asset":"BNBUP","free":"0.00000000","locked":"0.00000000"},{"asset":"BNBDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"XTZUP","free":"0.00000000","locked":"0.00000000"},{"asset":"XTZDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"AVA","free":"0.00000000","locked":"0.00000000"},{"asset":"BAL","free":"0.00000000","locked":"0.00000000"},{"asset":"YFI","free":"0.00000000","locked":"0.00000000"},{"asset":"SRM","free":"0.00000000","locked":"0.00000000"},{"asset":"ANT","free":"0.00000000","locked":"0.00000000"},{"asset":"CRV","free":"0.00000000","locked":"0.00000000"},{"asset":"SAND","free":"0.00000000","locked":"0.00000000"},{"asset":"OCEAN","free":"0.00000000","locked":"0.00000000"},{"asset":"NMR","free":"0.00000000","locked":"0.00000000"},{"asset":"LUNA","free":"0.00000000","locked":"0.00000000"},{"asset":"IDEX","free":"0.00000000","locked":"0.00000000"},{"asset":"RSR","free":"0.00000000","locked":"0.00000000"},{"asset":"PAXG","free":"0.00000000","locked":"0.00000000"},{"asset":"WNXM","free":"0.00000000","locked":"0.00000000"},{"asset":"TRB","free":"0.00000000","locked":"0.00000000"},{"asset":"EGLD","free":"0.00000000","locked":"0.00000000"},{"asset":"BZRX","free":"0.00000000","locked":"0.00000000"},{"asset":"WBTC","free":"0.00000000","locked":"0.00000000"},{"asset":"KSM","free":"0.00000000","locked":"0.00000000"},{"asset":"SUSHI","free":"0.00000000","locked":"0.00000000"},{"asset":"YFII","free":"0.00000000","locked":"0.00000000"},{"asset":"DIA","free":"0.00000000","locked":"0.00000000"},{"asset":"BEL","free":"0.00000000","locked":"0.00000000"},{"asset":"UMA","free":"0.00000000","locked":"0.00000000"},{"asset":"EOSUP","free":"0.00000000","locked":"0.00000000"},{"asset":"TRXUP","free":"0.00000000","locked":"0.00000000"},{"asset":"EOSDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"TRXDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"XRPUP","free":"0.00000000","locked":"0.00000000"},{"asset":"XRPDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"DOTUP","free":"0.00000000","locked":"0.00000000"},{"asset":"DOTDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"NBS","free":"0.00000000","locked":"0.00000000"},{"asset":"WING","free":"0.00000000","locked":"0.00000000"},{"asset":"SWRV","free":"0.00000000","locked":"0.00000000"},{"asset":"LTCUP","free":"0.00000000","locked":"0.00000000"},{"asset":"LTCDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"CREAM","free":"0.00000000","locked":"0.00000000"},{"asset":"UNI","free":"0.00000000","locked":"0.00000000"},{"asset":"OXT","free":"0.00000000","locked":"0.00000000"},{"asset":"SUN","free":"0.00000000","locked":"0.00000000"},{"asset":"AVAX","free":"0.00000000","locked":"0.00000000"},{"asset":"BURGER","free":"0.00000000","locked":"0.00000000"},{"asset":"BAKE","free":"0.00000000","locked":"0.00000000"},{"asset":"FLM","free":"0.00000000","locked":"0.00000000"},{"asset":"SCRT","free":"0.00000000","locked":"0.00000000"},{"asset":"XVS","free":"0.00000000","locked":"0.00000000"},{"asset":"CAKE","free":"0.00000000","locked":"0.00000000"},{"asset":"SPARTA","free":"0.00000000","locked":"0.00000000"},{"asset":"UNIUP","free":"0.00000000","locked":"0.00000000"},{"asset":"UNIDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"ALPHA","free":"0.00000000","locked":"0.00000000"},{"asset":"ORN","free":"0.00000000","locked":"0.00000000"},{"asset":"UTK","free":"0.00000000","locked":"0.00000000"},{"asset":"NEAR","free":"0.00000000","locked":"0.00000000"},{"asset":"VIDT","free":"0.00000000","locked":"0.00000000"},{"asset":"AAVE","free":"0.00000000","locked":"0.00000000"},{"asset":"FIL","free":"0.00000000","locked":"0.00000000"},{"asset":"SXPUP","free":"0.00000000","locked":"0.00000000"},{"asset":"SXPDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"INJ","free":"0.00000000","locked":"0.00000000"},{"asset":"FILDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"FILUP","free":"0.00000000","locked":"0.00000000"},{"asset":"YFIUP","free":"0.00000000","locked":"0.00000000"},{"asset":"YFIDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"CTK","free":"0.00000000","locked":"0.00000000"},{"asset":"EASY","free":"0.00000000","locked":"0.00000000"},{"asset":"AUDIO","free":"0.00000000","locked":"0.00000000"},{"asset":"BCHUP","free":"0.00000000","locked":"0.00000000"},{"asset":"BCHDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"BOT","free":"0.00000000","locked":"0.00000000"},{"asset":"AXS","free":"0.00000000","locked":"0.00000000"},{"asset":"AKRO","free":"0.00000000","locked":"0.00000000"},{"asset":"HARD","free":"0.00000000","locked":"0.00000000"},{"asset":"KP3R","free":"0.00000000","locked":"0.00000000"},{"asset":"RENBTC","free":"0.00000000","locked":"0.00000000"},{"asset":"SLP","free":"0.00000000","locked":"0.00000000"},{"asset":"STRAX","free":"0.00000000","locked":"0.00000000"},{"asset":"UNFI","free":"0.00000000","locked":"0.00000000"},{"asset":"CVP","free":"0.00000000","locked":"0.00000000"},{"asset":"BCHA","free":"0.00000000","locked":"0.00000000"},{"asset":"FOR","free":"0.00000000","locked":"0.00000000"},{"asset":"FRONT","free":"0.00000000","locked":"0.00000000"},{"asset":"ROSE","free":"0.00000000","locked":"0.00000000"},{"asset":"MDX","free":"0.00000000","locked":"0.00000000"},{"asset":"HEGIC","free":"0.00000000","locked":"0.00000000"},{"asset":"AAVEUP","free":"0.00000000","locked":"0.00000000"},{"asset":"AAVEDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"PROM","free":"0.00000000","locked":"0.00000000"},{"asset":"BETH","free":"0.00000000","locked":"0.00000000"},{"asset":"SKL","free":"0.00000000","locked":"0.00000000"},{"asset":"GLM","free":"0.00000000","locked":"0.00000000"},{"asset":"SUSD","free":"0.00000000","locked":"0.00000000"},{"asset":"COVER","free":"0.00000000","locked":"0.00000000"},{"asset":"GHST","free":"0.00000000","locked":"0.00000000"},{"asset":"SUSHIUP","free":"0.00000000","locked":"0.00000000"},{"asset":"SUSHIDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"XLMUP","free":"0.00000000","locked":"0.00000000"},{"asset":"XLMDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"DF","free":"0.00000000","locked":"0.00000000"},{"asset":"JUV","free":"0.00000000","locked":"0.00000000"},{"asset":"PSG","free":"0.00000000","locked":"0.00000000"},{"asset":"BVND","free":"0.00","locked":"0.00"},{"asset":"GRT","free":"0.00000000","locked":"0.00000000"},{"asset":"CELO","free":"0.00000000","locked":"0.00000000"},{"asset":"TWT","free":"0.00000000","locked":"0.00000000"},{"asset":"REEF","free":"0.00000000","locked":"0.00000000"},{"asset":"OG","free":"0.00000000","locked":"0.00000000"},{"asset":"ATM","free":"0.00000000","locked":"0.00000000"},{"asset":"ASR","free":"0.00000000","locked":"0.00000000"},{"asset":"1INCH","free":"0.00012810","locked":"0.00000000"},{"asset":"LD1INCH","free":"0.06762721","locked":"0.00000000"},{"asset":"RIF","free":"0.00000000","locked":"0.00000000"},{"asset":"BTCST","free":"0.00000000","locked":"0.00000000"},{"asset":"TRU","free":"0.00000000","locked":"0.00000000"},{"asset":"DEXE","free":"0.00000000","locked":"0.00000000"},{"asset":"CKB","free":"0.00000000","locked":"0.00000000"},{"asset":"FIRO","free":"0.00000000","locked":"0.00000000"},{"asset":"LIT","free":"0.00000000","locked":"0.00000000"},{"asset":"PROS","free":"0.00000000","locked":"0.00000000"},{"asset":"VAI","free":"0.00000000","locked":"0.00000000"},{"asset":"SFP","free":"0.00000000","locked":"0.00000000"},{"asset":"FXS","free":"0.00000000","locked":"0.00000000"},{"asset":"DODO","free":"0.00000000","locked":"0.00000000"},{"asset":"AUCTION","free":"0.00000000","locked":"0.00000000"},{"asset":"UFT","free":"0.00000000","locked":"0.00000000"},{"asset":"ACM","free":"0.00000000","locked":"0.00000000"},{"asset":"PHA","free":"0.00000000","locked":"0.00000000"},{"asset":"TVK","free":"0.00000000","locked":"0.00000000"},{"asset":"BADGER","free":"0.00000000","locked":"0.00000000"},{"asset":"FIS","free":"0.00000000","locked":"0.00000000"},{"asset":"QI","free":"0.00000000","locked":"0.00000000"},{"asset":"OM","free":"0.00000000","locked":"0.00000000"},{"asset":"POND","free":"0.00000000","locked":"0.00000000"},{"asset":"ALICE","free":"0.00000000","locked":"0.00000000"},{"asset":"DEGO","free":"0.00000000","locked":"0.00000000"},{"asset":"BIFI","free":"0.00000000","locked":"0.00000000"},{"asset":"LINA","free":"0.00000000","locked":"0.00000000"},{"asset":"PERP","free":"0.00000000","locked":"0.00000000"},{"asset":"RAMP","free":"0.00000000","locked":"0.00000000"},{"asset":"SUPER","free":"0.00000000","locked":"0.00000000"},{"asset":"CFX","free":"0.00000000","locked":"0.00000000"},{"asset":"TKO","free":"0.00000000","locked":"0.00000000"},{"asset":"AUTO","free":"0.00000000","locked":"0.00000000"},{"asset":"EPS","free":"0.00000000","locked":"0.00000000"},{"asset":"PUNDIX","free":"0.00000000","locked":"0.00000000"},{"asset":"TLM","free":"0.00000000","locked":"0.00000000"},{"asset":"1INCHUP","free":"0.00000000","locked":"0.00000000"},{"asset":"1INCHDOWN","free":"0.00000000","locked":"0.00000000"},{"asset":"MIR","free":"0.00000000","locked":"0.00000000"},{"asset":"BAR","free":"0.00000000","locked":"0.00000000"},{"asset":"FORTH","free":"0.00000000","locked":"0.00000000"},{"asset":"EZ","free":"0.00000000","locked":"0.00000000"},{"asset":"AR","free":"0.00000000","locked":"0.00000000"},{"asset":"ICP","free":"0.00000000","locked":"0.00000000"},{"asset":"SHIB","free":"0.00","locked":"0.00"},{"asset":"GYEN","free":"0.00000000","locked":"0.00000000"},{"asset":"POLS","free":"0.00000000","locked":"0.00000000"},{"asset":"MASK","free":"0.00000000","locked":"0.00000000"},{"asset":"LPT","free":"0.00000000","locked":"0.00000000"},{"asset":"AGIX","free":"0.00000000","locked":"0.00000000"},{"asset":"ATA","free":"0.00000000","locked":"0.00000000"},{"asset":"NU","free":"0.00000000","locked":"0.00000000"},{"asset":"GTC","free":"0.00000000","locked":"0.00000000"},{"asset":"KLAY","free":"0.00000000","locked":"0.00000000"},{"asset":"TORN","free":"0.00000000","locked":"0.00000000"},{"asset":"KEEP","free":"0.00000000","locked":"0.00000000"},{"asset":"ERN","free":"0.00000000","locked":"0.00000000"},{"asset":"BOND","free":"0.00000000","locked":"0.00000000"},{"asset":"MLN","free":"0.00000000","locked":"0.00000000"},{"asset":"C98","free":"0.00000000","locked":"0.00000000"},{"asset":"FLOW","free":"0.00000000","locked":"0.00000000"},{"asset":"QUICK","free":"0.00000000","locked":"0.00000000"},{"asset":"RAY","free":"0.00000000","locked":"0.00000000"},{"asset":"MINA","free":"0.01746000","locked":"166.90000000"},{"asset":"QNT","free":"0.00000000","locked":"0.00000000"},{"asset":"CLV","free":"0.00000000","locked":"0.00000000"},{"asset":"XEC","free":"0.00","locked":"0.00"},{"asset":"ALPACA","free":"0.00000000","locked":"0.00000000"},{"asset":"FARM","free":"0.00000000","locked":"0.00000000"},{"asset":"VGX","free":"0.00000000","locked":"0.00000000"},{"asset":"MBOX","free":"0.00000000","locked":"0.00000000"},{"asset":"WAXP","free":"0.00000000","locked":"0.00000000"},{"asset":"TRIBE","free":"0.00000000","locked":"0.00000000"},{"asset":"GNO","free":"0.00000000","locked":"0.00000000"},{"asset":"USDP","free":"0.00000000","locked":"0.00000000"},{"asset":"DYDX","free":"0.00000000","locked":"0.00000000"},{"asset":"GALA","free":"0.00000000","locked":"0.00000000"},{"asset":"ILV","free":"0.00000000","locked":"0.00000000"},{"asset":"YGG","free":"0.00000000","locked":"0.00000000"},{"asset":"FIDA","free":"0.00000000","locked":"0.00000000"},{"asset":"AGLD","free":"0.00000000","locked":"0.00000000"},{"asset":"BETA","free":"0.00000000","locked":"0.00000000"},{"asset":"RAD","free":"0.00000000","locked":"0.00000000"},{"asset":"RARE","free":"0.00000000","locked":"0.00000000"},{"asset":"SSV","free":"0.00000000","locked":"0.00000000"},{"asset":"LAZIO","free":"0.00000000","locked":"0.00000000"},{"asset":"MOVR","free":"0.00000000","locked":"0.00000000"},{"asset":"CHESS","free":"0.00000000","locked":"0.00000000"},{"asset":"DAR","free":"0.00000000","locked":"0.00000000"},{"asset":"BNX","free":"0.00000000","locked":"0.00000000"},{"asset":"RGT","free":"0.00000000","locked":"0.00000000"},{"asset":"CITY","free":"0.00000000","locked":"0.00000000"},{"asset":"ENS","free":"0.00000000","locked":"0.00000000"},{"asset":"PORTO","free":"0.00000000","locked":"0.00000000"},{"asset":"JASMY","free":"0.00000000","locked":"0.00000000"},{"asset":"AMP","free":"0.00000000","locked":"0.00000000"},{"asset":"PLA","free":"0.00000000","locked":"0.00000000"},{"asset":"PYR","free":"0.00000000","locked":"0.00000000"},{"asset":"SANTOS","free":"0.00000000","locked":"0.00000000"},{"asset":"RNDR","free":"0.00000000","locked":"0.00000000"},{"asset":"ALCX","free":"0.00000000","locked":"0.00000000"},{"asset":"MC","free":"0.00000000","locked":"0.00000000"},{"asset":"ANY","free":"0.00000000","locked":"0.00000000"},{"asset":"VOXEL","free":"0.00000000","locked":"0.00000000"},{"asset":"BICO","free":"0.00000000","locked":"0.00000000"},{"asset":"FLUX","free":"0.00000000","locked":"0.00000000"},{"asset":"UST","free":"0.00000000","locked":"0.00000000"},{"asset":"HIGH","free":"0.00000000","locked":"0.00000000"},{"asset":"OOKI","free":"0.00000000","locked":"0.00000000"},{"asset":"CVX","free":"0.00000000","locked":"0.00000000"},{"asset":"PEOPLE","free":"0.00000000","locked":"0.00000000"},{"asset":"SPELL","free":"0.00000000","locked":"0.00000000"},{"asset":"JOE","free":"0.00000000","locked":"0.00000000"}],"permissions":["SPOT","LEVERAGED"]}

niXman commented 2 years ago

very strange because this JSON is valid...

I need to think...

mehmetisl commented 2 years ago

I`m not sure it is related with the issue but. I just removed the "-" from the code , otherwise it wasn't compiled at all: https://github.com/niXman/binapi/blob/master/include/binapi/flatjson.hpp#L309


conv_to(const char *ptr, std::size_t len) {
    if ( *ptr == '-' ) {
        ++ptr;
        return -conv_to<typename std::make_unsigned<To>::type>(ptr, len - 1);
    }

    return conv_to<typename std::make_unsigned<To>::type>(ptr, len);
}
mehmetisl commented 2 years ago

Hi again, I just tried find out where the exception is throwing and this is what i found: image

niXman commented 2 years ago

I`m not sure it is related with the issue but. I just removed the "-" from the code , otherwise it wasn't compiled at all: https://github.com/niXman/binapi/blob/master/include/binapi/flatjson.hpp#L309

conv_to(const char *ptr, std::size_t len) {
    if ( *ptr == '-' ) {
        ++ptr;
        return -conv_to<typename std::make_unsigned<To>::type>(ptr, len - 1);
    }

    return conv_to<typename std::make_unsigned<To>::type>(ptr, len);
}

if you get an exception, then the code compiled successfully.

niXman commented 2 years ago

Hi again, I just tried find out where the exception is throwing and this is what i found: image

please show the backtrace

red-angry-bird commented 2 years ago

Hi there, maybe i can help. I also got that exactly same problem on windows and solved it. Only problem is I can't remember how.. but I don't think this problem comes from the underlying library. One important thing that comes first in my mind is that the windows time server is really thrashy. So you need synchronize it like once a day manually. See my screenshot for further information time_sync

If I remember more details, I'll let you know.

mehmetisl commented 2 years ago

These are the const flatjson::fjson json object values __vfptr = 0x0028f318 {Binance.exe!void(* flatjson::fjson::vftable'[2])()} {0x00241d90 {Binance.exe!flatjson::fjson::scalar deleting destructor'(unsigned int)}} m_storage = shared_ptr { size=2452 } [1 strong ref] [{_Storage={_Value={ size=2452 } } }] m_src_beg = 0x00c17000 "{\"makerCommission\":10,\"takerCommission\":10,\"buyerCommission\":0,\"sellerCommission\":0,\"canTrade\":true,\"canWithdraw\":true,\"canDeposit\":true,\"updateTime\":1641352875207,\"accountType\":\"SPOT\",\"balances\":[{\"a... m_src_end = 0x00c1e09e "" m_beg = 0x00000000 m_end = 0x00000000 m_err = FJ_EC_CHILDS_OVERFLOW (-6)

mehmetisl commented 2 years ago

@red-angry-bird Thank you for the information , i have tried it but the result is same.

niXman commented 2 years ago

These are the const flatjson::fjson json object values __vfptr = 0x0028f318 {Binance.exe!void(* flatjson::fjson::vftable'[2])()} {0x00241d90 {Binance.exe!flatjson::fjson::scalar deleting destructor'(unsigned int)}} m_storage = shared_ptr { size=2452 } [1 strong ref] [{_Storage={_Value={ size=2452 } } }] m_src_beg = 0x00c17000 "{"makerCommission":10,"takerCommission":10,"buyerCommission":0,"sellerCommission":0,"canTrade":true,"canWithdraw":true,"canDeposit":true,"updateTime":1641352875207,"accountType":"SPOT","balances":[{"a... m_src_end = 0x00c1e09e "" m_beg = 0x00000000 m_end = 0x00000000 m_err = FJ_EC_CHILDS_OVERFLOW (-6)

do you use any of my CMakelists files from examples to build your project?

niXman commented 2 years ago

I will rewrite this line (https://github.com/niXman/binapi/blob/master/src/api.cpp#L262) soon so the code can report errors on parsing.

mehmetisl commented 2 years ago

do you use any of my CMakelists files from examples to build your project?

No i'm not using your CMakelists files to build the project. Actually i`m not sure how to use it properly.

niXman commented 2 years ago

so you haven't added those definitions to your project?: https://github.com/niXman/binapi/blob/master/examples/asynchronous/CMakeLists.txt#L10

mehmetisl commented 2 years ago

so you haven't added those definitions to your project?: https://github.com/niXman/binapi/blob/master/examples/asynchronous/CMakeLists.txt#L10

No i haven`t added them. Do you have any instruction documentation or guidance about how to build the project with CMake

niXman commented 2 years ago

just add the following definitions:

__FLATJSON__CHILDS_TYPE=std::uint32_t
__FLATJSON__VLEN_TYPE=std::uint32_t
niXman commented 2 years ago

I will rewrite this line (https://github.com/niXman/binapi/blob/master/src/api.cpp#L262) soon so the code can report errors on parsing.

also I will make changes to the flatjson project so the __FLATJSON__KLEN_TYPE / __ FLATJSON__VLEN_TYPE / __ FLATJSON__CHILDS_TYPE macros have the uint32_t type by default.

mehmetisl commented 2 years ago

just add the following definitions:

It worked! Thank you.

niXman commented 2 years ago

I will rewrite this line (https://github.com/niXman/binapi/blob/master/src/api.cpp#L262) soon so the code can report errors on parsing.

also I will make changes to the flatjson project so the __FLATJSON__KLEN_TYPE / __ FLATJSON__VLEN_TYPE / __ FLATJSON__CHILDS_TYPE macros have the uint32_t type by default.

done: https://github.com/niXman/binapi/commit/6ae48b18ce790931e7324c4ff040b90158517abb

niXman commented 2 years ago

I will rewrite this line (https://github.com/niXman/binapi/blob/master/src/api.cpp#L262) soon so the code can report errors on parsing.

done: https://github.com/niXman/binapi/commit/923bec4d9bc4c344b15d2da3e06b2808bd64f16e

niXman commented 2 years ago

@mehmetisl @red-angry-bird could you test please? :)

red-angry-bird commented 2 years ago

@niXman tested receiving error messages in that specific case and stopped using those definitions in my CMakefile. Works!

niXman commented 2 years ago

@mehmetisl please confirm and close.

mehmetisl commented 2 years ago

Tested. Works!