question

Upvotes
Accepted
1 0 0 0

Import csv list of DSCodes in DSWS API

Hi,


I'm trying to run DSWS request using a list of dscodes from a csv vile, but the code I'm using adds "[]" before and after the list, it's returning error. Here's my code


instruments= []


with open('DSCD list1.csv') as csvDataFile:

csvReader = csv.reader(csvDataFile)

for row in csvReader:

for ticker in row:

instruments.append(row[0])



ds.get_data(tickers=instruments,

fields=['SOHSDP032','SOHRDP0103'], start='-12Y', freq='Y')


dsws-api2.png


dsws-api1.png


Thank you.

python#technologydatastream-apidsws-api
dsws-api1.png (28.0 KiB)
dsws-api2.png (10.2 KiB)
icon clock
10 |1500

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

1 Answer

· Write an Answer
Upvotes
Accepted
84.6k 287 53 77

@markangelo.uy

Thank you for reaching out to us.

The tickers parameter acceps a string. Each RIC can be separated by a comma character.

ds.get_data(tickers=','.join(instruments),
 fields=['SOHSDP032','SOHRDP0103'], start='-12Y', freq='Y')

If you have any further questions regarding the retrieved content, please contact the Datastream support team directly via MyAccount to verify the content.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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