Kelsey Sterner commited on
Commit
004b923
1 Parent(s): 42b9a99
Files changed (3) hide show
  1. README.md +1 -1
  2. dviApp.py +143 -0
  3. requirements.txt +7 -0
README.md CHANGED
@@ -8,5 +8,5 @@ sdk_version: 1.28.2
8
  app_file: app.py
9
  pinned: false
10
  ---
11
-
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
8
  app_file: app.py
9
  pinned: false
10
  ---
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
12
+ Dvi
dviApp.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import streamlit as st
3
+ import numpy as np
4
+ from streamlit_card import card
5
+ import yfinance as yf
6
+ import altair as alt
7
+
8
+ # Set the background color and opacity for the container
9
+ container_style = """
10
+ background-color: rgba(55, 65, 82, 0.7);
11
+ padding: 100px;
12
+ border-radius: 10px;
13
+ margin-top: 20px;
14
+ margin-bottom: 20px;
15
+ """
16
+
17
+ st.markdown("<h1 style='text-align: center;'>Volatility Indicator</h1>", unsafe_allow_html=True)
18
+ st.write(""" ### Economic Volitility Examination""")
19
+ # Create a translucent container
20
+ x = card(title="", text = "When we talk about stock volitility, we typically need fundamental data like company earning reports, interest rates, and technical analysis trends",
21
+ styles = {
22
+ "card": {
23
+ "width": "650px",
24
+ "height": "200px",
25
+ "background-color": "rgba(55, 65, 82, 1)",
26
+ "padding": "20px",
27
+ "margin-top": "20px",
28
+ #"margin-bottom": "20px",
29
+ },
30
+
31
+ }
32
+
33
+ )
34
+
35
+
36
+ # Download historical stock data for Tesla
37
+ ticker = "TSLA"
38
+ start_date = "2021-09-29"
39
+ end_date = "2022-09-29"
40
+
41
+ stock_data = yf.download(ticker, start=start_date, end=end_date)
42
+
43
+
44
+
45
+ # Calculate daily returns
46
+ stock_data["Daily_Return"] = stock_data["Close"].pct_change()
47
+
48
+ # Calculate historical volatility (standard deviation)
49
+ historical_volatility = stock_data["Daily_Return"].std()
50
+
51
+ # Streamlit app
52
+ st.markdown("<h1 style='text-align: center;'>Tesla Stock Volatility Analysis</h1>", unsafe_allow_html=True)
53
+
54
+
55
+ # Display historical stock data
56
+ st.subheader("Historical Stock Data")
57
+ st.write(stock_data)
58
+
59
+
60
+
61
+ stock_data = yf.download(ticker, start=start_date, end=end_date)
62
+
63
+ # Calculate daily returns
64
+ stock_data["Daily_Return"] = ((stock_data["Close"] / stock_data["Open"]) - 1)
65
+ notable = []
66
+ days = []
67
+ for day in stock_data["Daily_Return"]:
68
+ if day > 0.1:
69
+ notable.append(day)
70
+ days.append("Date")
71
+ elif day < -0.1:
72
+ notable.append(day)
73
+ days.append("Date")
74
+
75
+
76
+
77
+
78
+ # Line chart for stock prices
79
+ st.subheader("Tesla Stock Prices Over Time")
80
+ line_chart = alt.Chart(stock_data.reset_index()).mark_line().encode(
81
+ x="Date:T",
82
+ y="Daily_Return",
83
+ tooltip=["Date", "Daily_Return"]
84
+ ).properties(width=800, height=400)
85
+ st.altair_chart(line_chart, use_container_width=True)
86
+
87
+ st.write("2021-11-09 00:00:00: \"Telsa fire in Stanford took 42 minutes to extinguish\" ")
88
+ st.write("2022-01-27 00:00:00: \"Tesla drops more than 11% as investors digest new vehicle delays\"")
89
+ st.write("2022-02-23 00:00:00: \"Tesla model Y wins EV award\"")
90
+ st.write("2022-04-26 00:00:00: \"Elon Musk says people might download their personalities onto a human robot constructed by Tesla\"")
91
+
92
+
93
+ st.markdown("<h1 style='text-align: center;'>Our Approach</h1>", unsafe_allow_html=True)
94
+
95
+ x = card(title="",
96
+ text = "How can we predict the potential social impact on stock volitility? Qualitative tabular data poses a challenge concerning data processing resources",
97
+ styles = {
98
+ "card": {
99
+ "width": "650px",
100
+ "height": "200px",
101
+ "background-color": "rgba(55, 65, 82, 1)",
102
+ "padding": "50px",
103
+ "margin-top": "10px",
104
+ "margin-bottom": "10px",
105
+ },
106
+
107
+ }
108
+
109
+ )
110
+ st.write("")
111
+
112
+
113
+ # Streamlit app
114
+ st.title('First Model')
115
+ model1 = card(title="",
116
+ text = "",
117
+ styles = {
118
+ "card": {
119
+ "width": "650px",
120
+ "height": "200px",
121
+ "margin-top": "10px",
122
+ "margin-bottom": "10px",
123
+ },
124
+ },
125
+ image="https://i.postimg.cc/Bn8q0Ddy/XBoost.png",
126
+ on_click=lambda: st.write("The model generating embeddings represent the data in the prompt. Each embedding captures an immense amount of training data that is then used to project desired data")
127
+
128
+ )
129
+ st.title('Second Model')
130
+ mod2 = card(title="",
131
+ text = "",
132
+ styles = {
133
+ "card": {
134
+ "width": "700px",
135
+ "height": "400px",
136
+ "margin-top": "20px",
137
+ "margin-bottom": "20px",
138
+ }
139
+ },
140
+ image="https://miro.medium.com/v2/resize:fit:976/1*oc1gaCFvgWXq_gHQFM63UQ.png",
141
+ on_click=lambda: st.write("A neural network learns to map input data to output by adjusting the strengths of connections (weights) between nodes during a training process. This enables the network to recognize patterns and make predictions on new data.")
142
+
143
+ )
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ pandas
2
+ streamlit
3
+ numpy
4
+ streamlit_card
5
+ yfinance
6
+ altair
7
+ markdownlit