-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
149 lines (119 loc) · 3.51 KB
/
main.cpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include <iostream>
#include <string>
#include <vector>
using namespace std;
enum class OrderBookType{bid, ask};
class OrderBookEntry{
public:
OrderBookEntry(double price, double amount, string timestamp, string product, OrderBookType orderType): price(price), amount(amount), timestamp(timestamp), product(product), orderType(orderType) {
// alternate way to create constructors
//instead of using : after the parameters we
// write this-> code inside this curly braces
// this->price = price;
// this->amount = amount;
// this->timestamp = timestamp;
// this->product = product;
// this->orderType = orderType;
}
double price;
double amount;
string timestamp;
string product;
OrderBookType orderType;
};
void printMenu(){
cout<< "1: Print Help\n";
cout << "2: Print Exchange Stats\n";
cout << "3: Make an offer\n";
cout << "4: Make a bid\n";
cout << "5: Print Wallet\n";
cout << "6: Continue\n";
cout << "==================\n";
};
int getUserOption(){
cout << "Type in 1-6: \n";
int userOption;
cin >> userOption;
cout << "you chose "<< userOption << "\n";
return userOption;
}
void invalidInput(){
cout<< "Bad Input. Choose 1-6\n";
}
void printHelp(){
cout<< "Help: Your aim is to make money. Analyze the market and make bids and offers. \n";
}
void printMarketStats(){
cout<< "Market Stats: \n";
}
void printOffer(){
cout<< "Make an offer - enter the amount.\n";
}
void enterBid(){
cout<< "Make bid - enter the amount.\n";
}
void printWallet(){
cout<< "Wallet: \n";
}
void goToNextTimeFrame(){
cout<< "Going to next time frame.\n";
}
void processUserOption(int userOption){
if (userOption==0){
invalidInput();
};
if (userOption==1){
printHelp();
};
if (userOption==2){
printMarketStats();
};
if (userOption==3){
printOffer();
};
if (userOption==4){
enterBid();
};
if (userOption==5){
printWallet();
};
if (userOption==6){
goToNextTimeFrame();
};
}
int main (){
double price = 0.48;
double amount = 0.03123456;
string timestamp{"2021/04/24 22:10:40.345678"};
string product{"BTC/USDT"};
// string orderType{"anything"};
//This enum will make sure of order of only type
//2 type: bid, ask;
OrderBookType orderType = OrderBookType::bid;
vector<double> prices;
vector<double> amounts;
vector<string> timestamps;
vector<string> products;
vector<OrderBookType> orderTypes;
prices.push_back(5000.01);
amounts.push_back(0.001);
timestamps.push_back("2021/04/24 22:10:40.345678");
products.push_back("BTC/USDT");
orderTypes.push_back(OrderBookType::bid);
cout<< "prices"<< prices[0]<< "\n";
cout<< "prices"<< prices[1]<< "\n";
while(true){
printMenu();
int userOption = getUserOption();
processUserOption(userOption);
if (userOption==0){
break;
};
};
OrderBookEntry order1{1000, 0.002f, "2021/04/24 22:10:40.345678", "BTC/USDT", OrderBookType::bid};
cout<< "price: "<< order1.price<< "\n";
cout<< "amount: "<< order1.amount<< "\n";
cout<< "timestamp: "<< order1.timestamp<< "\n";
cout<< "product: "<< order1.product<< "\n";
return 0;
}