Ejemplo n.º 1
0
def update_graph_from_dropdown(dropdown, multi, arglist):
    # Get Quantmod Chart
    ch = qm.get_symbol(dropdown, start='2016/01/01')
    # Get functions
    if arglist:
        arglist = arglist.replace('(', '').replace(')', '').split(';')
        arglist = [args.strip() for args in arglist]
        for function, args in zip(multi, arglist):
            if args:
                args = args.split(',')
                newargs = []
                for arg in args:
                    try:
                        arg = int(arg)
                    except:
                        try:
                            arg = float(arg)
                        except:
                            pass
                    newargs.append(arg)

                print(newargs)
                getattr(qm, function)(ch, *newargs)
            else:
                getattr(qm, function)(ch)
    else:
        for function in multi:
            getattr(qm, function)(ch)

    # Return plot as figure
    fig = ch.to_figure(width=960)
    return fig
Ejemplo n.º 2
0
def main():
	u = np.array([[4, 7], [-2, 6]])
	v = np.array([[0.6, -0.7], [-0.2, 0.4]])

	dfs = list(map(lambda x: qm.get_symbol(x).to_frame(), symbols))
	for df in dfs:
		df['log_ret'] = ret(df["Adj Close"])
	rets = [df.log_ret.mean(axis=0) for df in dfs]
	cv = np.cov(rets)
	print (cv)
	return
Ejemplo n.º 3
0
def update_graph_from_dropdown(dropdown, multi):
    # Get Quantmod Chart
    ch = qm.get_symbol(dropdown, start='2016/01/01')

    if 'EMA' in multi:
        ch.add_EMA()
    if 'RSI' in multi:
        ch.add_RSI()
    if 'MACD' in multi:
        ch.add_MACD()
    if 'BBANDS' in multi:
        ch.add_BBANDS()

    # Return plot as figure
    return ch.to_figure()
Ejemplo n.º 4
0
# In[]:

import numpy as np
import quantmod as qm
import pandas as pd
import pandas_datareader as web

# In[]:

ch = qm.get_symbol('TSLA')

ch.adjust(inplace=True)
ch.add_RSI()
ch.add_MACD()
ch.add_EMA()
ch.add_BBANDS()
ch.plot(kind='candlestick', theme='light', log=True, volume=True)
ch.plot(kind='candlestick', theme='dark', log=True, volume=True)
ch.ind.tail(100)
Ejemplo n.º 5
0
ch.add_MINUS_DI()
ch.add_PLUS_DI()
ch.add_MINUS_DM()
ch.add_PLUS_DM()
ch.add_MACD()
ch.add_MACDEXT()
ch.add_MFI()
ch.add_MOM()
ch.add_PPO()
ch.add_ROC()
ch.add_ROCP()
ch.add_ROCR()
ch.add_ROCR100()
ch.add_RSI()
ch.add_STOCH()
ch.add_STOCHF()
ch.add_STOCHRSI()
ch.add_TRIX()
ch.add_ULTOSC()
ch.add_WILLR()

ch.plot(kind='candlestick', volume=True,
        title='Full Test', filename='full_test')


import quantmod as qm
ch = qm.get_symbol('QQQ', start='01/01/2016')
ch.add_EMA(9)
ch.add_RSI(14)
ch.iplot()