vfilimonov/pydatastream

Economics data

leocaza opened this issue · 3 comments

Hi,

I'm trying
DWE.fetch(["BHWDA347A","BHWDM8P5A"], date_from='2009', date_to='2016')

I get
DatastreamException: Failure (error 2): $$"ER", E100, INVALID CODE OR EXPRESSION ENTERED, BHWDM8P5A(P) --> "BHWDA347A,BHWDM8P5A2009-01-01:2016-01-01~D"

But i know that individually, it works well :
DWE.fetch(["BHWDA347A"], date_from='2009', date_to='2016')
DWE.fetch(["BHWDM8P5A"], date_from='2009', date_to='2016')

What am i doing wrong?

My goal:
I would like to do one request with a list of 10 series instead of looping 10 series on 10 rows (with for i in range(1,10)... I'm sure it will be faster with one single request

Hi,

Unfortunately I could not help you here and perhaps you should ask Thomson Reuters service desk about the correct request format for fetching multiple economic indicators at once. The error which you see is coming from the Datastream server, and I'm confused as well, why the individual symbols are fetched correctly (Request:BHWDA347A~2009-01-01~:2016-01-01~D), but two of them are not (Request:BHWDA347A,BHWDM8P5A~2009-01-01~:2016-01-01~D).

From another hand, if you need only ~10 indicators, then a simple loop is not a big problem at all:

import pandas as pd
pd.DataFrame({_:DWE.fetch(_, date_from='2009', date_to='2016')['P'] 
              for _ in ["BHWDA347A","BHWDM8P5A"]})

p.s. If you set DWE.show_request = True then you'll be given the requests used in each case.

Best
Vladimir

I'm closing this for now.

There're some more context to the issue: #14

"P" here is considered as a mnemonic for API, when for economic series it does not exist. Instead you should request the datatype "ES" (Economic Series):

DWE.fetch(["BHWDA347A","BHWDM8P5A"], fields=['ES'])