<s> '''<STR_LIT>''' <EOL> import numpy as np <EOL> import qstkutil . qsdateutil as du <EOL> import qstkutil . tsutil as tsu <EOL> import qstkutil . DataAccess as da <EOL> import qstkfeat . sb_featutil as feat <EOL> import datetime as dt <EOL> import pickle <EOL> import os <EOL> import matplotlib . pyplot as plt <EOL> from pylab import * <EOL> from pandas import * <EOL> def genData ( startday , endday , datadirectory , symbols ) : <EOL> coredirectory = os . environ [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> directorylocation = coredirectory + datadirectory + '<STR_LIT:_>' + startday . date ( ) . isoformat ( ) + '<STR_LIT:_>' + endday . date ( ) . isoformat ( ) <EOL> if not os . path . exists ( directorylocation ) : <EOL> os . mkdir ( directorylocation ) <EOL> directorylocation = directorylocation + '<STR_LIT:/>' <EOL> timeofday = dt . timedelta ( hours = <NUM_LIT:16> ) <EOL> timestamps = du . getNYSEdays ( startday , endday , timeofday ) <EOL> file = open ( directorylocation + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> for onedate in timestamps : <EOL> stringdate = dt . date . isoformat ( onedate ) <EOL> file . write ( stringdate + '<STR_LIT:\n>' ) <EOL> file . close ( ) <EOL> dataobj = da . DataAccess ( '<STR_LIT>' ) <EOL> all_symbols = dataobj . get_all_symbols ( ) <EOL> badsymbols = set ( symbols ) - set ( all_symbols ) <EOL> if len ( list ( badsymbols ) ) > <NUM_LIT:0> : <EOL> print "<STR_LIT>" + str ( badsymbols ) <EOL> symbols = list ( set ( symbols ) - badsymbols ) <EOL> lsKeys = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> ldfData = dataobj . get_data ( timestamps , symbols , lsKeys ) <EOL> dData = dict ( zip ( lsKeys , ldfData ) ) <EOL> ( lfcFeatures , ldArgs , lsNames ) = feat . getFeatureFuncs22 ( ) <EOL> FinalData = feat . applyFeatures ( dData , lfcFeatures , ldArgs , sMarketRel = '<STR_LIT>' ) <EOL> file = open ( directorylocation + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> for sym in symbols : <EOL> file . write ( str ( sym ) + '<STR_LIT:\n>' ) <EOL> file . close ( ) <EOL> file = open ( directorylocation + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> for f in lsNames : <EOL> file . write ( f + '<STR_LIT:\n>' ) <EOL> file . close ( ) <EOL> Numpyarray = [ ] <EOL> for IndicatorData in FinalData : <EOL> Numpyarray . append ( IndicatorData . values ) <EOL> pickle . dump ( Numpyarray , open ( directorylocation + '<STR_LIT>' , '<STR_LIT:wb>' ) , - <NUM_LIT:1> ) <EOL> def main ( ) : <EOL> startday = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> endday = dt . datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) <EOL> datadirectory = '<STR_LIT>' <EOL> symbols = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:T>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> genData ( startday , endday , datadirectory , symbols ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
