flashnuke / BinanceExtensionCPP

An extension for the API of Binance (https://www.binance.com/)
GNU General Public License v3.0
14 stars 4 forks source link

getting price #54

Closed repane4229 closed 3 years ago

repane4229 commented 3 years ago

How would one get the currnet price of a symbol in a loop to compare it? im not sure how to read the json from get_ticker

flashnuke commented 3 years ago

hey @repane4229 I wrote this example to illustrate how to use get_ticker() https://github.com/adanikel/BinanceExtensionCPP/blob/master/examples/fetch_ticker_rest.cpp

Please make sure you have the JsonCPP dependency installed beforehand

repane4229 commented 3 years ago

thanks so much Would i need to check for null? and add try/catch? if it was in a loop

flashnuke commented 3 years ago

Well, all REST methods throw BadRequestREST (custom library exception) if anything does not go well

You can start from catching that exception and use its method what() to see the traceback

flashnuke commented 3 years ago

thanks so much Would i need to check for null? and add try/catch? if it was in a loop

Can I close this? :)