Update ccapi to 7.9.3 (compatible w/ new boost)
This commit is contained in:
1 parent
bd7ccb5f44
commit
9fa7a9898e
117 files changed
+9016
-11255
No files matched your search
@@ -5,14 +5,16 @@
|
||||
|
||||
#include "ccapi_cpp/ccapi_element.h"
|
||||
#include "ccapi_cpp/ccapi_logger.h"
|
||||
|
||||
namespace ccapi {
|
||||
|
||||
/**
|
||||
* A handle to a single message. Message objects are obtained from the getMessageList() function of the Event object. Each Message is associated with one or
|
||||
* more correlation id values. The Message contents are represented as Elements and can be accessed via the getElementList() function. Each Message object
|
||||
* consists of an Type attribute and a RecapType attribute. The exchange timestamp (if any) associated with the Messsage object can be retrieved via the
|
||||
* getTime() function. The library timestamp can be retrieved via the getTimeReceived() function.
|
||||
*/
|
||||
class Message CCAPI_FINAL {
|
||||
class Message {
|
||||
public:
|
||||
enum class RecapType {
|
||||
UNKNOWN,
|
||||
@@ -21,6 +23,7 @@ class Message CCAPI_FINAL {
|
||||
NONE, // Normal data tick, not a recap. For market depth, it represents the updated order book state. For public trade, it represents the new trades. These
|
||||
// are the batches of data points after the first batch.
|
||||
};
|
||||
|
||||
static std::string recapTypeToString(RecapType recapType) {
|
||||
std::string output;
|
||||
switch (recapType) {
|
||||
@@ -48,10 +51,12 @@ class Message CCAPI_FINAL {
|
||||
MARKET_DATA_EVENTS_CANDLESTICK,
|
||||
EXECUTION_MANAGEMENT_EVENTS_ORDER_UPDATE,
|
||||
EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE,
|
||||
EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE_LITE,
|
||||
EXECUTION_MANAGEMENT_EVENTS_BALANCE_UPDATE,
|
||||
EXECUTION_MANAGEMENT_EVENTS_POSITION_UPDATE,
|
||||
SUBSCRIPTION_STARTED,
|
||||
SUBSCRIPTION_FAILURE,
|
||||
SUBSCRIPTION_FAILURE_DUE_TO_CONNECTION_FAILURE,
|
||||
SESSION_CONNECTION_UP,
|
||||
SESSION_CONNECTION_DOWN,
|
||||
INCORRECT_STATE_FOUND,
|
||||
@@ -70,18 +75,23 @@ class Message CCAPI_FINAL {
|
||||
GET_RECENT_CANDLESTICKS,
|
||||
GET_HISTORICAL_CANDLESTICKS,
|
||||
GET_MARKET_DEPTH,
|
||||
GET_SERVER_TIME,
|
||||
GET_INSTRUMENT,
|
||||
GET_INSTRUMENTS,
|
||||
GET_BBOS,
|
||||
GET_TICKERS,
|
||||
RESPONSE_ERROR,
|
||||
REQUEST_FAILURE,
|
||||
GENERIC_ERROR,
|
||||
CUSTOM,
|
||||
FIX,
|
||||
FIX_FAILURE,
|
||||
FIX_FAILURE_DUE_TO_CONNECTION_FAILURE,
|
||||
GENERIC_PUBLIC_REQUEST,
|
||||
GENERIC_PUBLIC_SUBSCRIPTION,
|
||||
GENERIC_PRIVATE_REQUEST,
|
||||
};
|
||||
|
||||
static std::string typeToString(Type type) {
|
||||
std::string output;
|
||||
switch (type) {
|
||||
@@ -112,6 +122,9 @@ class Message CCAPI_FINAL {
|
||||
case Type::EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE:
|
||||
output = "EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE";
|
||||
break;
|
||||
case Type::EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE_LITE:
|
||||
output = "EXECUTION_MANAGEMENT_EVENTS_PRIVATE_TRADE_LITE";
|
||||
break;
|
||||
case Type::EXECUTION_MANAGEMENT_EVENTS_BALANCE_UPDATE:
|
||||
output = "EXECUTION_MANAGEMENT_EVENTS_BALANCE_UPDATE";
|
||||
break;
|
||||
@@ -124,6 +137,9 @@ class Message CCAPI_FINAL {
|
||||
case Type::SUBSCRIPTION_FAILURE:
|
||||
output = "SUBSCRIPTION_FAILURE";
|
||||
break;
|
||||
case Type::SUBSCRIPTION_FAILURE_DUE_TO_CONNECTION_FAILURE:
|
||||
output = "SUBSCRIPTION_FAILURE_DUE_TO_CONNECTION_FAILURE";
|
||||
break;
|
||||
case Type::SESSION_CONNECTION_UP:
|
||||
output = "SESSION_CONNECTION_UP";
|
||||
break;
|
||||
@@ -178,12 +194,21 @@ class Message CCAPI_FINAL {
|
||||
case Type::GET_MARKET_DEPTH:
|
||||
output = "GET_MARKET_DEPTH";
|
||||
break;
|
||||
case Type::GET_SERVER_TIME:
|
||||
output = "GET_SERVER_TIME";
|
||||
break;
|
||||
case Type::GET_INSTRUMENT:
|
||||
output = "GET_INSTRUMENT";
|
||||
break;
|
||||
case Type::GET_INSTRUMENTS:
|
||||
output = "GET_INSTRUMENTS";
|
||||
break;
|
||||
case Type::GET_BBOS:
|
||||
output = "GET_BBOS";
|
||||
break;
|
||||
case Type::GET_TICKERS:
|
||||
output = "GET_TICKERS";
|
||||
break;
|
||||
case Type::RESPONSE_ERROR:
|
||||
output = "RESPONSE_ERROR";
|
||||
break;
|
||||
@@ -202,6 +227,9 @@ class Message CCAPI_FINAL {
|
||||
case Type::FIX_FAILURE:
|
||||
output = "FIX_FAILURE";
|
||||
break;
|
||||
case Type::FIX_FAILURE_DUE_TO_CONNECTION_FAILURE:
|
||||
output = "FIX_FAILURE_DUE_TO_CONNECTION_FAILURE";
|
||||
break;
|
||||
case Type::GENERIC_PUBLIC_REQUEST:
|
||||
output = "GENERIC_PUBLIC_REQUEST";
|
||||
break;
|
||||
@@ -216,48 +244,63 @@ class Message CCAPI_FINAL {
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::string toString() const {
|
||||
std::string output = "Message [type = " + typeToString(type) + ", recapType = " + recapTypeToString(recapType) +
|
||||
", time = " + UtilTime::getISOTimestamp(time) + ", timeReceived = " + UtilTime::getISOTimestamp(timeReceived) +
|
||||
", elementList = " + ccapi::firstNToString(elementList, 10) + ", correlationIdList = " + ccapi::toString(correlationIdList) +
|
||||
", secondaryCorrelationIdMap = " + ccapi::toString(secondaryCorrelationIdMap) + "]";
|
||||
", elementList = " + ccapi::firstNToString(elementList, 10) + ", correlationIdList = " + ccapi::toString(correlationIdList) + "]";
|
||||
return output;
|
||||
}
|
||||
std::string toStringPretty(const int space = 2, const int leftToIndent = 0, const bool indentFirstLine = true) const {
|
||||
|
||||
std::string toPrettyString(const int space = 2, const int leftToIndent = 0, const bool indentFirstLine = true) const {
|
||||
std::string sl(leftToIndent, ' ');
|
||||
std::string ss(leftToIndent + space, ' ');
|
||||
std::string output = (indentFirstLine ? sl : "") + "Message [\n" + ss + "type = " + typeToString(type) + ",\n" + ss +
|
||||
"recapType = " + recapTypeToString(recapType) + ",\n" + ss + "time = " + UtilTime::getISOTimestamp(time) + ",\n" + ss +
|
||||
"timeReceived = " + UtilTime::getISOTimestamp(timeReceived) + ",\n" + ss +
|
||||
"elementList = " + ccapi::firstNToStringPretty(elementList, 10, space, space + leftToIndent, false) + ",\n" + ss +
|
||||
"correlationIdList = " + ccapi::toString(correlationIdList) + ",\n" + ss +
|
||||
"secondaryCorrelationIdMap = " + ccapi::toString(secondaryCorrelationIdMap) + "\n" + sl + "]";
|
||||
"correlationIdList = " + ccapi::toString(correlationIdList) + ",\n" + sl + "]";
|
||||
return output;
|
||||
}
|
||||
|
||||
const std::vector<Element>& getElementList() const { return elementList; }
|
||||
|
||||
void setElementList(const std::vector<Element>& elementList) { this->elementList = elementList; }
|
||||
|
||||
void setElementList(std::vector<Element>& elementList) { this->elementList = std::move(elementList); }
|
||||
|
||||
const std::vector<std::string>& getCorrelationIdList() const { return correlationIdList; }
|
||||
const std::map<std::string, std::string>& getSecondaryCorrelationIdMap() const { return secondaryCorrelationIdMap; }
|
||||
|
||||
void setCorrelationIdList(const std::vector<std::string>& correlationIdList) { this->correlationIdList = correlationIdList; }
|
||||
void setSecondaryCorrelationIdMap(const std::map<std::string, std::string>& secondaryCorrelationIdMap) {
|
||||
this->secondaryCorrelationIdMap = secondaryCorrelationIdMap;
|
||||
}
|
||||
|
||||
// 'getTime' only works in C++. For other languages, please use 'getTimeISO'.
|
||||
TimePoint getTime() const { return time; }
|
||||
|
||||
std::string getTimeISO() const { return UtilTime::getISOTimestamp(time); }
|
||||
|
||||
std::pair<long long, long long> getTimeUnix() const { return UtilTime::divide(time); }
|
||||
|
||||
std::pair<long long, long long> getTimePair() const { return UtilTime::divide(time); }
|
||||
|
||||
void setTime(TimePoint time) { this->time = time; }
|
||||
|
||||
RecapType getRecapType() const { return recapType; }
|
||||
|
||||
void setRecapType(RecapType recapType) { this->recapType = recapType; }
|
||||
|
||||
Type getType() const { return type; }
|
||||
|
||||
void setType(Type type) { this->type = type; }
|
||||
|
||||
// 'getTimeReceived' only works in C++. For other languages, please use 'getTimeReceivedISO'.
|
||||
TimePoint getTimeReceived() const { return timeReceived; }
|
||||
|
||||
std::string getTimeReceivedISO() const { return UtilTime::getISOTimestamp(timeReceived); }
|
||||
|
||||
std::pair<long long, long long> getTimeReceivedUnix() const { return UtilTime::divide(timeReceived); }
|
||||
|
||||
std::pair<long long, long long> getTimeReceivedPair() const { return UtilTime::divide(timeReceived); }
|
||||
|
||||
void setTimeReceived(TimePoint timeReceived) { this->timeReceived = timeReceived; }
|
||||
#ifndef CCAPI_EXPOSE_INTERNAL
|
||||
|
||||
@@ -267,9 +310,9 @@ class Message CCAPI_FINAL {
|
||||
TimePoint timeReceived{std::chrono::seconds{0}};
|
||||
std::vector<Element> elementList;
|
||||
std::vector<std::string> correlationIdList;
|
||||
std::map<std::string, std::string> secondaryCorrelationIdMap;
|
||||
Type type{Type::UNKNOWN};
|
||||
RecapType recapType{RecapType::UNKNOWN};
|
||||
};
|
||||
|
||||
} /* namespace ccapi */
|
||||
#endif // INCLUDE_CCAPI_CPP_CCAPI_MESSAGE_H_
|
||||
Reference in new issue
Block a user