binacpp window port : Switched to nlohmann/json for JSON parsing, replaced POSIX functions with Windows equivalents, and implemented CMake for the build system.
dependencies need to be installed separately, you can install them using vcpkg.
libcurl-7.56.0
libwebsockets-2.4.0
#include "binacpp.h"
#include "binacpp_websocket.h"
#include "json.hpp"
using json = nlohmann::json;
string api_key = API_KEY;
string secret_key = SECRET_KEY;
BinaCPP::init( api_key , secret_key );
json result;
BinaCPP::get_serverTime( result ) ;
json result;
BinaCPP::get_allPrices( result );
double bnbeth_price = BinaCPP::get_price( "BNBETH");
json result;
long recvWindow = 10000;
BinaCPP::get_account( recvWindow , result );
json result;
BinaCPP::get_allBookTickers( result );
json result;
BinaCPP::get_bookTicker("bnbeth", result );
json result;
BinaCPP::get_depth( "ETHBTC", 5, result ) ;
long recvWindow = 10000;
json result;
BinaCPP::send_order( "BNBETH", "BUY", "LIMIT", "GTC", 20 , 0.00380000, "",0,0, recvWindow, result );
long recvWindow = 10000;
json result;
BinaCPP::send_order( "BNBETH", "BUY", "MARKET", "GTC", 20 , 0, "",0,0, recvWindow, result );
long recvWindow = 10000;
json result;
BinaCPP::send_order( "BNBETH", "BUY", "MARKET", "GTC", 1 , 0, "",0,20, recvWindow , result );
long recvWindow = 10000;
json result;
BinaCPP::get_order( "BNBETH", 12345678, "", recvWindow, result );
long recvWindow = 10000;
json result;
BinaCPP::cancel_order("BNBETH", 12345678, "","", recvWindow, result);
long recvWindow = 10000;
json result;
BinaCPP::get_openOrders( "BNBETH", recvWindow, result ) ;
long recvWindow = 10000;
json result;
BinaCPP::get_allOrders( "BNBETH", 0,0, recvWindow, result )
long recvWindow = 10000;
json result;
BinaCPP::get_myTrades( "BNBETH", 0,0, recvWindow , result );
json result;
BinaCPP::get_24hr( "ETHBTC", result ) ;
json result;
BinaCPP::get_klines( "ETHBTC", "1h", 10 , 0, 0, result );
BinaCPP::start_userDataStream(result );
string ws_path = string("/ws/");
ws_path.append( result["listenKey"].get<std::string>() );
BinaCPP_websocket::init();
BinaCPP_websocket::connect_endpoint( ws_aggTrade_OnData ,"/ws/bnbbtc@aggTrade" );
BinaCPP_websocket::connect_endpoint( ws_userStream_OnData , ws_path.c_str() );
BinaCPP_websocket::connect_endpoint( ws_klines_onData ,"/ws/bnbbtc@kline_1m" );
BinaCPP_websocket::connect_endpoint( ws_depth_onData ,"/ws/bnbbtc@depth" );
BinaCPP_websocket::enter_event_loop();