Skip to content

Commit 62d9d8c

Browse files
committed
wallet endpoint
1 parent eb2d0f8 commit 62d9d8c

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

include/Exchange_Client.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Client
103103
unsigned int stream_aggTrade(const std::string& symbol, std::string& buffer, FT& functor);
104104

105105
template <typename FT>
106-
unsigned int stream_Trade(const std::string& symbol, std::string& buffer, FT& functor); // todo: only for spot
106+
unsigned int stream_Trade(const std::string& symbol, std::string& buffer, FT& functor);
107107

108108
template <typename FT>
109109
unsigned int stream_kline(const std::string& symbol, std::string& buffer, FT& functor, std::string interval = "1h");
@@ -127,7 +127,7 @@ class Client
127127
unsigned int stream_ticker_all_book(std::string& buffer, FT& functor);
128128

129129
template <typename FT>
130-
unsigned int stream_depth_partial(const std::string& symbol, std::string& buffer, FT& functor, const unsigned int levels = 5, const unsigned int interval = 100); // todo: different intervals for different fronts
130+
unsigned int stream_depth_partial(const std::string& symbol, std::string& buffer, FT& functor, const unsigned int levels = 5, const unsigned int interval = 100);
131131

132132
template <typename FT>
133133
unsigned int stream_depth_diff(const std::string& symbol, std::string& buffer, FT& functor, const unsigned int interval = 100);
@@ -154,7 +154,6 @@ class Client
154154

155155
// Global requests (wallet, account etc)
156156

157-
bool exchange_status();
158157

159158
struct Wallet
160159
{
@@ -163,6 +162,7 @@ class Client
163162
explicit Wallet(const Client<T>& client);
164163
~Wallet();
165164

165+
bool exchange_status();
166166
Json::Value get_all_coins(const Params* params_ptr = nullptr);
167167
Json::Value daily_snapshot(const Params* params_ptr);
168168
Json::Value fast_withdraw_switch(const bool& state);
@@ -331,8 +331,8 @@ class Client
331331
template <typename FT>
332332
unsigned int custom_stream(const std::string stream_name, std::string& buffer, FT& functor, const bool ping_listen_key = 0);
333333

334-
RestSession* _rest_client = nullptr; // todo: move init
335-
WebsocketClient<T>* _ws_client = nullptr; // todo: move init, leave decl
334+
RestSession* _rest_client = nullptr;
335+
WebsocketClient<T>* _ws_client = nullptr;
336336

337337
~Client();
338338

@@ -353,7 +353,7 @@ class FuturesClient : public Client<FuturesClient<CT>>
353353

354354
// market data
355355

356-
bool v_ping_client(); // todo: define lower levels
356+
bool v_ping_client();
357357
unsigned long long v_exchange_time();
358358
Json::Value v_exchange_info();
359359
Json::Value v_order_book(const Params* params_ptr);
@@ -414,15 +414,15 @@ class FuturesClient : public Client<FuturesClient<CT>>
414414

415415
// -- unique to USDT endpoint
416416

417-
Json::Value pos_adl_quantile_est(const Params* params_ptr = nullptr); // todo: define, default param
417+
Json::Value pos_adl_quantile_est(const Params* params_ptr = nullptr);
418418

419419
// ------------------- inter-future crtp ONLY
420420

421421
// market Data
422422

423-
Json::Value mark_price(const Params* params_ptr = nullptr); // todo: define, crtp? default param
424-
Json::Value public_liquidation_orders(const Params* params_ptr); // todo: define, crtp?
425-
Json::Value open_interest(const Params* params_ptr); // todo: define, crtp?
423+
Json::Value mark_price(const Params* params_ptr = nullptr);
424+
Json::Value public_liquidation_orders(const Params* params_ptr);
425+
Json::Value open_interest(const Params* params_ptr);
426426

427427

428428
// note that the following four might be only for coin margined market data

src/Binance_Client.cpp

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -606,21 +606,6 @@ std::string Client<T>::_generate_query(const Params* params_ptr, const bool& sig
606606
}
607607
}
608608

609-
template <typename T>
610-
bool Client<T>::exchange_status() // todo: is this abstract?
611-
{
612-
try
613-
{
614-
std::string full_path = _BASE_REST_SPOT + "/wapi/v3/systemStatus.html";
615-
return this->_rest_client->_getreq(full_path)["response"]["status"].asBool();
616-
}
617-
catch (ClientException e)
618-
{
619-
e.append_to_traceback(std::string(__FUNCTION__));
620-
throw(e);
621-
}
622-
}
623-
624609

625610
// ------------------------------ End | Client General methods - Infrastructure
626611

@@ -665,6 +650,22 @@ Client<T>::Wallet::~Wallet()
665650
// ------ Endpoint methods
666651

667652

653+
template <typename T>
654+
bool Client<T>::Wallet::exchange_status()
655+
{
656+
try
657+
{
658+
std::string full_path = _BASE_REST_SPOT + "/wapi/v3/systemStatus.html";
659+
return user_client->_rest_client->_getreq(full_path)["response"]["status"].asBool();
660+
}
661+
catch (ClientException e)
662+
{
663+
e.append_to_traceback(std::string(__FUNCTION__));
664+
throw(e);
665+
}
666+
}
667+
668+
668669
template <typename T>
669670
Json::Value Client<T>::Wallet::get_all_coins(const Params* params_ptr)
670671
{
@@ -4512,14 +4513,6 @@ Json::Value FuturesClientCoin::v_funding_rate_history(const Params* params_ptr)
45124513

45134514
// ------------------------------ End | FuturesClientCoin CRTP methods - Unique Endpoints
45144515

4515-
// ------------------------------ Start | FuturesClientCoin CRTP methods - WS Streams
4516-
4517-
// -- Global (up to Client level)
4518-
// todo: if testnet
4519-
4520-
4521-
// ------------------------------ End | FuturesClientCoin CRTP methods - WS Streams
4522-
45234516

45244517
// =======================================================================================================
45254518

0 commit comments

Comments
 (0)