question

Upvotes
Accepted
1 1 1 0

Error message "Invalid JSON date"

Dear community,


I am having a bit of trouble with DSWS API operating through Python. Hoping for your experience and help!


I am running the DSWS api through python and run the following request


instrument_request = 'DE0007236101'
#fields_request = ['P']
fields_request = ['x(P)~E0','x(UP)~E0','x(PI)~E0','x(PI)~E0','x(PO)~E0','x(PA)~E0','x(PB)~E0','x(PH)~E0','x(PL)~E0','AF','x(MP)~E0','(x(VO)*1000)','(x(VC)*1000)','x(CP)~E0', 'x(GP)~E0', 'NOSH']

start_request = '-20Y'
end_request = '2020-06-30'

# Run the actual request

df = ds.get_data(instrument_request,fields_request,start=start_request,end=end_request)

print(df)

That query produces the following error for the earlier dates obviously:

raise Exception("Invalid JSON Date")
Exception: Invalid JSON Date


It runs smoothly if use '-10Y' orfor any date after '2003-01-01'. The actual time series is longer and should contain data. The response is:

Instrument DE0007236101 ...
Field x(P)~E0 x(UP)~E0 x(PI)~E0 ... x(CP)~E0 x(GP)~E0 NOSH
Dates ...
NaN 104.548 161.80 1524.0 ... None None 594780
NaN 108.683 168.20 1584.3 ... None None 594840
NaN 108.554 168.00 1582.4 ... None None 594840
NaN 105.323 163.00 1535.3 ... None None 594840
NaN 104.677 162.00 1525.9 ... None None 594840
... ... ... ... ... ... ...
2020-06-24 101.100 101.10 1473.8 ... None None 850000
2020-06-25 102.300 102.30 1491.3 ... None None 850000
2020-06-26 101.880 101.88 1485.1 ... None None 850000
2020-06-29 103.800 103.80 1513.1 ... None None 850000
2020-06-30 104.300 104.30 1520.4 ... None None 850000


Any ideas what, would be solving the issue?

Thank you very much for any help. It is highly appreciated!

pythondatastream-apidsws-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
21 0 0 1

Looking into this more - its not the python version. I downgraded to 1.0.1 (pip install DatastreamDSWS ==1.0.1) and that fixed the issue. Looks like a change was made to the code recently. I raised a comment on the Git Repo.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
21 0 0 1

I am getting this issue now I have updated to the latest version of Python. Still working OK with 3.7.4 though.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea