This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yfinance as yf | |
import pandas as pd | |
import plotly.graph_objs as go | |
from plotly.subplots import make_subplots | |
#Get Historical Stock Data from AAPL | |
stock_data = yf.download(tickers='AAPL', interval='1d', period='3y') | |
#Calculate an SMA | |
stock_data['SMA50'] = stock_data['Close'].rolling(window=50).mean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
2 Pre-Requisites - install the package, and get an OpenAI API key | |
pip install openai | |
""" | |
#import the package and add your key | |
import openai | |
openai.api_key = "YOUR_API_KEY_HERE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the necessary packages | |
import yfinance as yf | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
#download the historical stock data | |
aapl_df = yf.download("AAPL", start="2018-03-24", end="2023-03-24") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
First, we need to create a Reddit account and get an API key to access the Reddit API. Once you have created an account, you can obtain an API key by following these steps: | |
Go to https://ssl.reddit.com/prefs/apps/ | |
Scroll down to "Developed Applications" and click "Create App" | |
Choose "Web app" and give your app a name and description. | |
Set "About url" and "Redirect uri" to "http://localhost:8000" | |
Click "Create app" and copy the "client_id" and "client_secret" values. | |
Once you have the API key, you can start coding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Will need to install boto3: pip install boto3 | |
""" | |
import os | |
import boto3 | |
# variables come from AWS Management Console | |
os.environ['AWS_ACCESS_KEY_ID'] = 'YOUR_ACCESS_KEY' | |
os.environ['AWS_SECRET_ACCESS_KEY'] = 'YOUR_SECRET_KEY' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy as tw #An easy-to-use Python library for accessing the Twitter API | |
import string | |
from collections import Counter | |
TWITTER_CONSUMER_KEY = '[FROM_TWITTER_DEVELOPER_CONSOLE]' | |
TWITTER_CONSUMER_SECRET = '[FROM_TWITTER_DEVELOPER_CONSOLE]' | |
TWITTER_ACCESS_TOKEN = '[FROM_TWITTER_DEVELOPER_CONSOLE]' | |
TWITTER_ACCESS_TOKEN_SECRET = '[FROM_TWITTER_DEVELOPER_CONSOLE]' | |
TWITTER_LIST_ID = '[LIST_ID]' #get from the url of the twitter list: https://twitter.com/i/lists/[LIST_ID] |