-
Notifications
You must be signed in to change notification settings - Fork 4
Refactoring include out of the source folder, added in an SQL manager #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f203bdd
c6a399b
cc87cf0
cf014a8
82aca01
9bf8d0a
0f69def
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Backtesting Engine in C++ | ||
| // | ||
| // (c) 2025 Ryan McCaffery | https://mccaffers.com | ||
| // This code is licensed under MIT license (see LICENSE.txt for details) | ||
| // --------------------------------------- | ||
| #pragma once | ||
| #include <string> | ||
| #include <vector> | ||
| #include "models/priceData.hpp" | ||
| #include "databaseConnection.hpp" | ||
|
|
||
| class SqlManager { | ||
| public: | ||
| static std::vector<PriceData> getInitialPriceData(const DatabaseConnection& db); | ||
| static std::string getBaseQuery(); | ||
| private: | ||
| static constexpr int DEFAULT_LIMIT = 1000; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Backtesting Engine in C++ | ||
| // | ||
| // (c) 2025 Ryan McCaffery | https://mccaffers.com | ||
| // This code is licensed under MIT license (see LICENSE.txt for details) | ||
| // --------------------------------------- | ||
| #include "sqlManager.hpp" | ||
|
|
||
| std::string SqlManager::getBaseQuery() { | ||
| return "SELECT * FROM EURUSD LIMIT " + std::to_string(DEFAULT_LIMIT) + ";"; | ||
|
Check warning on line 9 in source/sqlManager.cpp
|
||
| } | ||
|
|
||
| std::vector<PriceData> SqlManager::getInitialPriceData(const DatabaseConnection& db) { | ||
|
Comment on lines
+8
to
+12
|
||
| return db.executeQuery(getBaseQuery()); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBaseQuery()hardcodes the table/symbol (EURUSD) and the row limit, even though configuration includes aSYMBOLSfield. To makeSqlManagerreusable (and avoid having to change code for different symbols/limits), consider takingsymbolandlimitas parameters (or reading them from the parsed configuration).