-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWallet.h
66 lines (57 loc) · 1.9 KB
/
Wallet.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <string>
#include <map>
#include "OrderBookEntry.h"
class Wallet
{
public:
Wallet();
/**
* Insert a specified amount of a currency into the wallet.
*
* @param currency the type of currency to insert
* @param amount the amount of currency to insert
*
* @return void
*
* @throws std::exception if the amount is less than 0
*/
void insertCurrency(std::string currency, double amount);
/**
* Removes the specified amount of the given currency from the wallet.
*
* @param currency the currency to be removed
* @param amount the amount to be removed
*
* @return true if the currency was successfully removed, false otherwise
*
* @throws std::exception if the amount is less than 0
*/
bool removeCurrency(std::string currency, double amount);
/**
* Check if the wallet contains the specified currency with the given amount.
*
* @param currency the currency to check for
* @param amount the amount of the currency
*
* @return true if the wallet contains the specified currency with the given amount, false otherwise
*/
bool containsCurrency(std::string currency, double amount);
/**
* Converts the Wallet object to a string representation.
*
* @return the string representation of the Wallet
*/
std::string toString();
/**
* Check if the wallet can fulfill the given order.
*
* @param order The order to be checked
*
* @return True if the wallet can fulfill the order, false otherwise
*/
bool canFullfillOrder(OrderBookEntry order);
void processSale(OrderBookEntry& sale);
private:
std::map<std::string, double> currencies;
};