-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
35 lines (27 loc) · 992 Bytes
/
main.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
import multiprocessing
import alpaca_trade_api as trade_api
import uvicorn
import searcher
from app import get_api
from src.database import create_db, populate_db
from variables import variables as vb
def process_one():
api = trade_api.REST(vb.api_key, vb.secret_key, vb.base_url)
create_db.drop_db(vb.host, vb.user, vb.password)
create_db.create_db(vb.host, vb.user, vb.password)
connection = create_db.connect(vb.host, vb.user, vb.password, vb.database, vb.port)
create_db.create_tables(connection)
populate_db.populate_stock(connection, api)
populate_db.populate_stock_price(connection, api)
populate_db.populate_strategies(connection)
searcher.schedule_api()
def process_two():
app = get_api()
uvicorn.run(app, host="localhost", port=8000)
if __name__ == '__main__':
# p1 = multiprocessing.Process(target=process_one)
# p2 = multiprocessing.Process(target=process_two)
#
# #p1.start()
# p2.start()
process_two()