<s> import os , os . path <EOL> import time <EOL> import io <EOL> import pandas as pd <EOL> import ashiba . plot <EOL> from ashiba . plot import plt <EOL> AAPL = pd . DataFrame . from_csv ( "<STR_LIT>" ) . sort ( ) <EOL> GOOG = pd . DataFrame . from_csv ( "<STR_LIT>" ) . sort ( ) <EOL> def btn_update__click ( dom ) : <EOL> symbol = dom [ '<STR_LIT>' ] [ '<STR_LIT:value>' ] <EOL> if symbol == '<STR_LIT>' : <EOL> df = AAPL <EOL> elif symbol == '<STR_LIT>' : <EOL> df = GOOG <EOL> else : <EOL> return dom <EOL> bounds = [ dom [ x ] [ '<STR_LIT:value>' ] if dom [ x ] [ '<STR_LIT:value>' ] else None <EOL> for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] <EOL> ts = df [ '<STR_LIT>' ] [ bounds [ <NUM_LIT:0> ] : bounds [ <NUM_LIT:1> ] ] <EOL> if ts . any ( ) : <EOL> try : <EOL> ts . plot ( ) <EOL> for win in [ int ( dom [ x ] [ '<STR_LIT:value>' ] ) <EOL> for x in [ '<STR_LIT>' , '<STR_LIT>' ] ] : <EOL> pd . rolling_mean ( ts , win ) . plot ( ) <EOL> plt . title ( "<STR_LIT>" . format ( symbol ) ) <EOL> dom [ '<STR_LIT>' ] . set_image ( plt . get_svg ( ) , '<STR_LIT>' ) <EOL> finally : <EOL> plt . close ( ) <EOL> return dom </s>
