-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtradeManager.hpp
More file actions
27 lines (23 loc) · 764 Bytes
/
Copy pathtradeManager.hpp
File metadata and controls
27 lines (23 loc) · 764 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
// 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 <unordered_map>
#include <memory>
#include "trade.hpp"
class TradeManager {
private:
static TradeManager* instance;
std::unordered_map<std::string, Trade> activeTrades;
TradeManager() = default;
public:
static TradeManager* getInstance();
static void reset();
void clearAllTrades();
std::string openTrade(double price, double size, bool isLong);
size_t reviewAccount() const;
bool closeTrade(const std::string& tradeId);
const std::unordered_map<std::string, Trade>& getActiveTrades() const;
};