Sarat Chandra commited on
Commit
48eb4b5
1 Parent(s): 175957c

intial commit

Browse files
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a Python base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /code
6
+
7
+ # Copy the required files to the working directory
8
+ COPY app.py .
9
+ COPY ./templates/index.html /code/templates/index.html
10
+ COPY ./requirements.txt /code/requirements.txt
11
+
12
+ # Install the required packages
13
+ RUN pip install --no-cache-dir -r /code/requirements.txt
14
+
15
+ # Expose the port that the Flask app will run on
16
+ EXPOSE 7860
17
+
18
+ # Start the Flask app
19
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ import plotly.graph_objs as go
3
+ from transformers import pipeline
4
+ import yfinance as yf
5
+ import requests
6
+ from newspaper import Article
7
+ from newspaper import Config
8
+ from bs4 import BeautifulSoup
9
+ from datetime import datetime, timedelta
10
+
11
+ app = Flask(__name__)
12
+
13
+ # Set up sentiment analysis and summarization pipelines
14
+ sentiment_analysis_pipeline = pipeline("sentiment-analysis",model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
15
+ summarization_pipeline = pipeline("summarization")
16
+
17
+ # News API setup
18
+ def get_news_articles_info(ticker_name):
19
+ # URL of the search results page
20
+ url = "https://www.marketwatch.com/search?q=" + ticker_name + "&ts=0&tab=All%20News"
21
+
22
+ # Send an HTTP GET request to the URL
23
+ response = requests.get(url)
24
+
25
+ # Parse the HTML content using BeautifulSoup
26
+ soup = BeautifulSoup(response.content, "html.parser")
27
+
28
+ article_links = []
29
+
30
+ for content in soup.find_all("h3",class_="article__headline"):
31
+ for link in content.find_all("a"):
32
+ if link['href'] != "#":
33
+ article_links.append(link['href'])
34
+
35
+ article_links = article_links[18:36]
36
+ ticker_news_extracted = []
37
+ count = 0
38
+ for link in article_links:
39
+ article_info = {}
40
+ article_info['text'] = ''
41
+ article_info['url'] = link
42
+ try:
43
+ url = article_info['url']
44
+ url = requests.head(url, allow_redirects=True).url
45
+
46
+ user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
47
+ config = Config()
48
+ config.browser_user_agent = user_agent
49
+
50
+ article = Article(url, config=config)
51
+ article.download()
52
+ article.parse()
53
+ article_info['title'] = article.title
54
+ article_info['text'] = article.text
55
+ article_info['url'] = url
56
+ count = count + 1
57
+ print(count,url)
58
+ except Exception as error:
59
+ print("Error",url,error)
60
+ continue
61
+ if article_info['text'] == '':
62
+ print('No text',url)
63
+ continue
64
+ if count > 5:
65
+ break
66
+ ticker_news_extracted.append(article_info)
67
+ return ticker_news_extracted
68
+
69
+ @app.route("/", methods=["GET", "POST"])
70
+ def index():
71
+ if request.method == "POST":
72
+ ticker = request.form["ticker"]
73
+
74
+ # Get top 5 news articles for the given ticker
75
+ search_results = get_news_articles_info(ticker_name=ticker)
76
+ articles = search_results[:5]
77
+
78
+ print("Getting the info finished")
79
+
80
+ news_data = []
81
+
82
+ for article in articles:
83
+ title = article['title']
84
+ link = article['url']
85
+ content = article['text']
86
+
87
+ # Perform sentiment analysis on article content
88
+ sentiment = sentiment_analysis_pipeline(content)[0]
89
+
90
+ # Summarize article content
91
+ summary = summarization_pipeline(content, max_length=100, min_length=30, do_sample=False)[0]["summary_text"]
92
+
93
+ news_data.append({
94
+ "title": title,
95
+ "link": link,
96
+ "sentiment": sentiment["label"],
97
+ "sentiment_score": round(sentiment["score"],3),
98
+ "summary": summary
99
+ })
100
+
101
+ print(link)
102
+
103
+ # Define the stock ticker symbol and the date range
104
+ ticker_symbol = ticker # Example: Apple Inc.
105
+ end_date = datetime.today()
106
+ start_date = end_date - timedelta(days=90)
107
+
108
+ # Fetch historical data using yfinance
109
+ data = yf.download(ticker_symbol, start=start_date, end=end_date)
110
+
111
+ # Create a candlestick graph using Plotly
112
+ fig = go.Figure(data=[go.Candlestick(x=data.index,
113
+ open=data['Open'],
114
+ high=data['High'],
115
+ low=data['Low'],
116
+ close=data['Close'])])
117
+
118
+ # Customize the layout
119
+ fig.update_layout(title=f'Candlestick Chart for {ticker_symbol} in the Last 90 Days',
120
+ xaxis_title='Date',
121
+ yaxis_title='Price',
122
+ xaxis_rangeslider_visible=False)
123
+
124
+ # convert the fig to HTML DIV element
125
+ graph_html = fig.to_html(full_html=False)
126
+
127
+ return render_template("index.html", news_data=news_data, candlestick_graph=graph_html)
128
+
129
+ return render_template("index.html")
130
+
131
+ if __name__ == "__main__":
132
+ app.run(host='0.0.0.0',port=7860)
candelstick_grpah_test.ipynb ADDED
@@ -0,0 +1,1320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Defaulting to user installation because normal site-packages is not writeable\n",
13
+ "Requirement already satisfied: plotly in /Users/sarat/Library/Python/3.9/lib/python/site-packages (5.16.1)\n",
14
+ "Requirement already satisfied: nbformat in /Users/sarat/Library/Python/3.9/lib/python/site-packages (5.9.2)\n",
15
+ "Requirement already satisfied: tenacity>=6.2.0 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from plotly) (8.2.3)\n",
16
+ "Requirement already satisfied: packaging in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from plotly) (23.1)\n",
17
+ "Requirement already satisfied: fastjsonschema in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (2.18.0)\n",
18
+ "Requirement already satisfied: jsonschema>=2.6 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (4.19.0)\n",
19
+ "Requirement already satisfied: jupyter-core in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (5.3.1)\n",
20
+ "Requirement already satisfied: traitlets>=5.1 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (5.9.0)\n",
21
+ "Requirement already satisfied: attrs>=22.2.0 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (23.1.0)\n",
22
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (2023.7.1)\n",
23
+ "Requirement already satisfied: referencing>=0.28.4 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (0.30.2)\n",
24
+ "Requirement already satisfied: rpds-py>=0.7.1 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (0.9.2)\n",
25
+ "Requirement already satisfied: platformdirs>=2.5 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jupyter-core->nbformat) (3.10.0)\n"
26
+ ]
27
+ }
28
+ ],
29
+ "source": [
30
+ "!pip install --upgrade plotly nbformat"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": 2,
36
+ "metadata": {},
37
+ "outputs": [
38
+ {
39
+ "name": "stdout",
40
+ "output_type": "stream",
41
+ "text": [
42
+ "Files removed: 2\n"
43
+ ]
44
+ }
45
+ ],
46
+ "source": [
47
+ "!pip cache purge"
48
+ ]
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": 3,
53
+ "metadata": {},
54
+ "outputs": [
55
+ {
56
+ "name": "stdout",
57
+ "output_type": "stream",
58
+ "text": [
59
+ "Defaulting to user installation because normal site-packages is not writeable\n",
60
+ "Requirement already satisfied: nbformat in /Users/sarat/Library/Python/3.9/lib/python/site-packages (5.9.2)\n",
61
+ "Requirement already satisfied: fastjsonschema in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (2.18.0)\n",
62
+ "Requirement already satisfied: jsonschema>=2.6 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (4.19.0)\n",
63
+ "Requirement already satisfied: jupyter-core in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (5.3.1)\n",
64
+ "Requirement already satisfied: traitlets>=5.1 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from nbformat) (5.9.0)\n",
65
+ "Requirement already satisfied: attrs>=22.2.0 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (23.1.0)\n",
66
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (2023.7.1)\n",
67
+ "Requirement already satisfied: referencing>=0.28.4 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (0.30.2)\n",
68
+ "Requirement already satisfied: rpds-py>=0.7.1 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jsonschema>=2.6->nbformat) (0.9.2)\n",
69
+ "Requirement already satisfied: platformdirs>=2.5 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from jupyter-core->nbformat) (3.10.0)\n"
70
+ ]
71
+ }
72
+ ],
73
+ "source": [
74
+ "!pip install --upgrade nbformat"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": 4,
80
+ "metadata": {},
81
+ "outputs": [
82
+ {
83
+ "name": "stdout",
84
+ "output_type": "stream",
85
+ "text": [
86
+ "[*********************100%***********************] 1 of 1 completed\n"
87
+ ]
88
+ },
89
+ {
90
+ "data": {
91
+ "application/vnd.plotly.v1+json": {
92
+ "config": {
93
+ "plotlyServerURL": "https://plot.ly"
94
+ },
95
+ "data": [
96
+ {
97
+ "close": [
98
+ 174.1999969482422,
99
+ 171.55999755859375,
100
+ 171.83999633789062,
101
+ 172.99000549316406,
102
+ 175.42999267578125,
103
+ 177.3000030517578,
104
+ 177.25,
105
+ 180.08999633789062,
106
+ 180.9499969482422,
107
+ 179.5800018310547,
108
+ 179.2100067138672,
109
+ 177.82000732421875,
110
+ 180.57000732421875,
111
+ 180.9600067138672,
112
+ 183.7899932861328,
113
+ 183.30999755859375,
114
+ 183.9499969482422,
115
+ 186.00999450683594,
116
+ 184.9199981689453,
117
+ 185.00999450683594,
118
+ 183.9600067138672,
119
+ 187,
120
+ 186.67999267578125,
121
+ 185.27000427246094,
122
+ 188.05999755859375,
123
+ 189.25,
124
+ 189.58999633789062,
125
+ 193.97000122070312,
126
+ 192.4600067138672,
127
+ 191.3300018310547,
128
+ 191.80999755859375,
129
+ 190.67999267578125,
130
+ 188.61000061035156,
131
+ 188.0800018310547,
132
+ 189.77000427246094,
133
+ 190.5399932861328,
134
+ 190.69000244140625,
135
+ 193.99000549316406,
136
+ 193.72999572753906,
137
+ 195.10000610351562,
138
+ 193.1300048828125,
139
+ 191.94000244140625,
140
+ 192.75,
141
+ 193.6199951171875,
142
+ 194.5,
143
+ 193.22000122070312,
144
+ 195.8300018310547,
145
+ 196.4499969482422,
146
+ 195.61000061035156,
147
+ 192.5800018310547,
148
+ 191.1699981689453,
149
+ 181.99000549316406,
150
+ 178.85000610351562,
151
+ 179.8000030517578,
152
+ 178.19000244140625,
153
+ 177.97000122070312,
154
+ 177.7899932861328,
155
+ 179.4600067138672,
156
+ 177.4499969482422,
157
+ 176.57000732421875,
158
+ 174,
159
+ 174.49000549316406
160
+ ],
161
+ "high": [
162
+ 174.7100067138672,
163
+ 173.3800048828125,
164
+ 172.4199981689453,
165
+ 173.89999389648438,
166
+ 175.77000427246094,
167
+ 178.99000549316406,
168
+ 179.35000610351562,
169
+ 180.1199951171875,
170
+ 181.77999877929688,
171
+ 184.9499969482422,
172
+ 180.1199951171875,
173
+ 181.2100067138672,
174
+ 180.83999633789062,
175
+ 182.22999572753906,
176
+ 183.88999938964844,
177
+ 184.14999389648438,
178
+ 184.38999938964844,
179
+ 186.52000427246094,
180
+ 186.99000549316406,
181
+ 186.10000610351562,
182
+ 185.41000366210938,
183
+ 187.0500030517578,
184
+ 187.55999755859375,
185
+ 188.0500030517578,
186
+ 188.38999938964844,
187
+ 189.89999389648438,
188
+ 190.07000732421875,
189
+ 194.47999572753906,
190
+ 193.8800048828125,
191
+ 192.97999572753906,
192
+ 192.02000427246094,
193
+ 192.6699981689453,
194
+ 189.99000549316406,
195
+ 189.3000030517578,
196
+ 191.6999969482422,
197
+ 191.19000244140625,
198
+ 191.17999267578125,
199
+ 194.32000732421875,
200
+ 194.3300018310547,
201
+ 198.22999572753906,
202
+ 196.47000122070312,
203
+ 194.97000122070312,
204
+ 194.91000366210938,
205
+ 194.44000244140625,
206
+ 195.63999938964844,
207
+ 197.1999969482422,
208
+ 196.6300048828125,
209
+ 196.49000549316406,
210
+ 196.72999572753906,
211
+ 195.17999267578125,
212
+ 192.3699951171875,
213
+ 187.3800048828125,
214
+ 183.1300048828125,
215
+ 180.27000427246094,
216
+ 180.92999267578125,
217
+ 180.75,
218
+ 178.6199951171875,
219
+ 179.69000244140625,
220
+ 179.47999572753906,
221
+ 178.5399932861328,
222
+ 177.50999450683594,
223
+ 175.10000610351562
224
+ ],
225
+ "low": [
226
+ 173.4499969482422,
227
+ 171.27999877929688,
228
+ 170.52000427246094,
229
+ 171.69000244140625,
230
+ 173.11000061035156,
231
+ 176.57000732421875,
232
+ 176.75999450683594,
233
+ 176.92999267578125,
234
+ 179.25999450683594,
235
+ 178.0399932861328,
236
+ 177.42999267578125,
237
+ 177.32000732421875,
238
+ 177.4600067138672,
239
+ 180.6300048828125,
240
+ 180.97000122070312,
241
+ 182.44000244140625,
242
+ 182.02000427246094,
243
+ 183.77999877929688,
244
+ 184.27000427246094,
245
+ 184.41000366210938,
246
+ 182.58999633789062,
247
+ 183.6699981689453,
248
+ 185.00999450683594,
249
+ 185.22999572753906,
250
+ 185.6699981689453,
251
+ 187.60000610351562,
252
+ 188.94000244140625,
253
+ 191.25999450683594,
254
+ 191.75999450683594,
255
+ 190.6199951171875,
256
+ 189.1999969482422,
257
+ 190.24000549316406,
258
+ 187.0399932861328,
259
+ 186.60000610351562,
260
+ 188.47000122070312,
261
+ 189.77999877929688,
262
+ 189.6300048828125,
263
+ 191.80999755859375,
264
+ 192.4199981689453,
265
+ 192.64999389648438,
266
+ 192.5,
267
+ 191.22999572753906,
268
+ 192.25,
269
+ 192.9199981689453,
270
+ 193.32000732421875,
271
+ 192.5500030517578,
272
+ 194.13999938964844,
273
+ 195.25999450683594,
274
+ 195.27999877929688,
275
+ 191.85000610351562,
276
+ 190.69000244140625,
277
+ 181.9199981689453,
278
+ 177.35000610351562,
279
+ 177.5800018310547,
280
+ 177.00999450683594,
281
+ 177.60000610351562,
282
+ 176.5500030517578,
283
+ 177.30999755859375,
284
+ 177.0500030517578,
285
+ 176.5,
286
+ 173.47999572753906,
287
+ 171.9600067138672
288
+ ],
289
+ "open": [
290
+ 173.97999572753906,
291
+ 173.1300048828125,
292
+ 171.08999633789062,
293
+ 172.41000366210938,
294
+ 173.32000732421875,
295
+ 176.9600067138672,
296
+ 177.3300018310547,
297
+ 177.6999969482422,
298
+ 181.02999877929688,
299
+ 182.6300048828125,
300
+ 179.97000122070312,
301
+ 178.44000244140625,
302
+ 177.89999389648438,
303
+ 181.5,
304
+ 181.27000427246094,
305
+ 182.8000030517578,
306
+ 183.3699951171875,
307
+ 183.9600067138672,
308
+ 186.72999572753906,
309
+ 184.41000366210938,
310
+ 184.89999389648438,
311
+ 183.74000549316406,
312
+ 185.5500030517578,
313
+ 186.8300018310547,
314
+ 185.88999938964844,
315
+ 187.92999267578125,
316
+ 189.0800018310547,
317
+ 191.6300048828125,
318
+ 193.77999877929688,
319
+ 191.57000732421875,
320
+ 189.83999633789062,
321
+ 191.41000366210938,
322
+ 189.25999450683594,
323
+ 189.16000366210938,
324
+ 189.67999267578125,
325
+ 190.5,
326
+ 190.22999572753906,
327
+ 191.89999389648438,
328
+ 193.35000610351562,
329
+ 193.10000610351562,
330
+ 195.08999633789062,
331
+ 194.10000610351562,
332
+ 193.41000366210938,
333
+ 193.3300018310547,
334
+ 193.6699981689453,
335
+ 196.02000427246094,
336
+ 194.6699981689453,
337
+ 196.05999755859375,
338
+ 196.24000549316406,
339
+ 195.0399932861328,
340
+ 191.57000732421875,
341
+ 185.52000427246094,
342
+ 182.1300048828125,
343
+ 179.69000244140625,
344
+ 180.8699951171875,
345
+ 179.47999572753906,
346
+ 177.32000732421875,
347
+ 177.97000122070312,
348
+ 178.8800048828125,
349
+ 177.1300048828125,
350
+ 177.13999938964844,
351
+ 172.3000030517578
352
+ ],
353
+ "type": "candlestick",
354
+ "x": [
355
+ "2023-05-22T00:00:00",
356
+ "2023-05-23T00:00:00",
357
+ "2023-05-24T00:00:00",
358
+ "2023-05-25T00:00:00",
359
+ "2023-05-26T00:00:00",
360
+ "2023-05-30T00:00:00",
361
+ "2023-05-31T00:00:00",
362
+ "2023-06-01T00:00:00",
363
+ "2023-06-02T00:00:00",
364
+ "2023-06-05T00:00:00",
365
+ "2023-06-06T00:00:00",
366
+ "2023-06-07T00:00:00",
367
+ "2023-06-08T00:00:00",
368
+ "2023-06-09T00:00:00",
369
+ "2023-06-12T00:00:00",
370
+ "2023-06-13T00:00:00",
371
+ "2023-06-14T00:00:00",
372
+ "2023-06-15T00:00:00",
373
+ "2023-06-16T00:00:00",
374
+ "2023-06-20T00:00:00",
375
+ "2023-06-21T00:00:00",
376
+ "2023-06-22T00:00:00",
377
+ "2023-06-23T00:00:00",
378
+ "2023-06-26T00:00:00",
379
+ "2023-06-27T00:00:00",
380
+ "2023-06-28T00:00:00",
381
+ "2023-06-29T00:00:00",
382
+ "2023-06-30T00:00:00",
383
+ "2023-07-03T00:00:00",
384
+ "2023-07-05T00:00:00",
385
+ "2023-07-06T00:00:00",
386
+ "2023-07-07T00:00:00",
387
+ "2023-07-10T00:00:00",
388
+ "2023-07-11T00:00:00",
389
+ "2023-07-12T00:00:00",
390
+ "2023-07-13T00:00:00",
391
+ "2023-07-14T00:00:00",
392
+ "2023-07-17T00:00:00",
393
+ "2023-07-18T00:00:00",
394
+ "2023-07-19T00:00:00",
395
+ "2023-07-20T00:00:00",
396
+ "2023-07-21T00:00:00",
397
+ "2023-07-24T00:00:00",
398
+ "2023-07-25T00:00:00",
399
+ "2023-07-26T00:00:00",
400
+ "2023-07-27T00:00:00",
401
+ "2023-07-28T00:00:00",
402
+ "2023-07-31T00:00:00",
403
+ "2023-08-01T00:00:00",
404
+ "2023-08-02T00:00:00",
405
+ "2023-08-03T00:00:00",
406
+ "2023-08-04T00:00:00",
407
+ "2023-08-07T00:00:00",
408
+ "2023-08-08T00:00:00",
409
+ "2023-08-09T00:00:00",
410
+ "2023-08-10T00:00:00",
411
+ "2023-08-11T00:00:00",
412
+ "2023-08-14T00:00:00",
413
+ "2023-08-15T00:00:00",
414
+ "2023-08-16T00:00:00",
415
+ "2023-08-17T00:00:00",
416
+ "2023-08-18T00:00:00"
417
+ ]
418
+ }
419
+ ],
420
+ "layout": {
421
+ "template": {
422
+ "data": {
423
+ "bar": [
424
+ {
425
+ "error_x": {
426
+ "color": "#2a3f5f"
427
+ },
428
+ "error_y": {
429
+ "color": "#2a3f5f"
430
+ },
431
+ "marker": {
432
+ "line": {
433
+ "color": "#E5ECF6",
434
+ "width": 0.5
435
+ },
436
+ "pattern": {
437
+ "fillmode": "overlay",
438
+ "size": 10,
439
+ "solidity": 0.2
440
+ }
441
+ },
442
+ "type": "bar"
443
+ }
444
+ ],
445
+ "barpolar": [
446
+ {
447
+ "marker": {
448
+ "line": {
449
+ "color": "#E5ECF6",
450
+ "width": 0.5
451
+ },
452
+ "pattern": {
453
+ "fillmode": "overlay",
454
+ "size": 10,
455
+ "solidity": 0.2
456
+ }
457
+ },
458
+ "type": "barpolar"
459
+ }
460
+ ],
461
+ "carpet": [
462
+ {
463
+ "aaxis": {
464
+ "endlinecolor": "#2a3f5f",
465
+ "gridcolor": "white",
466
+ "linecolor": "white",
467
+ "minorgridcolor": "white",
468
+ "startlinecolor": "#2a3f5f"
469
+ },
470
+ "baxis": {
471
+ "endlinecolor": "#2a3f5f",
472
+ "gridcolor": "white",
473
+ "linecolor": "white",
474
+ "minorgridcolor": "white",
475
+ "startlinecolor": "#2a3f5f"
476
+ },
477
+ "type": "carpet"
478
+ }
479
+ ],
480
+ "choropleth": [
481
+ {
482
+ "colorbar": {
483
+ "outlinewidth": 0,
484
+ "ticks": ""
485
+ },
486
+ "type": "choropleth"
487
+ }
488
+ ],
489
+ "contour": [
490
+ {
491
+ "colorbar": {
492
+ "outlinewidth": 0,
493
+ "ticks": ""
494
+ },
495
+ "colorscale": [
496
+ [
497
+ 0,
498
+ "#0d0887"
499
+ ],
500
+ [
501
+ 0.1111111111111111,
502
+ "#46039f"
503
+ ],
504
+ [
505
+ 0.2222222222222222,
506
+ "#7201a8"
507
+ ],
508
+ [
509
+ 0.3333333333333333,
510
+ "#9c179e"
511
+ ],
512
+ [
513
+ 0.4444444444444444,
514
+ "#bd3786"
515
+ ],
516
+ [
517
+ 0.5555555555555556,
518
+ "#d8576b"
519
+ ],
520
+ [
521
+ 0.6666666666666666,
522
+ "#ed7953"
523
+ ],
524
+ [
525
+ 0.7777777777777778,
526
+ "#fb9f3a"
527
+ ],
528
+ [
529
+ 0.8888888888888888,
530
+ "#fdca26"
531
+ ],
532
+ [
533
+ 1,
534
+ "#f0f921"
535
+ ]
536
+ ],
537
+ "type": "contour"
538
+ }
539
+ ],
540
+ "contourcarpet": [
541
+ {
542
+ "colorbar": {
543
+ "outlinewidth": 0,
544
+ "ticks": ""
545
+ },
546
+ "type": "contourcarpet"
547
+ }
548
+ ],
549
+ "heatmap": [
550
+ {
551
+ "colorbar": {
552
+ "outlinewidth": 0,
553
+ "ticks": ""
554
+ },
555
+ "colorscale": [
556
+ [
557
+ 0,
558
+ "#0d0887"
559
+ ],
560
+ [
561
+ 0.1111111111111111,
562
+ "#46039f"
563
+ ],
564
+ [
565
+ 0.2222222222222222,
566
+ "#7201a8"
567
+ ],
568
+ [
569
+ 0.3333333333333333,
570
+ "#9c179e"
571
+ ],
572
+ [
573
+ 0.4444444444444444,
574
+ "#bd3786"
575
+ ],
576
+ [
577
+ 0.5555555555555556,
578
+ "#d8576b"
579
+ ],
580
+ [
581
+ 0.6666666666666666,
582
+ "#ed7953"
583
+ ],
584
+ [
585
+ 0.7777777777777778,
586
+ "#fb9f3a"
587
+ ],
588
+ [
589
+ 0.8888888888888888,
590
+ "#fdca26"
591
+ ],
592
+ [
593
+ 1,
594
+ "#f0f921"
595
+ ]
596
+ ],
597
+ "type": "heatmap"
598
+ }
599
+ ],
600
+ "heatmapgl": [
601
+ {
602
+ "colorbar": {
603
+ "outlinewidth": 0,
604
+ "ticks": ""
605
+ },
606
+ "colorscale": [
607
+ [
608
+ 0,
609
+ "#0d0887"
610
+ ],
611
+ [
612
+ 0.1111111111111111,
613
+ "#46039f"
614
+ ],
615
+ [
616
+ 0.2222222222222222,
617
+ "#7201a8"
618
+ ],
619
+ [
620
+ 0.3333333333333333,
621
+ "#9c179e"
622
+ ],
623
+ [
624
+ 0.4444444444444444,
625
+ "#bd3786"
626
+ ],
627
+ [
628
+ 0.5555555555555556,
629
+ "#d8576b"
630
+ ],
631
+ [
632
+ 0.6666666666666666,
633
+ "#ed7953"
634
+ ],
635
+ [
636
+ 0.7777777777777778,
637
+ "#fb9f3a"
638
+ ],
639
+ [
640
+ 0.8888888888888888,
641
+ "#fdca26"
642
+ ],
643
+ [
644
+ 1,
645
+ "#f0f921"
646
+ ]
647
+ ],
648
+ "type": "heatmapgl"
649
+ }
650
+ ],
651
+ "histogram": [
652
+ {
653
+ "marker": {
654
+ "pattern": {
655
+ "fillmode": "overlay",
656
+ "size": 10,
657
+ "solidity": 0.2
658
+ }
659
+ },
660
+ "type": "histogram"
661
+ }
662
+ ],
663
+ "histogram2d": [
664
+ {
665
+ "colorbar": {
666
+ "outlinewidth": 0,
667
+ "ticks": ""
668
+ },
669
+ "colorscale": [
670
+ [
671
+ 0,
672
+ "#0d0887"
673
+ ],
674
+ [
675
+ 0.1111111111111111,
676
+ "#46039f"
677
+ ],
678
+ [
679
+ 0.2222222222222222,
680
+ "#7201a8"
681
+ ],
682
+ [
683
+ 0.3333333333333333,
684
+ "#9c179e"
685
+ ],
686
+ [
687
+ 0.4444444444444444,
688
+ "#bd3786"
689
+ ],
690
+ [
691
+ 0.5555555555555556,
692
+ "#d8576b"
693
+ ],
694
+ [
695
+ 0.6666666666666666,
696
+ "#ed7953"
697
+ ],
698
+ [
699
+ 0.7777777777777778,
700
+ "#fb9f3a"
701
+ ],
702
+ [
703
+ 0.8888888888888888,
704
+ "#fdca26"
705
+ ],
706
+ [
707
+ 1,
708
+ "#f0f921"
709
+ ]
710
+ ],
711
+ "type": "histogram2d"
712
+ }
713
+ ],
714
+ "histogram2dcontour": [
715
+ {
716
+ "colorbar": {
717
+ "outlinewidth": 0,
718
+ "ticks": ""
719
+ },
720
+ "colorscale": [
721
+ [
722
+ 0,
723
+ "#0d0887"
724
+ ],
725
+ [
726
+ 0.1111111111111111,
727
+ "#46039f"
728
+ ],
729
+ [
730
+ 0.2222222222222222,
731
+ "#7201a8"
732
+ ],
733
+ [
734
+ 0.3333333333333333,
735
+ "#9c179e"
736
+ ],
737
+ [
738
+ 0.4444444444444444,
739
+ "#bd3786"
740
+ ],
741
+ [
742
+ 0.5555555555555556,
743
+ "#d8576b"
744
+ ],
745
+ [
746
+ 0.6666666666666666,
747
+ "#ed7953"
748
+ ],
749
+ [
750
+ 0.7777777777777778,
751
+ "#fb9f3a"
752
+ ],
753
+ [
754
+ 0.8888888888888888,
755
+ "#fdca26"
756
+ ],
757
+ [
758
+ 1,
759
+ "#f0f921"
760
+ ]
761
+ ],
762
+ "type": "histogram2dcontour"
763
+ }
764
+ ],
765
+ "mesh3d": [
766
+ {
767
+ "colorbar": {
768
+ "outlinewidth": 0,
769
+ "ticks": ""
770
+ },
771
+ "type": "mesh3d"
772
+ }
773
+ ],
774
+ "parcoords": [
775
+ {
776
+ "line": {
777
+ "colorbar": {
778
+ "outlinewidth": 0,
779
+ "ticks": ""
780
+ }
781
+ },
782
+ "type": "parcoords"
783
+ }
784
+ ],
785
+ "pie": [
786
+ {
787
+ "automargin": true,
788
+ "type": "pie"
789
+ }
790
+ ],
791
+ "scatter": [
792
+ {
793
+ "fillpattern": {
794
+ "fillmode": "overlay",
795
+ "size": 10,
796
+ "solidity": 0.2
797
+ },
798
+ "type": "scatter"
799
+ }
800
+ ],
801
+ "scatter3d": [
802
+ {
803
+ "line": {
804
+ "colorbar": {
805
+ "outlinewidth": 0,
806
+ "ticks": ""
807
+ }
808
+ },
809
+ "marker": {
810
+ "colorbar": {
811
+ "outlinewidth": 0,
812
+ "ticks": ""
813
+ }
814
+ },
815
+ "type": "scatter3d"
816
+ }
817
+ ],
818
+ "scattercarpet": [
819
+ {
820
+ "marker": {
821
+ "colorbar": {
822
+ "outlinewidth": 0,
823
+ "ticks": ""
824
+ }
825
+ },
826
+ "type": "scattercarpet"
827
+ }
828
+ ],
829
+ "scattergeo": [
830
+ {
831
+ "marker": {
832
+ "colorbar": {
833
+ "outlinewidth": 0,
834
+ "ticks": ""
835
+ }
836
+ },
837
+ "type": "scattergeo"
838
+ }
839
+ ],
840
+ "scattergl": [
841
+ {
842
+ "marker": {
843
+ "colorbar": {
844
+ "outlinewidth": 0,
845
+ "ticks": ""
846
+ }
847
+ },
848
+ "type": "scattergl"
849
+ }
850
+ ],
851
+ "scattermapbox": [
852
+ {
853
+ "marker": {
854
+ "colorbar": {
855
+ "outlinewidth": 0,
856
+ "ticks": ""
857
+ }
858
+ },
859
+ "type": "scattermapbox"
860
+ }
861
+ ],
862
+ "scatterpolar": [
863
+ {
864
+ "marker": {
865
+ "colorbar": {
866
+ "outlinewidth": 0,
867
+ "ticks": ""
868
+ }
869
+ },
870
+ "type": "scatterpolar"
871
+ }
872
+ ],
873
+ "scatterpolargl": [
874
+ {
875
+ "marker": {
876
+ "colorbar": {
877
+ "outlinewidth": 0,
878
+ "ticks": ""
879
+ }
880
+ },
881
+ "type": "scatterpolargl"
882
+ }
883
+ ],
884
+ "scatterternary": [
885
+ {
886
+ "marker": {
887
+ "colorbar": {
888
+ "outlinewidth": 0,
889
+ "ticks": ""
890
+ }
891
+ },
892
+ "type": "scatterternary"
893
+ }
894
+ ],
895
+ "surface": [
896
+ {
897
+ "colorbar": {
898
+ "outlinewidth": 0,
899
+ "ticks": ""
900
+ },
901
+ "colorscale": [
902
+ [
903
+ 0,
904
+ "#0d0887"
905
+ ],
906
+ [
907
+ 0.1111111111111111,
908
+ "#46039f"
909
+ ],
910
+ [
911
+ 0.2222222222222222,
912
+ "#7201a8"
913
+ ],
914
+ [
915
+ 0.3333333333333333,
916
+ "#9c179e"
917
+ ],
918
+ [
919
+ 0.4444444444444444,
920
+ "#bd3786"
921
+ ],
922
+ [
923
+ 0.5555555555555556,
924
+ "#d8576b"
925
+ ],
926
+ [
927
+ 0.6666666666666666,
928
+ "#ed7953"
929
+ ],
930
+ [
931
+ 0.7777777777777778,
932
+ "#fb9f3a"
933
+ ],
934
+ [
935
+ 0.8888888888888888,
936
+ "#fdca26"
937
+ ],
938
+ [
939
+ 1,
940
+ "#f0f921"
941
+ ]
942
+ ],
943
+ "type": "surface"
944
+ }
945
+ ],
946
+ "table": [
947
+ {
948
+ "cells": {
949
+ "fill": {
950
+ "color": "#EBF0F8"
951
+ },
952
+ "line": {
953
+ "color": "white"
954
+ }
955
+ },
956
+ "header": {
957
+ "fill": {
958
+ "color": "#C8D4E3"
959
+ },
960
+ "line": {
961
+ "color": "white"
962
+ }
963
+ },
964
+ "type": "table"
965
+ }
966
+ ]
967
+ },
968
+ "layout": {
969
+ "annotationdefaults": {
970
+ "arrowcolor": "#2a3f5f",
971
+ "arrowhead": 0,
972
+ "arrowwidth": 1
973
+ },
974
+ "autotypenumbers": "strict",
975
+ "coloraxis": {
976
+ "colorbar": {
977
+ "outlinewidth": 0,
978
+ "ticks": ""
979
+ }
980
+ },
981
+ "colorscale": {
982
+ "diverging": [
983
+ [
984
+ 0,
985
+ "#8e0152"
986
+ ],
987
+ [
988
+ 0.1,
989
+ "#c51b7d"
990
+ ],
991
+ [
992
+ 0.2,
993
+ "#de77ae"
994
+ ],
995
+ [
996
+ 0.3,
997
+ "#f1b6da"
998
+ ],
999
+ [
1000
+ 0.4,
1001
+ "#fde0ef"
1002
+ ],
1003
+ [
1004
+ 0.5,
1005
+ "#f7f7f7"
1006
+ ],
1007
+ [
1008
+ 0.6,
1009
+ "#e6f5d0"
1010
+ ],
1011
+ [
1012
+ 0.7,
1013
+ "#b8e186"
1014
+ ],
1015
+ [
1016
+ 0.8,
1017
+ "#7fbc41"
1018
+ ],
1019
+ [
1020
+ 0.9,
1021
+ "#4d9221"
1022
+ ],
1023
+ [
1024
+ 1,
1025
+ "#276419"
1026
+ ]
1027
+ ],
1028
+ "sequential": [
1029
+ [
1030
+ 0,
1031
+ "#0d0887"
1032
+ ],
1033
+ [
1034
+ 0.1111111111111111,
1035
+ "#46039f"
1036
+ ],
1037
+ [
1038
+ 0.2222222222222222,
1039
+ "#7201a8"
1040
+ ],
1041
+ [
1042
+ 0.3333333333333333,
1043
+ "#9c179e"
1044
+ ],
1045
+ [
1046
+ 0.4444444444444444,
1047
+ "#bd3786"
1048
+ ],
1049
+ [
1050
+ 0.5555555555555556,
1051
+ "#d8576b"
1052
+ ],
1053
+ [
1054
+ 0.6666666666666666,
1055
+ "#ed7953"
1056
+ ],
1057
+ [
1058
+ 0.7777777777777778,
1059
+ "#fb9f3a"
1060
+ ],
1061
+ [
1062
+ 0.8888888888888888,
1063
+ "#fdca26"
1064
+ ],
1065
+ [
1066
+ 1,
1067
+ "#f0f921"
1068
+ ]
1069
+ ],
1070
+ "sequentialminus": [
1071
+ [
1072
+ 0,
1073
+ "#0d0887"
1074
+ ],
1075
+ [
1076
+ 0.1111111111111111,
1077
+ "#46039f"
1078
+ ],
1079
+ [
1080
+ 0.2222222222222222,
1081
+ "#7201a8"
1082
+ ],
1083
+ [
1084
+ 0.3333333333333333,
1085
+ "#9c179e"
1086
+ ],
1087
+ [
1088
+ 0.4444444444444444,
1089
+ "#bd3786"
1090
+ ],
1091
+ [
1092
+ 0.5555555555555556,
1093
+ "#d8576b"
1094
+ ],
1095
+ [
1096
+ 0.6666666666666666,
1097
+ "#ed7953"
1098
+ ],
1099
+ [
1100
+ 0.7777777777777778,
1101
+ "#fb9f3a"
1102
+ ],
1103
+ [
1104
+ 0.8888888888888888,
1105
+ "#fdca26"
1106
+ ],
1107
+ [
1108
+ 1,
1109
+ "#f0f921"
1110
+ ]
1111
+ ]
1112
+ },
1113
+ "colorway": [
1114
+ "#636efa",
1115
+ "#EF553B",
1116
+ "#00cc96",
1117
+ "#ab63fa",
1118
+ "#FFA15A",
1119
+ "#19d3f3",
1120
+ "#FF6692",
1121
+ "#B6E880",
1122
+ "#FF97FF",
1123
+ "#FECB52"
1124
+ ],
1125
+ "font": {
1126
+ "color": "#2a3f5f"
1127
+ },
1128
+ "geo": {
1129
+ "bgcolor": "white",
1130
+ "lakecolor": "white",
1131
+ "landcolor": "#E5ECF6",
1132
+ "showlakes": true,
1133
+ "showland": true,
1134
+ "subunitcolor": "white"
1135
+ },
1136
+ "hoverlabel": {
1137
+ "align": "left"
1138
+ },
1139
+ "hovermode": "closest",
1140
+ "mapbox": {
1141
+ "style": "light"
1142
+ },
1143
+ "paper_bgcolor": "white",
1144
+ "plot_bgcolor": "#E5ECF6",
1145
+ "polar": {
1146
+ "angularaxis": {
1147
+ "gridcolor": "white",
1148
+ "linecolor": "white",
1149
+ "ticks": ""
1150
+ },
1151
+ "bgcolor": "#E5ECF6",
1152
+ "radialaxis": {
1153
+ "gridcolor": "white",
1154
+ "linecolor": "white",
1155
+ "ticks": ""
1156
+ }
1157
+ },
1158
+ "scene": {
1159
+ "xaxis": {
1160
+ "backgroundcolor": "#E5ECF6",
1161
+ "gridcolor": "white",
1162
+ "gridwidth": 2,
1163
+ "linecolor": "white",
1164
+ "showbackground": true,
1165
+ "ticks": "",
1166
+ "zerolinecolor": "white"
1167
+ },
1168
+ "yaxis": {
1169
+ "backgroundcolor": "#E5ECF6",
1170
+ "gridcolor": "white",
1171
+ "gridwidth": 2,
1172
+ "linecolor": "white",
1173
+ "showbackground": true,
1174
+ "ticks": "",
1175
+ "zerolinecolor": "white"
1176
+ },
1177
+ "zaxis": {
1178
+ "backgroundcolor": "#E5ECF6",
1179
+ "gridcolor": "white",
1180
+ "gridwidth": 2,
1181
+ "linecolor": "white",
1182
+ "showbackground": true,
1183
+ "ticks": "",
1184
+ "zerolinecolor": "white"
1185
+ }
1186
+ },
1187
+ "shapedefaults": {
1188
+ "line": {
1189
+ "color": "#2a3f5f"
1190
+ }
1191
+ },
1192
+ "ternary": {
1193
+ "aaxis": {
1194
+ "gridcolor": "white",
1195
+ "linecolor": "white",
1196
+ "ticks": ""
1197
+ },
1198
+ "baxis": {
1199
+ "gridcolor": "white",
1200
+ "linecolor": "white",
1201
+ "ticks": ""
1202
+ },
1203
+ "bgcolor": "#E5ECF6",
1204
+ "caxis": {
1205
+ "gridcolor": "white",
1206
+ "linecolor": "white",
1207
+ "ticks": ""
1208
+ }
1209
+ },
1210
+ "title": {
1211
+ "x": 0.05
1212
+ },
1213
+ "xaxis": {
1214
+ "automargin": true,
1215
+ "gridcolor": "white",
1216
+ "linecolor": "white",
1217
+ "ticks": "",
1218
+ "title": {
1219
+ "standoff": 15
1220
+ },
1221
+ "zerolinecolor": "white",
1222
+ "zerolinewidth": 2
1223
+ },
1224
+ "yaxis": {
1225
+ "automargin": true,
1226
+ "gridcolor": "white",
1227
+ "linecolor": "white",
1228
+ "ticks": "",
1229
+ "title": {
1230
+ "standoff": 15
1231
+ },
1232
+ "zerolinecolor": "white",
1233
+ "zerolinewidth": 2
1234
+ }
1235
+ }
1236
+ },
1237
+ "title": {
1238
+ "text": "Candlestick Chart for AAPL in the Last 90 Days"
1239
+ },
1240
+ "xaxis": {
1241
+ "rangeslider": {
1242
+ "visible": false
1243
+ },
1244
+ "title": {
1245
+ "text": "Date"
1246
+ }
1247
+ },
1248
+ "yaxis": {
1249
+ "title": {
1250
+ "text": "Price"
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+ },
1256
+ "metadata": {},
1257
+ "output_type": "display_data"
1258
+ }
1259
+ ],
1260
+ "source": [
1261
+ "import yfinance as yf\n",
1262
+ "import plotly.graph_objects as go\n",
1263
+ "from datetime import datetime, timedelta\n",
1264
+ "\n",
1265
+ "# Define the stock ticker symbol and the date range\n",
1266
+ "ticker_symbol = \"AAPL\" # Example: Apple Inc.\n",
1267
+ "end_date = datetime.today()\n",
1268
+ "start_date = end_date - timedelta(days=90)\n",
1269
+ "\n",
1270
+ "# Fetch historical data using yfinance\n",
1271
+ "data = yf.download(ticker_symbol, start=start_date, end=end_date)\n",
1272
+ "\n",
1273
+ "# Create a candlestick graph using Plotly\n",
1274
+ "fig = go.Figure(data=[go.Candlestick(x=data.index,\n",
1275
+ " open=data['Open'],\n",
1276
+ " high=data['High'],\n",
1277
+ " low=data['Low'],\n",
1278
+ " close=data['Close'])])\n",
1279
+ "\n",
1280
+ "# Customize the layout\n",
1281
+ "fig.update_layout(title=f'Candlestick Chart for {ticker_symbol} in the Last 90 Days',\n",
1282
+ " xaxis_title='Date',\n",
1283
+ " yaxis_title='Price',\n",
1284
+ " xaxis_rangeslider_visible=False)\n",
1285
+ "\n",
1286
+ "# Show the plot\n",
1287
+ "fig.show()"
1288
+ ]
1289
+ },
1290
+ {
1291
+ "cell_type": "code",
1292
+ "execution_count": null,
1293
+ "metadata": {},
1294
+ "outputs": [],
1295
+ "source": []
1296
+ }
1297
+ ],
1298
+ "metadata": {
1299
+ "kernelspec": {
1300
+ "display_name": "Python 3",
1301
+ "language": "python",
1302
+ "name": "python3"
1303
+ },
1304
+ "language_info": {
1305
+ "codemirror_mode": {
1306
+ "name": "ipython",
1307
+ "version": 3
1308
+ },
1309
+ "file_extension": ".py",
1310
+ "mimetype": "text/x-python",
1311
+ "name": "python",
1312
+ "nbconvert_exporter": "python",
1313
+ "pygments_lexer": "ipython3",
1314
+ "version": "3.9.6"
1315
+ },
1316
+ "orig_nbformat": 4
1317
+ },
1318
+ "nbformat": 4,
1319
+ "nbformat_minor": 2
1320
+ }
market_watch_test.ipynb ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Defaulting to user installation because normal site-packages is not writeable\n",
13
+ "Requirement already satisfied: beautifulsoup4 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (4.9.3)\n",
14
+ "Requirement already satisfied: soupsieve>1.2 in /Users/sarat/Library/Python/3.9/lib/python/site-packages (from beautifulsoup4) (2.4.1)\n"
15
+ ]
16
+ }
17
+ ],
18
+ "source": [
19
+ "# !pip install beautifulsoup4"
20
+ ]
21
+ },
22
+ {
23
+ "cell_type": "code",
24
+ "execution_count": 11,
25
+ "metadata": {},
26
+ "outputs": [],
27
+ "source": [
28
+ "import requests\n",
29
+ "from bs4 import BeautifulSoup\n",
30
+ "\n",
31
+ "# URL of the search results page\n",
32
+ "url = \"https://www.marketwatch.com/search?q=AAPL&ts=0&tab=All%20News\"\n",
33
+ "\n",
34
+ "# Send an HTTP GET request to the URL\n",
35
+ "response = requests.get(url)\n",
36
+ "\n",
37
+ "# Parse the HTML content using BeautifulSoup\n",
38
+ "soup = BeautifulSoup(response.content, \"html.parser\")\n",
39
+ "\n",
40
+ "# # Find all the article link elements\n",
41
+ "# article_links = []\n",
42
+ "# for link in soup.find_all(\"a\", class_=\"link\"):\n",
43
+ "# print(link)\n",
44
+ "# article_links.append(link['href'])\n",
45
+ "\n",
46
+ "# # Print the list of article links\n",
47
+ "# for link in article_links:\n",
48
+ "# print(link)"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": null,
54
+ "metadata": {},
55
+ "outputs": [],
56
+ "source": []
57
+ },
58
+ {
59
+ "cell_type": "code",
60
+ "execution_count": 15,
61
+ "metadata": {},
62
+ "outputs": [
63
+ {
64
+ "name": "stdout",
65
+ "output_type": "stream",
66
+ "text": [
67
+ "https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline\n",
68
+ "https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline\n",
69
+ "https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline\n",
70
+ "https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline\n",
71
+ "https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline\n",
72
+ "https://www.marketwatch.com/articles/china-global-economic-troubles-97d96b95?mod=search_headline\n",
73
+ "https://www.marketwatch.com/story/jet-ais-stock-more-than-doubles-after-app-release-on-apple-store-65f1982b?mod=search_headline\n",
74
+ "https://www.marketwatch.com/data-news/gamestop-corp-cl-a-stock-falls-friday-underperforms-market-cc7697cf-c5bfa4ec6e52?mod=search_headline\n",
75
+ "https://www.marketwatch.com/data-news/microsoft-corp-stock-underperforms-friday-when-compared-to-competitors-23ff3fca-f8ed89bc49af?mod=search_headline\n",
76
+ "https://www.marketwatch.com/data-news/apple-inc-stock-outperforms-competitors-on-strong-trading-day-184dc0b1-2aa1f776330a?mod=search_headline\n",
77
+ "https://www.marketwatch.com/data-news/netflix-inc-stock-outperforms-market-on-strong-trading-day-355fc99c-7b3e57800700?mod=search_headline\n",
78
+ "https://www.marketwatch.com/data-news/amazon-com-inc-stock-falls-friday-underperforms-market-efd30685-e8466fc6f926?mod=search_headline\n",
79
+ "https://www.marketwatch.com/data-news/meta-platforms-inc-stock-underperforms-friday-when-compared-to-competitors-6b93997f-56a4534b7810?mod=search_headline\n",
80
+ "https://www.marketwatch.com/story/x-will-remove-block-feature-musk-says-setting-up-possible-showdown-with-apple-and-google-83c7100f?mod=search_headline\n",
81
+ "https://www.marketwatch.com/story/do-you-know-where-your-prescriptions-drugs-come-from-why-you-should-a9fea0b4?mod=search_headline\n",
82
+ "https://www.marketwatch.com/story/red-flags-waving-for-tech-stocks-as-ai-bounce-fades-china-fears-escalate-fbb986c1?mod=search_headline\n",
83
+ "https://www.marketwatch.com/articles/apple-iphone-15-coming-expect-9b626dad?mod=search_headline\n",
84
+ "https://www.marketwatch.com/data-news/dow-down-nearly-100-points-on-losses-for-shares-of-johnson-johnson-microsoft-91d6cedc-72dc231e67ae?mod=search_headline\n",
85
+ "#\n",
86
+ "https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline\n",
87
+ "https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline\n",
88
+ "https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline\n",
89
+ "https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline\n",
90
+ "https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline\n",
91
+ "https://www.marketwatch.com/articles/china-global-economic-troubles-97d96b95?mod=search_headline\n",
92
+ "https://www.marketwatch.com/story/jet-ais-stock-more-than-doubles-after-app-release-on-apple-store-65f1982b?mod=search_headline\n",
93
+ "https://www.marketwatch.com/data-news/gamestop-corp-cl-a-stock-falls-friday-underperforms-market-cc7697cf-c5bfa4ec6e52?mod=search_headline\n",
94
+ "https://www.marketwatch.com/data-news/microsoft-corp-stock-underperforms-friday-when-compared-to-competitors-23ff3fca-f8ed89bc49af?mod=search_headline\n",
95
+ "https://www.marketwatch.com/data-news/apple-inc-stock-outperforms-competitors-on-strong-trading-day-184dc0b1-2aa1f776330a?mod=search_headline\n",
96
+ "https://www.marketwatch.com/data-news/netflix-inc-stock-outperforms-market-on-strong-trading-day-355fc99c-7b3e57800700?mod=search_headline\n",
97
+ "https://www.marketwatch.com/data-news/amazon-com-inc-stock-falls-friday-underperforms-market-efd30685-e8466fc6f926?mod=search_headline\n",
98
+ "https://www.marketwatch.com/data-news/meta-platforms-inc-stock-underperforms-friday-when-compared-to-competitors-6b93997f-56a4534b7810?mod=search_headline\n",
99
+ "https://www.marketwatch.com/story/x-will-remove-block-feature-musk-says-setting-up-possible-showdown-with-apple-and-google-83c7100f?mod=search_headline\n",
100
+ "https://www.marketwatch.com/story/do-you-know-where-your-prescriptions-drugs-come-from-why-you-should-a9fea0b4?mod=search_headline\n",
101
+ "https://www.marketwatch.com/story/red-flags-waving-for-tech-stocks-as-ai-bounce-fades-china-fears-escalate-fbb986c1?mod=search_headline\n",
102
+ "https://www.marketwatch.com/articles/apple-iphone-15-coming-expect-9b626dad?mod=search_headline\n",
103
+ "https://www.marketwatch.com/data-news/dow-down-nearly-100-points-on-losses-for-shares-of-johnson-johnson-microsoft-91d6cedc-72dc231e67ae?mod=search_headline\n",
104
+ "#\n",
105
+ "https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline\n",
106
+ "https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline\n",
107
+ "https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline\n",
108
+ "https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline\n",
109
+ "https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline\n",
110
+ "https://www.marketwatch.com/articles/china-global-economic-troubles-97d96b95?mod=search_headline\n",
111
+ "https://www.marketwatch.com/story/jet-ais-stock-more-than-doubles-after-app-release-on-apple-store-65f1982b?mod=search_headline\n",
112
+ "https://www.marketwatch.com/data-news/gamestop-corp-cl-a-stock-falls-friday-underperforms-market-cc7697cf-c5bfa4ec6e52?mod=search_headline\n",
113
+ "https://www.marketwatch.com/data-news/microsoft-corp-stock-underperforms-friday-when-compared-to-competitors-23ff3fca-f8ed89bc49af?mod=search_headline\n",
114
+ "https://www.marketwatch.com/data-news/apple-inc-stock-outperforms-competitors-on-strong-trading-day-184dc0b1-2aa1f776330a?mod=search_headline\n",
115
+ "https://www.marketwatch.com/data-news/netflix-inc-stock-outperforms-market-on-strong-trading-day-355fc99c-7b3e57800700?mod=search_headline\n",
116
+ "https://www.marketwatch.com/data-news/amazon-com-inc-stock-falls-friday-underperforms-market-efd30685-e8466fc6f926?mod=search_headline\n",
117
+ "https://www.marketwatch.com/data-news/meta-platforms-inc-stock-underperforms-friday-when-compared-to-competitors-6b93997f-56a4534b7810?mod=search_headline\n",
118
+ "https://www.marketwatch.com/story/x-will-remove-block-feature-musk-says-setting-up-possible-showdown-with-apple-and-google-83c7100f?mod=search_headline\n",
119
+ "https://www.marketwatch.com/story/do-you-know-where-your-prescriptions-drugs-come-from-why-you-should-a9fea0b4?mod=search_headline\n",
120
+ "https://www.marketwatch.com/story/red-flags-waving-for-tech-stocks-as-ai-bounce-fades-china-fears-escalate-fbb986c1?mod=search_headline\n",
121
+ "https://www.marketwatch.com/articles/apple-iphone-15-coming-expect-9b626dad?mod=search_headline\n",
122
+ "https://www.marketwatch.com/data-news/dow-down-nearly-100-points-on-losses-for-shares-of-johnson-johnson-microsoft-91d6cedc-72dc231e67ae?mod=search_headline\n",
123
+ "#\n",
124
+ "https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline\n",
125
+ "https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline\n",
126
+ "https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline\n",
127
+ "https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline\n",
128
+ "https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline\n",
129
+ "https://www.marketwatch.com/articles/china-global-economic-troubles-97d96b95?mod=search_headline\n",
130
+ "https://www.marketwatch.com/story/jet-ais-stock-more-than-doubles-after-app-release-on-apple-store-65f1982b?mod=search_headline\n",
131
+ "https://www.marketwatch.com/data-news/gamestop-corp-cl-a-stock-falls-friday-underperforms-market-cc7697cf-c5bfa4ec6e52?mod=search_headline\n",
132
+ "https://www.marketwatch.com/data-news/microsoft-corp-stock-underperforms-friday-when-compared-to-competitors-23ff3fca-f8ed89bc49af?mod=search_headline\n",
133
+ "https://www.marketwatch.com/data-news/apple-inc-stock-outperforms-competitors-on-strong-trading-day-184dc0b1-2aa1f776330a?mod=search_headline\n",
134
+ "https://www.marketwatch.com/data-news/netflix-inc-stock-outperforms-market-on-strong-trading-day-355fc99c-7b3e57800700?mod=search_headline\n",
135
+ "https://www.marketwatch.com/data-news/amazon-com-inc-stock-falls-friday-underperforms-market-efd30685-e8466fc6f926?mod=search_headline\n",
136
+ "https://www.marketwatch.com/data-news/meta-platforms-inc-stock-underperforms-friday-when-compared-to-competitors-6b93997f-56a4534b7810?mod=search_headline\n",
137
+ "https://www.marketwatch.com/story/x-will-remove-block-feature-musk-says-setting-up-possible-showdown-with-apple-and-google-83c7100f?mod=search_headline\n",
138
+ "https://www.marketwatch.com/story/do-you-know-where-your-prescriptions-drugs-come-from-why-you-should-a9fea0b4?mod=search_headline\n",
139
+ "https://www.marketwatch.com/story/red-flags-waving-for-tech-stocks-as-ai-bounce-fades-china-fears-escalate-fbb986c1?mod=search_headline\n",
140
+ "https://www.marketwatch.com/articles/apple-iphone-15-coming-expect-9b626dad?mod=search_headline\n",
141
+ "https://www.marketwatch.com/data-news/dow-down-nearly-100-points-on-losses-for-shares-of-johnson-johnson-microsoft-91d6cedc-72dc231e67ae?mod=search_headline\n",
142
+ "#\n",
143
+ "\n"
144
+ ]
145
+ }
146
+ ],
147
+ "source": [
148
+ "for content in soup.find_all(\"h3\",class_=\"article__headline\"):\n",
149
+ " for link in content.find_all(\"a\"):\n",
150
+ " print(link['href'])"
151
+ ]
152
+ },
153
+ {
154
+ "cell_type": "code",
155
+ "execution_count": 13,
156
+ "metadata": {},
157
+ "outputs": [],
158
+ "source": [
159
+ "from newspaper import Article\n",
160
+ "from newspaper import Config"
161
+ ]
162
+ },
163
+ {
164
+ "cell_type": "code",
165
+ "execution_count": 32,
166
+ "metadata": {},
167
+ "outputs": [],
168
+ "source": [
169
+ "def get_news_articles_info(ticker_name):\n",
170
+ " # URL of the search results page\n",
171
+ " url = \"https://www.marketwatch.com/search?q=\" + ticker_name + \"&ts=0&tab=All%20News\"\n",
172
+ "\n",
173
+ " # Send an HTTP GET request to the URL\n",
174
+ " response = requests.get(url)\n",
175
+ "\n",
176
+ " # Parse the HTML content using BeautifulSoup\n",
177
+ " soup = BeautifulSoup(response.content, \"html.parser\")\n",
178
+ "\n",
179
+ " article_links = []\n",
180
+ " \n",
181
+ " for content in soup.find_all(\"h3\",class_=\"article__headline\"):\n",
182
+ " for link in content.find_all(\"a\"):\n",
183
+ " if link['href'] != \"#\":\n",
184
+ " article_links.append(link['href'])\n",
185
+ "\n",
186
+ " article_links = article_links[18:36]\n",
187
+ " ticker_news_extracted = []\n",
188
+ " count = 0\n",
189
+ " for link in article_links:\n",
190
+ " article_info = {}\n",
191
+ " article_info['text'] = ''\n",
192
+ " article_info['url'] = link\n",
193
+ " try:\n",
194
+ " url = article_info['url']\n",
195
+ " url = requests.head(url, allow_redirects=True).url\n",
196
+ " \n",
197
+ " user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'\n",
198
+ " config = Config()\n",
199
+ " config.browser_user_agent = user_agent\n",
200
+ "\n",
201
+ " article = Article(url, config=config)\n",
202
+ " article.download()\n",
203
+ " article.parse()\n",
204
+ " article_info['title'] = article.title\n",
205
+ " article_info['text'] = article.text\n",
206
+ " article_info['url'] = url\n",
207
+ " count = count + 1\n",
208
+ " print(count,url)\n",
209
+ " except Exception as error:\n",
210
+ " print(\"Error\",url,error)\n",
211
+ " continue\n",
212
+ " if article_info['text'] == '':\n",
213
+ " print('No text',url)\n",
214
+ " continue\n",
215
+ " if count > 5:\n",
216
+ " break\n",
217
+ " ticker_news_extracted.append(article_info)\n",
218
+ " return ticker_news_extracted"
219
+ ]
220
+ },
221
+ {
222
+ "cell_type": "code",
223
+ "execution_count": 33,
224
+ "metadata": {},
225
+ "outputs": [
226
+ {
227
+ "name": "stdout",
228
+ "output_type": "stream",
229
+ "text": [
230
+ "1 https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline\n",
231
+ "2 https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline\n",
232
+ "3 https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline\n",
233
+ "4 https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline\n",
234
+ "5 https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline\n",
235
+ "6 https://www.marketwatch.com/articles/china-global-economic-troubles-97d96b95?mod=search_headline\n"
236
+ ]
237
+ },
238
+ {
239
+ "data": {
240
+ "text/plain": [
241
+ "[{'text': 'As kids go back to school, more of them are wearing Apple Watches with the blessing of their parents.\\n\\nThe device, which initially struggled to gain an identity of its own in a product line bejeweled with iPhone, iPad and Mac products, is now Apple Inc.’s AAPL, +0.28% hottest-selling product. Its growing popularity in great measure is as a safe, easy-to-monitor proxy for iPhone. As a result, Apple is pushing its nearly decade-old product as never before.\\n\\nThe roaring comeback of Apple Watch speaks to the upside of an ultra-safe device for children in an era of school shootings, increasing concerns over mental health for teens, online kids safety, and more-affordable alternatives to the iPhone. Just as importantly, the new-found popularity of Apple Watch speaks to the concept of reinvention in tech.\\n\\nAnd it plays into Apple’s strength: Market research shows consumers are 2.5 times more likely to buy Apple products for students. It’s being purchased for children as young as 5. This comes as, Apple has seen some relatively rough quarters of late (for them, at least) due to slowing sales of other products.\\n\\n“It puts a premium on focus time for kids, and offers parents peace of mind on their time at school,” Carolina Milanese, an analyst at Creative Strategies, said in an interview. “There are few things more frustrating for a parent than trying to pry a smartphone from the clutches of their children.”\\n\\nWith the watch’s cellular abilities, parents can use it to reach and track their children, while the miniature screens mitigate issues like internet addiction.\\n\\nSince smart watches have minimal apps and no web browser or camera, children are less likely to be exposed to distracting games, sexting and other adult content, according to Common Sense, which monitors kid safety online.\\n\\nRead more: Apple sees sales decline for third quarter in a row — and says performance could be similar this quarter\\n\\nThe use of smart watches as children’s gadgets show how the audience for a consumer technology product can morph in unexpected ways. Earlier this year, Apple Chief Executive Tim Cook told investors that nearly two-thirds of customers who purchased an Apple Watch were first-time buyers.\\n\\nThe reinvention of a product\\n\\nIt’s been a remarkable journey in Apple Watch’s transformation, but not totally unexpected. There is an axiom in Silicon Valley: Everything is reinvented, including company names and products. Remember, Apple changed its corporate name from Apple Computer Inc. in 2007.\\n\\nApple Watch was introduced as a luxury accessory in late 2014 but soon transformed into a health device. Still, sales were middling to the point where Apple did not disclose the Watch’s sales as it does other product lines.\\n\\nWithin a few years, the Watch became an indispensable medical device and barometer of health for athletes, boosting sales. But another makeover was on the way from Apple.\\n\\nBy 2020, the company introduced Family Setup, software that let parents track their children’s locations, manage their contacts list and limit their notifications. In 2022, a special mode called Schooltime debuted that restricts the Apple Watch during school hours. Parents can remotely manage this from their iPhone, limiting their students’ access to the internet, social media web sites, apps and a camera.\\n\\nThe latter feature seemed to especially resonate with parents in an era of school shootings and the dark side of the web, such as texting, bullying and internet addiction.\\n\\nOf course, the biggest selling point for parents is price. At less than $400 for most models, Apple Watches cost significantly less than iPhones.',\n",
242
+ " 'url': 'https://www.marketwatch.com/story/the-apple-watch-may-now-be-a-back-to-school-necessity-2971c8af?mod=search_headline',\n",
243
+ " 'title': 'The Apple Watch may now be a back-to-school necessity'},\n",
244
+ " {'text': '\\n\\nThe so-called Magnificent Seven grouping of technology stocks lost some of its luster this week after four of the seven moved into correction territory, meaning their stocks have fallen at least 10% from their recent peaks.\\n\\nThe corporate-bond market, in contrast, seems to like all seven names.\\n\\nThe group is made up of Facebook parent Meta Platforms Inc. META, -0.65% , Apple Inc. AAPL, +0.28% , Microsoft Corp. MSFT, -0.13% , Nvidia Corp. NVDA, -0.10% , Amazon. com Inc. AMZN, -0.57% , Google parent Alphabet Inc. GOOGL, -1.89% GOOG, -1.80% and Tesla Inc. TSLA, -1.70% .\\n\\nOne caveat: Tesla has no outstanding bonds. In the past, the electric-car maker issued convertible bonds, but they have all been converted into equity.\\n\\nThe group is credited with helping drive the stock market’s gains in the first half of the year, driven by excitement about artificial intelligence. But the rally has stalled in recent weeks as investors have fretted over the potential for U.S. interest-rate increases, surging Treasury yields and China worries, with property developer Evergrande filing for U.S. bankruptcy protection late Thursday.\\n\\nOn Thursday, Meta followed Apple, Microsoft and Nvidia into correction territory, as MarketWatch’s Emily Bary reported. Tesla, meanwhile, is in a bear market, meaning it’s down more than 20% from its recent peak.\\n\\nRead: Have AI stocks like Nvidia reached bubble territory? Here’s what history can tell us.\\n\\nThe following series of charts from data-solutions provider BondCliQ Media Services show how many bonds each company has issued by maturity and how they have traded as the stocks have pulled back.\\n\\nThe first chart shows that Microsoft has by far the most bonds, mostly in the 30-year bucket. The software and cloud giant has more than $50 billion in long-term debt, according to its 2023 10-K filing with the Securities and Exchange Commission.\\n\\nOutstanding Magnificent Seven debt by maturity bucket. Source: BondCliQ Media Services\\n\\nThis chart shows trading volumes over the last 10 days, divided by trade type. The green shows customer buying, while the red is customer selling. The blue shows dealer-to-dealer flows. Microsoft, for example, has seen almost $1.3 billion in customer buying from dealers in the last 10 days and $960 million in customer sales to dealers.\\n\\nMagnificent Seven debt trading volumes (last 10 days). Source: BondCliQ Media Services\\n\\nThis chart shows that every name in the group has enjoyed better net buying in the last 10 days, with Microsoft leading the way.\\n\\nNet customer flow of Magnificent Seven debt (last 10 days). Source: BondCliQ Media Services\\n\\nThis chart shows spread performance over the last 50 days for an intermediate-term bond from each of the seven issuers. Most have tightened or remained steady over the period.\\n\\nHistorical spread performance of Magnificent Seven debt. Source: BondCliQ Media Services\\n\\nRead also: Red flags waving for tech stocks as AI bounce fades, China fears escalate\\n\\nApple’s stock entered correction Wednesday upon falling more than 10% from its July 31 peak of $196.45. The company sells mainly discretionary products, and right now “consumers are still being pinched” and thinking more carefully about where they spend their money, according to Matt Stucky, senior portfolio manager for equities at Northwestern Mutual Wealth Management.',\n",
245
+ " 'url': 'https://www.marketwatch.com/story/magnificent-seven-stocks-are-losing-some-of-their-shine-but-their-bonds-are-doing-fine-95eaa2ec?mod=search_headline',\n",
246
+ " 'title': '‘Magnificent Seven’ stocks are losing some of their shine, but their bonds are doing fine'},\n",
247
+ " {'text': 'Consumer goods giant Unilever PLC is coming under renewed pressure to exit Russia following recent comments from the company’s CEO Hein Schumacher.\\n\\nThe U.K. Telegraph reports that Schumacher told a Ukrainian war veteran that he will look at the company’s decision to maintain its Russian business with “fresh eyes.”\\n\\n“We really hope this means he’ll do the right thing,” tweeted the Ukraine Solidarity Project this week. “Good leaders make bold decisions.”\\n\\nRelated: ‘Unilever has descended into a vortex of immorality’: Pressure mounts on consumer goods giant to exit Russia\\n\\nThe Moral Rating Agency, an organization set up after the invasion of Ukraine to examine whether companies were carrying out their promises of exiting Russia, reiterated its calls for Unilever to end its Russian operations. “Unilever needs to stop running down the clock as a way to keep making blood money,” said MRA founder Mark Dixon, in a statement this week. Unilever “simply needs to get out of Russia,” he added.\\n\\n“We have always said we would keep our position in Russia under close review,” a Unilever spokesperson told MarketWatch Friday. The spokesperson also directed MarketWatch to the company’s statement on the war in Ukraine released in February 2023.\\n\\nUnilever was recently added to the Ukrainian government’s ‘International sponsors of war’ list amid calls for a boycott of the company’s products.\\n\\nRelated: WeWork, Carl’s Jr., Unilever and Shell among companies slammed by Yale over operations in Russia\\n\\nAt the end of June Unilever employed approximately 3,000 people in Russia, according to the company’s second-quarter results. In the first six months of the year Russia represented 1.2% of the Unilever Group’s turnover and 1.5% of net profit, the company said. As of June 30, the company’s Russia business had net assets of around $870 million, including four factories.\\n\\nIn March 2022 Unilever announced its decision to suspend all imports and exports of Unilever products into and out of Russia and cease any capital flows in and out of the country. However, the company continues to supply what it describes as “everyday food and hygiene products” made in Russia to people in the country. “We understand why there are calls for Unilever to leave Russia. We also want to be clear that we are not trying to protect or manage our business in Russia,” the company said, in its statement released in February. “However, for companies like Unilever, which have a significant physical presence in the country, exiting is not straightforward.”\\n\\nRelated: Unilever urged to exit Russia: ‘It’s making their hands bloodstained,’ says Economic Security Council of Ukraine\\n\\nEarlier this year, on the anniversary of Russia’s invasion, the Economic Security Council of Ukraine criticized Unilever over its Russian presence.\\n\\nThe Ukraine Solidarity Project recently launched a high-profile campaign urging Unilever to get out of Russia using the images of Ukrainian veterans injured in the war with Russia. Last month, activists from the Ukraine Solidarity Project held a giant poster featuring the veterans outside Unilever’s London headquarters.',\n",
248
+ " 'url': 'https://www.marketwatch.com/story/unilever-ceo-vows-to-look-at-russian-operations-with-fresh-eyes-as-pressure-to-exit-the-country-mounts-6b872f36?mod=search_headline',\n",
249
+ " 'title': 'Unilever CEO vows to look at Russian operations with ‘fresh eyes’ as pressure to exit the country mounts'},\n",
250
+ " {'text': 'Over the past few months, the WGA and SAG-AFTRA strikes have sparked a public discourse about the urgent need for improved and fairer agreements in the film and TV industry. These agreements are a much needed adaptation to the immense transformation witnessed in the past decade, primarily fueled by the rapid rise and dominance of SVOD (streaming video on-demand) platforms including Netflix NFLX, +0.38% , Amazon Prime Video AMZN, -0.57% , Hulu, Disney+ DIS, +0.05% , (HBO) Max, Apple TV+ AAPL, +0.28% , Paramount+ and others.\\n\\nAs with any industry, the emergence of new technological advances brings both opportunities and challenges. One significant challenge that artists and talent face in the era of SVOD content is the lack of easily accessible data regarding viewership of specific titles on these streaming platforms.\\n\\nThis lack of transparency, or data asymmetry, can stifle growth, collaboration and innovation. It highlights the need for a singular, trusted and objective source of information that can be accessed by all parties.\\n\\nLooking back at the history of the entertainment industry, digital innovation has transformed both the music industry and the TV and film industry in similar ways. But the response has differed, with music often in the vanguard due to the more simplistic, audio-only format of music content (excluding music videos and other visuals).\\n\\n“Streaming, digital and physical sales, airplay and other music data is used daily across the music business.”\\n\\nWe’ve seen music tackle a multitude of physical formats through the years, with vinyl giving way to cassette tapes and ultimately the golden age of the CD where the music industry saw its revenues peak in 1999. When iTunes and then Spotify, Apple Music, Amazon Music and other streamers disrupted the ways listeners consumed music over the last two decades, record labels, distributors and artists had to evolve their release strategies. Fortunately, music charts all over the world, including the Billboard Charts in the United States, adapted in real time, making use of available streaming data to provide an objective look at the landscape.\\n\\nNow, streaming, digital and physical sales, airplay and other music data is used daily across the music business, from A&R to marketing departments, from live event promoters to independent artists, in order to make informed creative business decisions. This summer, for example, Taylor Swift is promoting a song from an album released four years ago as a radio single, with it just now reaching its peak on the charts. This campaign was made possible by streaming data that showed an uptick in the song’s consumption since Swift’s tour kicked off in the spring. That is a win for Swift, her tour promoter, her fans, her label, her co-writers and everyone in between.\\n\\n“ Is an AI-generated song worth as much as a Taylor Swift song? ”\\n\\nOf course, it can’t be ignored that music has its own issues surrounding valuation in the age of streaming. Is an AI-generated song worth as much as a Taylor Swift song? Should Bad Bunny receive the same royalty as “Rain Sounds on a Tin Roof”? Should an indie artist have to grapple with owning their masters or selling the ownership rights to access the power and influence of a label?\\n\\nThose questions are being answered from different points of view across the music ecosystem right now. In this case, streaming platforms have no stake in the production of the content, but there are informed answers because of pervasive and comprehensive access to data.\\n\\nActors and writers need the same kind of information to have the same control and insight into the audience demands for the content they’ve created. Taylor Swift would not be able to market her music with such precision and to her fans’ demand without access to the essential listenership information. Filmmakers and TV creators unfortunately are not in her position.\\n\\nStreaming services need that same information from their competitors if they want to have negotiation leverage with the creatives, whether they be established award winners or up-and-coming talent. This is not just about empowering one side, but about ensuring there is a level playing field for every participant from the largest studios and streamers to the up-and-coming actors and writers with dreams of making it big.\\n\\nIt is also important to reflect on the ways data has transformed film and TV in the past. Filmmakers were once able to solely rely on box-office numbers. Networks relied primarily on ratings to strategize on their programming decisions when revenue came primarily from ad buyers and not subscribers. Talent reps used both to negotiate fair contracts. That entire business model is fading away as streamers continue to collect more and more data, but view this as a competitive advantage and choose not to disclose their viewership data.\\n\\nAn opaque marketplace doesn’t make much sense when technological advances make transparency possible, and everyone knows it. If there is data that affects the work of many, while only informing a select few, a healthy ecosystem cannot be sustained. In this case, skewed information leads not only to disempowered artists but also to distribution and production companies building business models that are set up using varying, and in extreme cases contradictory, forecasts for the industry’s future. Accessible data for everyone can level the playing field.\\n\\nRob Jonas is CEO of entertainment data and insights company Luminate. The company, formerly operating as SoundScan, Nielsen Music and P-MRC Data, has fueled the Billboard Charts since 1991, provides global entertainment research-based audience insights and maintains a premier offering of verified film and TV industry metadata, from talent to executives.\\n\\nMore: If Sarah Silverman wins her lawsuit, OpenAI, Meta Platforms and other AI developers could face waves of litigation\\n\\nPlus: Strict limits on AI would harm Hollywood actors and writers',\n",
251
+ " 'url': 'https://www.marketwatch.com/story/taylor-swift-and-other-musicians-use-valuable-data-to-promote-their-work-actors-and-writers-deserve-the-same-b6e04e4f?mod=search_headline',\n",
252
+ " 'title': 'Opinion: The film & TV industry needs access to valuable data to make business decisions'},\n",
253
+ " {'text': 'In a dreary smartphone market, Apple Inc. could do something it’s never done before.\\n\\nThe consumer-electronics giant has a chance to finish the year as the global leader in smartphone shipments for the first time, according to analysts at Counterpoint Research.\\n\\nRead: ‘Magnificent Seven’ stocks are losing some of their shine, but their bonds are doing fine\\n\\nConsumers continue to hold onto their smartphones for longer, one reason why the Counterpoint team expects that overall shipments will fall 6% this year, to 1.15 billion units. That would mark the lowest level in a decade.\\n\\n“But we’re watching [the fourth quarter] with interest because the iPhone 15 launch is a window for carriers to steal high-value customers,” Jeff Fieldhack, Counterpoint’s North America research director, said in a release.\\n\\nWith a big base of current iPhone 12 owners due for upgrades, “promos are going to be aggressive, leaving Apple in a good spot.”\\n\\nCounterpoint notes that premium smartphones have been picking up share within the market and called out China as a region where that trend holds true. Apple AAPL, +0.28% focuses on the premium market and is expected to debut its next lineup of devices, the iPhone 15 family, in September, and sales likely will begin later that month or in early October.\\n\\nDon’t miss: Meta’s stock joins Apple, Microsoft and Nvidia shares in correction territory as tech-stock boom fizzles\\n\\nProjections from Counterpoint put Apple the closest its ever been to capturing the top spot. “We’re talking about a spread that’s literally a few days’ worth of sales,” Fieldhack said. “Assuming Apple doesn’t run into production problems like it did last year, it’s really a toss up at this point.”\\n\\nSamsung Electronics Co. Ltd 005930, -0.60% was the market leader in shipments last year, and it held the top spot in the first quarter of this year.\\n\\nSee also: Red flags waving for tech stocks as AI bounce fades, China fears escalate',\n",
254
+ " 'url': 'https://www.marketwatch.com/story/the-iphone-15-could-help-apple-clinch-a-title-its-never-held-before-2c56e819?mod=search_headline',\n",
255
+ " 'title': 'The iPhone 15 could help Apple clinch a title it’s never held before'}]"
256
+ ]
257
+ },
258
+ "execution_count": 33,
259
+ "metadata": {},
260
+ "output_type": "execute_result"
261
+ }
262
+ ],
263
+ "source": [
264
+ "get_news_articles_info('AAPL')"
265
+ ]
266
+ }
267
+ ],
268
+ "metadata": {
269
+ "kernelspec": {
270
+ "display_name": "Python 3",
271
+ "language": "python",
272
+ "name": "python3"
273
+ },
274
+ "language_info": {
275
+ "codemirror_mode": {
276
+ "name": "ipython",
277
+ "version": 3
278
+ },
279
+ "file_extension": ".py",
280
+ "mimetype": "text/x-python",
281
+ "name": "python",
282
+ "nbconvert_exporter": "python",
283
+ "pygments_lexer": "ipython3",
284
+ "version": "3.9.6"
285
+ },
286
+ "orig_nbformat": 4
287
+ },
288
+ "nbformat": 4,
289
+ "nbformat_minor": 2
290
+ }
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ flask
2
+ plotly
3
+ yfinance
4
+ newspaper3k
5
+ beautifulsoup4
templates/index.html ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Stock Information App</title>
5
+ </head>
6
+ <body>
7
+ <h1>Stock Information App</h1>
8
+ <style>
9
+ /* Styling for the news table */
10
+ #newsTable {
11
+ border-collapse: collapse;
12
+ width: 100%;
13
+ font-family: Arial, sans-serif;
14
+ margin-top: 20px;
15
+ }
16
+
17
+ #newsTable th, #newsTable td {
18
+ border: 1px solid #ddd;
19
+ padding: 8px;
20
+ text-align: left;
21
+ }
22
+
23
+ #newsTable th {
24
+ background-color: #f2f2f2;
25
+ color: #333;
26
+ }
27
+
28
+ #newsTable tr:nth-child(even) {
29
+ background-color: #f2f2f2;
30
+ }
31
+
32
+ #newsTable tr:hover {
33
+ background-color: #ddd;
34
+ }
35
+
36
+ /* Styling for the "Read full article" link */
37
+ #newsTable a {
38
+ text-decoration: none;
39
+ color: #007bff;
40
+ }
41
+
42
+ #newsTable a:hover {
43
+ text-decoration: underline;
44
+ }
45
+ </style>
46
+ <form method="post">
47
+ <label for="ticker">Enter Ticker:</label>
48
+ <input type="text" id="ticker" name="ticker" required>
49
+ <button type="submit">Get Information</button>
50
+ </form>
51
+
52
+ {% if news_data %}
53
+ <table id="newsTable">
54
+ <thead>
55
+ <tr>
56
+ <th>Title</th>
57
+ <th>Sentiment</th>
58
+ <th>Summary</th>
59
+ <th>Full Article</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ {% for article in news_data %}
64
+ <tr>
65
+ <td>{{ article.title }}</td>
66
+ <td>{{ article.sentiment }} (Score: {{ article.sentiment_score }})</td>
67
+ <td>{{ article.summary }}</td>
68
+ <td><a href="{{ article.link }}" target="_blank">Read full article</a></td>
69
+ </tr>
70
+ {% endfor %}
71
+ </tbody>
72
+ </table>
73
+ {% endif %}
74
+
75
+ {% if candlestick_graph %}
76
+ <h2>Stock Opening and Closing Data</h2>
77
+ {{ candlestick_graph | safe }}
78
+ {% endif %}
79
+ </body>
80
+ </html>
test.ipynb ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "# !pip3 install newspaper3k\n",
10
+ "# !pip3 install gnews\n",
11
+ "# !pip install plotly"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": 2,
17
+ "metadata": {},
18
+ "outputs": [
19
+ {
20
+ "name": "stdout",
21
+ "output_type": "stream",
22
+ "text": [
23
+ "{'title': \"Tesla Stock Went Down Again for a New Reason. Here's Where It's Going. - Barron's\", 'description': \"Tesla Stock Went Down Again for a New Reason. Here's Where It's Going. Barron's\", 'published date': 'Fri, 18 Aug 2023 21:17:00 GMT', 'url': 'https://news.google.com/rss/articles/CBMiSGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FydGljbGVzL3Rlc2xhLXN0b2NrLWRvd24tY2hpbmEtc3VwcG9ydC02NTgzMmQ3ZNIBTGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FtcC9hcnRpY2xlcy90ZXNsYS1zdG9jay1kb3duLWNoaW5hLXN1cHBvcnQtNjU4MzJkN2Q?oc=5&hl=en-US&gl=US&ceid=US:en', 'publisher': {'href': 'https://www.barrons.com', 'title': \"Barron's\"}}\n"
24
+ ]
25
+ }
26
+ ],
27
+ "source": [
28
+ "from gnews import GNews\n",
29
+ "\n",
30
+ "google_news = GNews(max_results=10)\n",
31
+ "tesla_news = google_news.get_news('TSLA')\n",
32
+ "print(tesla_news[0])"
33
+ ]
34
+ },
35
+ {
36
+ "cell_type": "code",
37
+ "execution_count": 3,
38
+ "metadata": {},
39
+ "outputs": [
40
+ {
41
+ "name": "stderr",
42
+ "output_type": "stream",
43
+ "text": [
44
+ "08/20/2023 02:10:56 PM - Article `download()` failed with 403 Client Error: Forbidden for url: https://www.barrons.com/articles/tesla-stock-down-china-support-65832d7d on URL https://news.google.com/rss/articles/CBMiSGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FydGljbGVzL3Rlc2xhLXN0b2NrLWRvd24tY2hpbmEtc3VwcG9ydC02NTgzMmQ3ZNIBTGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FtcC9hcnRpY2xlcy90ZXNsYS1zdG9jay1kb3duLWNoaW5hLXN1cHBvcnQtNjU4MzJkN2Q?oc=5&hl=en-US&gl=US&ceid=US:en\n"
45
+ ]
46
+ }
47
+ ],
48
+ "source": [
49
+ "import newspaper\n",
50
+ "google_news.get_full_article(tesla_news[0]['url'])"
51
+ ]
52
+ },
53
+ {
54
+ "cell_type": "code",
55
+ "execution_count": 4,
56
+ "metadata": {},
57
+ "outputs": [
58
+ {
59
+ "data": {
60
+ "text/plain": [
61
+ "[{'title': \"Tesla Stock Went Down Again for a New Reason. Here's Where It's Going. - Barron's\",\n",
62
+ " 'description': \"Tesla Stock Went Down Again for a New Reason. Here's Where It's Going. Barron's\",\n",
63
+ " 'published date': 'Fri, 18 Aug 2023 21:17:00 GMT',\n",
64
+ " 'url': 'https://news.google.com/rss/articles/CBMiSGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FydGljbGVzL3Rlc2xhLXN0b2NrLWRvd24tY2hpbmEtc3VwcG9ydC02NTgzMmQ3ZNIBTGh0dHBzOi8vd3d3LmJhcnJvbnMuY29tL2FtcC9hcnRpY2xlcy90ZXNsYS1zdG9jay1kb3duLWNoaW5hLXN1cHBvcnQtNjU4MzJkN2Q?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
65
+ " 'publisher': {'href': 'https://www.barrons.com', 'title': \"Barron's\"}},\n",
66
+ " {'title': \"Tesla (NASDAQ:TSLA): What's Next for This Buzzing Reddit Stock? - TipRanks.com - TipRanks\",\n",
67
+ " 'description': \"Tesla (NASDAQ:TSLA): What's Next for This Buzzing Reddit Stock? - TipRanks.com TipRanks\",\n",
68
+ " 'published date': 'Fri, 18 Aug 2023 17:22:12 GMT',\n",
69
+ " 'url': 'https://news.google.com/rss/articles/CBMiX2h0dHBzOi8vd3d3LnRpcHJhbmtzLmNvbS9uZXdzL2FydGljbGUvdGVzbGEtbmFzZGFxdHNsYS13aGF0cy1uZXh0LWZvci10aGlzLWJ1enppbmctcmVkZGl0LXN0b2Nr0gEA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
70
+ " 'publisher': {'href': 'https://www.tipranks.com', 'title': 'TipRanks'}},\n",
71
+ " {'title': 'TSLA Stock Forecast: 3 Reasons Tesla Is a Losing Bet Through 2024 - InvestorPlace',\n",
72
+ " 'description': 'TSLA Stock Forecast: 3 Reasons Tesla Is a Losing Bet Through 2024 InvestorPlace',\n",
73
+ " 'published date': 'Thu, 17 Aug 2023 10:13:38 GMT',\n",
74
+ " 'url': 'https://news.google.com/rss/articles/CBMiY2h0dHBzOi8vaW52ZXN0b3JwbGFjZS5jb20vMjAyMy8wOC90c2xhLXN0b2NrLWZvcmVjYXN0LTMtcmVhc29ucy10ZXNsYS1pcy1hLWxvc2luZy1iZXQtdGhyb3VnaC0yMDI0L9IBAA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
75
+ " 'publisher': {'href': 'https://investorplace.com',\n",
76
+ " 'title': 'InvestorPlace'}},\n",
77
+ " {'title': 'Tesla continues waging price war; VinFast makes U.S. debut: This week in EVs - Yahoo Finance',\n",
78
+ " 'description': 'Tesla continues waging price war; VinFast makes U.S. debut: This week in EVs Yahoo Finance',\n",
79
+ " 'published date': 'Sun, 20 Aug 2023 06:15:00 GMT',\n",
80
+ " 'url': 'https://news.google.com/rss/articles/CBMiTmh0dHBzOi8vZmluYW5jZS55YWhvby5jb20vbmV3cy90ZXNsYS1jb250aW51ZXMtd2FnaW5nLXByaWNlLXdhci0wNjE1MDc5MDguaHRtbNIBVmh0dHBzOi8vZmluYW5jZS55YWhvby5jb20vYW1waHRtbC9uZXdzL3Rlc2xhLWNvbnRpbnVlcy13YWdpbmctcHJpY2Utd2FyLTA2MTUwNzkwOC5odG1s?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
81
+ " 'publisher': {'href': 'https://finance.yahoo.com',\n",
82
+ " 'title': 'Yahoo Finance'}},\n",
83
+ " {'title': 'Tesla stock falls 3%, on to longest losing run since December - MarketWatch',\n",
84
+ " 'description': 'Tesla stock falls 3%, on to longest losing run since December MarketWatch',\n",
85
+ " 'published date': 'Fri, 18 Aug 2023 15:34:00 GMT',\n",
86
+ " 'url': 'https://news.google.com/rss/articles/CBMiZmh0dHBzOi8vd3d3Lm1hcmtldHdhdGNoLmNvbS9zdG9yeS90ZXNsYS1zdG9jay1mYWxscy0zLW9uLXRvLWxvbmdlc3QtbG9zaW5nLXJ1bi1zaW5jZS1kZWNlbWJlci1mNWVkMjkxN9IBamh0dHBzOi8vd3d3Lm1hcmtldHdhdGNoLmNvbS9hbXAvc3RvcnkvdGVzbGEtc3RvY2stZmFsbHMtMy1vbi10by1sb25nZXN0LWxvc2luZy1ydW4tc2luY2UtZGVjZW1iZXItZjVlZDI5MTc?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
87
+ " 'publisher': {'href': 'https://www.marketwatch.com',\n",
88
+ " 'title': 'MarketWatch'}},\n",
89
+ " {'title': 'Good News for Tesla Investors. Bad News for Tesla Stock. - The Motley Fool',\n",
90
+ " 'description': 'Good News for Tesla Investors. Bad News for Tesla Stock. The Motley Fool',\n",
91
+ " 'published date': 'Sat, 19 Aug 2023 14:30:00 GMT',\n",
92
+ " 'url': 'https://news.google.com/rss/articles/CBMiXWh0dHBzOi8vd3d3LmZvb2wuY29tL2ludmVzdGluZy8yMDIzLzA4LzE5L2dvb2QtbmV3cy1mb3ItdGVzbGEtaW52ZXN0b3JzLWJhZC1uZXdzLWZvci10ZXNsYS1zL9IBAA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
93
+ " 'publisher': {'href': 'https://www.fool.com', 'title': 'The Motley Fool'}},\n",
94
+ " {'title': 'Tesla Revamped Model 3 Mass Output in China May Start Next Month - Bloomberg',\n",
95
+ " 'description': 'Tesla Revamped Model 3 Mass Output in China May Start Next Month Bloomberg',\n",
96
+ " 'published date': 'Thu, 17 Aug 2023 09:52:24 GMT',\n",
97
+ " 'url': 'https://news.google.com/rss/articles/CBMic2h0dHBzOi8vd3d3LmJsb29tYmVyZy5jb20vbmV3cy9hcnRpY2xlcy8yMDIzLTA4LTE3L3Rlc2xhLXJldmFtcGVkLW1vZGVsLTMtbWFzcy1vdXRwdXQtaW4tY2hpbmEtbWF5LXN0YXJ0LW5leHQtbW9udGjSAQA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
98
+ " 'publisher': {'href': 'https://www.bloomberg.com', 'title': 'Bloomberg'}},\n",
99
+ " {'title': \"What's Going On With Tesla Stock Today? - Tesla (NASDAQ:TSLA) - Benzinga\",\n",
100
+ " 'description': \"What's Going On With Tesla Stock Today? - Tesla (NASDAQ:TSLA) Benzinga\",\n",
101
+ " 'published date': 'Fri, 18 Aug 2023 16:02:37 GMT',\n",
102
+ " 'url': 'https://news.google.com/rss/articles/CBMiUmh0dHBzOi8vd3d3LmJlbnppbmdhLmNvbS9uZXdzLzIzLzA4LzMzOTE3ODU3L3doYXRzLWdvaW5nLW9uLXdpdGgtdGVzbGEtc3RvY2stdG9kYXnSAS1odHRwczovL3d3dy5iZW56aW5nYS5jb20vYW1wL2NvbnRlbnQvMzM5MTc4NTc?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
103
+ " 'publisher': {'href': 'https://www.benzinga.com', 'title': 'Benzinga'}},\n",
104
+ " {'title': 'Tesla Needs A Narrative Change (NASDAQ:TSLA) - Seeking Alpha',\n",
105
+ " 'description': 'Tesla Needs A Narrative Change (NASDAQ:TSLA) Seeking Alpha',\n",
106
+ " 'published date': 'Thu, 17 Aug 2023 11:00:00 GMT',\n",
107
+ " 'url': 'https://news.google.com/rss/articles/CBMiR2h0dHBzOi8vc2Vla2luZ2FscGhhLmNvbS9hcnRpY2xlLzQ2MjkwODctdGVzbGEtbmVlZHMtYS1uYXJyYXRpdmUtY2hhbmdl0gEA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
108
+ " 'publisher': {'href': 'https://seekingalpha.com', 'title': 'Seeking Alpha'}},\n",
109
+ " {'title': 'Is Tesla (TSLA) a Hidden Gem? A Deep Dive into its Valuation and Financial Health - GuruFocus.com',\n",
110
+ " 'description': 'Is Tesla (TSLA) a Hidden Gem? A Deep Dive into its Valuation and Financial Health GuruFocus.com',\n",
111
+ " 'published date': 'Fri, 18 Aug 2023 16:06:35 GMT',\n",
112
+ " 'url': 'https://news.google.com/rss/articles/CBMidWh0dHBzOi8vd3d3Lmd1cnVmb2N1cy5jb20vbmV3cy8yMDY4MTc3L2lzLXRlc2xhLXRzbGEtYS1oaWRkZW4tZ2VtLWEtZGVlcC1kaXZlLWludG8taXRzLXZhbHVhdGlvbi1hbmQtZmluYW5jaWFsLWhlYWx0aNIBAA?oc=5&hl=en-US&gl=US&ceid=US:en',\n",
113
+ " 'publisher': {'href': 'https://www.gurufocus.com',\n",
114
+ " 'title': 'GuruFocus.com'}}]"
115
+ ]
116
+ },
117
+ "execution_count": 4,
118
+ "metadata": {},
119
+ "output_type": "execute_result"
120
+ }
121
+ ],
122
+ "source": [
123
+ "tesla_news"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "code",
128
+ "execution_count": 5,
129
+ "metadata": {},
130
+ "outputs": [
131
+ {
132
+ "name": "stdout",
133
+ "output_type": "stream",
134
+ "text": [
135
+ "https://www.barrons.com/articles/tesla-stock-down-china-support-65832d7d\n"
136
+ ]
137
+ }
138
+ ],
139
+ "source": [
140
+ "import requests\n",
141
+ "r = requests.head(tesla_news[0]['url'], allow_redirects=True)\n",
142
+ "print(r.url)"
143
+ ]
144
+ },
145
+ {
146
+ "cell_type": "code",
147
+ "execution_count": 6,
148
+ "metadata": {},
149
+ "outputs": [
150
+ {
151
+ "data": {
152
+ "text/plain": [
153
+ "'Tesla Stock Went Down Again for a New Reason. Here’s Where It’s Going.\\n\\nShares of EV leader Tesla have taken a beating for the past couple of weeks, for reasons related both to the company and to what is happening in financial markets.\\n\\nFrom To Message\\n\\nSEND\\n\\nAn error has occurred, please try again later.'"
154
+ ]
155
+ },
156
+ "execution_count": 6,
157
+ "metadata": {},
158
+ "output_type": "execute_result"
159
+ }
160
+ ],
161
+ "source": [
162
+ "from newspaper import Article\n",
163
+ "from newspaper import Config\n",
164
+ "\n",
165
+ "user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'\n",
166
+ "\n",
167
+ "config = Config()\n",
168
+ "config.browser_user_agent = user_agent\n",
169
+ "\n",
170
+ "url = r.url\n",
171
+ "\n",
172
+ "article = Article(url, config=config)\n",
173
+ "article.download()\n",
174
+ "article.html\n",
175
+ "article.parse()\n",
176
+ "article.text"
177
+ ]
178
+ },
179
+ {
180
+ "cell_type": "code",
181
+ "execution_count": 7,
182
+ "metadata": {},
183
+ "outputs": [],
184
+ "source": [
185
+ "def get_news_articles_info(ticker_name):\n",
186
+ " google_news = GNews(max_results=10)\n",
187
+ " ticker_news = google_news.get_news(ticker_name)\n",
188
+ " ticker_news_extracted = []\n",
189
+ " count = 0\n",
190
+ " for details in ticker_news:\n",
191
+ " details['text'] = ''\n",
192
+ " try:\n",
193
+ " url = details['url']\n",
194
+ " url = requests.head(url, allow_redirects=True).url\n",
195
+ " print(url)\n",
196
+ " \n",
197
+ " user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'\n",
198
+ " config = Config()\n",
199
+ " config.browser_user_agent = user_agent\n",
200
+ "\n",
201
+ " article = Article(url, config=config)\n",
202
+ " article.download()\n",
203
+ " article.parse()\n",
204
+ " details['text'] = article.text\n",
205
+ " details['url'] = url\n",
206
+ " count = count + 1\n",
207
+ " print(count,url)\n",
208
+ " except:\n",
209
+ " print(\"Error\",url)\n",
210
+ " continue\n",
211
+ " if details['text'] == '':\n",
212
+ " print('No text',url)\n",
213
+ " continue\n",
214
+ " if count > 5:\n",
215
+ " break\n",
216
+ " ticker_news_extracted.append(details)\n",
217
+ " return ticker_news_extracted"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": 8,
223
+ "metadata": {},
224
+ "outputs": [
225
+ {
226
+ "name": "stdout",
227
+ "output_type": "stream",
228
+ "text": [
229
+ "https://www.marketbeat.com/instant-alerts/nyse-dlb-sec-filing-2023-08-20/\n",
230
+ "1 https://www.marketbeat.com/instant-alerts/nyse-dlb-sec-filing-2023-08-20/\n",
231
+ "https://www.investorsobserver.com/news/stock-update/industrials-stocks-moving-up-and-down-friday-lgmk-vcig-az-dlb-quad-eh-up-view\n",
232
+ "2 https://www.investorsobserver.com/news/stock-update/industrials-stocks-moving-up-and-down-friday-lgmk-vcig-az-dlb-quad-eh-up-view\n",
233
+ "https://bismarcktribune.com/sports/high-school/basketball/dlb-standout-yale-kinda-done-being-a-kid-now/article_bb691422-2c10-11ee-9593-abd4b2d8e8a9.html\n",
234
+ "3 https://bismarcktribune.com/sports/high-school/basketball/dlb-standout-yale-kinda-done-being-a-kid-now/article_bb691422-2c10-11ee-9593-abd4b2d8e8a9.html\n",
235
+ "Error https://news.google.com/rss/articles/CBMiT2h0dHBzOi8vd3d3Lm5hc2RhcS5jb20vYXJ0aWNsZXMvZGxiLXF1YW50aXRhdGl2ZS1zdG9jay1hbmFseXNpcy1iZW5qYW1pbi1ncmFoYW3SAQA?oc=5&hl=en-US&gl=US&ceid=US:en\n",
236
+ "https://seekingalpha.com/news/4004259-dolby-laboratories-set-to-join-sp-midcap-400-staar-surgical-to-join-sp-smallcap-600?source=content_type:react%7Cfirst_level_url:market-news%7Csection_asset:main\n",
237
+ "4 https://seekingalpha.com/news/4004259-dolby-laboratories-set-to-join-sp-midcap-400-staar-surgical-to-join-sp-smallcap-600?source=content_type:react%7Cfirst_level_url:market-news%7Csection_asset:main\n",
238
+ "https://finance.yahoo.com/news/dolby-laboratories-inc-nyse-dlb-223245549.html\n",
239
+ "5 https://finance.yahoo.com/news/dolby-laboratories-inc-nyse-dlb-223245549.html\n"
240
+ ]
241
+ }
242
+ ],
243
+ "source": [
244
+ "news_info = get_news_articles_info('DLB')"
245
+ ]
246
+ },
247
+ {
248
+ "cell_type": "code",
249
+ "execution_count": null,
250
+ "metadata": {},
251
+ "outputs": [
252
+ {
253
+ "data": {
254
+ "text/plain": [
255
+ "[{'title': 'Apple (NASDAQ:APPL) Slips After iPhone Launch Details Emerge ... - TipRanks',\n",
256
+ " 'description': 'Apple (NASDAQ:APPL) Slips After iPhone Launch Details Emerge ... TipRanks',\n",
257
+ " 'published date': 'Mon, 07 Aug 2023 07:00:00 GMT',\n",
258
+ " 'url': 'https://www.tipranks.com/news/apple-nasdaqappl-slips-after-iphone-launch-details-emerge',\n",
259
+ " 'publisher': {'href': 'https://www.tipranks.com', 'title': 'TipRanks'},\n",
260
+ " 'text': 'In what may be an odd twist for Apple (NASDAQ:AAPL) the release of the latest iPhone just got some fresh details attached to it. But oddly, this failed to bolster Apple’s stock price at all. In fact, Apple was down somewhat in Monday afternoon’s trading despite just how much a new iPhone likely means to Apple’s bottom line.\\n\\nThe latest reports note that the iPhone 15 will get a full sales launch somewhere around September 22. That’s a Friday, which should help improve sales, if only narrowly, as buyers will have all weekend to set up their new devices and check out all the little differences. Naturally, the phone won’t just drop into stores; Apple plans to have a launch event a week beforehand, somewhere around the 12th or the 13th. While the basic iPhone aesthetic likely won’t be much changed, there will be some new and worthwhile improvements. Perhaps the biggest will be the three nanometer A17 chip in the iPhone 15 Pro. That little measure is going to make the iPhone 15 Pro the first smartphone powered by a three nanometer chip for a good while.\\n\\nHowever, there will likely also be some issues with the newest launch. First, Apple has to beat its launch of the iPhone 14, which was marred by a supply chain nightmare and pandemic-related issues that kept sufficient models from coming out. Worse, Apple will be launching that new phone into what Apple CEO Tim Cook told CNBC would be a “tough” smartphone market. Considering the state of inflation right now, as well as still-rising prices for everyday staples, Apple might have a tough time convincing shoppers to give up their still-working previous iPhone in favor of the new variety.\\n\\nAnalysts, meanwhile, are mostly convinced Apple can do the job. With 22 Buy ratings and seven Hold, Apple stock is considered a Strong Buy by analyst consensus. Further, with an average price target of $208.99, Apple stock offers investors a 17.04% upside potential.\\n\\nDisclosure'},\n",
261
+ " {'title': \"Inside the recruitment of Badgers top 2025 LB target Carter Appl - Bucky's 5th Quarter\",\n",
262
+ " 'description': \"Inside the recruitment of Badgers top 2025 LB target Carter Appl Bucky's 5th Quarter\",\n",
263
+ " 'published date': 'Mon, 07 Aug 2023 07:00:00 GMT',\n",
264
+ " 'url': 'https://www.buckys5thquarter.com/wisconsin-football-recruiting/2023/8/7/23823101/inside-the-recruitment-of-wisconsin-badgers-top-2025-lb-target-carter-appl-mike-tressel-luke-fickell',\n",
265
+ " 'publisher': {'href': 'https://www.buckys5thquarter.com',\n",
266
+ " 'title': \"Bucky's 5th Quarter\"},\n",
267
+ " 'text': \"The Wisconsin Badgers are showing interest in 2025 in-state linebacker Carter Appl, a native of Appleton, Wisconsin, who was recently on campus this past June.\\n\\nWhile Appl hasn't earned an offer from Luke Fickell’s staff yet, the linebacker informed Bucky’s 5th Quarter about the coaches’ message that he’s a priority in the 2025 class for the program.\\n\\n“[Initial conversations with the staff have been] great. They had me down for an unofficial visit at the end of June with the last football camp and got to talk to a lot of coaches. They invited me down to a game in October and then sent me graphics this week and a message saying I’m one of their top targets for 2025,” Appl said.\\n\\nAppl has begun to build a relationship with linebackers coach Mike Tressel and the rest of the staff, which he hopes will continue on later visits.\\n\\n“[My relationships with the coaches] have been pretty good and they seem interested, hoping to further grow the relationships with more visits.”\\n\\nThe plan currently is for Appl to come down for a game this fall on his next visit, although the specific date hasn't been finalized.\\n\\nEarly in the recruiting process, Appl’s standout schools are Wisconsin and North Dakota State, but the Appleton native is looking to gain exposure on the recruiting platform with a strong junior season and camping elsewhere next summer.\\n\\n“As of now, [standout schools are] the Badgers and North Dakota State, but hoping to get exposure from other schools by going to more camps next summer and having a great season.”\\n\\nAs for personal goals, Appl is hoping to lead Xavier High School to a state title this year, while personally looking to be the leader in tackles amongst the state, while also hoping for an All-State achievement this fall.\\n\\n“My main goal for the season is for our team to reach our max potential and ultimately win a state title. Individually, my goal is to lead the state in tackles for loss and sacks and to make All-State which will hopefully help us to achieve those team goals!”\\n\\nThe Badgers already are recruiting in-state linebacker Cooper Catalano hard, and Appl could very well be another target for the school at linebacker in the 2025 class.\"},\n",
268
+ " {'title': 'Wisconsin Badgers Targeting In-State LB Carter Appl for 2025 Class - BVM Sports',\n",
269
+ " 'description': 'Wisconsin Badgers Targeting In-State LB Carter Appl for 2025 Class BVM Sports',\n",
270
+ " 'published date': 'Mon, 07 Aug 2023 22:18:00 GMT',\n",
271
+ " 'url': 'https://bvmsports.com/2023/08/07/wisconsin-badgers-targeting-in-state-lb-carter-appl-for-2025-class/',\n",
272
+ " 'publisher': {'href': 'https://bvmsports.com', 'title': 'BVM Sports'},\n",
273
+ " 'text': \"Via Bucky's 5th Quarter, 08/07/2023\\n\\nKey points: Wisconsin Badgers showing interest in 2025 in-state linebacker Carter Appl\\n\\nAppl informed Bucky's 5th Quarter about being a priority recruit for the Badgers' 2025 class\\n\\nAppl has standout schools of Wisconsin and North Dakota State, but looking for more exposure\\n\\nThe Wisconsin Badgers are showing interest in recruiting in-state linebacker Carter Appl for the 2025 class. Appl recently visited the campus and has been in talks with the coaching staff, who see him as a priority for the program. He is also considering North Dakota State as a potential school. Appl plans to attend a game at Wisconsin this fall and hopes to gain exposure through camps and have a successful junior season. His goals include leading his high school team to a state title and earning All-State honors. The Badgers are also recruiting linebacker Cooper Catalano.\\n\\nThe summary of the linked article was generated with the assistance of artificial intelligence technology from OpenAI\"},\n",
274
+ " {'title': 'LEGAL NOTICE Notice of Qualification of HENNING COMPANIES ... - Finger Lakes Times',\n",
275
+ " 'description': 'LEGAL NOTICE Notice of Qualification of HENNING COMPANIES ... Finger Lakes Times',\n",
276
+ " 'published date': 'Sat, 12 Aug 2023 03:57:51 GMT',\n",
277
+ " 'url': 'https://www.fltimes.com/classifieds/community/announcements/legal/legal-notice-notice-of-qualification-of-henning-companies-llc-appl/ad_d75248ba-7d56-5f98-b866-43d8700379e5.html',\n",
278
+ " 'publisher': {'href': 'https://www.fltimes.com',\n",
279
+ " 'title': 'Finger Lakes Times'},\n",
280
+ " 'text': 'LEGAL NOTICE\\n\\nNotice of Qualification of HENNING COMPANIES, LLC\\n\\nAppl. for Auth. filed with Secy. of State of NY (SSNY) on 07/31/23. Office location: Wayne County. LLC formed in Missouri (MO) on 02/10/15. Princ. office of LLC: 5800 Merle Hay Rd., Ste. 14, Johnston, IA 50131. NYS fictitious name: HENNING COMPANIES #1, LLC. SSNY designated as agent of LLC upon whom process against it may be served. SSNY shall mail process to Corporation Service Co., 80 State St., Albany, NY 12207-2543. Cert. of Form. filed with Secy. of State - MO, 600 W. Main St., Jefferson City, MO 65101. Purpose: Any lawful activity.\\n\\n528'},\n",
281
+ " {'title': \"Apple Faces Weak Smartphone Market. These Analysts Say Buy the Stock Anyway. - Barron's\",\n",
282
+ " 'description': \"Apple Faces Weak Smartphone Market. These Analysts Say Buy the Stock Anyway. Barron's\",\n",
283
+ " 'published date': 'Mon, 31 Jul 2023 07:00:00 GMT',\n",
284
+ " 'url': 'https://www.barrons.com/articles/apple-stock-price-iphone-sales-earnings-a84e66aa',\n",
285
+ " 'publisher': {'href': 'https://www.barrons.com', 'title': \"Barron's\"},\n",
286
+ " 'text': 'Apple Is Grappling With a Weak Smartphone Market. These Analysts Say to Buy the Stock Anyway.\\n\\nApple’s third-quarter report on Thursday is set to be the highlight of a busy earnings week.\\n\\nFrom To Message\\n\\nSEND\\n\\nAn error has occurred, please try again later.'}]"
287
+ ]
288
+ },
289
+ "execution_count": 94,
290
+ "metadata": {},
291
+ "output_type": "execute_result"
292
+ }
293
+ ],
294
+ "source": [
295
+ "news_info"
296
+ ]
297
+ },
298
+ {
299
+ "cell_type": "code",
300
+ "execution_count": null,
301
+ "metadata": {},
302
+ "outputs": [],
303
+ "source": [
304
+ "import plotly.graph_objs as go"
305
+ ]
306
+ }
307
+ ],
308
+ "metadata": {
309
+ "kernelspec": {
310
+ "display_name": "Python 3",
311
+ "language": "python",
312
+ "name": "python3"
313
+ },
314
+ "language_info": {
315
+ "codemirror_mode": {
316
+ "name": "ipython",
317
+ "version": 3
318
+ },
319
+ "file_extension": ".py",
320
+ "mimetype": "text/x-python",
321
+ "name": "python",
322
+ "nbconvert_exporter": "python",
323
+ "pygments_lexer": "ipython3",
324
+ "version": "3.9.6"
325
+ },
326
+ "orig_nbformat": 4
327
+ },
328
+ "nbformat": 4,
329
+ "nbformat_minor": 2
330
+ }
yfinance_news_test.ipynb ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 44,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import json\n",
10
+ "import feedparser"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 45,
16
+ "metadata": {},
17
+ "outputs": [],
18
+ "source": [
19
+ "headers = {\n",
20
+ " 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0'\n",
21
+ "}"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "code",
26
+ "execution_count": 46,
27
+ "metadata": {},
28
+ "outputs": [],
29
+ "source": [
30
+ "ticker = 'APPLE finance News'"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": 47,
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": [
39
+ "rssfeedurl = 'https://feeds.finance.yahoo.com/rss/2.0/headline?s=%s&region=US&lang=en-US'%ticker"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 48,
45
+ "metadata": {},
46
+ "outputs": [
47
+ {
48
+ "data": {
49
+ "text/plain": [
50
+ "'https://feeds.finance.yahoo.com/rss/2.0/headline?s=APPLE finance News&region=US&lang=en-US'"
51
+ ]
52
+ },
53
+ "execution_count": 48,
54
+ "metadata": {},
55
+ "output_type": "execute_result"
56
+ }
57
+ ],
58
+ "source": [
59
+ "rssfeedurl"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": 49,
65
+ "metadata": {},
66
+ "outputs": [
67
+ {
68
+ "ename": "InvalidURL",
69
+ "evalue": "URL can't contain control characters. '/rss/2.0/headline?s=APPLE finance News&region=US&lang=en-US' (found at least ' ')",
70
+ "output_type": "error",
71
+ "traceback": [
72
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
73
+ "\u001b[0;31mInvalidURL\u001b[0m Traceback (most recent call last)",
74
+ "Cell \u001b[0;32mIn[49], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m NewsFeed \u001b[39m=\u001b[39m feedparser\u001b[39m.\u001b[39;49mparse(rssfeedurl)\n",
75
+ "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/feedparser/api.py:216\u001b[0m, in \u001b[0;36mparse\u001b[0;34m(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, response_headers, resolve_relative_uris, sanitize_html)\u001b[0m\n\u001b[1;32m 208\u001b[0m result \u001b[39m=\u001b[39m FeedParserDict(\n\u001b[1;32m 209\u001b[0m bozo\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m,\n\u001b[1;32m 210\u001b[0m entries\u001b[39m=\u001b[39m[],\n\u001b[1;32m 211\u001b[0m feed\u001b[39m=\u001b[39mFeedParserDict(),\n\u001b[1;32m 212\u001b[0m headers\u001b[39m=\u001b[39m{},\n\u001b[1;32m 213\u001b[0m )\n\u001b[1;32m 215\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 216\u001b[0m data \u001b[39m=\u001b[39m _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)\n\u001b[1;32m 217\u001b[0m \u001b[39mexcept\u001b[39;00m urllib\u001b[39m.\u001b[39merror\u001b[39m.\u001b[39mURLError \u001b[39mas\u001b[39;00m error:\n\u001b[1;32m 218\u001b[0m result\u001b[39m.\u001b[39mupdate({\n\u001b[1;32m 219\u001b[0m \u001b[39m'\u001b[39m\u001b[39mbozo\u001b[39m\u001b[39m'\u001b[39m: \u001b[39mTrue\u001b[39;00m,\n\u001b[1;32m 220\u001b[0m \u001b[39m'\u001b[39m\u001b[39mbozo_exception\u001b[39m\u001b[39m'\u001b[39m: error,\n\u001b[1;32m 221\u001b[0m })\n",
76
+ "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/feedparser/api.py:115\u001b[0m, in \u001b[0;36m_open_resource\u001b[0;34m(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[39mreturn\u001b[39;00m url_file_stream_or_string\u001b[39m.\u001b[39mread()\n\u001b[1;32m 113\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39misinstance\u001b[39m(url_file_stream_or_string, \u001b[39mstr\u001b[39m) \\\n\u001b[1;32m 114\u001b[0m \u001b[39mand\u001b[39;00m urllib\u001b[39m.\u001b[39mparse\u001b[39m.\u001b[39murlparse(url_file_stream_or_string)[\u001b[39m0\u001b[39m] \u001b[39min\u001b[39;00m (\u001b[39m'\u001b[39m\u001b[39mhttp\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39mhttps\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39mftp\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39mfile\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39mfeed\u001b[39m\u001b[39m'\u001b[39m):\n\u001b[0;32m--> 115\u001b[0m \u001b[39mreturn\u001b[39;00m http\u001b[39m.\u001b[39;49mget(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)\n\u001b[1;32m 117\u001b[0m \u001b[39m# try to open with native open function (if url_file_stream_or_string is a filename)\u001b[39;00m\n\u001b[1;32m 118\u001b[0m \u001b[39mtry\u001b[39;00m:\n",
77
+ "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/feedparser/http.py:171\u001b[0m, in \u001b[0;36mget\u001b[0;34m(url, etag, modified, agent, referrer, handlers, request_headers, result)\u001b[0m\n\u001b[1;32m 169\u001b[0m opener \u001b[39m=\u001b[39m urllib\u001b[39m.\u001b[39mrequest\u001b[39m.\u001b[39mbuild_opener(\u001b[39m*\u001b[39m\u001b[39mtuple\u001b[39m(handlers \u001b[39m+\u001b[39m [_FeedURLHandler()]))\n\u001b[1;32m 170\u001b[0m opener\u001b[39m.\u001b[39maddheaders \u001b[39m=\u001b[39m [] \u001b[39m# RMK - must clear so we only send our custom User-Agent\u001b[39;00m\n\u001b[0;32m--> 171\u001b[0m f \u001b[39m=\u001b[39m opener\u001b[39m.\u001b[39;49mopen(request)\n\u001b[1;32m 172\u001b[0m data \u001b[39m=\u001b[39m f\u001b[39m.\u001b[39mread()\n\u001b[1;32m 173\u001b[0m f\u001b[39m.\u001b[39mclose()\n",
78
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py:517\u001b[0m, in \u001b[0;36mOpenerDirector.open\u001b[0;34m(self, fullurl, data, timeout)\u001b[0m\n\u001b[1;32m 514\u001b[0m req \u001b[39m=\u001b[39m meth(req)\n\u001b[1;32m 516\u001b[0m sys\u001b[39m.\u001b[39maudit(\u001b[39m'\u001b[39m\u001b[39murllib.Request\u001b[39m\u001b[39m'\u001b[39m, req\u001b[39m.\u001b[39mfull_url, req\u001b[39m.\u001b[39mdata, req\u001b[39m.\u001b[39mheaders, req\u001b[39m.\u001b[39mget_method())\n\u001b[0;32m--> 517\u001b[0m response \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_open(req, data)\n\u001b[1;32m 519\u001b[0m \u001b[39m# post-process response\u001b[39;00m\n\u001b[1;32m 520\u001b[0m meth_name \u001b[39m=\u001b[39m protocol\u001b[39m+\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m_response\u001b[39m\u001b[39m\"\u001b[39m\n",
79
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py:534\u001b[0m, in \u001b[0;36mOpenerDirector._open\u001b[0;34m(self, req, data)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[39mreturn\u001b[39;00m result\n\u001b[1;32m 533\u001b[0m protocol \u001b[39m=\u001b[39m req\u001b[39m.\u001b[39mtype\n\u001b[0;32m--> 534\u001b[0m result \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_call_chain(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mhandle_open, protocol, protocol \u001b[39m+\u001b[39;49m\n\u001b[1;32m 535\u001b[0m \u001b[39m'\u001b[39;49m\u001b[39m_open\u001b[39;49m\u001b[39m'\u001b[39;49m, req)\n\u001b[1;32m 536\u001b[0m \u001b[39mif\u001b[39;00m result:\n\u001b[1;32m 537\u001b[0m \u001b[39mreturn\u001b[39;00m result\n",
80
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py:494\u001b[0m, in \u001b[0;36mOpenerDirector._call_chain\u001b[0;34m(self, chain, kind, meth_name, *args)\u001b[0m\n\u001b[1;32m 492\u001b[0m \u001b[39mfor\u001b[39;00m handler \u001b[39min\u001b[39;00m handlers:\n\u001b[1;32m 493\u001b[0m func \u001b[39m=\u001b[39m \u001b[39mgetattr\u001b[39m(handler, meth_name)\n\u001b[0;32m--> 494\u001b[0m result \u001b[39m=\u001b[39m func(\u001b[39m*\u001b[39;49margs)\n\u001b[1;32m 495\u001b[0m \u001b[39mif\u001b[39;00m result \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 496\u001b[0m \u001b[39mreturn\u001b[39;00m result\n",
81
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py:1389\u001b[0m, in \u001b[0;36mHTTPSHandler.https_open\u001b[0;34m(self, req)\u001b[0m\n\u001b[1;32m 1388\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mhttps_open\u001b[39m(\u001b[39mself\u001b[39m, req):\n\u001b[0;32m-> 1389\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mdo_open(http\u001b[39m.\u001b[39;49mclient\u001b[39m.\u001b[39;49mHTTPSConnection, req,\n\u001b[1;32m 1390\u001b[0m context\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_context, check_hostname\u001b[39m=\u001b[39;49m\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_check_hostname)\n",
82
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py:1346\u001b[0m, in \u001b[0;36mAbstractHTTPHandler.do_open\u001b[0;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[1;32m 1344\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m 1345\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m-> 1346\u001b[0m h\u001b[39m.\u001b[39;49mrequest(req\u001b[39m.\u001b[39;49mget_method(), req\u001b[39m.\u001b[39;49mselector, req\u001b[39m.\u001b[39;49mdata, headers,\n\u001b[1;32m 1347\u001b[0m encode_chunked\u001b[39m=\u001b[39;49mreq\u001b[39m.\u001b[39;49mhas_header(\u001b[39m'\u001b[39;49m\u001b[39mTransfer-encoding\u001b[39;49m\u001b[39m'\u001b[39;49m))\n\u001b[1;32m 1348\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mOSError\u001b[39;00m \u001b[39mas\u001b[39;00m err: \u001b[39m# timeout error\u001b[39;00m\n\u001b[1;32m 1349\u001b[0m \u001b[39mraise\u001b[39;00m URLError(err)\n",
83
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/http/client.py:1257\u001b[0m, in \u001b[0;36mHTTPConnection.request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1254\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mrequest\u001b[39m(\u001b[39mself\u001b[39m, method, url, body\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, headers\u001b[39m=\u001b[39m{}, \u001b[39m*\u001b[39m,\n\u001b[1;32m 1255\u001b[0m encode_chunked\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m):\n\u001b[1;32m 1256\u001b[0m \u001b[39m \u001b[39m\u001b[39m\"\"\"Send a complete request to the server.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1257\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_send_request(method, url, body, headers, encode_chunked)\n",
84
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/http/client.py:1268\u001b[0m, in \u001b[0;36mHTTPConnection._send_request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1265\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39m'\u001b[39m\u001b[39maccept-encoding\u001b[39m\u001b[39m'\u001b[39m \u001b[39min\u001b[39;00m header_names:\n\u001b[1;32m 1266\u001b[0m skips[\u001b[39m'\u001b[39m\u001b[39mskip_accept_encoding\u001b[39m\u001b[39m'\u001b[39m] \u001b[39m=\u001b[39m \u001b[39m1\u001b[39m\n\u001b[0;32m-> 1268\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mputrequest(method, url, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mskips)\n\u001b[1;32m 1270\u001b[0m \u001b[39m# chunked encoding will happen if HTTP/1.1 is used and either\u001b[39;00m\n\u001b[1;32m 1271\u001b[0m \u001b[39m# the caller passes encode_chunked=True or the following\u001b[39;00m\n\u001b[1;32m 1272\u001b[0m \u001b[39m# conditions hold:\u001b[39;00m\n\u001b[1;32m 1273\u001b[0m \u001b[39m# 1. content-length has not been explicitly set\u001b[39;00m\n\u001b[1;32m 1274\u001b[0m \u001b[39m# 2. the body is a file or iterable, but not a str or bytes-like\u001b[39;00m\n\u001b[1;32m 1275\u001b[0m \u001b[39m# 3. Transfer-Encoding has NOT been explicitly set by the caller\u001b[39;00m\n\u001b[1;32m 1277\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39m'\u001b[39m\u001b[39mcontent-length\u001b[39m\u001b[39m'\u001b[39m \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m header_names:\n\u001b[1;32m 1278\u001b[0m \u001b[39m# only chunk body if not explicitly set for backwards\u001b[39;00m\n\u001b[1;32m 1279\u001b[0m \u001b[39m# compatibility, assuming the client code is already handling the\u001b[39;00m\n\u001b[1;32m 1280\u001b[0m \u001b[39m# chunking\u001b[39;00m\n",
85
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/http/client.py:1102\u001b[0m, in \u001b[0;36mHTTPConnection.putrequest\u001b[0;34m(self, method, url, skip_host, skip_accept_encoding)\u001b[0m\n\u001b[1;32m 1099\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_method \u001b[39m=\u001b[39m method\n\u001b[1;32m 1101\u001b[0m url \u001b[39m=\u001b[39m url \u001b[39mor\u001b[39;00m \u001b[39m'\u001b[39m\u001b[39m/\u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m-> 1102\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_validate_path(url)\n\u001b[1;32m 1104\u001b[0m request \u001b[39m=\u001b[39m \u001b[39m'\u001b[39m\u001b[39m%s\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m%s\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m%s\u001b[39;00m\u001b[39m'\u001b[39m \u001b[39m%\u001b[39m (method, url, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_http_vsn_str)\n\u001b[1;32m 1106\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_output(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_encode_request(request))\n",
86
+ "File \u001b[0;32m/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/http/client.py:1202\u001b[0m, in \u001b[0;36mHTTPConnection._validate_path\u001b[0;34m(self, url)\u001b[0m\n\u001b[1;32m 1200\u001b[0m match \u001b[39m=\u001b[39m _contains_disallowed_url_pchar_re\u001b[39m.\u001b[39msearch(url)\n\u001b[1;32m 1201\u001b[0m \u001b[39mif\u001b[39;00m match:\n\u001b[0;32m-> 1202\u001b[0m \u001b[39mraise\u001b[39;00m InvalidURL(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mURL can\u001b[39m\u001b[39m'\u001b[39m\u001b[39mt contain control characters. \u001b[39m\u001b[39m{\u001b[39;00murl\u001b[39m!r}\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 1203\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m(found at least \u001b[39m\u001b[39m{\u001b[39;00mmatch\u001b[39m.\u001b[39mgroup()\u001b[39m!r}\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m\"\u001b[39m)\n",
87
+ "\u001b[0;31mInvalidURL\u001b[0m: URL can't contain control characters. '/rss/2.0/headline?s=APPLE finance News&region=US&lang=en-US' (found at least ' ')"
88
+ ]
89
+ }
90
+ ],
91
+ "source": [
92
+ "NewsFeed = feedparser.parse(rssfeedurl)"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "code",
97
+ "execution_count": null,
98
+ "metadata": {},
99
+ "outputs": [
100
+ {
101
+ "data": {
102
+ "text/plain": [
103
+ "feedparser.util.FeedParserDict"
104
+ ]
105
+ },
106
+ "execution_count": 40,
107
+ "metadata": {},
108
+ "output_type": "execute_result"
109
+ }
110
+ ],
111
+ "source": [
112
+ "type(NewsFeed)"
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": null,
118
+ "metadata": {},
119
+ "outputs": [
120
+ {
121
+ "data": {
122
+ "text/plain": [
123
+ "dict_keys(['bozo', 'entries', 'feed', 'headers', 'href', 'status', 'encoding', 'version', 'namespaces'])"
124
+ ]
125
+ },
126
+ "execution_count": 41,
127
+ "metadata": {},
128
+ "output_type": "execute_result"
129
+ }
130
+ ],
131
+ "source": [
132
+ "NewsFeed.keys()"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": null,
138
+ "metadata": {},
139
+ "outputs": [
140
+ {
141
+ "data": {
142
+ "text/plain": [
143
+ "20"
144
+ ]
145
+ },
146
+ "execution_count": 42,
147
+ "metadata": {},
148
+ "output_type": "execute_result"
149
+ }
150
+ ],
151
+ "source": [
152
+ "len(NewsFeed.entries)"
153
+ ]
154
+ },
155
+ {
156
+ "cell_type": "code",
157
+ "execution_count": null,
158
+ "metadata": {},
159
+ "outputs": [
160
+ {
161
+ "data": {
162
+ "text/plain": [
163
+ "{'summary': 'In this article, we will be taking a look at the 10 stocks ChatGPT said will make me rich in 10 years. To skip our detailed analysis of generative AI and its application in the field of investing, you can go directly to see the 5 Stocks ChatGPT Said Will Make Me Rich in 10 Years. […]',\n",
164
+ " 'summary_detail': {'type': 'text/html',\n",
165
+ " 'language': None,\n",
166
+ " 'base': 'https://feeds.finance.yahoo.com/rss/2.0/headline?s=AAPL&region=US&lang=en-US',\n",
167
+ " 'value': 'In this article, we will be taking a look at the 10 stocks ChatGPT said will make me rich in 10 years. To skip our detailed analysis of generative AI and its application in the field of investing, you can go directly to see the 5 Stocks ChatGPT Said Will Make Me Rich in 10 Years. […]'},\n",
168
+ " 'id': '5ab07694-9da7-320d-bf6b-a51044b80e44',\n",
169
+ " 'guidislink': False,\n",
170
+ " 'links': [{'rel': 'alternate',\n",
171
+ " 'type': 'text/html',\n",
172
+ " 'href': 'https://finance.yahoo.com/news/10-stocks-chatgpt-said-rich-202351994.html?.tsrc=rss'}],\n",
173
+ " 'link': 'https://finance.yahoo.com/news/10-stocks-chatgpt-said-rich-202351994.html?.tsrc=rss',\n",
174
+ " 'published': 'Sun, 20 Aug 2023 20:23:51 +0000',\n",
175
+ " 'published_parsed': time.struct_time(tm_year=2023, tm_mon=8, tm_mday=20, tm_hour=20, tm_min=23, tm_sec=51, tm_wday=6, tm_yday=232, tm_isdst=0),\n",
176
+ " 'title': '10 Stocks ChatGPT Said Will Make Me Rich in 10 Years',\n",
177
+ " 'title_detail': {'type': 'text/plain',\n",
178
+ " 'language': None,\n",
179
+ " 'base': 'https://feeds.finance.yahoo.com/rss/2.0/headline?s=AAPL&region=US&lang=en-US',\n",
180
+ " 'value': '10 Stocks ChatGPT Said Will Make Me Rich in 10 Years'}}"
181
+ ]
182
+ },
183
+ "execution_count": 43,
184
+ "metadata": {},
185
+ "output_type": "execute_result"
186
+ }
187
+ ],
188
+ "source": [
189
+ "NewsFeed.entries[0]"
190
+ ]
191
+ }
192
+ ],
193
+ "metadata": {
194
+ "kernelspec": {
195
+ "display_name": "Python 3",
196
+ "language": "python",
197
+ "name": "python3"
198
+ },
199
+ "language_info": {
200
+ "codemirror_mode": {
201
+ "name": "ipython",
202
+ "version": 3
203
+ },
204
+ "file_extension": ".py",
205
+ "mimetype": "text/x-python",
206
+ "name": "python",
207
+ "nbconvert_exporter": "python",
208
+ "pygments_lexer": "ipython3",
209
+ "version": "3.9.6"
210
+ },
211
+ "orig_nbformat": 4
212
+ },
213
+ "nbformat": 4,
214
+ "nbformat_minor": 2
215
+ }