-
Notifications
You must be signed in to change notification settings - Fork 0
/
order_service.py
55 lines (48 loc) · 1.37 KB
/
order_service.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
import json
import glob
import sys
import pandas as pd
from utility import get_data_path, format_date
from order import Order
class OrderService:
@classmethod
def load_orders(cls):
path = get_data_path()
all_files = glob.glob(path + "/*.csv")
if len(all_files) == 0:
print("No Files Found!!! please add files in (data/reports) to continue...")
sys.exit(0)
data = pd.concat(map(pd.read_csv, all_files))
data_json = json.loads(data.to_json(orient = 'records'))
order_list = []
for each_stock in data_json:
trade_date = format_date(each_stock['trade_date'])
order = Order(each_stock['symbol'],each_stock['series'],each_stock['quantity'], each_stock['price'], each_stock['trade_type'], trade_date)
order_list.append(order)
return order_list
"""
save order.
input: order object
"""
def save_order(self, order):
pass
"""
get list of orders by trade_type
"""
def get_orders(self):
pass
"""
get list of orders by symbol
"""
def get_orders_by_symbol(self, symbol):
pass
"""
get list of orders by trade_date
"""
def get_orders_by_date(self, series):
pass
"""
get list of orders by series
"""
def get_orders_by_series(self, series):
pass