Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* Supported exchanges:
* Market Data: ascendex, binance, binanceds-futures, binance-coin-futures, binance, bitfinex, bitget, bitget-futures, bitmart, bitmex, bitstamp, bybit, okx, cryptocom, deribit, erisx (Cboe Digital), gateio, gateio-perpetual-futures, gemini, huobi, huobi-usdt-swap, huobi-coin-swap, kraken, kraken-futures, kucoin, kucoin-futures, mexc, mexc-futures, okx, whitebit.
* Execution Management: ascendex, binance, binanceds-futures, binance-coin-futures, binance, bitfinex, bitget, bitget-futures, bitmart, bitmex, bitstamp, bybit, okx, cryptocom, deribit, erisx (Cboe Digital), gateio, gateio-perpetual-futures, gemini, huobi, huobi-usdt-swap, huobi-coin-swap, kraken, kraken-futures, kucoin, kucoin-futures, mexc, okx.
* FIX: okx, gemini.
* FIX: coinbase, gemini.
* Join us on Discord https://discord.gg/b5EKcp9s8T and Medium https://cryptochassis.medium.com.

## Branches
Expand Down
14 changes: 14 additions & 0 deletions example/src/test_order_latency/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ int main(int argc, char** argv) {
const auto& byWebsocket = UtilSystem::getEnvAsBool("BY_WEBSOCKET");
SessionOptions sessionOptions;
SessionConfigs sessionConfigs;

const auto& okx_rest_fast_url = ccapi::UtilSystem::getEnvAsString("OKX_REST_FAST_URL");
const auto& okx_websocket_fast_url = ccapi::UtilSystem::getEnvAsString("OKX_WEBSOCKET_FAST_URL");
auto url_rest_base = sessionConfigs.getUrlRestBase();
if (!okx_rest_fast_url.empty()) {
url_rest_base.at("okx") = okx_rest_fast_url;
}
sessionConfigs.setUrlRestBase(url_rest_base);
std::map<std::string, std::string> url_websocket_base = sessionConfigs.getUrlWebsocketBase();
if (!okx_websocket_fast_url.empty()) {
url_websocket_base.at("okx") = okx_websocket_fast_url;
}
sessionConfigs.setUrlWebsocketBase(url_websocket_base);

std::string websocketOrderEntrySubscriptionCorrelationId("any");
MyEventHandler eventHandler(symbol, side, quantity, price, clientOrderIdLength, cancelByClientOrderId, numOrders, byWebsocket,
websocketOrderEntrySubscriptionCorrelationId);
Expand Down
2 changes: 1 addition & 1 deletion include/ccapi_cpp/ccapi_hmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <stdint.h>
#include <sstream>

#include <iomanip>
#include <sstream>

namespace ccapi {
class Hmac {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,26 @@ class ExecutionManagementServiceBybit : public ExecutionManagementService {
if (document.HasMember("op")) {
std::string op = document["op"].GetString();
if (op == "auth") {
message.setCorrelationIdList({subscription.getCorrelationId()});
std::string retCode = document["retCode"].GetString();
if (retCode == "0") {
event.setType(Event::Type::AUTHORIZATION_STATUS);
Message message;
message.setType(Message::Type::AUTHORIZATION_SUCCESS);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_INFO_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
} else {
event.setType(Event::Type::AUTHORIZATION_STATUS);
message.setType(Message::Type::AUTHORIZATION_FAILURE);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_ERROR_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
}
} else if (op == "order.create" || op == "order.cancel") {
unsigned long wsRequestId = std::stoul(document["reqId"].GetString());
Expand Down Expand Up @@ -520,9 +531,10 @@ class ExecutionManagementServiceBybit : public ExecutionManagementService {
bool success = document["success"].GetBool();
if (success) {
event.setType(Event::Type::AUTHORIZATION_STATUS);
Message message;
message.setType(Message::Type::AUTHORIZATION_SUCCESS);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_INFO_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
Expand Down Expand Up @@ -555,6 +567,15 @@ class ExecutionManagementServiceBybit : public ExecutionManagementService {
if (ec) {
this->onError(Event::Type::SUBSCRIPTION_STATUS, Message::Type::SUBSCRIPTION_FAILURE, ec, "subscribe");
}
} else {
event.setType(Event::Type::AUTHORIZATION_STATUS);
message.setType(Message::Type::AUTHORIZATION_FAILURE);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_ERROR_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
}
} else if (op == "subscribe") {
bool success = document["success"].GetBool();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,17 @@ class ExecutionManagementServiceCryptocom : public ExecutionManagementService {
event.setType(Event::Type::AUTHORIZATION_STATUS);
message.setType(Message::Type::AUTHORIZATION_FAILURE);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_ERROR_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
} else {
event.setType(Event::Type::AUTHORIZATION_STATUS);
message.setType(Message::Type::AUTHORIZATION_SUCCESS);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_INFO_MESSAGE, textMessage);
message.setElementList({element});
messageList.emplace_back(std::move(message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ class ExecutionManagementServiceOkx : public ExecutionManagementService {
Message message;
message.setType(Message::Type::AUTHORIZATION_SUCCESS);
Element element;
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
element.insert(CCAPI_INFO_MESSAGE, textMessage);
message.setElementList({element});
std::vector<Message> messageList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class MarketDataServiceBinanceBase : public MarketDataService {

void onOpen(std::shared_ptr<WsConnection> wsConnectionPtr) override {
CCAPI_LOGGER_FUNCTION_ENTER;
auto now = UtilTime::now();
Service::onOpen(wsConnectionPtr);
this->startSubscribe(wsConnectionPtr);
}
Expand Down
3 changes: 1 addition & 2 deletions include/ccapi_cpp/service/ccapi_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,7 @@ class Service : public std::enable_shared_from_this<Service> {
message.setType(Message::Type::SESSION_CONNECTION_DOWN);
message.setCorrelationIdList(wsConnectionPtr->correlationIdList);
Element element;
auto& connectionId = wsConnectionPtr->id;
element.insert(CCAPI_CONNECTION_ID, connectionId);
element.insert(CCAPI_CONNECTION_ID, wsConnectionPtr->id);
element.insert(CCAPI_CONNECTION_URL, wsConnectionPtr->url);
message.setElementList({element});
event.setMessageList({message});
Expand Down
45 changes: 10 additions & 35 deletions test/test_build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,43 @@ set(SERVICE_LIST "MARKET_DATA" "EXECUTION_MANAGEMENT" "FIX")

set(MARKET_DATA_EXCHANGE_LIST
"COINBASE"
# "GEMINI"
# "KRAKEN"
# "KRAKEN_FUTURES"
# "BITSTAMP"
# "BITFINEX"
# "BITMEX"
# "GEMINI" "KRAKEN" "KRAKEN_FUTURES" "BITSTAMP" "BITFINEX" "BITMEX"
# "BINANCE_US"
"BINANCE"
"BINANCE_USDS_FUTURES"
"BINANCE_COIN_FUTURES"
# "HUOBI"
# "HUOBI_USDT_SWAP"
# "HUOBI_COIN_SWAP"
# "HUOBI" "HUOBI_USDT_SWAP" "HUOBI_COIN_SWAP"
"OKX"
# "ERISX"
# "KUCOIN"
# "KUCOIN_FUTURES"
# "DERIBIT"
# "ERISX" "KUCOIN" "KUCOIN_FUTURES" "DERIBIT"
"GATEIO"
"GATEIO_PERPETUAL_FUTURES"
"CRYPTOCOM"
# "ASCENDEX"
"BYBIT"
"BITGET"
"BITGET_FUTURES"
# "BITMART"
# "MEXC"
# "MEXC_FUTURES"
# "WHITEBIT"
)
# "BITMART" "MEXC" "MEXC_FUTURES" "WHITEBIT"
)

set(EXECUTION_MANAGEMENT_EXCHANGE_LIST
"COINBASE"
# "GEMINI"
# "KRAKEN"
# "KRAKEN_FUTURES"
# "BITSTAMP"
# "BITFINEX"
# "BITMEX"
# "GEMINI" "KRAKEN" "KRAKEN_FUTURES" "BITSTAMP" "BITFINEX" "BITMEX"
# "BINANCE_US"
"BINANCE"
"BINANCE_USDS_FUTURES"
"BINANCE_COIN_FUTURES"
# "HUOBI"
# "HUOBI_USDT_SWAP"
# "HUOBI_COIN_SWAP"
# "HUOBI" "HUOBI_USDT_SWAP" "HUOBI_COIN_SWAP"
"OKX"
# "ERISX"
# "KUCOIN"
# "KUCOIN_FUTURES"
# "DERIBIT"
# "ERISX" "KUCOIN" "KUCOIN_FUTURES" "DERIBIT"
"GATEIO"
"GATEIO_PERPETUAL_FUTURES"
"CRYPTOCOM"
# "ASCENDEX"
"BYBIT"
"BITGET"
"BITGET_FUTURES"
# "BITMART"
# "MEXC"
# "WHITEBIT"
)
# "BITMART" "MEXC" "WHITEBIT"
)

set(FIX_EXCHANGE_LIST "COINBASE" "GEMINI")

Expand Down
Loading