-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbid.py
35 lines (29 loc) · 881 Bytes
/
bid.py
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
"""
This file contains the Bid class which handles the storage and retrieval of bid data.
"""
class Bid:
def __init__(self):
self.bids = {}
def add_bid(self, name, bid_power, bid_price, bid_type):
self.bids[name] = {
"bid_power": bid_power,
"bid_price": bid_price,
"bid_type": bid_type,
}
def get_bids(self):
return self.bids
def clear_bids(self):
self.bids = {}
def bids_to_list(self):
return [
{
"name": name,
"bid_power": bid["bid_power"],
"bid_price": bid["bid_price"],
"bid_type": bid["bid_type"],
"accepted_volume": 0,
"remaining_volume": bid["bid_power"],
"profit": 0,
}
for name, bid in self.bids.items()
]