Skip to content

Commit f6f5670

Browse files
committed
dev: draft for specifying a local ip address when sending a request
1 parent ab4ed13 commit f6f5670

File tree

55 files changed

+216
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+216
-181
lines changed

.clang-format

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
BasedOnStyle: Google
22
ColumnLimit: 160
3+
SeparateDefinitionBlocks: Always
4+
MaxEmptyLinesToKeep: 1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(NAME execution_management_simple_request)
22
project(${NAME})
33
add_compile_definitions(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT)
4-
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE)
4+
add_compile_definitions(CCAPI_ENABLE_LOG_TRACE)
5+
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_USDS_FUTURES)
56
add_executable(${NAME} main.cpp)
67
add_dependencies(${NAME} boost rapidjson)

example/src/execution_management_simple_request/main.cpp

+36-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#include "ccapi_cpp/ccapi_session.h"
22
namespace ccapi {
3-
Logger* Logger::logger = nullptr; // This line is needed.
3+
class MyLogger final : public Logger {
4+
public:
5+
void logMessage(const std::string& severity, const std::string& threadId, const std::string& timeISO, const std::string& fileName,
6+
const std::string& lineNumber, const std::string& message) override {
7+
std::lock_guard<std::mutex> lock(m);
8+
std::cout << threadId << ": [" << timeISO << "] {" << fileName << ":" << lineNumber << "} " << severity << std::string(8, ' ') << message << std::endl;
9+
}
10+
11+
private:
12+
std::mutex m;
13+
};
14+
MyLogger myLogger;
15+
Logger* Logger::logger = &myLogger;
416
class MyEventHandler : public EventHandler {
517
public:
618
bool processEvent(const Event& event, Session* session) override {
@@ -17,14 +29,14 @@ using ::ccapi::SessionOptions;
1729
using ::ccapi::toString;
1830
using ::ccapi::UtilSystem;
1931
int main(int argc, char** argv) {
20-
if (UtilSystem::getEnvAsString("BINANCE_API_KEY").empty()) {
21-
std::cerr << "Please set environment variable BINANCE_API_KEY" << std::endl;
22-
return EXIT_FAILURE;
23-
}
24-
if (UtilSystem::getEnvAsString("BINANCE_API_SECRET").empty()) {
25-
std::cerr << "Please set environment variable BINANCE_API_SECRET" << std::endl;
26-
return EXIT_FAILURE;
27-
}
32+
// if (UtilSystem::getEnvAsString("BINANCE_API_KEY").empty()) {
33+
// std::cerr << "Please set environment variable BINANCE_API_KEY" << std::endl;
34+
// return EXIT_FAILURE;
35+
// }
36+
// if (UtilSystem::getEnvAsString("BINANCE_API_SECRET").empty()) {
37+
// std::cerr << "Please set environment variable BINANCE_API_SECRET" << std::endl;
38+
// return EXIT_FAILURE;
39+
// }
2840
std::vector<std::string> modeList = {
2941
"create_order", "cancel_order", "get_order", "get_open_orders", "cancel_open_orders", "get_account_balances",
3042
};
@@ -45,7 +57,7 @@ int main(int argc, char** argv) {
4557
session.stop();
4658
return EXIT_FAILURE;
4759
}
48-
Request request(Request::Operation::CREATE_ORDER, "binance", argv[2]);
60+
Request request(Request::Operation::CREATE_ORDER, "binance-usds-futures", argv[2]);
4961
request.appendParam({
5062
{"SIDE", strcmp(argv[3], "buy") == 0 ? "BUY" : "SELL"},
5163
{"QUANTITY", argv[4]},
@@ -60,7 +72,7 @@ int main(int argc, char** argv) {
6072
session.stop();
6173
return EXIT_FAILURE;
6274
}
63-
Request request(Request::Operation::CANCEL_ORDER, "binance", argv[2]);
75+
Request request(Request::Operation::CANCEL_ORDER, "binance-usds-futures", argv[2]);
6476
request.appendParam({
6577
{"ORDER_ID", argv[3]},
6678
});
@@ -73,7 +85,7 @@ int main(int argc, char** argv) {
7385
session.stop();
7486
return EXIT_FAILURE;
7587
}
76-
Request request(Request::Operation::GET_ORDER, "binance", argv[2]);
88+
Request request(Request::Operation::GET_ORDER, "binance-usds-futures", argv[2]);
7789
request.appendParam({
7890
{"ORDER_ID", argv[3]},
7991
});
@@ -86,8 +98,16 @@ int main(int argc, char** argv) {
8698
session.stop();
8799
return EXIT_FAILURE;
88100
}
89-
Request request(Request::Operation::GET_OPEN_ORDERS, "binance", argv[2]);
90-
session.sendRequest(request);
101+
{
102+
Request request(Request::Operation::GET_OPEN_ORDERS, "binance-usds-futures", argv[2]);
103+
session.sendRequest(request);
104+
}
105+
// std::this_thread::sleep_for(std::chrono::seconds(1));
106+
{
107+
Request request(Request::Operation::GET_OPEN_ORDERS, "binance-usds-futures", argv[2]);
108+
session.sendRequest(request);
109+
}
110+
91111
} else if (mode == "cancel_open_orders") {
92112
if (argc != 3) {
93113
std::cerr << "Usage: " << argv[0] << " cancel_open_orders <symbol>\n"
@@ -96,10 +116,10 @@ int main(int argc, char** argv) {
96116
session.stop();
97117
return EXIT_FAILURE;
98118
}
99-
Request request(Request::Operation::CANCEL_OPEN_ORDERS, "binance", argv[2]);
119+
Request request(Request::Operation::CANCEL_OPEN_ORDERS, "binance-usds-futures", argv[2]);
100120
session.sendRequest(request);
101121
} else if (mode == "get_account_balances") {
102-
Request request(Request::Operation::GET_ACCOUNT_BALANCES, "binance");
122+
Request request(Request::Operation::GET_ACCOUNT_BALANCES, "binance-usds-futures");
103123
session.sendRequest(request);
104124
}
105125
std::this_thread::sleep_for(std::chrono::seconds(10));
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(NAME execution_management_simple_subscription)
22
project(${NAME})
33
add_compile_definitions(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT)
4-
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_COINBASE)
4+
add_compile_definitions(CCAPI_ENABLE_LOG_TRACE)
5+
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_USDS_FUTURES)
56
add_executable(${NAME} main.cpp)
67
add_dependencies(${NAME} boost rapidjson)

example/src/execution_management_simple_subscription/main.cpp

+43-31
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
#include "ccapi_cpp/ccapi_session.h"
22
namespace ccapi {
3-
Logger* Logger::logger = nullptr; // This line is needed.
3+
class MyLogger final : public Logger {
4+
public:
5+
void logMessage(const std::string& severity, const std::string& threadId, const std::string& timeISO, const std::string& fileName,
6+
const std::string& lineNumber, const std::string& message) override {
7+
std::lock_guard<std::mutex> lock(m);
8+
std::cout << threadId << ": [" << timeISO << "] {" << fileName << ":" << lineNumber << "} " << severity << std::string(8, ' ') << message << std::endl;
9+
}
10+
11+
private:
12+
std::mutex m;
13+
};
14+
MyLogger myLogger;
15+
Logger* Logger::logger = &myLogger;
416
class MyEventHandler : public EventHandler {
517
public:
618
bool processEvent(const Event& event, Session* session) override {
7-
if (event.getType() == Event::Type::SUBSCRIPTION_STATUS) {
8-
std::cout << "Received an event of type SUBSCRIPTION_STATUS:\n" + event.toStringPretty(2, 2) << std::endl;
9-
auto message = event.getMessageList().at(0);
10-
if (message.getType() == Message::Type::SUBSCRIPTION_STARTED) {
11-
Request request(Request::Operation::CREATE_ORDER, "coinbase", "BTC-USD");
12-
request.appendParam({
13-
{"SIDE", "BUY"},
14-
{"LIMIT_PRICE", "20000"},
15-
{"QUANTITY", "0.001"},
16-
{"CLIENT_ORDER_ID", "6d4eb0fb-2229-469f-873e-557dd78ac11e"},
17-
});
18-
session->sendRequest(request);
19-
}
20-
} else if (event.getType() == Event::Type::SUBSCRIPTION_DATA) {
21-
std::cout << "Received an event of type SUBSCRIPTION_DATA:\n" + event.toStringPretty(2, 2) << std::endl;
22-
}
19+
// if (event.getType() == Event::Type::SUBSCRIPTION_STATUS) {
20+
// std::cout << "Received an event of type SUBSCRIPTION_STATUS:\n" + event.toStringPretty(2, 2) << std::endl;
21+
// auto message = event.getMessageList().at(0);
22+
// if (message.getType() == Message::Type::SUBSCRIPTION_STARTED) {
23+
// Request request(Request::Operation::CREATE_ORDER, "coinbase", "BTC-USD");
24+
// request.appendParam({
25+
// {"SIDE", "BUY"},
26+
// {"LIMIT_PRICE", "20000"},
27+
// {"QUANTITY", "0.001"},
28+
// {"CLIENT_ORDER_ID", "6d4eb0fb-2229-469f-873e-557dd78ac11e"},
29+
// });
30+
// session->sendRequest(request);
31+
// }
32+
// } else if (event.getType() == Event::Type::SUBSCRIPTION_DATA) {
33+
// std::cout << "Received an event of type SUBSCRIPTION_DATA:\n" + event.toStringPretty(2, 2) << std::endl;
34+
// }
2335
return true;
2436
}
2537
};
@@ -32,25 +44,25 @@ using ::ccapi::SessionOptions;
3244
using ::ccapi::Subscription;
3345
using ::ccapi::UtilSystem;
3446
int main(int argc, char** argv) {
35-
if (UtilSystem::getEnvAsString("COINBASE_API_KEY").empty()) {
36-
std::cerr << "Please set environment variable COINBASE_API_KEY" << std::endl;
37-
return EXIT_FAILURE;
38-
}
39-
if (UtilSystem::getEnvAsString("COINBASE_API_SECRET").empty()) {
40-
std::cerr << "Please set environment variable COINBASE_API_SECRET" << std::endl;
41-
return EXIT_FAILURE;
42-
}
43-
if (UtilSystem::getEnvAsString("COINBASE_API_PASSPHRASE").empty()) {
44-
std::cerr << "Please set environment variable COINBASE_API_PASSPHRASE" << std::endl;
45-
return EXIT_FAILURE;
46-
}
47+
// if (UtilSystem::getEnvAsString("COINBASE_API_KEY").empty()) {
48+
// std::cerr << "Please set environment variable COINBASE_API_KEY" << std::endl;
49+
// return EXIT_FAILURE;
50+
// }
51+
// if (UtilSystem::getEnvAsString("COINBASE_API_SECRET").empty()) {
52+
// std::cerr << "Please set environment variable COINBASE_API_SECRET" << std::endl;
53+
// return EXIT_FAILURE;
54+
// }
55+
// if (UtilSystem::getEnvAsString("COINBASE_API_PASSPHRASE").empty()) {
56+
// std::cerr << "Please set environment variable COINBASE_API_PASSPHRASE" << std::endl;
57+
// return EXIT_FAILURE;
58+
// }
4759
SessionOptions sessionOptions;
4860
SessionConfigs sessionConfigs;
4961
MyEventHandler eventHandler;
5062
Session session(sessionOptions, sessionConfigs, &eventHandler);
51-
Subscription subscription("coinbase", "BTC-USD", "ORDER_UPDATE");
63+
Subscription subscription("binance-usds-futures", argv[1], argv[2]);
5264
session.subscribe(subscription);
53-
std::this_thread::sleep_for(std::chrono::seconds(10));
65+
std::this_thread::sleep_for(std::chrono::seconds(1000));
5466
session.stop();
5567
std::cout << "Bye" << std::endl;
5668
return EXIT_SUCCESS;

include/ccapi_cpp/ccapi_http_connection.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ class HttpConnection CCAPI_FINAL {
1515
std::string toString() const {
1616
std::ostringstream oss;
1717
oss << streamPtr;
18-
std::string output = "HttpConnection [host = " + host + ", port = " + port + ", streamPtr = " + oss.str() + "]";
18+
std::string output = "HttpConnection [host = " + host + ", port = " + port + ", streamPtr = " + oss.str() +", lastReceiveDataTp = "+UtilTime::getISOTimestamp(lastReceiveDataTp)+ "]";
1919
return output;
2020
}
2121
std::string host;
2222
std::string port;
2323
std::shared_ptr<beast::ssl_stream<beast::tcp_stream> > streamPtr;
24+
TimePoint lastReceiveDataTp{std::chrono::seconds{0}};
2425
};
2526
} /* namespace ccapi */
2627
#endif // INCLUDE_CCAPI_CPP_CCAPI_HTTP_CONNECTION_H_

include/ccapi_cpp/ccapi_macro.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@
603603
#ifndef CCAPI_CREDENTIAL_DISPLAY_LENGTH
604604
#define CCAPI_CREDENTIAL_DISPLAY_LENGTH 4
605605
#endif
606+
#ifndef CCAPI_LOCAL_IP_ADDRESS_DEFAULT
607+
#define CCAPI_LOCAL_IP_ADDRESS_DEFAULT ""
608+
#endif
606609

607610
// start: exchange REST urls
608611
#ifndef CCAPI_COINBASE_URL_REST_BASE
@@ -1004,12 +1007,6 @@
10041007
#ifndef CCAPI_BINANCE_API_SECRET
10051008
#define CCAPI_BINANCE_API_SECRET "BINANCE_API_SECRET"
10061009
#endif
1007-
// #ifndef CCAPI_BINANCE_MARGIN_API_KEY
1008-
// #define CCAPI_BINANCE_MARGIN_API_KEY "BINANCE_MARGIN_API_KEY"
1009-
// #endif
1010-
// #ifndef CCAPI_BINANCE_MARGIN_API_SECRET
1011-
// #define CCAPI_BINANCE_MARGIN_API_SECRET "BINANCE_MARGIN_API_SECRET"
1012-
// #endif
10131010
#ifndef CCAPI_BINANCE_USDS_FUTURES_API_KEY
10141011
#define CCAPI_BINANCE_USDS_FUTURES_API_KEY "BINANCE_USDS_FUTURES_API_KEY"
10151012
#endif

include/ccapi_cpp/ccapi_request.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class Request CCAPI_FINAL {
148148
", correlationId = " + correlationId + ", secondaryCorrelationId = " + secondaryCorrelationId +
149149
(this->serviceName == CCAPI_FIX ? ", paramListFix = " + ccapi::toString(paramListFix) : ", paramList = " + ccapi::toString(paramList)) +
150150
", credential = " + ccapi::toString(shortCredential) + ", operation = " + operationToString(operation) +
151-
", timeSent = " + UtilTime::getISOTimestamp(timeSent) + "]";
151+
", timeSent = " + UtilTime::getISOTimestamp(timeSent)+", index = " + ccapi::toString(index)+", localIpAddress = " + localIpAddress + "]";
152152
return output;
153153
}
154154
const std::string& getCorrelationId() const { return correlationId; }
@@ -181,11 +181,13 @@ class Request CCAPI_FINAL {
181181
std::pair<long long, long long> getTimeSentPair() const { return UtilTime::divide(timeSent); }
182182
void setTimeSent(TimePoint timeSent) { this->timeSent = timeSent; }
183183
int getIndex() const { return index; }
184+
const std::string& getLocalIpAddress() const { return localIpAddress; }
184185
void setIndex(int index) { this->index = index; }
185186
void setCredential(const std::map<std::string, std::string>& credential) { this->credential = credential; }
186187
void setCorrelationId(const std::string& correlationId) { this->correlationId = correlationId; }
187188
void setSecondaryCorrelationId(const std::string& secondaryCorrelationId) { this->secondaryCorrelationId = secondaryCorrelationId; }
188189
void setMarginType(const std::string& marginType) { this->marginType = marginType; }
190+
void bind(const std::string& localIpAddress){this->localIpAddress=localIpAddress;}
189191
#ifndef CCAPI_EXPOSE_INTERNAL
190192

191193
private:
@@ -202,6 +204,7 @@ class Request CCAPI_FINAL {
202204
std::vector<std::vector<std::pair<int, std::string> > > paramListFix;
203205
TimePoint timeSent{std::chrono::seconds{0}};
204206
int index{};
207+
std::string localIpAddress{CCAPI_LOCAL_IP_ADDRESS_DEFAULT};
205208
};
206209
} /* namespace ccapi */
207210
#endif // INCLUDE_CCAPI_CPP_CCAPI_REQUEST_H_

include/ccapi_cpp/ccapi_session.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,18 @@ class Session {
259259
Session(const Session&) = delete;
260260
Session& operator=(const Session&) = delete;
261261
Session(const SessionOptions& sessionOptions = SessionOptions(), const SessionConfigs& sessionConfigs = SessionConfigs(),
262-
EventHandler* eventHandler = nullptr, EventDispatcher* eventDispatcher = nullptr)
262+
EventHandler* eventHandler = nullptr, EventDispatcher* eventDispatcher = nullptr, ServiceContext* serviceContextPtr=nullptr)
263263
: sessionOptions(sessionOptions),
264264
sessionConfigs(sessionConfigs),
265265
eventHandler(eventHandler),
266266
#ifndef CCAPI_USE_SINGLE_THREAD
267267
eventDispatcher(eventDispatcher),
268268
#endif
269269
eventQueue(sessionOptions.maxEventQueueSize),
270-
serviceContextPtr(new ServiceContext()) {
270+
serviceContextPtr(serviceContextPtr) {
271+
if (!this->serviceContextPtr){
272+
this->serviceContextPtr=new ServiceContext();
273+
}
271274
CCAPI_LOGGER_FUNCTION_ENTER;
272275
#ifndef CCAPI_USE_SINGLE_THREAD
273276
if (this->eventHandler) {
@@ -291,6 +294,7 @@ class Session {
291294
delete this->eventDispatcher;
292295
}
293296
#endif
297+
delete this->serviceContextPtr;
294298
CCAPI_LOGGER_FUNCTION_EXIT;
295299
}
296300
virtual void start() {
@@ -968,7 +972,7 @@ class Session {
968972
EventDispatcher* eventDispatcher;
969973
bool useInternalEventDispatcher{};
970974
#endif
971-
std::shared_ptr<ServiceContext> serviceContextPtr;
975+
ServiceContext* serviceContextPtr;
972976
std::map<std::string, std::map<std::string, std::shared_ptr<Service> > > serviceByServiceNameExchangeMap;
973977
std::thread t;
974978
Queue<Event> eventQueue;

include/ccapi_cpp/ccapi_session_options.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SessionOptions CCAPI_FINAL {
2828
", httpMaxNumRedirect = " + ccapi::toString(httpMaxNumRedirect) +
2929
", httpRequestTimeoutMilliseconds = " + ccapi::toString(httpRequestTimeoutMilliseconds) +
3030
", httpConnectionPoolMaxSize = " + ccapi::toString(httpConnectionPoolMaxSize) +
31-
", httpConnectionPoolIdleTimeoutMilliseconds = " + ccapi::toString(httpConnectionPoolIdleTimeoutMilliseconds) +
31+
", httpConnectionKeepAliveTimeoutSeconds = " + ccapi::toString(httpConnectionKeepAliveTimeoutSeconds) +
3232
", enableOneHttpConnectionPerRequest = " + ccapi::toString(enableOneHttpConnectionPerRequest) + "]";
3333
return output;
3434
}
@@ -50,8 +50,7 @@ class SessionOptions CCAPI_FINAL {
5050
int httpMaxNumRedirect{1};
5151
long httpRequestTimeoutMilliseconds{10000};
5252
int httpConnectionPoolMaxSize{1}; // used to set the maximal number of http connections to be kept in the pool (connections in the pool are idle)
53-
long httpConnectionPoolIdleTimeoutMilliseconds{0}; // used to purge the http connection pool if all connections in the
54-
// pool have stayed idle for at least this amount of time
53+
long httpConnectionKeepAliveTimeoutSeconds{10}; // used to remove a http connection from the http connection pool if it has stayed idle for at least this amount of time
5554
bool enableOneHttpConnectionPerRequest{}; // create a new http connection for each request
5655
#ifdef CCAPI_LEGACY_USE_WEBSOCKETPP
5756
#else

include/ccapi_cpp/service/ccapi_market_data_service.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace ccapi {
1717
class MarketDataService : public Service {
1818
public:
1919
MarketDataService(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
20-
std::shared_ptr<ServiceContext> serviceContextPtr)
20+
ServiceContext* serviceContextPtr)
2121
: Service(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
2222
CCAPI_LOGGER_FUNCTION_ENTER;
2323
this->requestOperationToMessageTypeMap = {

include/ccapi_cpp/service/ccapi_market_data_service_ascendex.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ccapi {
77
class MarketDataServiceAscendex : public MarketDataService {
88
public:
99
MarketDataServiceAscendex(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
10-
std::shared_ptr<ServiceContext> serviceContextPtr)
10+
ServiceContext* serviceContextPtr)
1111
: MarketDataService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
1212
this->exchangeName = CCAPI_EXCHANGE_NAME_ASCENDEX;
1313
this->baseUrlWs = sessionConfigs.getUrlWebsocketBase().at(this->exchangeName) + "/api/pro/v1/stream";

include/ccapi_cpp/service/ccapi_market_data_service_binance.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ccapi {
77
class MarketDataServiceBinance : public MarketDataServiceBinanceBase {
88
public:
99
MarketDataServiceBinance(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
10-
std::shared_ptr<ServiceContext> serviceContextPtr)
10+
ServiceContext* serviceContextPtr)
1111
: MarketDataServiceBinanceBase(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
1212
this->exchangeName = CCAPI_EXCHANGE_NAME_BINANCE;
1313
this->baseUrlWs = sessionConfigs.getUrlWebsocketBase().at(this->exchangeName) + "/stream";

include/ccapi_cpp/service/ccapi_market_data_service_binance_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ccapi {
88
class MarketDataServiceBinanceBase : public MarketDataService {
99
public:
1010
MarketDataServiceBinanceBase(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
11-
std::shared_ptr<ServiceContext> serviceContextPtr)
11+
ServiceContext* serviceContextPtr)
1212
: MarketDataService(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
1313
this->enableCheckPingPongWebsocketApplicationLevel = false;
1414
}

include/ccapi_cpp/service/ccapi_market_data_service_binance_coin_futures.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ccapi {
77
class MarketDataServiceBinanceCoinFutures : public MarketDataServiceBinanceDerivativesBase {
88
public:
99
MarketDataServiceBinanceCoinFutures(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
10-
std::shared_ptr<ServiceContext> serviceContextPtr)
10+
ServiceContext* serviceContextPtr)
1111
: MarketDataServiceBinanceDerivativesBase(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
1212
this->exchangeName = CCAPI_EXCHANGE_NAME_BINANCE_COIN_FUTURES;
1313
this->baseUrlWs = sessionConfigs.getUrlWebsocketBase().at(this->exchangeName) + "/stream";

include/ccapi_cpp/service/ccapi_market_data_service_binance_derivatives_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ccapi {
77
class MarketDataServiceBinanceDerivativesBase : public MarketDataServiceBinanceBase {
88
public:
99
MarketDataServiceBinanceDerivativesBase(std::function<void(Event&, Queue<Event>*)> eventHandler, SessionOptions sessionOptions, SessionConfigs sessionConfigs,
10-
std::shared_ptr<ServiceContext> serviceContextPtr)
10+
ServiceContext* serviceContextPtr)
1111
: MarketDataServiceBinanceBase(eventHandler, sessionOptions, sessionConfigs, serviceContextPtr) {
1212
this->isDerivatives = true;
1313
}

0 commit comments

Comments
 (0)