How to use the yfinance.pdr_override function in yfinance

To help you get started, we’ve selected a few yfinance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyPatel / Options-Trading-Strategies-in-Python / Turtle Trading.py View on Github external
# Let's Start

#Import the necesary libraries

# To get the closing prices data
from pandas_datareader import data as pdr
import yfinance as yf
yf.pdr_override()

# Plotting data
import matplotlib.pyplot as plt
import seaborn

#data Manipulation
import numpy as np
import pandas as pd


# Define a function to calculate the strategy performance on a stock
def strategy_performance(stock_ticker):
    stock = pdr.get_data_yahoo(stock_ticker, start = "2009-01-01", end = "2017-11-10")
    
    # Compute 55 days breakout and mean
    # 5 days high