diff --git a/.clang-tidy b/.clang-tidy index 1fd5dc5f..451697a3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -6,7 +6,6 @@ Checks: "-*,\ google-readability-casting,\ misc-*,\ -misc-non-private-member-variables-in-classes,\ - -misc-include-cleaner,\ -misc-const-correctness,\ modernize-*,\ -modernize-avoid-c-arrays,\ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9604fb02..dec3e4d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ else() if(CLANG_TIDY) message(STATUS "Activate clang-tidy") - set(CMAKE_CXX_CLANG_TIDY "clang-tidy") + set(CMAKE_CXX_CLANG_TIDY clang-tidy) else() message(FATAL_ERROR "clang-tidy executable cannot be found") endif() diff --git a/src/api-objects/include/tradedamounts.hpp b/src/api-objects/include/tradedamounts.hpp index 621a2858..1ba1ec68 100644 --- a/src/api-objects/include/tradedamounts.hpp +++ b/src/api-objects/include/tradedamounts.hpp @@ -26,7 +26,7 @@ struct TradedAmounts { return *this; } - bool operator==(const TradedAmounts &) const = default; + constexpr bool operator==(const TradedAmounts &) const = default; friend std::ostream &operator<<(std::ostream &os, const TradedAmounts &tradedAmounts); diff --git a/src/api-objects/src/tradedamounts.cpp b/src/api-objects/src/tradedamounts.cpp index 9dfd2460..a79b3366 100644 --- a/src/api-objects/src/tradedamounts.cpp +++ b/src/api-objects/src/tradedamounts.cpp @@ -1,5 +1,9 @@ #include "tradedamounts.hpp" +#include + +#include "cct_string.hpp" + namespace cct { string TradedAmounts::str() const { diff --git a/src/api/common/src/exchangeprivateapi.cpp b/src/api/common/src/exchangeprivateapi.cpp index a86c314c..587d3621 100644 --- a/src/api/common/src/exchangeprivateapi.cpp +++ b/src/api/common/src/exchangeprivateapi.cpp @@ -1,15 +1,51 @@ #include "exchangeprivateapi.hpp" +#include #include +#include +#include #include +#include +#include +#include #include +#include +#include +#include "apikey.hpp" +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" +#include "cct_log.hpp" #include "cct_vector.hpp" #include "coincenterinfo.hpp" +#include "currencycode.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" +#include "exchangebase.hpp" +#include "exchangeinfo.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapi.hpp" +#include "exchangepublicapitypes.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "monetaryamount.hpp" +#include "monetaryamountbycurrencyset.hpp" +#include "orderid.hpp" +#include "priceoptions.hpp" +#include "priceoptionsdef.hpp" #include "recentdeposit.hpp" #include "timedef.hpp" +#include "tradedamounts.hpp" +#include "tradedefinitions.hpp" +#include "tradeinfo.hpp" +#include "tradeside.hpp" #include "unreachable.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" #include "withdrawoptions.hpp" +#include "withdrawordeposit.hpp" +#include "withdrawsconstraints.hpp" namespace cct::api { diff --git a/src/api/common/test/exchangepublicapi_test.cpp b/src/api/common/test/exchangepublicapi_test.cpp index ec5686de..3d5ae552 100644 --- a/src/api/common/test/exchangepublicapi_test.cpp +++ b/src/api/common/test/exchangepublicapi_test.cpp @@ -3,13 +3,24 @@ #include #include +#include + #include "cct_const.hpp" #include "cct_exception.hpp" #include "coincenterinfo.hpp" #include "commonapi.hpp" +#include "currencycode.hpp" #include "exchangeinfo.hpp" #include "exchangepublicapi_mock.hpp" +#include "exchangepublicapitypes.hpp" #include "fiatconverter.hpp" +#include "loadconfiguration.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "monetaryamount.hpp" +#include "runmodes.hpp" +#include "timedef.hpp" +#include "volumeandpricenbdecimals.hpp" namespace cct::api { class ExchangePublicTest : public ::testing::Test { diff --git a/src/api/exchanges/src/bithumbprivateapi.cpp b/src/api/exchanges/src/bithumbprivateapi.cpp index 3a5bfd31..08b56611 100644 --- a/src/api/exchanges/src/bithumbprivateapi.cpp +++ b/src/api/exchanges/src/bithumbprivateapi.cpp @@ -1,25 +1,55 @@ #include "bithumbprivateapi.hpp" #include -#include -#include +#include +#include +#include +#include +#include +#include #include +#include +#include "accountowner.hpp" #include "apikey.hpp" +#include "apiquerytypeenum.hpp" +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" #include "bithumbpublicapi.hpp" +#include "cachedresult.hpp" #include "cct_exception.hpp" +#include "cct_fixedcapacityvector.hpp" #include "cct_json.hpp" #include "cct_log.hpp" #include "cct_smallvector.hpp" +#include "cct_string.hpp" #include "codec.hpp" #include "coincenterinfo.hpp" +#include "curlhandle.hpp" #include "curloptions.hpp" +#include "currencycode.hpp" +#include "exchangeinfo.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapitypes.hpp" #include "file.hpp" +#include "httprequesttype.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "ordersconstraints.hpp" +#include "runmodes.hpp" #include "ssl_sha.hpp" #include "stringhelpers.hpp" #include "timedef.hpp" #include "timestring.hpp" +#include "tradedamounts.hpp" +#include "tradeinfo.hpp" #include "tradeoptions.hpp" +#include "tradeside.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawordeposit.hpp" +#include "withdrawsconstraints.hpp" +#include "withdrawsordepositsconstraints.hpp" namespace cct::api { namespace { diff --git a/src/api/exchanges/src/bithumbpublicapi.cpp b/src/api/exchanges/src/bithumbpublicapi.cpp index 8c777387..95c7db97 100644 --- a/src/api/exchanges/src/bithumbpublicapi.cpp +++ b/src/api/exchanges/src/bithumbpublicapi.cpp @@ -1,21 +1,38 @@ #include "bithumbpublicapi.hpp" #include -#include #include +#include +#include +#include #include #include +#include +#include +#include "apiquerytypeenum.hpp" +#include "cachedresult.hpp" #include "cct_exception.hpp" #include "cct_json.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "cct_vector.hpp" #include "coincenterinfo.hpp" #include "commonapi.hpp" +#include "curlhandle.hpp" #include "curloptions.hpp" +#include "currencycode.hpp" +#include "currencyexchange.hpp" +#include "exchangepublicapitypes.hpp" #include "fiatconverter.hpp" +#include "httprequesttype.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" #include "monetaryamount.hpp" +#include "permanentcurloptions.hpp" #include "stringhelpers.hpp" #include "timestring.hpp" +#include "tradeside.hpp" namespace cct::api { namespace { diff --git a/src/api/exchanges/src/krakenprivateapi.cpp b/src/api/exchanges/src/krakenprivateapi.cpp index 6ede5097..a69a2569 100644 --- a/src/api/exchanges/src/krakenprivateapi.cpp +++ b/src/api/exchanges/src/krakenprivateapi.cpp @@ -1,21 +1,58 @@ #include "krakenprivateapi.hpp" -#include +#include +#include +#include +#include +#include #include +#include #include "apikey.hpp" +#include "apiquerytypeenum.hpp" +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" +#include "cachedresult.hpp" #include "cct_exception.hpp" #include "cct_json.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "cct_vector.hpp" #include "codec.hpp" #include "coincenterinfo.hpp" +#include "commonapi.hpp" +#include "curlhandle.hpp" #include "curloptions.hpp" +#include "currencycode.hpp" +#include "currencyexchange.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" +#include "exchangeinfo.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapi.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapitypes.hpp" +#include "httprequesttype.hpp" #include "krakenpublicapi.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "orderid.hpp" +#include "ordersconstraints.hpp" +#include "permanentcurloptions.hpp" #include "ssl_sha.hpp" #include "stringhelpers.hpp" #include "timedef.hpp" #include "timestring.hpp" #include "toupperlower.hpp" +#include "tradedamounts.hpp" +#include "tradeinfo.hpp" +#include "tradeside.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" +#include "withdrawordeposit.hpp" +#include "withdrawsconstraints.hpp" namespace cct::api { namespace { diff --git a/src/api/exchanges/src/kucoinprivateapi.cpp b/src/api/exchanges/src/kucoinprivateapi.cpp index e933ba13..a59cd491 100644 --- a/src/api/exchanges/src/kucoinprivateapi.cpp +++ b/src/api/exchanges/src/kucoinprivateapi.cpp @@ -1,16 +1,55 @@ #include "kucoinprivateapi.hpp" -#include +#include +#include +#include +#include +#include +#include +#include #include "apikey.hpp" +#include "apiquerytypeenum.hpp" +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" +#include "cachedresult.hpp" +#include "cct_exception.hpp" +#include "cct_json.hpp" +#include "cct_log.hpp" +#include "cct_string.hpp" #include "codec.hpp" #include "coincenterinfo.hpp" +#include "commonapi.hpp" +#include "curlhandle.hpp" #include "curloptions.hpp" +#include "currencycode.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" +#include "exchangeinfo.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapi.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapitypes.hpp" +#include "httprequesttype.hpp" #include "kucoinpublicapi.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "orderid.hpp" +#include "ordersconstraints.hpp" +#include "permanentcurloptions.hpp" #include "ssl_sha.hpp" #include "stringhelpers.hpp" +#include "timedef.hpp" #include "timestring.hpp" -#include "toupperlower.hpp" +#include "tradedamounts.hpp" +#include "tradeinfo.hpp" +#include "tradeside.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" +#include "withdrawordeposit.hpp" +#include "withdrawsconstraints.hpp" namespace cct::api { diff --git a/src/api/exchanges/src/upbitprivateapi.cpp b/src/api/exchanges/src/upbitprivateapi.cpp index b89e52f3..b3c88d6a 100644 --- a/src/api/exchanges/src/upbitprivateapi.cpp +++ b/src/api/exchanges/src/upbitprivateapi.cpp @@ -4,30 +4,66 @@ #include #include -#include +#include +#include +#include +#include #include #include +#include #include "apikey.hpp" +#include "apiquerytypeenum.hpp" +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" +#include "cachedresult.hpp" #include "cct_exception.hpp" #include "cct_json.hpp" #include "cct_log.hpp" -#include "codec.hpp" +#include "cct_string.hpp" #include "coincenterinfo.hpp" #include "commonapi.hpp" +#include "curlhandle.hpp" #include "curloptions.hpp" +#include "currencycode.hpp" +#include "currencycodeset.hpp" +#include "currencyexchange.hpp" +#include "currencyexchangeflatset.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" +#include "exchangeinfo.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapi.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapitypes.hpp" +#include "httprequesttype.hpp" +#include "market.hpp" #include "monetaryamount.hpp" +#include "order.hpp" +#include "orderid.hpp" +#include "ordersconstraints.hpp" +#include "permanentcurloptions.hpp" #include "ssl_sha.hpp" +#include "timedef.hpp" #include "timestring.hpp" +#include "tradedamounts.hpp" +#include "tradeinfo.hpp" +#include "tradeside.hpp" #include "upbitpublicapi.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" +#include "withdrawordeposit.hpp" namespace cct::api { namespace { +enum class IfError : int8_t { kThrow, kNoThrow }; + template json PrivateQuery(CurlHandle& curlHandle, const APIKey& apiKey, HttpRequestType requestType, std::string_view endpoint, - CurlPostDataT&& curlPostData = CurlPostData(), bool throwIfError = true) { + CurlPostDataT&& curlPostData = CurlPostData(), IfError ifError = IfError::kThrow) { CurlOptions opts(requestType, std::forward(curlPostData)); auto jsonWebToken = jwt::create() @@ -50,7 +86,7 @@ json PrivateQuery(CurlHandle& curlHandle, const APIKey& apiKey, HttpRequestType opts.appendHttpHeader("Authorization", authStr); json ret = json::parse(curlHandle.query(endpoint, opts)); - if (throwIfError) { + if (ifError == IfError::kThrow) { auto errorIt = ret.find("error"); if (errorIt != ret.end()) { log::error("Full Upbit json error: '{}'", ret.dump()); @@ -86,8 +122,8 @@ UpbitPrivate::UpbitPrivate(const CoincenterInfo& config, UpbitPublic& upbitPubli _curlHandle, _apiKey, upbitPublic) {} bool UpbitPrivate::validateApiKey() { - constexpr bool throwIfError = false; - json ret = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/api_keys", CurlPostData(), throwIfError); + json ret = + PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/api_keys", CurlPostData(), IfError::kNoThrow); auto errorIt = ret.find("error"); return errorIt == ret.end() && !ret.empty(); } @@ -147,7 +183,8 @@ BalancePortfolio UpbitPrivate::queryAccountBalance(const BalanceOptions& balance Wallet UpbitPrivate::DepositWalletFunc::operator()(CurrencyCode currencyCode) { CurlPostData postData{{"currency", currencyCode.str()}}; - json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/deposits/coin_address", postData, false); + json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/deposits/coin_address", postData, + IfError::kNoThrow); bool generateDepositAddressNeeded = false; auto errorIt = result.find("error"); if (errorIt != result.end()) { @@ -166,17 +203,17 @@ Wallet UpbitPrivate::DepositWalletFunc::operator()(CurrencyCode currencyCode) { if (genCoinAddressResult.contains("success")) { log::info("Successfully generated address"); } - std::chrono::seconds sleepingTime(1); + TimeInS sleepingTime(1); static constexpr int kNbMaxRetries = 15; int nbRetries = 0; do { if (nbRetries > 0) { log::info("Waiting {} s for address to be generated...", - std::chrono::duration_cast(sleepingTime).count()); + std::chrono::duration_cast(sleepingTime).count()); } std::this_thread::sleep_for(sleepingTime); result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/deposits/coin_address", postData); - sleepingTime += std::chrono::seconds(1); + sleepingTime += TimeInS(1); ++nbRetries; } while (nbRetries < kNbMaxRetries && result["deposit_address"].is_null()); } @@ -419,8 +456,8 @@ OrderInfo ParseOrderJson(const json& orderJson, CurrencyCode fromCurrencyCode, M IsOrderClosed(orderJson)); if (orderJson.contains("trades")) { - CurrencyCode feeCurrencyCode( - mk.quote()); // TODO: to be confirmed (this is true at least for markets involving KRW) + // TODO: to be confirmed (this is true at least for markets involving KRW) + CurrencyCode feeCurrencyCode(mk.quote()); MonetaryAmount fee(orderJson["paid_fee"].get(), feeCurrencyCode); for (const json& orderDetails : orderJson["trades"]) { diff --git a/src/api/interface/src/exchange.cpp b/src/api/interface/src/exchange.cpp index d6de3fdc..6a670027 100644 --- a/src/api/interface/src/exchange.cpp +++ b/src/api/interface/src/exchange.cpp @@ -1,8 +1,12 @@ #include "exchange.hpp" -#include "cct_const.hpp" -#include "cct_exception.hpp" -#include "cct_json.hpp" +#include + +#include "currencycode.hpp" +#include "currencyexchangeflatset.hpp" +#include "exchangeinfo.hpp" +#include "exchangeprivateapi.hpp" +#include "exchangepublicapi.hpp" namespace cct { @@ -21,7 +25,7 @@ bool Exchange::canWithdraw(CurrencyCode currencyCode, const CurrencyExchangeFlat } auto lb = currencyExchangeSet.find(currencyCode); if (lb == currencyExchangeSet.end()) { - log::trace("{} cannot be withdrawed from {}", currencyCode, name()); + log::trace("{} cannot be withdrawn from {}", currencyCode, name()); return false; } return lb->canWithdraw(); diff --git a/src/api/interface/src/exchangepool.cpp b/src/api/interface/src/exchangepool.cpp index 7deb55ce..11c8cbab 100644 --- a/src/api/interface/src/exchangepool.cpp +++ b/src/api/interface/src/exchangepool.cpp @@ -1,13 +1,18 @@ #include "exchangepool.hpp" -#include +#include +#include "apikey.hpp" #include "apikeysprovider.hpp" #include "binanceprivateapi.hpp" #include "bithumbprivateapi.hpp" +#include "cct_const.hpp" #include "cct_exception.hpp" -#include "cct_string.hpp" +#include "cct_log.hpp" #include "coincenterinfo.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapi.hpp" +#include "exchangepublicapi.hpp" #include "huobiprivateapi.hpp" #include "krakenprivateapi.hpp" #include "kucoinprivateapi.hpp" diff --git a/src/engine/include/coincentercommand.hpp b/src/engine/include/coincentercommand.hpp index c4aa29f8..dad817e9 100644 --- a/src/engine/include/coincentercommand.hpp +++ b/src/engine/include/coincentercommand.hpp @@ -1,7 +1,10 @@ #pragma once +#include +#include #include +#include "cct_type_traits.hpp" #include "coincentercommandtype.hpp" #include "currencycode.hpp" #include "depositsconstraints.hpp" @@ -12,6 +15,7 @@ #include "tradeoptions.hpp" #include "withdrawoptions.hpp" #include "withdrawsconstraints.hpp" +#include "withdrawsordepositsconstraints.hpp" namespace cct { class CoincenterCommand { diff --git a/src/engine/src/balanceperexchangeportfolio.cpp b/src/engine/src/balanceperexchangeportfolio.cpp index e9b8cc0d..aa15bcb2 100644 --- a/src/engine/src/balanceperexchangeportfolio.cpp +++ b/src/engine/src/balanceperexchangeportfolio.cpp @@ -1,7 +1,13 @@ #include "balanceperexchangeportfolio.hpp" +#include + +#include "balanceportfolio.hpp" +#include "cct_json.hpp" #include "cct_string.hpp" +#include "currencycode.hpp" #include "exchange.hpp" +#include "monetaryamount.hpp" #include "simpletable.hpp" namespace cct { diff --git a/src/engine/src/coincentercommand.cpp b/src/engine/src/coincentercommand.cpp index 493a6933..1c91fae8 100644 --- a/src/engine/src/coincentercommand.cpp +++ b/src/engine/src/coincentercommand.cpp @@ -1,6 +1,18 @@ #include "coincentercommand.hpp" +#include + #include "cct_exception.hpp" +#include "coincentercommandtype.hpp" +#include "currencycode.hpp" +#include "depositsconstraints.hpp" +#include "exchangename.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" +#include "ordersconstraints.hpp" +#include "tradeoptions.hpp" +#include "withdrawoptions.hpp" +#include "withdrawsconstraints.hpp" namespace cct { bool CoincenterCommand::isPublic() const { diff --git a/src/engine/src/coincentercommands.cpp b/src/engine/src/coincentercommands.cpp index ba72640e..c9abd070 100644 --- a/src/engine/src/coincentercommands.cpp +++ b/src/engine/src/coincentercommands.cpp @@ -1,18 +1,30 @@ #include "coincentercommands.hpp" -#include #include #include #include +#include +#include #include "cct_invalid_argument_exception.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "cct_vector.hpp" #include "coincentercommandtype.hpp" #include "coincenteroptions.hpp" #include "commandlineoptionsparser.hpp" #include "commandlineoptionsparseriterator.hpp" +#include "depositsconstraints.hpp" +#include "exchangename.hpp" +#include "monetaryamount.hpp" +#include "ordersconstraints.hpp" +#include "priceoptions.hpp" #include "stringoptionparser.hpp" +#include "timedef.hpp" #include "tradedefinitions.hpp" +#include "tradeoptions.hpp" +#include "withdrawoptions.hpp" +#include "withdrawsconstraints.hpp" namespace cct { diff --git a/src/engine/src/coincenterinfo_create.cpp b/src/engine/src/coincenterinfo_create.cpp index 6a4107db..fe037bc2 100644 --- a/src/engine/src/coincenterinfo_create.cpp +++ b/src/engine/src/coincenterinfo_create.cpp @@ -1,8 +1,24 @@ #include "coincenterinfo_create.hpp" +#include +#include + +#include "apioutputtype.hpp" +#include "cct_json.hpp" +#include "cct_string.hpp" +#include "coincenterinfo.hpp" +#include "coincenteroptions.hpp" #include "durationstring.hpp" +#include "exchangesecretsinfo.hpp" #include "file.hpp" +#include "generalconfig.hpp" +#include "loadconfiguration.hpp" +#include "logginginfo.hpp" +#include "monitoringinfo.hpp" +#include "requestsconfig.hpp" +#include "runmodes.hpp" #include "stringoptionparser.hpp" +#include "timedef.hpp" namespace cct { diff --git a/src/engine/src/coincenteroptions.cpp b/src/engine/src/coincenteroptions.cpp index 8bfb7256..8cde026c 100644 --- a/src/engine/src/coincenteroptions.cpp +++ b/src/engine/src/coincenteroptions.cpp @@ -2,7 +2,9 @@ #include #include +#include +#include "cct_config.hpp" #include "cct_const.hpp" #include "curlhandle.hpp" #include "ssl_sha.hpp" diff --git a/src/engine/src/exchangesorchestrator.cpp b/src/engine/src/exchangesorchestrator.cpp index 9d878a0f..1a7d08d2 100644 --- a/src/engine/src/exchangesorchestrator.cpp +++ b/src/engine/src/exchangesorchestrator.cpp @@ -2,13 +2,46 @@ #include #include -#include #include - +#include +#include +#include +#include +#include +#include +#include + +#include "balanceoptions.hpp" +#include "balanceportfolio.hpp" +#include "cct_const.hpp" +#include "cct_exception.hpp" +#include "cct_fixedcapacityvector.hpp" #include "cct_log.hpp" #include "cct_smallvector.hpp" +#include "cct_string.hpp" +#include "commonapi.hpp" +#include "currencycode.hpp" +#include "currencyexchangeflatset.hpp" +#include "depositsconstraints.hpp" +#include "exchange.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapitypes.hpp" +#include "exchangepublicapi.hpp" #include "exchangepublicapitypes.hpp" +#include "exchangeretriever.hpp" +#include "exchangeretrieverbase.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "monetaryamount.hpp" +#include "ordersconstraints.hpp" +#include "queryresulttypes.hpp" #include "requestsconfig.hpp" +#include "threadpool.hpp" +#include "tradeoptions.hpp" +#include "wallet.hpp" +#include "withdrawinfo.hpp" +#include "withdrawoptions.hpp" +#include "withdrawsconstraints.hpp" namespace cct { @@ -518,15 +551,7 @@ TradedAmountsPerExchange ExchangesOrchestrator::smartBuy(MonetaryAmount endAmoun const int nbTrades = trades.size(); int publicExchangePos = -1; api::ExchangePublic *pExchangePublic = nullptr; -#ifdef CCT_CLANG - // Clang does not consider structured bindings symbols as variables yet... - // So they cannot be captured by lambdas - for (auto &pExchangeBalancePair : balancePerExchange) { - auto &pExchange = pExchangeBalancePair.first; - auto &balance = pExchangeBalancePair.second; -#else for (auto &[pExchange, balance] : balancePerExchange) { -#endif if (pExchangePublic != &pExchange->apiPublic()) { pExchangePublic = &pExchange->apiPublic(); ++publicExchangePos; diff --git a/src/engine/src/metricsexporter.cpp b/src/engine/src/metricsexporter.cpp index 45730b77..29440271 100644 --- a/src/engine/src/metricsexporter.cpp +++ b/src/engine/src/metricsexporter.cpp @@ -3,8 +3,17 @@ #include #include "abstractmetricgateway.hpp" +#include "balanceportfolio.hpp" +#include "cct_string.hpp" #include "curlmetrics.hpp" +#include "currencycode.hpp" #include "exchange.hpp" +#include "market.hpp" +#include "metric.hpp" +#include "monetaryamount.hpp" +#include "publictrade.hpp" +#include "queryresulttypes.hpp" +#include "tradeside.hpp" #define RETURN_IF_NO_MONITORING \ if (!_pMetricsGateway) return diff --git a/src/engine/src/queryresultprinter.cpp b/src/engine/src/queryresultprinter.cpp index 23252d2e..24a1b8f7 100644 --- a/src/engine/src/queryresultprinter.cpp +++ b/src/engine/src/queryresultprinter.cpp @@ -1,20 +1,49 @@ #include "queryresultprinter.hpp" +#include +#include +#include +#include +#include #include +#include +#include +#include "apioutputtype.hpp" #include "balanceperexchangeportfolio.hpp" +#include "cct_json.hpp" +#include "cct_log.hpp" #include "cct_string.hpp" #include "coincentercommandtype.hpp" +#include "currencycode.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" #include "durationstring.hpp" #include "exchange.hpp" +#include "file.hpp" #include "logginginfo.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "orderid.hpp" +#include "ordersconstraints.hpp" +#include "priceoptions.hpp" +#include "publictrade.hpp" +#include "queryresulttypes.hpp" #include "simpletable.hpp" #include "stringhelpers.hpp" #include "timestring.hpp" #include "tradedamounts.hpp" +#include "tradedefinitions.hpp" +#include "tradeside.hpp" #include "unreachable.hpp" +#include "withdraw.hpp" #include "withdrawinfo.hpp" #include "withdrawoptions.hpp" +#include "withdrawsconstraints.hpp" +#include "withdrawsordepositsconstraints.hpp" +#include "writer.hpp" namespace cct { namespace { diff --git a/src/engine/src/stringoptionparser.cpp b/src/engine/src/stringoptionparser.cpp index a869b99b..14717f2a 100644 --- a/src/engine/src/stringoptionparser.cpp +++ b/src/engine/src/stringoptionparser.cpp @@ -1,10 +1,21 @@ #include "stringoptionparser.hpp" #include +#include +#include +#include +#include +#include #include "cct_cctype.hpp" #include "cct_const.hpp" #include "cct_invalid_argument_exception.hpp" +#include "cct_string.hpp" +#include "cct_vector.hpp" +#include "currencycode.hpp" +#include "exchangename.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" #include "toupperlower.hpp" namespace cct { diff --git a/src/engine/test/commandlineoptionsparser_test.cpp b/src/engine/test/commandlineoptionsparser_test.cpp index 759786e1..a3f0878d 100644 --- a/src/engine/test/commandlineoptionsparser_test.cpp +++ b/src/engine/test/commandlineoptionsparser_test.cpp @@ -2,10 +2,16 @@ #include +#include +#include +#include +#include #include +#include #include "cct_invalid_argument_exception.hpp" #include "cct_vector.hpp" +#include "commandlineoption.hpp" #include "staticcommandlineoptioncheck.hpp" #include "timedef.hpp" diff --git a/src/engine/test/exchangesorchestrator_private_test.cpp b/src/engine/test/exchangesorchestrator_private_test.cpp index aa1671cd..16b63bad 100644 --- a/src/engine/test/exchangesorchestrator_private_test.cpp +++ b/src/engine/test/exchangesorchestrator_private_test.cpp @@ -1,8 +1,32 @@ +#include #include -#include "cct_const.hpp" +#include +#include +#include + +#include "accountowner.hpp" +#include "balanceoptions.hpp" +#include "cct_exception.hpp" +#include "currencycode.hpp" +#include "currencyexchange.hpp" +#include "currencyexchangeflatset.hpp" +#include "exchange.hpp" #include "exchangedata_test.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapitypes.hpp" #include "exchangesorchestrator.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "ordersconstraints.hpp" +#include "queryresulttypes.hpp" +#include "timedef.hpp" +#include "tradeside.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" +#include "withdrawoptions.hpp" +#include "withdrawordeposit.hpp" namespace cct { diff --git a/src/engine/test/exchangesorchestrator_public_test.cpp b/src/engine/test/exchangesorchestrator_public_test.cpp index 55de1928..89cee325 100644 --- a/src/engine/test/exchangesorchestrator_public_test.cpp +++ b/src/engine/test/exchangesorchestrator_public_test.cpp @@ -1,8 +1,21 @@ +#include #include +#include +#include + #include "cct_const.hpp" +#include "currencycode.hpp" +#include "currencyexchange.hpp" +#include "currencyexchangeflatset.hpp" +#include "exchange.hpp" #include "exchangedata_test.hpp" +#include "exchangename.hpp" +#include "exchangepublicapitypes.hpp" +#include "exchangeretriever.hpp" #include "exchangesorchestrator.hpp" +#include "market.hpp" +#include "queryresulttypes.hpp" namespace cct { diff --git a/src/engine/test/exchangesorchestrator_trade_test.cpp b/src/engine/test/exchangesorchestrator_trade_test.cpp index 446cc964..65c70b1f 100644 --- a/src/engine/test/exchangesorchestrator_trade_test.cpp +++ b/src/engine/test/exchangesorchestrator_trade_test.cpp @@ -1,8 +1,32 @@ +#include #include -#include "cct_const.hpp" +#include +#include +#include +#include + +#include "balanceoptions.hpp" +#include "cct_exception.hpp" +#include "currencycode.hpp" +#include "exchange.hpp" #include "exchangedata_test.hpp" +#include "exchangename.hpp" +#include "exchangepublicapitypes.hpp" #include "exchangesorchestrator.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "monetaryamount.hpp" +#include "orderid.hpp" +#include "priceoptions.hpp" +#include "priceoptionsdef.hpp" +#include "queryresulttypes.hpp" +#include "timedef.hpp" +#include "tradedamounts.hpp" +#include "tradedefinitions.hpp" +#include "tradeinfo.hpp" +#include "tradeoptions.hpp" +#include "tradeside.hpp" namespace cct { diff --git a/src/engine/test/queryresultprinter_base_test.hpp b/src/engine/test/queryresultprinter_base_test.hpp index a25228bc..b29d3780 100644 --- a/src/engine/test/queryresultprinter_base_test.hpp +++ b/src/engine/test/queryresultprinter_base_test.hpp @@ -1,11 +1,15 @@ #include +#include #include #include #include +#include "apioutputtype.hpp" #include "cct_config.hpp" +#include "cct_json.hpp" #include "exchangedata_test.hpp" +#include "queryresultprinter.hpp" #include "timedef.hpp" namespace cct { diff --git a/src/engine/test/queryresultprinter_private_test.cpp b/src/engine/test/queryresultprinter_private_test.cpp index 27d1048b..4ecabc34 100644 --- a/src/engine/test/queryresultprinter_private_test.cpp +++ b/src/engine/test/queryresultprinter_private_test.cpp @@ -1,8 +1,32 @@ #include +#include + +#include "accountowner.hpp" +#include "apioutputtype.hpp" +#include "balanceportfolio.hpp" +#include "currencycode.hpp" +#include "deposit.hpp" +#include "depositsconstraints.hpp" +#include "exchangename.hpp" +#include "exchangeprivateapitypes.hpp" +#include "monetaryamount.hpp" +#include "order.hpp" +#include "ordersconstraints.hpp" +#include "priceoptions.hpp" +#include "priceoptionsdef.hpp" #include "queryresultprinter.hpp" #include "queryresultprinter_base_test.hpp" +#include "queryresulttypes.hpp" +#include "tradedamounts.hpp" +#include "tradeoptions.hpp" +#include "tradeside.hpp" +#include "wallet.hpp" +#include "withdraw.hpp" +#include "withdrawinfo.hpp" #include "withdrawoptions.hpp" +#include "withdrawordeposit.hpp" +#include "withdrawsconstraints.hpp" namespace cct { diff --git a/src/engine/test/queryresultprinter_public_test.cpp b/src/engine/test/queryresultprinter_public_test.cpp index c234380f..e1464ad0 100644 --- a/src/engine/test/queryresultprinter_public_test.cpp +++ b/src/engine/test/queryresultprinter_public_test.cpp @@ -1,7 +1,17 @@ #include +#include + +#include "apioutputtype.hpp" +#include "currencycode.hpp" +#include "exchangepublicapitypes.hpp" +#include "market.hpp" +#include "marketorderbook.hpp" +#include "publictrade.hpp" #include "queryresultprinter.hpp" #include "queryresultprinter_base_test.hpp" +#include "queryresulttypes.hpp" +#include "tradeside.hpp" namespace cct { diff --git a/src/engine/test/stringoptionparser_test.cpp b/src/engine/test/stringoptionparser_test.cpp index f69a7490..31fbaf8c 100644 --- a/src/engine/test/stringoptionparser_test.cpp +++ b/src/engine/test/stringoptionparser_test.cpp @@ -2,7 +2,16 @@ #include +#include +#include + #include "cct_invalid_argument_exception.hpp" +#include "cct_string.hpp" +#include "cct_vector.hpp" +#include "currencycode.hpp" +#include "exchangename.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" namespace cct { diff --git a/src/http-request/src/besturlpicker.cpp b/src/http-request/src/besturlpicker.cpp index cfa2374b..b10fa625 100644 --- a/src/http-request/src/besturlpicker.cpp +++ b/src/http-request/src/besturlpicker.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/src/http-request/src/curlhandle.cpp b/src/http-request/src/curlhandle.cpp index dbcba8f6..78e9725e 100644 --- a/src/http-request/src/curlhandle.cpp +++ b/src/http-request/src/curlhandle.cpp @@ -2,22 +2,33 @@ #include -#include +#include +#include +#include +#include +#include #include +#include #include #include +#include #include #include #include "abstractmetricgateway.hpp" -#include "cct_const.hpp" +#include "besturlpicker.hpp" #include "cct_exception.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" #include "curlmetrics.hpp" #include "curloptions.hpp" #include "flatkeyvaluestring.hpp" +#include "httprequesttype.hpp" +#include "metric.hpp" +#include "permanentcurloptions.hpp" #include "proxy.hpp" -#include "stringhelpers.hpp" +#include "runmodes.hpp" +#include "timedef.hpp" namespace cct { @@ -33,7 +44,7 @@ size_t CurlWriteCallback(const char *contents, size_t size, size_t nmemb, void * } catch (const std::bad_alloc &e) { // Do not throw exceptions in a function passed to a C library // This will cause CURL to raise an error - log::error("Bad alloc catched in curl write call back action, returning 0: {}", e.what()); + log::error("Bad alloc caught in curl write call back action, returning 0: {}", e.what()); return 0; } return size * nmemb; diff --git a/src/http-request/src/curlmetrics.cpp b/src/http-request/src/curlmetrics.cpp index 5a285021..4955a12f 100644 --- a/src/http-request/src/curlmetrics.cpp +++ b/src/http-request/src/curlmetrics.cpp @@ -1,5 +1,8 @@ #include "curlmetrics.hpp" +#include "httprequesttype.hpp" +#include "metric.hpp" + namespace cct { namespace { diff --git a/src/http-request/test/besturlpicker_test.cpp b/src/http-request/test/besturlpicker_test.cpp index 3c143f19..e858c741 100644 --- a/src/http-request/test/besturlpicker_test.cpp +++ b/src/http-request/test/besturlpicker_test.cpp @@ -2,6 +2,9 @@ #include +#include +#include + namespace cct { namespace { constexpr std::string_view kSingleURL = "singleurl"; @@ -99,4 +102,4 @@ TEST(BestURLPicker, SeveralURL) { bestURLPicker.storeResponseTimePerBaseURL(0, 28); EXPECT_EQ(bestURLPicker.getNextBaseURL(), kSeveralURL[0]); } -} // namespace cct \ No newline at end of file +} // namespace cct diff --git a/src/http-request/test/curlhandle_test.cpp b/src/http-request/test/curlhandle_test.cpp index 60fadce4..be5662e9 100644 --- a/src/http-request/test/curlhandle_test.cpp +++ b/src/http-request/test/curlhandle_test.cpp @@ -2,9 +2,14 @@ #include +#include + #include "cct_exception.hpp" #include "curloptions.hpp" +#include "httprequesttype.hpp" +#include "permanentcurloptions.hpp" #include "proxy.hpp" +#include "runmodes.hpp" /* URL available to test HTTPS, cf * https://support.nmi.com/hc/en-gb/articles/360021544791-How-to-Check-If-the-Correct-Certificates-Are-Installed-on-Linux diff --git a/src/http-request/test/permanentcurloptions_test.cpp b/src/http-request/test/permanentcurloptions_test.cpp index c07dcacd..ca1a2f3c 100644 --- a/src/http-request/test/permanentcurloptions_test.cpp +++ b/src/http-request/test/permanentcurloptions_test.cpp @@ -2,6 +2,8 @@ #include +#include "cct_string.hpp" + namespace cct { TEST(PermanentCurlOptions, Builder) { auto permanentCurlOptions = PermanentCurlOptions::Builder().setAcceptedEncoding("SomeEncoding").build(); diff --git a/src/main/src/processcommandsfromcli.cpp b/src/main/src/processcommandsfromcli.cpp index f5644c36..a167da56 100644 --- a/src/main/src/processcommandsfromcli.cpp +++ b/src/main/src/processcommandsfromcli.cpp @@ -1,8 +1,14 @@ #include "processcommandsfromcli.hpp" +#include + +#include "cct_exception.hpp" #include "coincenter.hpp" +#include "coincenterinfo.hpp" #include "coincenterinfo_create.hpp" +#include "coincenteroptions.hpp" #include "curlhandle.hpp" +#include "runmodes.hpp" namespace cct { diff --git a/src/main/test/processcommandsfromcli_test.cpp b/src/main/test/processcommandsfromcli_test.cpp index 4a3240c1..aac21351 100644 --- a/src/main/test/processcommandsfromcli_test.cpp +++ b/src/main/test/processcommandsfromcli_test.cpp @@ -2,6 +2,13 @@ #include +#include + +#include "cct_invalid_argument_exception.hpp" +#include "coincentercommands.hpp" +#include "coincenteroptions.hpp" +#include "runmodes.hpp" + namespace cct { namespace { constexpr settings::RunMode kRunMode = settings::RunMode::kTestKeys; diff --git a/src/monitoring/include/monitoringinfo.hpp b/src/monitoring/include/monitoringinfo.hpp index d1f85dbd..35dd8133 100644 --- a/src/monitoring/include/monitoringinfo.hpp +++ b/src/monitoring/include/monitoringinfo.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include "cct_string.hpp" @@ -16,7 +17,7 @@ class MonitoringInfo { /// Port should be a valid port value (in [0-65535]). Note that port 0 is reserved and should not be attributed. /// If you give 0 to port, it is equivalent to disabling monitoring. MonitoringInfo(bool useMonitoring, std::string_view jobName, std::string_view address, int port, - std::string_view username = std::string_view(), std::string_view password = std::string_view()); + std::string_view username, std::string_view password); std::string_view address() const { return _address; } std::string_view jobName() const { return _jobName; } diff --git a/src/monitoring/src/metric.cpp b/src/monitoring/src/metric.cpp index 1be0b3f9..cb3b8f21 100644 --- a/src/monitoring/src/metric.cpp +++ b/src/monitoring/src/metric.cpp @@ -1,6 +1,6 @@ #include "metric.hpp" -#include "cct_string.hpp" +#include namespace cct { MetricKey CreateMetricKey(std::string_view name, std::string_view help) { diff --git a/src/monitoring/src/monitoringinfo.cpp b/src/monitoring/src/monitoringinfo.cpp index b8cd3505..702a2619 100644 --- a/src/monitoring/src/monitoringinfo.cpp +++ b/src/monitoring/src/monitoringinfo.cpp @@ -1,9 +1,14 @@ #include "monitoringinfo.hpp" +#include +#include +#include + #include "cct_invalid_argument_exception.hpp" #include "cct_log.hpp" namespace cct { + MonitoringInfo::MonitoringInfo(bool useMonitoring, std::string_view jobName, std::string_view address, int port, std::string_view username, std::string_view password) : _jobName(jobName), @@ -20,4 +25,5 @@ MonitoringInfo::MonitoringInfo(bool useMonitoring, std::string_view jobName, std log::debug("Monitoring disabled"); } } -} // namespace cct \ No newline at end of file + +} // namespace cct diff --git a/src/monitoring/src/prometheusmetricgateway.cpp b/src/monitoring/src/prometheusmetricgateway.cpp index 1bf2099a..08fcefa5 100644 --- a/src/monitoring/src/prometheusmetricgateway.cpp +++ b/src/monitoring/src/prometheusmetricgateway.cpp @@ -6,10 +6,20 @@ #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include "abstractmetricgateway.hpp" #include "cct_exception.hpp" #include "cct_log.hpp" +#include "metric.hpp" +#include "monitoringinfo.hpp" #include "timedef.hpp" #ifdef CCT_MSVC diff --git a/src/objects/include/coincenterinfo.hpp b/src/objects/include/coincenterinfo.hpp index 00babf52..edf0d725 100644 --- a/src/objects/include/coincenterinfo.hpp +++ b/src/objects/include/coincenterinfo.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -48,13 +49,7 @@ class CoincenterInfo { /// Otherwise, return 'std::nullopt' std::optional fiatCurrencyIfStableCoin(CurrencyCode stableCoinCandidate) const; - const ExchangeInfo &exchangeInfo(std::string_view exchangeName) const { - auto it = _exchangeInfoMap.find(exchangeName); - if (it == _exchangeInfoMap.end()) { - throw exception("Unable to find this exchange in the configuration file"); - } - return it->second; - } + const ExchangeInfo &exchangeInfo(std::string_view exchangeName) const; settings::RunMode getRunMode() const { return _runMode; } @@ -62,12 +57,7 @@ class CoincenterInfo { bool useMonitoring() const { return _monitoringInfo.useMonitoring(); } - AbstractMetricGateway &metricGateway() const { - if (!useMonitoring()) { - throw exception("Unexpected monitoring setting"); - } - return *_metricGatewayPtr; - } + AbstractMetricGateway &metricGateway() const; AbstractMetricGateway *metricGatewayPtr() const { return _metricGatewayPtr.get(); } diff --git a/src/objects/include/currencyexchangeflatset.hpp b/src/objects/include/currencyexchangeflatset.hpp index 3f2eea93..7ca7bdd2 100644 --- a/src/objects/include/currencyexchangeflatset.hpp +++ b/src/objects/include/currencyexchangeflatset.hpp @@ -1,8 +1,13 @@ #pragma once +#include +#include + #include "cct_exception.hpp" #include "cct_flatset.hpp" #include "cct_type_traits.hpp" +#include "cct_vector.hpp" +#include "currencycode.hpp" #include "currencyexchange.hpp" namespace cct { @@ -14,12 +19,9 @@ using CurrencyExchangeVector = vector; /// CurrencyExchange. class CurrencyExchangeFlatSet { private: - struct CompareCurrencyExchangeByStandardCode { - bool operator()(const CurrencyExchange &lhs, const CurrencyExchange &rhs) const { - return lhs.standardCode() < rhs.standardCode(); - } - }; - using SetType = FlatSet; + using SetType = FlatSet; public: using iterator = SetType::iterator; diff --git a/src/objects/src/apioutputtype.cpp b/src/objects/src/apioutputtype.cpp index f386bc44..30476576 100644 --- a/src/objects/src/apioutputtype.cpp +++ b/src/objects/src/apioutputtype.cpp @@ -1,5 +1,7 @@ #include "apioutputtype.hpp" +#include + #include "cct_invalid_argument_exception.hpp" #include "cct_string.hpp" #include "toupperlower.hpp" diff --git a/src/objects/src/balanceportfolio.cpp b/src/objects/src/balanceportfolio.cpp index 58ab8ada..5022646b 100644 --- a/src/objects/src/balanceportfolio.cpp +++ b/src/objects/src/balanceportfolio.cpp @@ -1,6 +1,11 @@ #include "balanceportfolio.hpp" #include +#include +#include + +#include "currencycode.hpp" +#include "monetaryamount.hpp" namespace cct { namespace { diff --git a/src/objects/src/coincentercommandtype.cpp b/src/objects/src/coincentercommandtype.cpp index 1e93d918..bdb98fdd 100644 --- a/src/objects/src/coincentercommandtype.cpp +++ b/src/objects/src/coincentercommandtype.cpp @@ -1,5 +1,7 @@ #include "coincentercommandtype.hpp" +#include + #include "cct_exception.hpp" namespace cct { diff --git a/src/objects/src/coincenterinfo.cpp b/src/objects/src/coincenterinfo.cpp index dc3f1411..67e5329d 100644 --- a/src/objects/src/coincenterinfo.cpp +++ b/src/objects/src/coincenterinfo.cpp @@ -1,12 +1,24 @@ #include "coincenterinfo.hpp" -#include "cct_const.hpp" +#include +#include +#include +#include +#include + #include "cct_exception.hpp" #include "cct_json.hpp" #include "cct_log.hpp" -#include "durationstring.hpp" +#include "cct_string.hpp" +#include "currencycode.hpp" +#include "exchangeinfo.hpp" +#include "exchangeinfomap.hpp" #include "exchangeinfoparser.hpp" -#include "file.hpp" +#include "generalconfig.hpp" +#include "loadconfiguration.hpp" +#include "monitoringinfo.hpp" +#include "reader.hpp" +#include "runmodes.hpp" #include "toupperlower.hpp" #ifdef CCT_ENABLE_PROMETHEUS @@ -118,4 +130,19 @@ std::optional CoincenterInfo::fiatCurrencyIfStableCoin(CurrencyCod return std::nullopt; } +const ExchangeInfo& CoincenterInfo::exchangeInfo(std::string_view exchangeName) const { + auto it = _exchangeInfoMap.find(exchangeName); + if (it == _exchangeInfoMap.end()) { + throw exception("Unable to find this exchange in the configuration file"); + } + return it->second; +} + +AbstractMetricGateway& CoincenterInfo::metricGateway() const { + if (!useMonitoring()) { + throw exception("Unexpected monitoring setting"); + } + return *_metricGatewayPtr; +} + } // namespace cct \ No newline at end of file diff --git a/src/objects/src/currencyexchange.cpp b/src/objects/src/currencyexchange.cpp index e13f6940..f30eebbb 100644 --- a/src/objects/src/currencyexchange.cpp +++ b/src/objects/src/currencyexchange.cpp @@ -1,5 +1,10 @@ #include "currencyexchange.hpp" +#include + +#include "cct_string.hpp" +#include "currencycode.hpp" + namespace cct { CurrencyExchange::CurrencyExchange(CurrencyCode standardCode, Deposit deposit, Withdraw withdraw, Type type) diff --git a/src/objects/src/exchangeinfo.cpp b/src/objects/src/exchangeinfo.cpp index 4df3db36..25b688b3 100644 --- a/src/objects/src/exchangeinfo.cpp +++ b/src/objects/src/exchangeinfo.cpp @@ -1,10 +1,20 @@ #include "exchangeinfo.hpp" +#include +#include +#include +#include + +#include "apiquerytypeenum.hpp" #include "cct_const.hpp" #include "cct_exception.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "currencycodevector.hpp" #include "durationstring.hpp" -#include "stringhelpers.hpp" +#include "monetaryamount.hpp" +#include "monetaryamountbycurrencyset.hpp" +#include "timedef.hpp" namespace cct { diff --git a/src/objects/src/exchangename.cpp b/src/objects/src/exchangename.cpp index ac45ef57..6379e6bd 100644 --- a/src/objects/src/exchangename.cpp +++ b/src/objects/src/exchangename.cpp @@ -1,6 +1,10 @@ #include "exchangename.hpp" +#include +#include + #include "cct_exception.hpp" +#include "cct_string.hpp" #include "toupperlower.hpp" namespace cct { diff --git a/src/objects/src/file.cpp b/src/objects/src/file.cpp index 34bf3a8e..4b4fa02a 100644 --- a/src/objects/src/file.cpp +++ b/src/objects/src/file.cpp @@ -1,11 +1,18 @@ #include "file.hpp" +#include #include #include -#include +#include +#include +#include +#include #include "cct_exception.hpp" +#include "cct_json.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "writer.hpp" namespace cct { namespace { diff --git a/src/objects/src/loadconfiguration.cpp b/src/objects/src/loadconfiguration.cpp index a781a16b..405da51c 100644 --- a/src/objects/src/loadconfiguration.cpp +++ b/src/objects/src/loadconfiguration.cpp @@ -1,5 +1,9 @@ #include "loadconfiguration.hpp" +#include + +#include "cct_const.hpp" + namespace cct { LoadConfiguration::LoadConfiguration() noexcept : _dataDir(kDefaultDataDir), _exchangeConfigFileType(ExchangeConfigFileType::kProd) {} diff --git a/src/objects/src/market.cpp b/src/objects/src/market.cpp index cc8a5189..2447f399 100644 --- a/src/objects/src/market.cpp +++ b/src/objects/src/market.cpp @@ -1,6 +1,13 @@ #include "market.hpp" +#include +#include +#include +#include + #include "cct_exception.hpp" +#include "cct_string.hpp" +#include "toupperlower.hpp" namespace cct { Market::Market(std::string_view marketStrRep, char currencyCodeSep) { diff --git a/src/objects/src/marketorderbook.cpp b/src/objects/src/marketorderbook.cpp index c7c34140..749546b4 100644 --- a/src/objects/src/marketorderbook.cpp +++ b/src/objects/src/marketorderbook.cpp @@ -2,14 +2,25 @@ #include #include +#include +#include +#include #include +#include +#include +#include #include "cct_exception.hpp" -#include "cct_fixedcapacityvector.hpp" #include "cct_log.hpp" +#include "cct_string.hpp" +#include "currencycode.hpp" +#include "market.hpp" +#include "monetaryamount.hpp" #include "priceoptions.hpp" -#include "stringhelpers.hpp" +#include "priceoptionsdef.hpp" +#include "simpletable.hpp" #include "unreachable.hpp" +#include "volumeandpricenbdecimals.hpp" namespace cct { diff --git a/src/objects/src/monetaryamount.cpp b/src/objects/src/monetaryamount.cpp index e5ca74c1..2ab08617 100644 --- a/src/objects/src/monetaryamount.cpp +++ b/src/objects/src/monetaryamount.cpp @@ -1,15 +1,25 @@ #include "monetaryamount.hpp" +#include #include #include +#include +#include #include #include #include +#include +#include +#include #include +#include +#include +#include -#include "cct_cctype.hpp" #include "cct_config.hpp" #include "cct_exception.hpp" +#include "currencycode.hpp" +#include "mathhelpers.hpp" #include "stringhelpers.hpp" namespace cct { diff --git a/src/objects/src/priceoptions.cpp b/src/objects/src/priceoptions.cpp index 86e50860..6395cf6b 100644 --- a/src/objects/src/priceoptions.cpp +++ b/src/objects/src/priceoptions.cpp @@ -1,9 +1,10 @@ #include "priceoptions.hpp" -#include +#include #include "cct_invalid_argument_exception.hpp" -#include "stringhelpers.hpp" +#include "cct_string.hpp" +#include "priceoptionsdef.hpp" #include "unreachable.hpp" namespace cct { diff --git a/src/objects/src/reader.cpp b/src/objects/src/reader.cpp index fd710edd..424b8881 100644 --- a/src/objects/src/reader.cpp +++ b/src/objects/src/reader.cpp @@ -1,5 +1,9 @@ #include "reader.hpp" +#include + +#include "cct_json.hpp" +#include "cct_string.hpp" namespace cct { json Reader::readAllJson() const { diff --git a/src/objects/test/balanceportfolio_test.cpp b/src/objects/test/balanceportfolio_test.cpp index 2a0e00cb..2848b2a7 100644 --- a/src/objects/test/balanceportfolio_test.cpp +++ b/src/objects/test/balanceportfolio_test.cpp @@ -3,13 +3,11 @@ #include +#include "monetaryamount.hpp" namespace cct { class BalancePortfolioTest1 : public ::testing::Test { protected: - void SetUp() override {} - void TearDown() override {} - BalancePortfolio balancePortfolio; }; @@ -37,9 +35,6 @@ TEST_F(BalancePortfolioTest1, NoEquivalentCurrency2) { class BalancePortfolioTest2 : public ::testing::Test { protected: - void SetUp() override {} - void TearDown() override {} - BalancePortfolioTest2() { balancePortfolio.add(MonetaryAmount("11704.5678 XRP")); balancePortfolio.add(MonetaryAmount("10 EUR")); diff --git a/src/objects/test/currencycode_test.cpp b/src/objects/test/currencycode_test.cpp index d7c0f317..602173e9 100644 --- a/src/objects/test/currencycode_test.cpp +++ b/src/objects/test/currencycode_test.cpp @@ -3,6 +3,9 @@ #include +#include "cct_invalid_argument_exception.hpp" +#include "cct_string.hpp" + namespace cct { TEST(CurrencyCodeTest, Neutral) { diff --git a/src/objects/test/monetaryamount_test.cpp b/src/objects/test/monetaryamount_test.cpp index a6731af8..8f61eb03 100644 --- a/src/objects/test/monetaryamount_test.cpp +++ b/src/objects/test/monetaryamount_test.cpp @@ -2,8 +2,10 @@ #include +#include + #include "cct_exception.hpp" -#include "cct_invalid_argument_exception.hpp" +#include "currencycode.hpp" namespace cct { diff --git a/src/objects/test/wallet_test.cpp b/src/objects/test/wallet_test.cpp index a27dd16e..54427f22 100644 --- a/src/objects/test/wallet_test.cpp +++ b/src/objects/test/wallet_test.cpp @@ -2,13 +2,17 @@ #include +#include + +#include "accountowner.hpp" +#include "cct_string.hpp" +#include "currencycode.hpp" +#include "exchangename.hpp" + namespace cct { class WalletTest : public ::testing::Test { protected: - void SetUp() override {} - void TearDown() override {} - WalletCheck walletCheck; }; diff --git a/src/tech/src/codec.cpp b/src/tech/src/codec.cpp index 0e878d19..a504fb4b 100644 --- a/src/tech/src/codec.cpp +++ b/src/tech/src/codec.cpp @@ -1,9 +1,12 @@ #include "codec.hpp" #include +#include +#include #include "cct_cctype.hpp" #include "cct_invalid_argument_exception.hpp" +#include "cct_string.hpp" namespace cct { diff --git a/src/tech/src/durationstring.cpp b/src/tech/src/durationstring.cpp index 3623fd7b..b35ce9e6 100644 --- a/src/tech/src/durationstring.cpp +++ b/src/tech/src/durationstring.cpp @@ -1,10 +1,15 @@ #include "durationstring.hpp" +#include +#include #include +#include #include "cct_cctype.hpp" #include "cct_invalid_argument_exception.hpp" +#include "cct_string.hpp" #include "stringhelpers.hpp" +#include "timedef.hpp" namespace cct { Duration ParseDuration(std::string_view durationStr) { @@ -129,4 +134,4 @@ string DurationToString(Duration dur) { return ret; } -} // namespace cct \ No newline at end of file +} // namespace cct diff --git a/src/tech/src/levenshteindistancecalculator.cpp b/src/tech/src/levenshteindistancecalculator.cpp index bb5f29d5..ecfab515 100644 --- a/src/tech/src/levenshteindistancecalculator.cpp +++ b/src/tech/src/levenshteindistancecalculator.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace cct { int LevenshteinDistanceCalculator::operator()(std::string_view word1, std::string_view word2) { diff --git a/src/tech/src/simpletable.cpp b/src/tech/src/simpletable.cpp index 2eedee8c..1c019041 100644 --- a/src/tech/src/simpletable.cpp +++ b/src/tech/src/simpletable.cpp @@ -1,9 +1,13 @@ #include "simpletable.hpp" #include -#include +#include #include +#include #include +#include +#include +#include #include "mathhelpers.hpp" #include "unreachable.hpp" diff --git a/src/tech/src/timestring.cpp b/src/tech/src/timestring.cpp index 5ae2dcac..eb2e52e2 100644 --- a/src/tech/src/timestring.cpp +++ b/src/tech/src/timestring.cpp @@ -4,9 +4,13 @@ #include #include #include +#include +#include #include "cct_exception.hpp" +#include "cct_string.hpp" #include "stringhelpers.hpp" +#include "timedef.hpp" namespace cct { diff --git a/src/tech/src/unitsparser.cpp b/src/tech/src/unitsparser.cpp index 76ef63e4..e93213a2 100644 --- a/src/tech/src/unitsparser.cpp +++ b/src/tech/src/unitsparser.cpp @@ -1,5 +1,8 @@ #include "unitsparser.hpp" +#include +#include + #include "cct_exception.hpp" #include "stringhelpers.hpp" diff --git a/src/tech/test/cachedresult_test.cpp b/src/tech/test/cachedresult_test.cpp index 5c4cbf47..888ad69a 100644 --- a/src/tech/test/cachedresult_test.cpp +++ b/src/tech/test/cachedresult_test.cpp @@ -5,6 +5,8 @@ #include #include +#include "cachedresultvault.hpp" + namespace cct { namespace { class Incr { diff --git a/src/tech/test/cct_exception_test.cpp b/src/tech/test/cct_exception_test.cpp index 14d41356..fe893f8a 100644 --- a/src/tech/test/cct_exception_test.cpp +++ b/src/tech/test/cct_exception_test.cpp @@ -2,6 +2,10 @@ #include +#include + +#include "cct_string.hpp" + namespace cct { TEST(CctExceptionTest, InfoTakenFromConstCharStar) { diff --git a/src/tech/test/cct_hash_test.cpp b/src/tech/test/cct_hash_test.cpp index 50e45c49..6ea64440 100644 --- a/src/tech/test/cct_hash_test.cpp +++ b/src/tech/test/cct_hash_test.cpp @@ -2,6 +2,10 @@ #include +#include +#include +#include + namespace cct { TEST(SSPHashTest, HashValue) { diff --git a/src/tech/test/codec_test.cpp b/src/tech/test/codec_test.cpp index f97f8875..3e1b2fc3 100644 --- a/src/tech/test/codec_test.cpp +++ b/src/tech/test/codec_test.cpp @@ -2,6 +2,7 @@ #include +#include #include namespace cct { diff --git a/src/tech/test/durationstring_test.cpp b/src/tech/test/durationstring_test.cpp index 2b5fdae4..78617a86 100644 --- a/src/tech/test/durationstring_test.cpp +++ b/src/tech/test/durationstring_test.cpp @@ -55,4 +55,4 @@ TEST(DurationString, DurationToStringMicroseconds) { EXPECT_EQ(DurationToString(std::chrono::microseconds(31736913078454L)), "1y2d1h59min21s78ms454us"); } -} // namespace cct \ No newline at end of file +} // namespace cct diff --git a/src/tech/test/flatkeyvaluestring_test.cpp b/src/tech/test/flatkeyvaluestring_test.cpp index 00611d5c..788a907c 100644 --- a/src/tech/test/flatkeyvaluestring_test.cpp +++ b/src/tech/test/flatkeyvaluestring_test.cpp @@ -2,7 +2,10 @@ #include -#include "cct_exception.hpp" +#include +#include + +#include "cct_json.hpp" namespace cct { namespace { diff --git a/src/tech/test/mathhelpers_test.cpp b/src/tech/test/mathhelpers_test.cpp index 3d10854c..e8175bd7 100644 --- a/src/tech/test/mathhelpers_test.cpp +++ b/src/tech/test/mathhelpers_test.cpp @@ -2,6 +2,9 @@ #include +#include +#include + namespace cct { TEST(MathHelpers, Power) { diff --git a/src/tech/test/simpletable_test.cpp b/src/tech/test/simpletable_test.cpp index 33edc111..a5fd898e 100644 --- a/src/tech/test/simpletable_test.cpp +++ b/src/tech/test/simpletable_test.cpp @@ -2,6 +2,11 @@ #include +#include +#include + +#include "cct_string.hpp" + namespace cct { TEST(SimpleTable, DefaultConstructor) { SimpleTable table; diff --git a/src/tech/test/static_string_view_helpers_test.cpp b/src/tech/test/static_string_view_helpers_test.cpp index 6fc42ec9..778386d7 100644 --- a/src/tech/test/static_string_view_helpers_test.cpp +++ b/src/tech/test/static_string_view_helpers_test.cpp @@ -1,5 +1,7 @@ #include "static_string_view_helpers.hpp" +#include + namespace cct { // JoinStringView namespace test1 { diff --git a/src/tech/test/stringhelpers_test.cpp b/src/tech/test/stringhelpers_test.cpp index ed912b80..3e3f1af2 100644 --- a/src/tech/test/stringhelpers_test.cpp +++ b/src/tech/test/stringhelpers_test.cpp @@ -2,6 +2,9 @@ #include +#include +#include + #include "cct_string.hpp" namespace cct { diff --git a/src/tech/test/threadpool_test.cpp b/src/tech/test/threadpool_test.cpp index 7226a880..728c397e 100644 --- a/src/tech/test/threadpool_test.cpp +++ b/src/tech/test/threadpool_test.cpp @@ -2,8 +2,11 @@ #include +#include #include +#include #include +#include #include "cct_vector.hpp" @@ -94,4 +97,4 @@ TEST(ThreadPoolTest, LongTaskToBeFinishedBeforeThreadPoolDestroyed) { threadPool.enqueue(SlowDouble, elem); } } -} // namespace cct \ No newline at end of file +} // namespace cct diff --git a/src/tech/test/timestring_test.cpp b/src/tech/test/timestring_test.cpp index f255502b..36943ef5 100644 --- a/src/tech/test/timestring_test.cpp +++ b/src/tech/test/timestring_test.cpp @@ -2,10 +2,13 @@ #include +#include +#include #include #include #include "stringhelpers.hpp" +#include "timedef.hpp" namespace cct { @@ -59,4 +62,4 @@ TEST(TimeStringTest, FromToString) { // std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); // EXPECT_STREQ(ToString(now).c_str(), ToString(FromString(ToString(now).c_str())).c_str()); } -} // namespace cct \ No newline at end of file +} // namespace cct