Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Last active August 3, 2020 01:12
Show Gist options
  • Save shashankvemuri/ae22b91f29c5960f52493329775064cb to your computer and use it in GitHub Desktop.
Save shashankvemuri/ae22b91f29c5960f52493329775064cb to your computer and use it in GitHub Desktop.
Start of the code
import numpy as np
import pandas as pd
import yfinance as yf
import datetime as dt
import matplotlib.pyplot as plt
import mplfinance as mpf
from finta import TA
from pylab import rcParams
from yahoo_fin import stock_info as si
import talib
import ta
pd.set_option('display.max_columns', None)
# define stock and time range
stock = input('Enter a stock ticker: ')
num_of_years = input('Enter number of years: ')
num_of_years = float(num_of_years)
start = dt.date.today() - dt.timedelta(days = int(365.25*num_of_years))
end = dt.datetime.now()
current_price = round(si.get_live_price(stock), 2)
df = yf.download(stock,start, end, interval='1d')
signals = ['Moving Average', 'Relative Strength Index', 'Bollinger Bands', 'MACD', 'Commodity Channel Index']
change = []
num_of_trades = []
last_sell = []
last_buy = []
average_gain = []
average_loss = []
max_return = []
max_loss = []
gain_loss = []
success_rate = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment