No results were returned when accessing the eikon api
A python program that tries to access the eikon api does not return a result. It will only work if you restart the service, but it may be hours later when you try to access the api
log:
[INFO:2023-10-07 09:46:39,467] web.views views.py:944:get bond dirty price request: {'code': ['JPYCNY=R'], 'endDate': '2023-07-31', 'interval': 'daily', 'startDate': '2023-07-28'}
[INFO:2023-10-07 09:46:39,467] web.views views.py:23:set_rv_app_key: 4b45e9df491c43af8266bde1e96d1e94692ae941
[INFO:2023-10-07 09:46:39,469] pyeikon session.py:378:Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...
code:
def get_exchange_rate_history_price(request):
success = True
val = json.loads(request.body)
loggers.info("get bond dirty price request: " + str(val))
code = val.get("code")
startDate = val.get("startDate")
endDate = val.get("endDate")
return_dict = {'return_code': '200', 'return_info': 'success', 'result': False}
set_rv_app_key()
rd.open_session()
# response = bond.Definition(
# instrument_code="CND100063XD1",
# fields=['DirtyPrice'],
# pricing_parameters=bond.PricingParameters(
# market_data_date="2023-05-05")).get_data()
try:
df = ek.get_timeseries(code,
# fields=["OPEN", "CLOSE"],
start_date=startDate,
end_date=endDate,
interval='daily',
calendar=None,
corax=None,
normalize=False,
raw_output=True)
except Exception as result:
errorMsg = str(result)
loggers.error("get bond dirty price exception: " + str(result))
success = False
if success:
print(df)
# print(df.keys())
# print(df.values())
dflist = list(df.values())
# print(dflist[0])
newList = dflist[0]
for dt in newList:
print(dt)
if (dt['statusCode'] == 'Error'):
newList.remove(dt)
print(newList)
#
# print(dflist[0][0])
# obj1 = dflist[0][0]
# print(obj1['dataPoints'])
# data_dict = ["timeseriesData", newList]
# print(dflist.get(0))
# numy = df.to_json()
# loggers.info("get stock info response: " + numy)
# data.to_excel("C:\\dpp\\refinitive\\test\\stock.xlsx", sheet_name='Sheet1', index=False)
# return_dict['result'] = json.loads(numy)
# return_dict['result'] = json.loads(json.dumps(newList))
return_dict['result'] = json.loads(json.dumps(df))
else:
return_dict['return_code'] = 500
return_dict['return_info'] = errorMsg
return_dict['result'] = {}
return HttpResponse(json.dumps(return_dict), content_type="application/json")
pls help me solve this problem
Tagged:
0
Best Answer
-
Thank you for reaching out to us.
According to the code, you are using the get_timeseries method in Eikon Data API to get the data.
df = ek.get_timeseries(code,
# fields=["OPEN", "CLOSE"],
start_date=startDate,
end_date=endDate,
interval='daily',
calendar=None,
corax=None,
normalize=False,
raw_output=True)To get the dataframe, you need to set the raw_output to False.
I ran the following code and could get the data.
df = ek.get_timeseries("JPYCNY=R",
start_date="2023-07-28",
end_date="2023-07-31",
interval="daily",
calendar=None,
corax=None,
normalize=False,
raw_output=False)The output is:
To verify the problem in Eikon Data API, you can enable tracing in the API by using the followin code.
import eikon as ek
ek.set_log_level(1)
ek.set_app_key('<app key>')0
Categories
- All Categories
- 6 AHS
- 38 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛