Skip to content

Commit c46f959

Browse files
committed
testnet ops
1 parent 216bfb6 commit c46f959

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

include/Exchange_Client.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,11 +938,15 @@ class OpsClient : public Client<OpsClient>
938938

939939

940940
// crtp infrastructure end
941-
942-
941+
942+
;
943943

944944
public:
945945
friend Client;
946+
bool _testnet_mode;
947+
948+
void set_testnet_mode(const bool status);
949+
bool get_testnet_mode();
946950

947951
OpsClient();
948952
OpsClient(const std::string key, const std::string secret);

src/Binance_Client.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7384,6 +7384,26 @@ void OpsClient::v_init_ws_session()
73847384
this->_ws_client->set_gzip_conversion(1);
73857385
}
73867386

7387+
/**
7388+
Enables / disables testnet mode
7389+
@param status - a boolean for enabling / disabling
7390+
*/
7391+
void OpsClient::set_testnet_mode(const bool status)
7392+
{
7393+
if (status) this->_ws_client->set_host_port(_WS_BASE_FUTURES_USDT_TESTNET, _WS_PORT_FUTURES);
7394+
else this->_ws_client->set_host_port(_WS_BASE_FUTURES_USDT, _WS_PORT_FUTURES);
7395+
this->_testnet_mode = status;
7396+
}
7397+
7398+
/**
7399+
Get current testnet mode status
7400+
@return 1 if enabled, 0 if disabled
7401+
*/
7402+
bool OpsClient::get_testnet_mode()
7403+
{
7404+
return this->_testnet_mode;
7405+
}
7406+
73877407
/**
73887408
Create a ListenKey
73897409
@return an std::string representing the ListenKey

0 commit comments

Comments
 (0)