66#include < coinbase/auth.hpp>
77#include < coinbase/utils.hpp>
88#include < nlohmann/json.hpp>
9- #include < slick/net/http.h >
9+ #include < slick/net/http.hpp >
1010#include < format>
1111#include < numeric>
1212#include < algorithm>
@@ -76,7 +76,7 @@ std::vector<Account> CoinbaseRestClient::list_accounts(const AccountQueryParams
7676 auto j = json::parse (res.result_text );
7777 std::vector<Account> accounts = j[" accounts" ];
7878 while (j.contains (" has_next" ) && j[" has_next" ].get <bool >() && !j[" cursor" ].get <std::string_view>().empty ()) {
79- AccountQueryParams new_params;
79+ AccountQueryParams new_params = params ;
8080 new_params.cursor = j[" cursor" ].get <std::string_view>();
8181 res = Http::get (std::format (" {}/api/v3/brokerage/accounts{}" , base_url_, new_params ()), {
8282 {" Authorization" , " Bearer " + coinbase::generate_coinbase_jwt (std::format (" GET {}/api/v3/brokerage/accounts" , domain_).c_str ())}
@@ -190,7 +190,7 @@ std::vector<Order> CoinbaseRestClient::list_orders(const OrderQueryParams &query
190190 auto j = json::parse (res.result_text );
191191 std::vector<Order> orders = j[" orders" ];
192192 while (j.contains (" has_next" ) && j[" has_next" ].get <bool >() && !j[" cursor" ].get <std::string_view>().empty ()) {
193- OrderQueryParams new_query;
193+ OrderQueryParams new_query = query ;
194194 new_query.cursor = j[" cursor" ].get <std::string_view>();
195195 res = Http::get (std::format (" {}/api/v3/brokerage/orders/historical/batch{}" , base_url_, new_query ()), {
196196 {" Authorization" , " Bearer " + coinbase::generate_coinbase_jwt (std::format (" GET {}/api/v3/brokerage/orders/historical/batch" , domain_).c_str ())}
@@ -221,7 +221,7 @@ Order CoinbaseRestClient::get_order(std::string_view order_id) const {
221221 });
222222 if (res.is_ok ()) {
223223 auto j = json::parse (res.result_text );
224- LOG_TRACE (j.dump ());
224+ LOG_TRACE (j.dump (). c_str () );
225225 return j[" order" ].get <Order>();
226226 }
227227 LOG_ERROR (" Failed to get order {}. error: {}" , order_id, res.result_text );
@@ -241,7 +241,7 @@ std::vector<Fill> CoinbaseRestClient::list_fills(const FillQueryParams ¶ms)
241241 auto j = json::parse (res.result_text );
242242 std::vector<Fill> fills = j[" fills" ];
243243 while (j.contains (" cursor" ) && !j[" cursor" ].get <std::string_view>().empty ()) {
244- FillQueryParams new_query;
244+ FillQueryParams new_query = params ;
245245 new_query.cursor = j[" cursor" ].get <std::string_view>();
246246 res = Http::get (std::format (" {}/api/v3/brokerage/orders/historical/fills{}" , base_url_, new_query ()), {
247247 {" Authorization" , " Bearer " + coinbase::generate_coinbase_jwt (std::format (" GET {}/api/v3/brokerage/orders/historical/fills" , domain_).c_str ())}
@@ -285,7 +285,7 @@ std::vector<PriceBook> CoinbaseRestClient::get_best_bid_ask(const std::vector<st
285285 });
286286 if (res.is_ok ()) {
287287 auto j = json::parse (res.result_text );
288- LOG_TRACE (j.dump ());
288+ LOG_TRACE (j.dump (). c_str () );
289289 return j[" pricebooks" ];
290290 }
291291 LOG_ERROR (" get_best_bid_ask failed. error: {}" , res.result_text );
@@ -333,7 +333,7 @@ MarketTrades CoinbaseRestClient::get_market_trades(std::string_view product_id,
333333std::vector<Candle> CoinbaseRestClient::get_product_candles (std::string_view product_id, const ProductCandlesQueryParams ¶ms) const
334334{
335335 try {
336- LOG_TRACE (params ());
336+ LOG_TRACE (params (). c_str () );
337337 auto res = Http::get (std::format (" {}/api/v3/brokerage/products/{}/candles{}" , base_url_, product_id, params ()), {
338338 {" Authorization" , " Bearer " + coinbase::generate_coinbase_jwt (std::format (" GET {}/api/v3/brokerage/products/{}/candles" , domain_, product_id).c_str ())}
339339 });
@@ -404,7 +404,7 @@ CreateOrderResponse CoinbaseRestClient::create_order(
404404 else {
405405 rsp.error_response .message = std::format (" TimeInForce {} invalid for market order" , to_string (time_in_force));
406406 rsp.success = false ;
407- LOG_ERROR (rsp.error_response .message );
407+ LOG_ERROR (rsp.error_response .message . c_str () );
408408 return rsp;
409409 }
410410
@@ -496,7 +496,7 @@ CreateOrderResponse CoinbaseRestClient::create_order(
496496 else {
497497 rsp.error_response .message = std::format (" TimeInForce {} invalid for market order" , to_string (time_in_force));
498498 rsp.success = false ;
499- LOG_ERROR (rsp.error_response .message );
499+ LOG_ERROR (rsp.error_response .message . c_str () );
500500 return rsp;
501501 }
502502
@@ -558,7 +558,7 @@ CreateOrderResponse CoinbaseRestClient::create_order(
558558 else {
559559 rsp.error_response .message = std::format (" TimeInForce {} invalid for market order" , to_string (time_in_force));
560560 rsp.success = false ;
561- LOG_ERROR (rsp.error_response .message );
561+ LOG_ERROR (rsp.error_response .message . c_str () );
562562 return rsp;
563563 }
564564 break ;
@@ -624,7 +624,7 @@ CreateOrderResponse CoinbaseRestClient::create_order(
624624 }
625625 default : {
626626 rsp.error_response .message = std::format (" OrderType {} is not supported. client_order_id: {}" , to_string (order_type), client_order_id);
627- LOG_ERROR (rsp.error_response .message );
627+ LOG_ERROR (rsp.error_response .message . c_str () );
628628 rsp.success = false ;
629629 return rsp;
630630 }
@@ -650,15 +650,15 @@ CreateOrderResponse CoinbaseRestClient::create_order(
650650 });
651651 if (res.is_ok ()) {
652652 auto j = json::parse (res.result_text );
653- LOG_TRACE (j.dump ());
653+ LOG_TRACE (j.dump (). c_str () );
654654 return j;
655655 }
656656 rsp.error_response .message = std::format (" Failed to create order. client_order_id: {} error: {}" , client_order_id, res.result_text );
657- LOG_ERROR (rsp.error_response .message );
657+ LOG_ERROR (rsp.error_response .message . c_str () );
658658 }
659659 catch (const std::exception &e) {
660660 rsp.error_response .message = std::format (" Failed to create order. client_order_id: {} error: {}" , client_order_id, e.what ());
661- LOG_ERROR (rsp.error_response .message );
661+ LOG_ERROR (rsp.error_response .message . c_str () );
662662 }
663663 rsp.success = false ;
664664 return rsp;
@@ -703,7 +703,7 @@ ModifyOrderResponse CoinbaseRestClient::modify_order(
703703 });
704704 if (res.is_ok ()) {
705705 auto j = json::parse (res.result_text );
706- LOG_TRACE (j.dump ());
706+ LOG_TRACE (j.dump (). c_str () );
707707 return j;
708708 }
709709 LOG_ERROR (" modify_order failed. order_id: {}, error: {}" , order_id, res.result_text );
@@ -729,7 +729,7 @@ std::vector<CancelOrderResponse> CoinbaseRestClient::cancel_orders(const std::ve
729729 });
730730 if (res.is_ok ()) {
731731 auto j = json::parse (res.result_text );
732- LOG_TRACE (j.dump ());
732+ LOG_TRACE (j.dump (). c_str () );
733733 return j[" results" ];
734734 }
735735 LOG_ERROR (" cancel_orders failed. error: {}" , res.result_text );
0 commit comments