-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathordersystem.h
50 lines (40 loc) · 1.17 KB
/
ordersystem.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
#ifndef ORDERSYSTEM_H
#define ORDERSYSTEM_H
#include <QSet>
#include <QHash>
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <QByteArray>
#include <QJsonValue>
#include <QJsonObject>
#include <QJsonDocument>
#include "aes.h"
#include "stockbox.h"
#include "datastruct.h"
#define RAKUTEN_PASSPHRASE "TRex+"
class OrderSystem : public QObject
{
Q_OBJECT
public:
explicit OrderSystem(QObject *parent = nullptr);
void order(QString action, OrderStatus info, int qty, double price);
signals:
void sendOrderResult(OrderResult result);
void log(QString msg);
public slots:
// StockBox
void requestDone(QNetworkReply *reply);
void receiveOrder(QString action, int id, QString code, QString name, int qty, double price, int triggerSize);
// Mainwindow
void changeRakutenInfo(RakutenInfo info);
private:
AES* aes;
RakutenInfo info;
QNetworkRequest networkRequest;
QNetworkAccessManager* networkManager;
QHash<QString, QSet<StockBox*>> codeToStockBoxes;
QHash<StockBox*, OrderStatus> stockBoxToOrderStatus;
QByteArray requestData(QString odrSide, QString mrktsym, int qty, double price);
};
#endif // ORDERSYSTEM_H