error while getting turnover data using get_timeseries
Hi, tried using the below formula to get turnover time series data
import datetime
from dateutil.relativedelta import relativedelta
endDate = datetime.datetime.today()
startDate = endDate - relativedelta(months = 3)
temp = eikon.get_timeseries('BATS.L', fields='VALUE', start_date=startDate, end_date=endDate)
but the result is
BATS.L VALUE
Date
2017-06-28 NaN
2017-06-29 NaN
2017-06-30 NaN
2017-07-03 NaN
2017-07-04 NaN
...
2017-09-21 NaN
2017-09-22 NaN
2017-09-25 NaN
2017-09-26 NaN
[64 rows x 1 columns]
Is there any syntax error or is there any alternate formula which I can use to get the data?
Also Can I get the turnover values in EUR only and I don't need to multiply be any factors.
ex: I need to multiply turnover value by 10^6 in excel to get actual turnover
=TR("BATS.L","TR.TURNOVER*1000000","Frq=D SDate=2017-06-25 EDate=2017-09-25 Curn=EUR CH=Fd")
Best Answer
-
For eikon.get_timeseries, if you don't specify the fields parameter, all fields will be returned. From the result, there is no "VALUE" field.
data = ek.get_timeseries('BATS.L', start_date=startDate, end_date=endDate)
...
BATS.L HIGH LOW OPEN CLOSE COUNT VOLUME
Date
2017-06-28 5426.00000 5346.00000 5409.0 5351.0 15958.0 3021602.0
2017-06-29 5371.00000 5235.00000 5340.0 5235.0 16880.0 3635156.0
2017-06-30 5280.00000 5189.17539 5235.0 5234.0 15255.0 3621102.0
2017-07-03 5253.00000 5210.00000 5214.0 5236.0 13974.0 2503098.0
2017-07-04 5228.00000 5177.00000 5205.0 5177.0 9081.0 2095120.0I think that this is why the value of "VALUE" field returns NaN.
For TR.TURNOVER, you can apply the Eikon Excel formula to Eikon Scripting API. For example, if Eikon Excel formula is:
=TR("BATS.L","TR.TURNOVER*1000000","Frq=D SDate=2017-06-25 EDate=2017-09-25 Curn=EUR CH=Fd")
the python code will be:
data = ek.get_data(
instruments=['BATS.L'],
fields = [
'TR.TURNOVER*1000000'
],
parameters = {
'CH' : 'Fd',
'SDate' : '2017-06-25',
'EDate' : '2017-09-25',
'Curn' : 'EUR',
'Frq' : 'D'
})Refer to Data Item Browser app, TR.TURNOVER is the unscaled turnover value (summation of the value of all trades during the market day) for a particular instrument.
Moreover, I found that the TR function doesn't have a parameter to automatically apply factors to the turnover value as this is market specific. Therefore, Eikon Scripting API is unable to do it too.
0
Answers
-
TimeSeries service doesn't provide VALUE field but only HIGH, LOW, OPEN, CLOSE, COUNT and VOLUME.
To check available fields, don't detail field list :
>>> temp = ek.get_timeseries('BATS.L', start_date=startDate, end_date=endDate)
>>> temp
BATS.L HIGH LOW OPEN CLOSE COUNT VOLUME
Date
2017-06-28 5426.00000 5346.00000 5409.0 5351.0 15958.0 3021602.0
2017-06-29 5371.00000 5235.00000 5340.0 5235.0 16880.0 3635156.0
2017-06-30 5280.00000 5189.17539 5235.0 5234.0 15255.0 3621102.0
... ... ... ... ... ... ...
2017-09-25 4613.50000 4550.00000 4613.5 4585.0 14948.0 3711885.0
2017-09-26 4655.00000 4508.50000 4595.5 4650.0 23032.0 4485152.0
2017-09-27 4717.00000 4638.00000 4664.5 4663.5 9135.0 1368120.0
[65 rows x 6 columns]To get Turnover, you have to request on DataGrid service with get_data function:
>>> temp = eikon.get_data('BATS.L', ['TR.TURNOVER.Date','TR.TURNOVER'], parameters={'SDate': '2017-06-25', 'EDate': '2017-0 9-25'})
>>> temp
( Instrument Date Turnover
0 BATS.L 2017-06-26T00:00:00Z 134.927570
1 BATS.L 2017-06-27T00:00:00Z 174.867660
2 BATS.L 2017-06-28T00:00:00Z 162.414590
.. ... ... ...
62 BATS.L 2017-09-21T00:00:00Z 185.998271
63 BATS.L 2017-09-22T00:00:00Z 141.654754
64 BATS.L 2017-09-25T00:00:00Z 170.441317
[65 rows x 3 columns], None)If you want TURNOVER in EUR, add 'curn':'EUR in parameters :
>>> temp = ek.get_data('BATS.L', ['TR.TURNOVER.Date','TR.TURNOVER'], parameters={'SDate': '2017-06-25', 'EDate': '2017-0
9-25', 'curn':'EUR'})
>>> temp
( Instrument Date Turnover
0 BATS.L 2017-06-26T00:00:00Z 1.535270
1 BATS.L 2017-06-27T00:00:00Z 1.976493
2 BATS.L 2017-06-28T00:00:00Z 1.845156
.. ... ... ...
62 BATS.L 2017-09-21T00:00:00Z 2.115308
63 BATS.L 2017-09-22T00:00:00Z 1.598960
64 BATS.L 2017-09-25T00:00:00Z 1.937354
[65 rows x 3 columns], None)As values are provided in millions, you can also adjust by multiplying turnover value by 10^6:
>>> temp = ek.get_data('BATS.L', ['TR.TURNOVER.Date','TR.TURNOVER*1000000'], parameters={'SDate': '2017-06-25', 'EDate':
>>> temp
( Instrument Date TR.TURNOVER*1000000
0 BATS.L 2017-06-26T00:00:00Z 1.535270e+06
1 BATS.L 2017-06-27T00:00:00Z 1.976493e+06
2 BATS.L 2017-06-28T00:00:00Z 1.845156e+06
.. ... ... ...
62 BATS.L 2017-09-21T00:00:00Z 2.115308e+06
63 BATS.L 2017-09-22T00:00:00Z 1.598960e+06
64 BATS.L 2017-09-25T00:00:00Z 1.937354e+06
[65 rows x 3 columns], None)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 中文论坛