Scheduled price extraction for currencies

Trying to extract scheduled price data for CNH and CNY identifiers , i was able to successfully extract EOD pricing for these identifiers but facing error when trying to extract the prices at specific time of day, please find below the API query details along with URL and error message
Code
from ayx import Alteryx
import pandas as pd
import requests
from datetime import datetime
import html
a = Alteryx.read('#1')
token_url = "https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken"
payload = "{\r\n "Credentials": {\r\n "Username": "9038135",\r\n "Password": "*********"\r\n }\r\n}"
scheduled_price_url="https://selectapi.datascope.refinitiv.com/restapi/v1/Extractions/Schedules"
headers = {
'Prefer': 'respond-async',
'Content-Type': 'application/json'
}
PROXY = {
'http':'http://proxy.jpmchase.net:10443'
, 'https':'http://proxy.jpmchase.net:10443'
}
try:
response = requests.request("POST", token_url, headers=headers, data=payload,proxies = PROXY,verify=False)
print("Successfully connected")
data=response.json()
token=data.get("value")
scheduled_price_header={
'Prefer': 'respond-async',
'Content-Type': 'application/json',
"Authorization": "Token "+token
}
body={
"Name": "TEST Sample EOD Extraction",
"TimeZone": "Coordinated Universal Time",
"Recurrence":
{
"@odata.type": "#DataScope.Select.Api.Extractions.Schedules.SingleRecurrence",
"ExtractionDateTime": "2025-06-03T12:35:00.000",
"IsImmediate": "TRUE"
},
"Trigger":
{
"@odata.type": "#DataScope.Select.Api.Extractions.Schedules.ImmediateTrigger",
"LimitReportToTodaysData": "FALSE"
},
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{ "Identifier":"CNH=", "IdentifierType":"Ric" },
{ "Identifier":"CNY=", "IdentifierType":"Ric" },
],
},
"ValidationOptions": None,
"UseUserPreferencesForValidationOptions": "FALSE",
"Condition": None
}
response_close_price=requests.request("POST", scheduled_price_url, headers=scheduled_price_header,json=body, proxies = PROXY,verify=False).json()
print(response_close_price)
except requests.RequestException as e:
print(f"Couldnt connect : {e}")
results=[]
for item in response_close_price.get('Contents'):
identifier=item.get('RIC')
trade_date=item.get('Trade Date')
close_price=item.get('Universal Close Price')
results.extend([{'Identifier':identifier,'Trade Date':trade_date,
'Universal Close Price':close_price}])
results_df=pd.DataFrame(results)
Alteryx.write(results_df, 1)
Answers
-
Hello @AnuragShetty
I am not sure what you are trying to do in this code. If your intention is to extract the data for an asset at a particular time (intraday extraction), then please use On-Demand extraction - IntradayPricing Extraction Request.
You can how this on demand extraction is used in the following repo on GitHub -
0 -
Please also refer to the answer on this discussion.
You need to check if you would like to use the immediate scheduled extraction or on-demand extraction. You can't specify instruments (InstrumentIdentifiers) directly in a scheduled extraction request message.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛