Plotly Dash | Exponential Moving Average + Live Updates from CSV

I am building out a cryptocurrency chart. I can plot the chart no big deal however I dont know how to refresh the data properly and add technical analysis to the graph.

  1. Make live so the CSV is adding new data (May just be a pull - as if new )
    1a. Im assuming take the time diff from most current plot and append the remaining timestamps

  2. Add Exponential Moving Averages to the chart - Also must be live, obviously :slight_smile:

I think if I can get these two working I can build it out further independently but Im struggling with these new features.

import dash
from dash.dependencies import Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly
import random
import plotly.graph_objs as go
from collections import deque
import pandas as pd
#import bot_func as bf

#############   PULLS THE MOST CURRENT DATA AND IMPORTS TO CSV  ##################################
#bf.xrp_data_poloneix_4HOUR()
#bf.xrp_data_poloneix_15MIN()
#bf.xrp_data_poloneix_5MIN()
#############   END - PULLS THE MOST CURRENT DATA AND IMPORTS TO CSV  #############################

#############   READ THE MOST CURRENT CSV  ##################################
############  KRAKEN XRP-USDT - 4 HOUR #############
df4HRK = pd.read_csv('XRPUSD_4HR_KRAKEN.csv',index_col=0)
datetime_4HRK = df4HRK.index
price_4HRK = df4HRK['close']

#############################################################################3
#############################################################################3
#############################################################################3

############  POLONIEX XRP-USDT - 4 HOUR #############
df4HR = pd.read_csv('USDT_XRP_4HOUR_MAY_2018.csv',index_col=0)
datetime_4HR = df4HR.index
price_4HR = df4HR['close']
############  POLONIEX XRP-USDT - 15 MIN #############
df15MIN = pd.read_csv('USDT_XRP_15MIN_MAY_2018.csv',index_col=0)
datetime_15MIN = df15MIN.index
price_15MIN = df15MIN['close']
############  POLONIEX XRP-USDT - 1 MIN #############
df5MIN = pd.read_csv('USDT_XRP_5MIN_MAY_2018.csv',index_col=0)
datetime_5MIN = df5MIN.index
price_5MIN = df5MIN['close']


#############  END - READ THE MOST CURRENT CSV  ##################################
app = dash.Dash(__name__)
app.layout = html.Div(
    [
        dcc.Graph(id='xrpusd-4-hour-kraken-graph', animate=True,
            figure={
                'data': [
                    {'x': datetime_4HRK , 'y': price_4HRK, 'type': 'line', 'name': 'LINE XRP-USD'},
                ],
                'layout': {
                    'title': '4 HOUR - XRP-USD - KRAKEN',  #TITLE AT TOP OF CHART
                    'legend': {'x': 'XRPUSD'}
                }
        }),
        dcc.Graph(id='xrpusd-15-min-live-graph', animate=True,
                  figure={
                      'data': [
                          {'x': datetime_15MIN, 'y': price_15MIN, 'type': 'line', 'name': 'LINE XRP-USDT'},
                      ],
                      'layout': {
                          'title': '15 MIN- XRP-USDT - POLONIEX'  # TITLE AT TOP OF CHART
                      }
                  }),
        dcc.Graph(id='xrpusd-5-min-live-graph', animate=True,
                  figure={
                      'data': [
                          {'x': datetime_5MIN, 'y': price_5MIN, 'type': 'line', 'name': 'LINE XRP-USDT'},
                      ],
                      'layout': {
                          'title': '15 MIN- XRP-USDT - POLONIEX'  # TITLE AT TOP OF CHART
                      }
                  }),
         dcc.Interval(
            id='graph-update',
            interval=1*100000
         )

    ]
)