Esempio n. 1
0
def update_graph(selected_dropdown_value):
    global stockpricedf  # Needed to modify global copy of stockpricedf
    ticker_fb = Fetcher(selected_dropdown_value, [yr, mo, dy])
    #ticker_fb = Fetcher('fb', [yr,mo,dy])
    stockpricedf = ticker_fb.get_historical()
    stockpricedf['Date'] = pd.to_datetime(stockpricedf['Date'])
    stockpricedf['Close'] = stockpricedf['Close']
    return {
        'data': [{
            'x': stockpricedf.Date,
            'y': stockpricedf.Close,
            'line': {
                'color': 'green'
            }
        }]
    }
Esempio n. 2
0
"""

import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import oauth_info as auth
import quandl
from yahoo_historical import Fetcher
from fbprophet import Prophet
import statsmodels.api as sm
import statsmodels.formula.api as smf

quandl.ApiConfig.api_key = auth.QUANDL_KEY

ticker_googl = Fetcher("NFLX", [2018, 1, 1])
googl_df = ticker_googl.get_historical()
print(googl_df.head())

# The adjusted close accounts for stock splits, so that is what we should graph
plt.plot(googl_df.Date, googl_df['Adj Close'])
plt.title('Google Stock Price')
plt.ylabel('Price ($)')
plt.xticks(rotation=45)
plt.show()

# Keep only the adj. Close
googl_adj_close = googl_df[['Date', 'Adj Close']]

# Rename the columns
googl_adj_close.columns = ['ds', 'y']
Esempio n. 3
0
def downloadTicker(stock: str, startyear: int) -> pd.DataFrame:
    stockFetcher = Fetcher(stock, [startyear, 1, 1], [2020, 12, 10])
    stock_df = stockFetcher.get_historical()
    return stock_df
Esempio n. 4
0
from yahoo_historical import Fetcher
from indicators import simpleMovingAverage, exponentialMovingAverage
import matplotlib.pyplot as plt

data_link = Fetcher("EDP.LS", [2007, 1, 1])
data = data_link.get_historical()

ts_date = data['Date']
ts_price = data['Close']

ts_sma = simpleMovingAverage(ts_price, periods=30)
ts_ema = exponentialMovingAverage(ts_price, periods=30)

print(ts_sma[200])
print(ts_ema[200])
print(data.iloc[200, :])

plt.plot(ts_price)
plt.plot(ts_sma)
plt.plot(ts_ema)
plt.ylabel('price')
plt.show()
from yahoo_historical import Fetcher
import pandas as pd

companies = pd.read_csv('companies-abbreviations.csv')

for co in companies['Stock Abbreviation']:
    data = Fetcher(co, [2018, 12, 31], [2020, 1, 1])
    filename = co + "_financial.csv"
    historical = data.get_historical()
    historical.to_csv("./financial/" + filename)