Skip to content

Dev/gitignore#8

Closed
mccaffers wants to merge 6 commits intomainfrom
dev/gitignore
Closed

Dev/gitignore#8
mccaffers wants to merge 6 commits intomainfrom
dev/gitignore

Conversation

@mccaffers
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 5, 2026 11:46
@mccaffers mccaffers self-assigned this Apr 5, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a small SQL abstraction (SqlManager) and reorganizes/expands public headers under ./include, updating build and IDE configuration accordingly.

Changes:

  • Add SqlManager and route the initial DB query in main.cpp through it.
  • Introduce/move several headers under include/ and update CMake include paths to match.
  • Minor tooling/IDE updates (run script env sourcing removed; Xcode scheme/project updated).

Reviewed changes

Copilot reviewed 9 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source/sqlManager.cpp Implements SqlManager query helpers.
include/sqlManager.hpp Declares SqlManager API for fetching initial price data.
source/main.cpp Switches to SqlManager::getInitialPriceData(db) for initial query.
source/jsonParser.cpp Adds file header banner comment.
include/jsonParser.hpp Adds JsonParser public header.
include/databaseConnection.hpp Adds DatabaseConnection public header.
include/models/priceData.hpp Adds missing <chrono> include for timestamp.
include/utilities/base64.hpp Adds Base64/Utilities header (currently missing required <chrono> include).
include/models/trade.hpp Adds Trade model header (static counter defined in source/models/trade.cpp).
include/trading/tradeManager.hpp Adds TradeManager public header.
include/trading_definitions.hpp Convenience umbrella header for trading definitions.
include/trading_definitions/configuration.hpp Adds Configuration model + JSON mapping.
include/trading_definitions/strategy.hpp Adds Strategy model + JSON mapping.
include/trading_definitions/strategy_variables.hpp Adds StrategyVariables model and JSON (de)serialization declarations.
include/trading_definitions/trading_variables.hpp Adds TradingVariables model + JSON mapping.
include/trading_definitions/ohlc_variables.hpp Adds OHLCVariables model + JSON mapping.
include/trading_definitions/ohlc_rsi_variables.hpp Adds OHLCRSIVariables model + JSON mapping.
include/configManager.hpp Adds ConfigManager header.
include/serviceA.hpp Adds ServiceA header.
scripts/run.sh Stops sourcing environment.sh (commented as unnecessary).
CMakeLists.txt Updates include directories to ./include/....
backtesting-engine-cpp.xcodeproj/xcshareddata/xcschemes/source.xcscheme Changes default CLI argument to localhost.
backtesting-engine-cpp.xcodeproj/project.pbxproj Adds include group + wires sqlManager.cpp/.hpp into the Xcode project.
Comments suppressed due to low confidence (1)

source/main.cpp:41

  • priceData[0] is accessed unconditionally, but SqlManager::getInitialPriceData() can return an empty vector (e.g. query returns zero rows or the DB call fails and returns empty results). This will cause out-of-bounds access and undefined behavior. Add an explicit empty-check (and handle/report the error) before using priceData[0].
  std::vector<PriceData> priceData = SqlManager::getInitialPriceData(db);
  
  // Convert timestamp to readable format for debugging
  auto timeT = std::chrono::system_clock::to_time_t(priceData[0].timestamp);
  std::cout << "Timestamp: " << std::put_time(std::localtime(&timeT), "%Y-%m-%d %H:%M:%S") << std::endl;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +40 to +44
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/utilities
${CMAKE_SOURCE_DIR}/include/models
${CMAKE_SOURCE_DIR}/include/trading
${CMAKE_SOURCE_DIR}/include/trading_definitions
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes the canonical header location from ./source/include to ./include (via include paths), but CONVENTIONS.md still documents headers as living under ./source/include. Either update the documentation to match the new layout, or keep the include paths aligned with the documented convention to avoid confusion for contributors.

Suggested change
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/utilities
${CMAKE_SOURCE_DIR}/include/models
${CMAKE_SOURCE_DIR}/include/trading
${CMAKE_SOURCE_DIR}/include/trading_definitions
${CMAKE_SOURCE_DIR}/source/include
${CMAKE_SOURCE_DIR}/source/include/utilities
${CMAKE_SOURCE_DIR}/source/include/models
${CMAKE_SOURCE_DIR}/source/include/trading
${CMAKE_SOURCE_DIR}/source/include/trading_definitions

Copilot uses AI. Check for mistakes.
Comment on lines 38 to 46
# Include directories
include_directories(
${CMAKE_SOURCE_DIR}/source/include
${CMAKE_SOURCE_DIR}/source/include/utilities
${CMAKE_SOURCE_DIR}/source/include/models
${CMAKE_SOURCE_DIR}/source/include/trading
${CMAKE_SOURCE_DIR}/source/include/trading_definitions
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/utilities
${CMAKE_SOURCE_DIR}/include/models
${CMAKE_SOURCE_DIR}/include/trading
${CMAKE_SOURCE_DIR}/include/trading_definitions
${CMAKE_SOURCE_DIR}/external
)
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title "Dev/gitignore" doesn't appear to match the actual changes (new SQL manager, header relocation, script tweak, Xcode scheme update). Consider renaming the PR and/or adding a short description so reviewers understand the intent/scope.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +15
#include <vector>
#include "models/priceData.hpp"
#include "databaseConnection.hpp"

class SqlManager {
public:
static std::vector<PriceData> getInitialPriceData(const DatabaseConnection& db);
static std::string getBaseQuery();
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SqlManager.hpp includes databaseConnection.hpp, which itself pulls in <pqxx/pqxx>. Since this header only needs DatabaseConnection as a reference type, consider forward-declaring class DatabaseConnection; here and including databaseConnection.hpp in source/sqlManager.cpp instead. This reduces transitive dependencies/compile time for any file that includes sqlManager.hpp.

Copilot uses AI. Check for mistakes.
@mccaffers mccaffers closed this Apr 6, 2026
@mccaffers mccaffers deleted the dev/gitignore branch April 6, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants