-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathquant_trader.h
52 lines (40 loc) · 1.47 KB
/
quant_trader.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef QUANT_TRADER_H
#define QUANT_TRADER_H
#include "market_watcher_interface.h"
#include "ctp_executer_interface.h"
template <typename T> class QList;
template <typename Key, typename T> class QMap;
template <typename Key, typename T> class QMultiMap;
class Bar;
class BarCollector;
class AbstractIndicator;
class AbstractStrategy;
class QuantTrader : public QObject
{
Q_OBJECT
protected:
org::ctp::market_watcher *pWatcher;
org::ctp::ctp_executer *pExecuter;
// Following QString keys stands for instument names
QMap<QString, BarCollector*> collector_map;
QMap<QString, QMap<int, QList<Bar>>> bars_map;
QMultiMap<QString, AbstractIndicator*> indicator_map;
QMultiMap<QString, AbstractStrategy*> strategy_map;
QMap<QString, int> position_map;
QString kt_export_dir;
void loadQuantTraderSettings();
void loadTradeStrategySettings();
QList<Bar>* getBars(const QString &instrumentID, const QString &time_frame_str);
QTimer *saveBarTimer;
public:
explicit QuantTrader(QObject *parent = 0);
~QuantTrader();
static QuantTrader *instance;
AbstractIndicator* registerIndicator(const QString &instrumentID, const QString &time_frame_str, QString indicator_name, ...);
signals:
private slots:
void onMarketData(const QString& instrumentID, uint time, double lastPrice, int volume);
void onNewBar(const QString &instrumentID, int time_frame, const Bar& bar);
void resetSaveBarTimer();
};
#endif // QUANT_TRADER_H