-
Notifications
You must be signed in to change notification settings - Fork 0
/
MerkelMain.cpp
122 lines (102 loc) · 2.62 KB
/
MerkelMain.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
#include "MerkelMain.h"
#include <iostream>
#include <vector>
#include "OrderBookEntry.h"
MerkelMain::MerkelMain() {}
void MerkelMain::init()
{
LoadOrderBook();
int input;
while (true)
{
input = getUserOption();
processUserOption(input);
}
};
void MerkelMain::LoadOrderBook()
{
orders.push_back(OrderBookEntry{10000, 0.002, "2020/03/17 17:01:24.884492", "BTC/USDT", OrderBookType::bid});
orders.push_back(OrderBookEntry{5323.83418, 0.001, "2020/03/17 17:01:24.884492", "BTC/USDT", OrderBookType::bid});
orders.push_back(OrderBookEntry{5000, 0.002, "2020/03/17 17:01:29.884492", "BTC/USDT", OrderBookType::bid});
}
void MerkelMain::printMenu()
{
// 1 print help
std::cout << "1: Print help " << std::endl;
// 2 print exchange stats
std::cout << "2: Print exchange stats " << std::endl;
// 3 make an offer
std::cout << "3: Make an offer " << std::endl;
// 4 make a bid
std::cout << "4: Make a bid " << std::endl;
// 5 print wallet
std::cout << "5: Print wallet " << std::endl;
// 6 continue
std::cout << "6: Continue " << std::endl;
std::cout << "===============" << std::endl;
}
// get input from user and return the input
int MerkelMain::getUserOption()
{
int userOption;
std::cout << "Type in 1-6" << std::endl;
std::cin >> userOption;
std::cout << "You chose: " << userOption << std::endl;
return userOption;
}
void MerkelMain::printHelp()
{
std::cout << "Help - your aim is to make money. Analyze the market and make bids." << std::endl;
}
void MerkelMain::printMarketStats()
{
std::cout << "OrderBook contains : " << orders.size() << " entries." << std::endl;
}
void MerkelMain::enterOffer()
{
std::cout << "Make and offer - enter the amount" << std::endl;
}
void MerkelMain::enterBid()
{
std::cout << "Make a bid - enter the amount" << std::endl;
}
void MerkelMain::printWallet()
{
std::cout << "Your wallet is empty. " << std::endl;
}
void MerkelMain::gotoNextTimeframe()
{
std::cout << "Going to the next time frame. " << std::endl;
}
// takes the userinput and print message accordingly
void MerkelMain::processUserOption(int userOption)
{
if (userOption == 0)
{
std::cout << "Invalid choice. Choose 1-6" << std::endl;
}
if (userOption == 1)
{
printHelp();
}
if (userOption == 2)
{
printMarketStats();
}
if (userOption == 3)
{
enterOffer();
}
if (userOption == 4)
{
enterBid();
}
if (userOption == 5)
{
printWallet();
}
if (userOption == 6)
{
gotoNextTimeframe();
}
}