-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.py
68 lines (57 loc) · 1.73 KB
/
order.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
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
import uuid
from enum import Enum, unique
@unique
class SideOrder(Enum):
BUY = "buy"
SELL = "sell"
class MarketOrder:
pass
class Order:
def __init__(self, trader_id, ticker, side, price, volume):
self.id = uuid.uuid4()
self.trader_id = trader_id
self.ticker = ticker
self.side = side
self.price = price
self.volume = volume
def __repr__(self):
msg = "Order{id: " \
+ str(self.id) \
+ ",trader id: " \
+ str(self.trader_id) \
+ ",self.ticker: " \
+ str(self.ticker) \
+ ",side: " \
+ str(self.side) \
+ ",price: " \
+ str(self.price) \
+ ",volume: " \
+ str(self.volume) \
+ "}"
return msg
class RealizedOrder:
def __init__(self, trader_origin, trader_destiny, ticker, order_type, price, volume):
self.id = uuid.uuid4()
self.trader_origin = trader_origin
self.trader_destiny = trader_destiny
self.ticker = ticker
self.order_type = order_type
self.price = price
self.volume = volume
def __repr__(self):
msg = "RealizedOrder{id: " \
+ str(self.id) \
+ ",trader origin id: " \
+ str(self.trader_origin) \
+ ",trader destiny id: " \
+ str(self.trader_destiny) \
+ ",ticker: " \
+ str(self.ticker) \
+ ",order_ticker: " \
+ str(self.order_type) \
+ ",order_price: " \
+ str(self.price) \
+ ",volume: " \
+ str(self.volume) \
+ "}"
return msg