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 time | |
import random | |
import numba as nb | |
import numpy as np | |
import pandas as pd | |
from copy import deepcopy | |
# For type hinting | |
from typing import Tuple |
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 numpy as np | |
import pandas as pd | |
import yfinance as yf | |
from typing import Tuple | |
from copy import deepcopy | |
import plotly.io as pio | |
import plotly.graph_objects as go | |
pio.renderers.default='browser' |
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 numpy as np | |
import matplotlib.pyplot as plt | |
from scipy import sparse | |
from typing import Tuple | |
from copy import deepcopy | |
from scipy.ndimage import gaussian_filter | |
IMAGE = 'PATH_TO_JPG_IMAGE' # Include JPG image 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 time | |
import random | |
import numba as nb | |
import numpy as np | |
import pandas as pd | |
import datetime as dt | |
from tqdm import tqdm | |
from copy import deepcopy | |
# For type hinting |
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
''' | |
This code is a demonstration to show how you can accidentally slip in future | |
results to a time-series predicting neural network. | |
DO NOT USE THIS CODE FOR MAKING PREDICTIONS, IT'S FAULTY ON PURPOSE. | |
''' | |
import numba as nb | |
import numpy as np | |
import pandas as pd |
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
''' | |
Simple Neural Network attempt for price prediction - it does not do a good job | |
at all and therefore SHOULD NOT BE USED FOR ANY REAL TRADING/INVESTING | |
''' | |
import numba as nb | |
import numpy as np | |
import pandas as pd | |
import yfinance as yf |
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 pandas as pd | |
import yfinance as yf | |
GROWTH_SINCE = '2021-12-01' # The lower date to calculate the stock performance | |
GROUPBY_COL = 'GICS Sector' # Use 'GICS Sector' or 'GICS Sub-Industry' | |
S_AND_P_URL = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' | |
NUM_PER_GROUP = 3 # The top n winning stocks per group | |
if __name__ == '__main__': |
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 streamlit as st | |
import streamlit.components.v1 as components | |
st.set_page_config(layout="wide") | |
def get_info_widget( | |
ticker: str = "AAPL", | |
theme: str = "dark", | |
): | |
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 numpy as np | |
import yfinance as yf | |
import scipy.stats as stats | |
from scipy.integrate import quad | |
from scipy.optimize import minimize | |
# Get the monthly price data for the SPY ticker | |
df = yf.download( | |
'SPY', | |
interval='1mo', |
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 numpy as np | |
from scipy.optimize import minimize, LinearConstraint | |
def find_grad_intercept(case, x, y): | |
''' | |
Find the granient and intercept terms for the envelope trend line. | |
Note: case = 'above' or 'below' | |
''' | |
OlderNewer