Skip to content

Commit f203bdd

Browse files
committed
Refactoring include out of the source folder, added in an SQL manager
1 parent 2cb570c commit f203bdd

22 files changed

Lines changed: 58 additions & 13 deletions

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ add_subdirectory(external/libpqxx EXCLUDE_FROM_ALL)
3737

3838
# Include directories
3939
include_directories(
40-
${CMAKE_SOURCE_DIR}/source/include
41-
${CMAKE_SOURCE_DIR}/source/include/utilities
42-
${CMAKE_SOURCE_DIR}/source/include/models
43-
${CMAKE_SOURCE_DIR}/source/include/trading
44-
${CMAKE_SOURCE_DIR}/source/include/trading_definitions
40+
${CMAKE_SOURCE_DIR}/include
41+
${CMAKE_SOURCE_DIR}/include/utilities
42+
${CMAKE_SOURCE_DIR}/include/models
43+
${CMAKE_SOURCE_DIR}/include/trading
44+
${CMAKE_SOURCE_DIR}/include/trading_definitions
4545
${CMAKE_SOURCE_DIR}/external
4646
)
4747

backtesting-engine-cpp.xcodeproj/project.pbxproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
940A61142C92CE210083FEB8 /* configManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 940A61112C92CE210083FEB8 /* configManager.cpp */; };
1212
940A61172C92CE960083FEB8 /* serviceA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 940A61152C92CE960083FEB8 /* serviceA.cpp */; };
1313
940A61182C92CE960083FEB8 /* serviceA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 940A61152C92CE960083FEB8 /* serviceA.cpp */; };
14+
941408AE2D59F93F000ED1F9 /* sqlManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941408AD2D59F93F000ED1F9 /* sqlManager.cpp */; };
15+
941408AF2D59F93F000ED1F9 /* sqlManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941408AD2D59F93F000ED1F9 /* sqlManager.cpp */; };
1416
941B549A2D3BBADE00E3BF64 /* trading_definitions_json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941B54992D3BBADD00E3BF64 /* trading_definitions_json.cpp */; };
1517
941B549B2D3BBADE00E3BF64 /* trading_definitions_json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941B54992D3BBADD00E3BF64 /* trading_definitions_json.cpp */; };
1618
94280BA32D2FC00200F1CF56 /* base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94280BA22D2FC00200F1CF56 /* base64.cpp */; };
@@ -51,6 +53,8 @@
5153
940A61122C92CE210083FEB8 /* configManager.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = configManager.hpp; sourceTree = "<group>"; };
5254
940A61152C92CE960083FEB8 /* serviceA.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = serviceA.cpp; sourceTree = "<group>"; };
5355
940A61162C92CE960083FEB8 /* serviceA.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = serviceA.hpp; sourceTree = "<group>"; };
56+
941408AD2D59F93F000ED1F9 /* sqlManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = sqlManager.cpp; sourceTree = "<group>"; };
57+
941408B02D59F954000ED1F9 /* sqlManager.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = sqlManager.hpp; sourceTree = "<group>"; };
5458
941B54902D3BBA4900E3BF64 /* ohlc_variables.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ohlc_variables.hpp; sourceTree = "<group>"; };
5559
941B54912D3BBA5600E3BF64 /* ohlc_rsi_variables.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ohlc_rsi_variables.hpp; sourceTree = "<group>"; };
5660
941B54922D3BBA6500E3BF64 /* trading_variables.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = trading_variables.hpp; sourceTree = "<group>"; };
@@ -1317,6 +1321,7 @@
13171321
94CD849E2D2D22C900041BBA /* external */,
13181322
944D0DD22C8C3704004DD0FC /* images */,
13191323
944D0DCE2C8C3704004DD0FC /* scripts */,
1324+
94DE4F772C8C3E7C00FE48FF /* include */,
13201325
9470B5A22C8C5AD0007D9CC6 /* source */,
13211326
9470B5AD2C8C5B99007D9CC6 /* tests */,
13221327
948A9CEC2C906ADB00E23669 /* resources */,
@@ -1395,16 +1400,16 @@
13951400
9470B5A22C8C5AD0007D9CC6 /* source */ = {
13961401
isa = PBXGroup;
13971402
children = (
1398-
943398232D57E53400287A2D /* jsonParser.cpp */,
13991403
94674B8C2D533E7800973137 /* models */,
14001404
94674B862D533B4000973137 /* trading */,
1401-
94DE4F772C8C3E7C00FE48FF /* include */,
14021405
941B54982D3BBAD800E3BF64 /* trading_definitions */,
14031406
94280BA72D2FC29F00F1CF56 /* utilities */,
14041407
9470B5A32C8C5AD0007D9CC6 /* main.cpp */,
14051408
940A61112C92CE210083FEB8 /* configManager.cpp */,
14061409
940A61152C92CE960083FEB8 /* serviceA.cpp */,
14071410
94CD8B9F2D2E8CE500041BBA /* databaseConnection.cpp */,
1411+
943398232D57E53400287A2D /* jsonParser.cpp */,
1412+
941408AD2D59F93F000ED1F9 /* sqlManager.cpp */,
14081413
);
14091414
path = source;
14101415
sourceTree = "<group>";
@@ -3510,6 +3515,7 @@
35103515
94DE4F772C8C3E7C00FE48FF /* include */ = {
35113516
isa = PBXGroup;
35123517
children = (
3518+
941408B02D59F954000ED1F9 /* sqlManager.hpp */,
35133519
943398222D57E52900287A2D /* jsonParser.hpp */,
35143520
94674B842D533B2F00973137 /* trading */,
35153521
942966D72D48E84100532862 /* models */,
@@ -3616,6 +3622,7 @@
36163622
isa = PBXSourcesBuildPhase;
36173623
buildActionMask = 2147483647;
36183624
files = (
3625+
941408AE2D59F93F000ED1F9 /* sqlManager.cpp in Sources */,
36193626
9470B5A42C8C5AD0007D9CC6 /* main.cpp in Sources */,
36203627
943398252D57E53400287A2D /* jsonParser.cpp in Sources */,
36213628
94280BA32D2FC00200F1CF56 /* base64.cpp in Sources */,
@@ -3633,6 +3640,7 @@
36333640
buildActionMask = 2147483647;
36343641
files = (
36353642
94CD8BA12D2E8CE500041BBA /* databaseConnection.cpp in Sources */,
3643+
941408AF2D59F93F000ED1F9 /* sqlManager.cpp in Sources */,
36363644
943398242D57E53400287A2D /* jsonParser.cpp in Sources */,
36373645
94280BA42D2FC00200F1CF56 /* base64.cpp in Sources */,
36383646
94674B8D2D533E7800973137 /* trade.cpp in Sources */,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// This code is licensed under MIT license (see LICENSE.txt for details)
55
// ---------------------------------------
66
#pragma once
7+
#include <chrono>
78

89
struct PriceData {
910
double value1;

include/sqlManager.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Backtesting Engine in C++
2+
//
3+
// (c) 2025 Ryan McCaffery | https://mccaffers.com
4+
// This code is licensed under MIT license (see LICENSE.txt for details)
5+
// ---------------------------------------
6+
#pragma once
7+
#include <string>
8+
#include <vector>
9+
#include "models/priceData.hpp"
10+
#include "databaseConnection.hpp"
11+
12+
class SqlManager {
13+
public:
14+
static std::vector<PriceData> getInitialPriceData(const DatabaseConnection& db);
15+
static std::string getBaseQuery();
16+
private:
17+
static constexpr int DEFAULT_LIMIT = 1000;
18+
};

0 commit comments

Comments
 (0)