-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
51 lines (39 loc) · 1.33 KB
/
app.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
from account_data_retriever import AccountDataRetriever
from flask import Flask, render_template
from webpage_data_refresher import WebpageDataRefresher
from trader import Trader
import csv
T = Trader()
data = T.create_market_order_data("AMD", 5, "buy", "market", "day")
#T.place_order(data)
app = Flask(__name__)
def ticker_dict():
company_industry = {}
with open('symbols.csv', 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
company_industry[row[1]] = row[2].replace(' ','_')
return company_industry
@app.route("/")
def index():
WDR = WebpageDataRefresher()
WDR.create_site_html()
stocks = WDR.positions
sorted_by_plpc = WDR.plpc_sorted_holdings
ADR = AccountDataRetriever()
cats = ADR.get_cats()
return render_template('index.html', stocks=stocks, plpc_sorted=sorted_by_plpc, cats=cats)
@app.route("/portfolio")
def generate_portfolio_page():
WDR = WebpageDataRefresher()
WDR.create_portfolio_page()
ADR = AccountDataRetriever()
header = ["${:,.2f}".format(ADR.get_stock_equity()) ]
holdings = ADR.formatted_positions
cats = ADR.get_cats()
return render_template('portfolio.html', header=header, holdings=holdings, cats=cats)
@app.route("/contact")
def generate_contact_page():
return render_template('contact.html')
if __name__ == "__main__":
app.run(host="localhost", debug=True)