daily log 12.05.20

less than 1 minute read

UPYD:

  • left off here
  • current local file: upyd-stockticker/StockTicker_Simple.py
  • guidebook

With no pandas-datareader


    start = pd.to_datetime(['2007-01-01']).astype(int)[0]//10**9 # convert to unix timestamp.
    end = pd.to_datetime(['2020-12-31']).astype(int)[0]//10**9 # convert to unix timestamp.
    url = 'https://query1.finance.yahoo.com/v7/finance/download/' + stock_ticker + '?period1=' + str(start) + '&period2=' + str(end) + '&interval=1d&events=history'
    df = pd.read_csv(url)

Line Charts

import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go

np.random.seed(56)

x_values = np.linspace(0, 1, 100)
y_values = np.random.randn(100)

trace = go.Scatter(x=x_values, y=y_values+5, mode='markers', name='markers')

data = [trace]

layout = go.Layout(title='Line Charts')

fig = go.Figure(data=data, layout=layout)

pyo.plot(fig)

NOW, with MORE LINES AND DATA!!

trace = go.Scatter(x=x_values, y=y_values+5, mode='markers', name='markers')
trace2 = go.Scatter(x=x_values, y=y_values+5, mode='lines', name='trace2')
trace3 = go.Scatter(x=x_values, y=y_values, mode='lines', name='trace3')
trace4 = go.Scatter(x=x_values, y=y_values-5, mode='lines+markers', name='4')

data = [trace, trace2, trace3, trace4]

Tags:

Updated: