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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MyEventHandler struct {
}

func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
fmt.Printf("Received an event:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event:\n%s\n", event.ToPrettyString(2, 2))
}

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MyEventHandler struct {

func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
if event.GetType() == ccapi.EventType_SUBSCRIPTION_STATUS {
fmt.Printf("Received an event of type SUBSCRIPTION_STATUS:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event of type SUBSCRIPTION_STATUS:\n%s\n", event.ToPrettyString(2, 2))
message := event.GetMessageList().Get(0)
if message.GetType() == ccapi.MessageType_SUBSCRIPTION_STARTED {
request := ccapi.NewRequest(ccapi.RequestOperation_CREATE_ORDER, "okx", "BTC-USDT")
Expand All @@ -27,7 +27,7 @@ func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
session.SendRequest(request)
}
} else if event.GetType() == ccapi.EventType_SUBSCRIPTION_DATA {
fmt.Printf("Received an event of type SUBSCRIPTION_DATA:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event of type SUBSCRIPTION_DATA:\n%s\n", event.ToPrettyString(2, 2))
}
}

Expand Down
4 changes: 2 additions & 2 deletions binding/go/example/fix_simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MyEventHandler struct {

func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
if event.GetType() == ccapi.EventType_AUTHORIZATION_STATUS {
fmt.Printf("Received an event of type AUTHORIZATION_STATUS:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event of type AUTHORIZATION_STATUS:\n%s\n", event.ToPrettyString(2, 2))
message := event.GetMessageList().Get(0)
if message.GetType() == ccapi.MessageType_AUTHORIZATION_SUCCESS {
request := ccapi.NewRequest(ccapi.RequestOperation_FIX, "coinbase", "", "same correlation id for subscription and request")
Expand Down Expand Up @@ -44,7 +44,7 @@ func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
session.SendRequestByFix(request)
}
} else if event.GetType() == ccapi.EventType_FIX {
fmt.Printf("Received an event of type FIX:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event of type FIX:\n%s\n", event.ToPrettyString(2, 2))
}
}

Expand Down
2 changes: 1 addition & 1 deletion binding/go/example/market_data_simple_request/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type MyEventHandler struct {
}

func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
fmt.Printf("Received an event:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event:\n%s\n", event.ToPrettyString(2, 2))
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion binding/go/example/market_data_simple_subscription/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MyEventHandler struct {

func (*MyEventHandler) ProcessEvent(event ccapi.Event, session ccapi.Session) {
if event.GetType() == ccapi.EventType_SUBSCRIPTION_STATUS {
fmt.Printf("Received an event of type SUBSCRIPTION_STATUS:\n%s\n", event.ToStringPretty(2, 2))
fmt.Printf("Received an event of type SUBSCRIPTION_STATUS:\n%s\n", event.ToPrettyString(2, 2))
} else if event.GetType() == ccapi.EventType_SUBSCRIPTION_DATA {
messageList := event.GetMessageList()
for i := 0; i < int(messageList.Size()); i++ {
Expand Down
2 changes: 2 additions & 0 deletions binding/go/go.mod.in
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module cryptochassis.com

go 1.17
2 changes: 2 additions & 0 deletions binding/go/go.mod.in_2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module main

go 1.17

require (
cryptochassis.com/ccapi v1.0.0
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class MarketDataServiceBitfinex : public MarketDataService {
} else {
MarketDataMessage::TypeForDataPoint dataPoint;
dataPoint.emplace(MarketDataMessage::DataFieldType::PRICE, UtilString::normalizeDecimalStringView(x[0].GetString()));
std::string_view count = std::string(x[1].GetString());
std::string_view count = x[1].GetString();
std::string_view amount = UtilString::normalizeDecimalStringView(x[2].GetString());
if (count != "0") {
if (amount.at(0) == '-') {
Expand Down
15 changes: 9 additions & 6 deletions include/ccapi_cpp/service/ccapi_service.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#ifndef INCLUDE_CCAPI_CPP_SERVICE_CCAPI_SERVICE_H_
#define INCLUDE_CCAPI_CPP_SERVICE_CCAPI_SERVICE_H_

#if (defined(CCAPI_ENABLE_SERVICE_MARKET_DATA) && \
(defined(CCAPI_ENABLE_EXCHANGE_HUOBI) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP))) || \
(defined(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT) && \
(defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_BITMART)))
#define CCAPI_REQUIRES_INFLATE_STREAM 1
#else
#define CCAPI_REQUIRES_INFLATE_STREAM 0
#endif

#ifndef CCAPI_HTTP_RESPONSE_PARSER_BODY_LIMIT
#define CCAPI_HTTP_RESPONSE_PARSER_BODY_LIMIT (8 * 1024 * 1024)
#endif
Expand All @@ -27,12 +36,6 @@
#define CCAPI_WEBSOCKET_WRITE_BUFFER_SIZE (1 << 20)
#endif

#define CCAPI_REQUIRES_INFLATE_STREAM \
((defined(CCAPI_ENABLE_SERVICE_MARKET_DATA) && \
(defined(CCAPI_ENABLE_EXCHANGE_HUOBI) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP))) || \
(defined(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT) && \
(defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_BITMART))))

#include <regex>

#include "boost/asio/strand.hpp"
Expand Down
Loading