-
Notifications
You must be signed in to change notification settings - Fork 1
/
datasystem.h
42 lines (35 loc) · 1023 Bytes
/
datasystem.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
#ifndef DATASYSTEM_H
#define DATASYSTEM_H
#include <QMap>
#include <QHash>
#include <QString>
#include <QObject>
#include <QtDebug>
#include "ddecomm.h"
#include "stockbox.h"
#include "datastruct.h"
class DataSystem : public QObject
{
Q_OBJECT
public:
explicit DataSystem(QObject *parent = nullptr);
bool startAdvise(QString code);
bool stopAdvise(QString code);
public slots:
// Slots for StockBox
void subscribe(StockBox* stockBox, QString code);
void unsubscribe(StockBox* stockBox, QString code);
// Slots for DdeComm
void receiveData(QString code, QString item, QString value);
signals:
void log(QString msg);
void update(QString code, StockData data);
private:
DdeComm* dde;
unsigned long long conversationMY;
unsigned long long conversationMD;
QHash<QString, StockData> codeToStockData;
QHash<QString, QMap<StockBox*,unsigned int>> codeToStockBoxes;
QStringList itemsIndex = { "bid", "ask", "bidsize", "asksize" };
};
#endif // DATASYSTEM_H