Request same field with different parameters in data_grid
If I do a request like the following:
ek.get_data('BHP.AX', ['TR.TradePriceClose', ('TR.TradePriceClose', {'Curn': 'USD'})])
The second TradePriceClose field (in USD) doesn't come through as an additional column as expected whereas this works fine in say excel, or through the COM apis (Dex2).
Instead what appears to be happenning is it is collapsing the data by bare field name (not including parameters) causing it to get folded together with the first field as a single column in the response, leaving only one instance of TradePriceClose in the returned json headers. Using either by itself works fine. Is there some way of modifying the request in data_grid to avoid this (eg passing some different parameters)?
Best Answer
-
I got the same result as yours.
The following is the Request and Response after using the above code.
Request
{
"Entity": {
"W": {
"fields": [
{
"name": "TR.TradePriceClose"
},
{
"parameters": {
"Curn": "USD"
},
"name": "TR.TradePriceClose"
}
],
"instruments": [
"BHP.AX"
]
},
"E": "DataGrid"
}
}Response
{
"columnHeadersCount": 1,
"data": [
[
"BHP.AX",
23.8
],
[
"BHP.AX",
23.8
]
],
"headerOrientation": "horizontal",
"headers": [
[
{
"displayName": "Instrument"
},
{
"displayName": "Trade Price Close",
"field": "TR.TRADEPRICECLOSE"
}
]
],
"rowHeadersCount": 1,
"totalColumnsCount": 2,
"totalRowsCount": 3
}However, if I use your workaround, I can get the correct data.
Request
{
"Entity": {
"W": {
"fields": [
{
"name": "TR.TradePriceClose.value",
"parameters": {
"Curn": "USD"
}
},
{
"name": "TR.TradePriceClose.value"
}
],
"instruments": [
"BHP.AX"
]
},
"E": "DataGrid"
}
}Response
{
"columnHeadersCount": 1,
"data": [
[
"BHP.AX",
17.933300179333,
23.8
]
],
"headerOrientation": "horizontal",
"headers": [
[
{
"displayName": "Instrument"
},
{
"displayName": "Trade Price Close",
"field": "TR.TRADEPRICECLOSE(Curn=USD).value"
},
{
"displayName": "Trade Price Close",
"field": "TR.TRADEPRICECLOSE.value"
}
]
],
"rowHeadersCount": 1,
"totalColumnsCount": 3,
"totalRowsCount": 2
}This could be the problem in Data Grid. I will contact Data Grid team to verify the issue.
0
Answers
-
It seems to work if I add a .value suffix to both fields, and put the USD one first, otherwise I get two identical columns. Can't quite figure make sense of this one.
0 -
Thanks for taking a look. Note that it is also reproducible in excel, ie this formula doesn't work correctly unless you flip the order:
=TR("BHP.AX","TR.TradePriceClose;TR.TradePriceClose(Curn=USD)","CH=Fd",B2)
So this has the potential to trip up many more people than just those using DataGrid via the scripting API or JET. Another thing to note is that it works fine with TR.PriceClose, so it is something peculiar to these items (which I believe get pulled from a different source than data cloud?).
0
Categories
- All Categories
- 6 AHS
- 37 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 中文论坛