# Get Spread data and convert to pickled data benmore = pd.read_hdf("futures_spread_ben.h5", "Benmore") otahuhu = pd.read_hdf("futures_spread_ota.h5", "Otahuhu") benmore.to_pickle("benmore.pickle") otahuhu.to_pickle("otahuhu.pickle") # Read the pickled data benmore = pd.read_pickle("benmore.pickle") otahuhu = pd.read_pickle("otahuhu.pickle") # Get OTA and BEN prices for current quarter connection = ea.DW_connect(linux=True) prices = ea.timeseries_convert( ea.FP_getter( connection, ea.query_prices(ea.current_quarter().start_time, datetime.now().date(), nodelist=["BEN2201", "OTA2201"]), ) ) # Calculate expanding mean over the quarter spot_OTA = prices.price.OTA2201.groupby(lambda x: x.date()).mean() spot_BEN = prices.price.BEN2201.groupby(lambda x: x.date()).mean() spot_OTA_EXMEAN = pd.expanding_mean(spot_OTA) # Otahuhu expanding mean spot_BEN_EXMEAN = pd.expanding_mean(spot_BEN) # Benmore expanding mean OTA_BA = ea.CQ_data(otahuhu, ota, spot_OTA_EXMEAN, CQ, "otahuhu") BEN_BA = ea.CQ_data(benmore, ben, spot_BEN_EXMEAN, CQ, "benmore") print "Generate LaTex table" ea.asx_table_maker(otahuhu, benmore, ota, ben, CQ, path + "/tables/asx_table_1.tex") # ea.asx_market_comment(ota,ben,path + '/comments/comment.tex')