Skip to content

Commit

Permalink
Merge pull request #395 from crypto-chassis/dev
Browse files Browse the repository at this point in the history
fix: rewrite internal date functions
  • Loading branch information
cryptochassis authored Jun 21, 2023
2 parents f46e5a7 + b923509 commit 1d5b9f2
Show file tree
Hide file tree
Showing 22 changed files with 160 additions and 5,628 deletions.
2 changes: 1 addition & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ if (WIN32)
set(ADDITIONAL_LINK_LIBRARIES ws2_32)
endif()
link_libraries(OpenSSL::Crypto OpenSSL::SSL ${ADDITIONAL_LINK_LIBRARIES})
add_compile_options(-Wno-deprecated)
add_compile_options(-Wno-deprecated -Wno-nonnull -Wno-deprecated-declarations)
add_subdirectory(src/spot_market_making)
add_subdirectory(src/single_order_execution)
1 change: 1 addition & 0 deletions app/include/app/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <random>
#include <string>

#include "ccapi_cpp/ccapi_logger.h"
#include "ccapi_cpp/ccapi_util_private.h"
namespace ccapi {
class AppUtil {
Expand Down
2 changes: 1 addition & 1 deletion app/include/app/historical_market_data_event_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HistoricalMarketDataEventProcessor {
bool shouldContinueTrade{true};
std::vector<std::string> previousSplittedMarketDepth;
while (currentDateTp < this->historicalMarketDataEndDateTp) {
const auto& currentDateISO = UtilTime::getISOTimestamp(currentDateTp, "%F");
const auto& currentDateISO = UtilTime::getISOTimestamp<std::chrono::seconds>(currentDateTp).substr(0, 10);
APP_LOGGER_INFO("Start processing " + currentDateISO + ".");
std::string fileNameWithDirBase = this->historicalMarketDataDirectory + "/" + this->historicalMarketDataFilePrefix + this->exchange + "__" +
this->baseAsset + "-" + this->quoteAsset + "__" + currentDateISO + "__";
Expand Down
4 changes: 2 additions & 2 deletions app/src/single_order_execution/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ int main(int argc, char** argv) {
eventHandler.marketImpfactFactor = UtilSystem::getEnvAsDouble("MARKET_IMPACT_FACTOR");
}
if (eventHandler.tradingMode == EventHandlerBase::TradingMode::BACKTEST) {
eventHandler.historicalMarketDataStartDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_START_DATE"), "%F");
eventHandler.historicalMarketDataStartDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_START_DATE"));
if (startTimeStr.empty()) {
eventHandler.startTimeTp = eventHandler.historicalMarketDataStartDateTp;
}
eventHandler.historicalMarketDataEndDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_END_DATE"), "%F");
eventHandler.historicalMarketDataEndDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_END_DATE"));
if (totalDurationSecondsStr.empty()) {
eventHandler.totalDurationSeconds =
std::chrono::duration_cast<std::chrono::seconds>(eventHandler.historicalMarketDataEndDateTp - eventHandler.historicalMarketDataStartDateTp).count();
Expand Down
4 changes: 2 additions & 2 deletions app/src/spot_market_making/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ int main(int argc, char** argv) {
eventHandler.marketImpfactFactor = UtilSystem::getEnvAsDouble("MARKET_IMPACT_FACTOR");
}
if (eventHandler.tradingMode == EventHandlerBase::TradingMode::BACKTEST) {
eventHandler.historicalMarketDataStartDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_START_DATE"), "%F");
eventHandler.historicalMarketDataStartDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_START_DATE"));
if (startTimeStr.empty()) {
eventHandler.startTimeTp = eventHandler.historicalMarketDataStartDateTp;
}
eventHandler.historicalMarketDataEndDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_END_DATE"), "%F");
eventHandler.historicalMarketDataEndDateTp = UtilTime::parse(UtilSystem::getEnvAsString("HISTORICAL_MARKET_DATA_END_DATE"));
if (totalDurationSecondsStr.empty()) {
eventHandler.totalDurationSeconds =
std::chrono::duration_cast<std::chrono::seconds>(eventHandler.historicalMarketDataEndDateTp - eventHandler.historicalMarketDataStartDateTp).count();
Expand Down
2 changes: 1 addition & 1 deletion binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ include(UseSWIG)
if(BUILD_TEST)
include(CTest)
endif()
add_compile_options(-Wno-deprecated)
add_compile_options(-Wno-deprecated -Wno-nonnull -Wno-deprecated-declarations)
add_subdirectory(python)
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (WIN32)
set(ADDITIONAL_LINK_LIBRARIES ws2_32)
endif()
link_libraries(OpenSSL::Crypto OpenSSL::SSL ${ADDITIONAL_LINK_LIBRARIES})
add_compile_options(-Wno-deprecated)
add_compile_options(-Wno-deprecated -Wno-nonnull -Wno-deprecated-declarations)
add_subdirectory(src/market_data_simple_request)
add_subdirectory(src/market_data_simple_subscription)
add_subdirectory(src/market_data_advanced_request)
Expand Down
Loading

0 comments on commit 1d5b9f2

Please sign in to comment.