-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathohlcmain.py
63 lines (56 loc) · 2.05 KB
/
ohlcmain.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
import json_to_csv as jc
import plotly.graph_objects as go
import pandas as pd
import plotly.express as px
import streamlit as st
import company_gen as cg
import graph_gen as gg
import pyEX as p
import api
jc.conv()
st.title("OHLC Chart Engine")
c = p.Client(api_token=api.IEX_API_TOKEN, version='stable')
x = st.text_input("Enter Company Symbol ")
file1 = open("MyFile.txt", "a")
file1.write(x)
file1.write("\n")
file1.close()
if len(x) != 0:
x = x.upper()
count = cg.symbol_gen(x)
if(count == 0):
st.write("NO COMAPNY FOUND!")
else:
file2 = open("Myfile.txt", "r")
content_list = file2.read()
content_list = content_list.split("\n")
content_list = list(set(content_list))
st.selectbox('Search History', content_list)
original_list = ['Candle', 'OHLC', 'Vertex Line',
'Colored Bar', 'Hollow Candlestick']
result = st.selectbox('Select a graph type', original_list)
if len(result) != 0:
if(result == "Candle"):
fig = gg.candle_gen()
st.plotly_chart(fig)
elif(result == "OHLC"):
fig = gg.ohlc_gen()
st.plotly_chart(fig)
elif(result == "Colored Bar"):
fig = gg.colored_bar()
st.plotly_chart(fig)
elif(result == "Vertex Line"):
fig = gg.vertex_line()
st.plotly_chart(fig)
elif(result == "Hollow Candlestick"):
fig = gg.hollow_gen()
st.plotly_chart(fig)
company_data_symbol = st.sidebar.text_input(
"Want to know more about a company?")
if len(company_data_symbol) != 0:
d = c.company(symbol=company_data_symbol)
st.sidebar.write("Company Name - " + d['companyName'])
st.sidebar.write("Web - " + d['website'])
st.sidebar.write("Primary Exchange - " + d['exchange'])
st.sidebar.write("CEO - " + d['CEO'])
st.sidebar.write("Address - " + d['city'] + ", " + d['country'])