-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdatabaseConnection.hpp
More file actions
29 lines (24 loc) · 880 Bytes
/
Copy pathdatabaseConnection.hpp
File metadata and controls
29 lines (24 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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 <iostream>
#include <pqxx/pqxx>
#include "models/priceData.hpp"
class DatabaseConnection {
private:
std::string connection_string;
public:
DatabaseConnection(const std::string& endpoint = "localhost",
int port = 8812,
const std::string& dbname = "qdb",
const std::string& user = "admin",
const std::string& password = "");
void printResults(const std::vector<PriceData>& results) const;
std::vector<PriceData> executeQuery(const std::string& query) const;
const std::string& getConnectionString() const {
return connection_string;
}
};