Hi Can you please help with a Python Payload to fetch EOD pricing data for few instruments or instrument list
I tried to look at the existing sample script <dss-python-shareholder-rights-sample> .. but it looks quite complex.
Appreciate your help.
Hi Team, I have created a payload with help postman .. but getting an error {"error":{"message":"Malformed request payload: Syntax error at Line 1, Char 1: expected valid json array or json object "}}
@vinaya.shetty
Thank you for reaching out to us.
You need to use our DSS REST Tutorials Postman collection to generate the code.
The code should be like this:
import requests url = "https://selectapi.datascope.lseg.com/RestApi/v1/Extractions/ExtractWithNotes" payload={ "ExtractionRequest": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.EndOfDayPricingExtractionRequest", "ContentFieldNames": [ "RIC", "Trade Date", "Universal Close Price" ], "IdentifierList": { "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", "InstrumentIdentifiers": [ { "Identifier": "LCOc1", "IdentifierType": "Ric" } ], "ValidationOptions": { "AllowOpenAccessInstruments": "false", "AllowHistoricalInstruments": "false", "AllowLimitedTermInstruments":"false", "ExcludeFinrAsPricingSourceForBonds": "false", "UseExchangeCodeInsteadOfLipper": "false", "UseUsQuoteInsteadOfCanadian": "false", "UseConsolidatedQuoteSourceForUsa": "false", "UseConsolidatedQuoteSourceForCanada": "false", "UseDebtOverEquity": "false", "UseOtcPqSource": "false", "AllowSubclassImport": "false" }, "UseUserPreferencesForValidationOptions": "false" }, "Condition": { "IsDelta": "false", "IsErrorCorrected": "false", "LimitReportToTodaysData": "false", "ScalableCurrency": "false", "TriggerTimeoutDayOffset": "FollowingDay", "TriggerTimeoutUserTime": { "Hour": 0, "Minute": 0 } } } } headers = { 'Authorization': 'Token <token>', 'Prefer': 'respond-async', 'Content-Type': 'application/json; odata=minimalmetadata' } response = requests.request("POST", url, headers=headers, json=payload) print(response.text)
The url should be:
url = "https://selectapi.datascope.lseg.com/RestApi/v1/Extractions/ExtractWithNotes"
The request should use the json parameter, not the data parameter.
response = requests.request("POST", url, headers=headers, json=payload)
Thanks a lot @Jirapongse this is very helpful