Skip to content

Commit e85e3e3

Browse files
committed
more new endpoints
1 parent ca95a29 commit e85e3e3

File tree

2 files changed

+175
-3
lines changed

2 files changed

+175
-3
lines changed

include/Exchange_Client.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ class Client
217217
Json::Value get_all_subaccounts(const Params* params_ptr = nullptr);
218218

219219
Json::Value transfer_master_history(const Params* params_ptr);
220+
Json::Value transfer_spot_subaccount_history(const Params* params_ptr = nullptr);
220221
Json::Value transfer_master_to_subaccount(const Params* params_ptr);
221222

222223
Json::Value futures_transfer_master_history(const Params* params_ptr);
@@ -243,6 +244,13 @@ class Client
243244
Json::Value transfer_subaccount_to_master(const Params* params_ptr);
244245
Json::Value transfer_subaccount_history(const Params* params_ptr);
245246

247+
Json::Value make_universal_transfer(const Params* params_ptr);
248+
Json::Value get_universal_transfer_history(const Params* params_ptr = nullptr);
249+
250+
Json::Value get_details_subaccount_futures(const Params* params_ptr);
251+
Json::Value get_summary_subaccount_futures(const Params* params_ptr);
252+
Json::Value get_positionrisk_subaccount_futures(const Params* params_ptr);
253+
246254
};
247255

248256
struct MarginAccount
@@ -280,6 +288,8 @@ class Client
280288
Json::Value margin_isolated_margin_account_info(const Params* params_ptr = nullptr);
281289
Json::Value margin_isolated_margin_symbol(const Params* params_ptr);
282290
Json::Value margin_isolated_margin_symbol_all(const Params* params_ptr = nullptr);
291+
Json::Value toggle_bnb_burn(const Params* params_ptr = nullptr);
292+
Json::Value get_bnb_burn_status(const Params* params_ptr = nullptr);
283293

284294
template <typename FT>
285295
unsigned int margin_stream_userStream(std::string& buffer, FT& functor, const bool ping_listen_key = 0, const bool& isolated_margin_type = 0);

src/Binance_Client.cpp

Lines changed: 165 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,29 @@ Json::Value Client<T>::SubAccount::transfer_master_history(const Params* params_
17781778
}
17791779
};
17801780

1781+
/**
1782+
Query Sub-account Spot Asset Transfer History (SAPI For Master Account)
1783+
@param params_ptr - a pointer to the request Params object
1784+
@return the json returned by the request
1785+
*/
1786+
template <typename T>
1787+
Json::Value Client<T>::SubAccount::transfer_spot_subaccount_history(const Params* params_ptr)
1788+
{
1789+
try
1790+
{
1791+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/sub-account/sub/transfer/history";
1792+
std::string query = user_client->_generate_query(params_ptr, 1);
1793+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
1794+
1795+
return response;
1796+
}
1797+
catch (ClientException e)
1798+
{
1799+
e.append_to_traceback(std::string(__FUNCTION__));
1800+
throw(e);
1801+
}
1802+
};
1803+
17811804
/**
17821805
Sub-account Spot Asset Transfer(For Master Account)
17831806
@param params_ptr - a pointer to the request Params object
@@ -2216,16 +2239,108 @@ Json::Value Client<T>::SubAccount::transfer_subaccount_to_master(const Params* p
22162239
};
22172240

22182241
/**
2219-
Sub-account Transfer History (For Sub-account)
2242+
Universal Transfer (For Master Account)
22202243
@param params_ptr - a pointer to the request Params object
22212244
@return the json returned by the request
22222245
*/
22232246
template <typename T>
2224-
Json::Value Client<T>::SubAccount::transfer_subaccount_history(const Params* params_ptr)
2247+
Json::Value Client<T>::SubAccount::make_universal_transfer(const Params* params_ptr)
22252248
{
22262249
try
22272250
{
2228-
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/sub-account/transfer/subUserHistory";
2251+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/sub-account/universalTransfer";
2252+
std::string query = user_client->_generate_query(params_ptr, 1);
2253+
Json::Value response = (user_client->_rest_client)->_postreq(full_path + query);
2254+
2255+
return response;
2256+
}
2257+
catch (ClientException e)
2258+
{
2259+
e.append_to_traceback(std::string(__FUNCTION__));
2260+
throw(e);
2261+
}
2262+
};
2263+
2264+
/**
2265+
Query Universal Transfer History
2266+
@param params_ptr - a pointer to the request Params object
2267+
@return the json returned by the request
2268+
*/
2269+
template <typename T>
2270+
Json::Value Client<T>::SubAccount::get_universal_transfer_history(const Params* params_ptr)
2271+
{
2272+
try
2273+
{
2274+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/sub-account/universalTransfer";
2275+
std::string query = user_client->_generate_query(params_ptr, 1);
2276+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
2277+
2278+
return response;
2279+
}
2280+
catch (ClientException e)
2281+
{
2282+
e.append_to_traceback(std::string(__FUNCTION__));
2283+
throw(e);
2284+
}
2285+
};
2286+
2287+
/**
2288+
Get Detail on Sub-account's Futures Account V2 (For Master Account)
2289+
@param params_ptr - a pointer to the request Params object
2290+
@return the json returned by the request
2291+
*/
2292+
template <typename T>
2293+
Json::Value Client<T>::SubAccount::get_details_subaccount_futures(const Params* params_ptr)
2294+
{
2295+
try
2296+
{
2297+
std::string full_path = _BASE_REST_SPOT + "/sapi/v2/sub-account/futures/account";
2298+
std::string query = user_client->_generate_query(params_ptr, 1);
2299+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
2300+
2301+
return response;
2302+
}
2303+
catch (ClientException e)
2304+
{
2305+
e.append_to_traceback(std::string(__FUNCTION__));
2306+
throw(e);
2307+
}
2308+
};
2309+
2310+
/**
2311+
Get Summary of Sub-account's Futures Account V2 (For Master Account)
2312+
@param params_ptr - a pointer to the request Params object
2313+
@return the json returned by the request
2314+
*/
2315+
template <typename T>
2316+
Json::Value Client<T>::SubAccount::get_summary_subaccount_futures(const Params* params_ptr)
2317+
{
2318+
try
2319+
{
2320+
std::string full_path = _BASE_REST_SPOT + "/sapi/v2/sub-account/futures/accountSummary";
2321+
std::string query = user_client->_generate_query(params_ptr, 1);
2322+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
2323+
2324+
return response;
2325+
}
2326+
catch (ClientException e)
2327+
{
2328+
e.append_to_traceback(std::string(__FUNCTION__));
2329+
throw(e);
2330+
}
2331+
};
2332+
2333+
/**
2334+
Get Futures Position-Risk of Sub-account V2 (For Master Account)
2335+
@param params_ptr - a pointer to the request Params object
2336+
@return the json returned by the request
2337+
*/
2338+
template <typename T>
2339+
Json::Value Client<T>::SubAccount::get_positionrisk_subaccount_futures(const Params* params_ptr)
2340+
{
2341+
try
2342+
{
2343+
std::string full_path = _BASE_REST_SPOT + "/sapi/v2/sub-account/futures/positionRisk";
22292344
std::string query = user_client->_generate_query(params_ptr, 1);
22302345
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
22312346

@@ -2980,6 +3095,53 @@ Json::Value Client<T>::MarginAccount::margin_isolated_margin_symbol_all(const Pa
29803095
}
29813096
};
29823097

3098+
/**
3099+
Toggle BNB Burn On Spot Trade And Margin Interest
3100+
3101+
@param params_ptr - a pointer to the request Params object
3102+
@return the json returned by the request
3103+
*/
3104+
template <typename T>
3105+
Json::Value Client<T>::MarginAccount::toggle_bnb_burn(const Params* params_ptr)
3106+
{
3107+
try
3108+
{
3109+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/bnbBurn";
3110+
std::string query = user_client->_generate_query(params_ptr, 1);
3111+
Json::Value response = (user_client->_rest_client)->_postreq(full_path + query);
3112+
3113+
return response;
3114+
}
3115+
catch (ClientException e)
3116+
{
3117+
e.append_to_traceback(std::string(__FUNCTION__));
3118+
throw(e);
3119+
}
3120+
};
3121+
3122+
/**
3123+
Get BNB Burn Status
3124+
3125+
@param params_ptr - a pointer to the request Params object
3126+
@return the json returned by the request
3127+
*/
3128+
template <typename T>
3129+
Json::Value Client<T>::MarginAccount::get_bnb_burn_status(const Params* params_ptr)
3130+
{
3131+
try
3132+
{
3133+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/bnbBurn";
3134+
std::string query = user_client->_generate_query(params_ptr, 1);
3135+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
3136+
3137+
return response;
3138+
}
3139+
catch (ClientException e)
3140+
{
3141+
e.append_to_traceback(std::string(__FUNCTION__));
3142+
throw(e);
3143+
}
3144+
};
29833145
/**
29843146
Create a ListenKey - Margin
29853147
@return the ListenKey as std::string

0 commit comments

Comments
 (0)