-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWallet.h
31 lines (26 loc) · 963 Bytes
/
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
#pragma once
#include <string>
#include <map>
#include "OrderBookEntry.h"
class Wallet
{
public:
Wallet();
friend std::ostream& operator<<(std::ostream& os, Wallet& wallet);
/** insert currency to the wallet */
void insertCurrency(std::string type, double amount);
/** remove currency from the wallet */
bool removeCurrency(std::string type, double amount);
/** check if the wallet contains this much currency or more */
bool containsCurrency(std::string type, double amount);
/** checks if the wallet can cope with this ask or bid.*/
bool canFulfillOrder(OrderBookEntry order);
/** update the contents of the wallet
* assumes the order was made by the owner of the wallet
*/
void processSale(OrderBookEntry& sale);
/** generate a string representation of the wallet */
std::string toString();
private:
std::map<std::string,double> currencies;
};