Skip to content

Commit b736121

Browse files
committed
add sapi endpoints
1 parent b7c94df commit b736121

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

include/Exchange_Client.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ class Client
246246
Json::Value get_summary_subaccount_futures(const Params* params_ptr);
247247
Json::Value get_positionrisk_subaccount_futures(const Params* params_ptr);
248248
Json::Value enable_leverage_token_subaccount(const Params* params_ptr);
249+
Json::Value deposit_asset_subaccount(const Params* params_ptr);
250+
Json::Value query_asset_subaccount(const Params* params_ptr);
251+
Json::Value withdraw_asset_subaccount(const Params* params_ptr);
249252

250253
};
251254

src/Binance_Client.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,78 @@ Json::Value Client<T>::SubAccount::enable_leverage_token_subaccount(const Params
22512251
}
22522252
};
22532253

2254+
/**
2255+
Deposit assets into the managed sub-account(For Investor Master Account)
2256+
2257+
@param params_ptr - a pointer to the request Params object
2258+
@return the json returned by the request
2259+
*/
2260+
template <typename T>
2261+
Json::Value Client<T>::SubAccount::deposit_asset_subaccount(const Params* params_ptr)
2262+
{
2263+
try
2264+
{
2265+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/managed-subaccount/deposit";
2266+
std::string query = user_client->_generate_query(params_ptr, 1);
2267+
Json::Value response = (user_client->_rest_client)->_postreq(full_path + query);
2268+
2269+
return response;
2270+
}
2271+
catch (ClientException e)
2272+
{
2273+
e.append_to_traceback(std::string(__FUNCTION__));
2274+
throw(e);
2275+
}
2276+
};
2277+
2278+
/**
2279+
Query managed sub-account asset details(For Investor Master Account)
2280+
2281+
@param params_ptr - a pointer to the request Params object
2282+
@return the json returned by the request
2283+
*/
2284+
template <typename T>
2285+
Json::Value Client<T>::SubAccount::query_asset_subaccount(const Params* params_ptr)
2286+
{
2287+
try
2288+
{
2289+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/managed-subaccount/asset";
2290+
std::string query = user_client->_generate_query(params_ptr, 1);
2291+
Json::Value response = (user_client->_rest_client)->_getreq(full_path + query);
2292+
2293+
return response;
2294+
}
2295+
catch (ClientException e)
2296+
{
2297+
e.append_to_traceback(std::string(__FUNCTION__));
2298+
throw(e);
2299+
}
2300+
};
2301+
2302+
/**
2303+
Withdrawal (assets) from the managed sub-account(For Investor Master Account
2304+
2305+
@param params_ptr - a pointer to the request Params object
2306+
@return the json returned by the request
2307+
*/
2308+
template <typename T>
2309+
Json::Value Client<T>::SubAccount::withdraw_asset_subaccount(const Params* params_ptr)
2310+
{
2311+
try
2312+
{
2313+
std::string full_path = _BASE_REST_SPOT + "/sapi/v1/managed-subaccount/withdraw";
2314+
std::string query = user_client->_generate_query(params_ptr, 1);
2315+
Json::Value response = (user_client->_rest_client)->_postreq(full_path + query);
2316+
2317+
return response;
2318+
}
2319+
catch (ClientException e)
2320+
{
2321+
e.append_to_traceback(std::string(__FUNCTION__));
2322+
throw(e);
2323+
}
2324+
};
2325+
22542326
// ------------------------------ End | Client SubAccount - User SubAccount Endpoints
22552327

22562328
// ***************************************************************************

0 commit comments

Comments
 (0)