def test_dp_fl_options(): provider = FlinpProvider() from StringIO import StringIO F = """ option://param/BASEYEAR?2010 option://param/ATSRANGE?start=2000001&end=2000012 option://param/TSRANGE?start=2009001&end=2011012 option://param/D_TSRANGE_AVG?~2005-12-31~2005-01-01~M option://param/D_TSRANGE?~2011-12-31~2009-01-01~M option://param/AVG?proc=convert(freq=A,func=mean)|oper(div=100) option://func/p_w_avg(B,Y)?proc=convert(freq=M,func=mean)|weighted_avg(base=$B)|deltap|limitY(year=$Y,n=2)|drop($B) flinp://DB22/ECB_STS1/M.SBBA.HU.01?name=IHUN_AVG&$ATSRANGE&$AVG flinp://DB22/ECB_STS1/M.SBBA.HU.01?name=IPHUN&$TSRANGE&p_w_avg(IPHUN_AVG,$BASEYEAR) """ for l in StringIO(F).readlines(): provider.append(l) res = provider.request() print "SERIES",res.keys() for k,r in res.items(): print k r.report() assert False
def test_dp_flinp_proc_convert(): provider = FlinpProvider() provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL2000AVG&start=2000001&end=2000012&proc=convert(freq=A,func=mean)') res = provider.request() pprint(res) ts = res.items()[0][1].items()[0][1].data pprint(ts)
def test_dp_flinp_name(): provider = FlinpProvider() # provider.append('flinp://DB22/ECB_STS1/M.BG.N.PROD.NS0020.4.000?name=IPBUL&start=$NOW-24M&end=$NOW&proc=weigthed_avg&check.0000.Z01.E') provider.append('flinp://DB22/ECB_STS1/M.BG.N.PROD.NS0020.4.000?name=IPBUL&start=2010001&end=2011012&proc=weighted_avg&check.0000.Z01.E') provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL&start=2010001&end=2011012&proc=weigthed_avg') res = provider.request() pprint(res) ts = res.items()[0][1].items()[0][1].data pprint(ts)
def test_dp_flinp_proc_convert_avg(): provider = FlinpProvider() provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL2000AVG&start=2000001&end=2000012&proc=convert(freq=A,func=mean)|oper(div=100)') provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL&start=2009001&end=2011012&') # provider.append('flinp://DB22/ECB_ICP1/M.PL.N.000000.4.INX?name=HCPPOL2005AVG&start=2005001&end=2005012&proc=convert(freq=A,func=mean)|oper(div=100)') # provider.append('flinp://DB22/ECB_ICP1/M.PL.N.000000.4.INX?name=HCPPOL&start=2010001&end=2011012&proc=weighted_avg(base=HCPPOL2005AVG)') res = provider.request() for k,r in res.items(): print k r.report()
def test_dp_options(): provider = FlinpProvider() # Param definitions provider.append('option://param/BASEYEAR?2010') provider.append('option://param/TSRANGE?start=2009001&end=2011012') provider.append('option://param/AVG?proc=convert(freq=A,func=mean)|oper(div=100)') provider.append('option://func/p_w_avg(B,Y)?proc=weighted_avg(base=$B)|deltap|limitY(year=$Y,n=2)|drop($B)') # Param use provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL2000AVG&$TSRANGE&$AVG') provider.append('flinp://DB22/ECB_STS1/M.PL.N.PROD.NS0020.4.000?name=IPPOL&$TSRANGE&p_w_avg(IPPOL2000AVG,$BASEYEAR)') provider.append('flinp://DB22/ECB_STS1/M.CZ.N.PROD.NS0020.4.000?name=IPCZE2000AVG&$TSRANGE&$AVG') provider.append('flinp://DB22/ECB_STS1/M.CZ.N.PROD.NS0020.4.000?name=IPCZE&$TSRANGE&p_w_avg(IPCZE2000AVG,$BASEYEAR)') provider.append('flinp://DB22/BIS_MACRO/M.SBBA.HU.01?name=IPHUN2000AVG&$TSRANGE&$AVG') provider.append('flinp://DB22/BIS_MACRO/M.SBBA.HU.01?name=IPHUN&$TSRANGE&p_w_avg(IPHUN2000AVG,$BASEYEAR)') res = provider.request() for k,r in res.items(): print k r.report()
def test_dp_flinp_request02(): provider = FlinpProvider() provider.append('flinp://db22/ECB_BSI1/M.AT.N.A.AXG.A.1.U4.0000.Z01.E?start=2009001') res = provider.request() pprint(res)
def test_dp_flinp_simple_request(): provider = FlinpProvider() provider.append('flinp://db22/ECB_BSI1/M.AT.N.A.AXG.A.1.U4.0000.Z01.E') res = provider.request() pprint(res)