Got a question about pulling daily historical data released at a given time. I am working stock prices of firms based in different time zones. For each day of the time series I want to pull the price of the stocks released at the same time of the day. My aim is to compare the stock price of a European security at 4pm CEST with the price of an American security at 10am EST (which corresponds to 4pm CEST, indeed).
In order to do so with Bloomberg, I need to import data and select intraday bars, as in the following example:
=BDH("ABLX BB EQUITY","OPEN","06/01/17 09:00","06/30/17 09:05","recurdaily=true","barsz=5","bartp=B")
The formula requests the data at the time specified, between 09:00 and 09:05 (in my timezone). With the option "OPEN”
I request the data as close as possible to the start of the bar bucket, which is 09:00. Since this is a 5-minutes time interval, I used "barsz=5"
. By setting "bartp=B"
I request BID price. The option "recurdaily=true"
means that I will get recursive data through days, ie daily data for the month of June 2017 at around 09:00am.
I have tried hard to translate this formula in R, using Rblpapi, but I couldn't manage it. I can either get historical data with “bdh”
or bar data with “getBar”
but I wasn't able to find a solution that provides me with the same result of the Excel formula written above. Would anyone please help me?
The bdh()
function does not retrieve intra-daily history.
But you can try getBars()
or getTicks()
. The option values you have there may need some extra mapping.
R> es <- getTicks("ESZ7 Index", returnAs="data.table")
R> es
pt date time type value size condcode
1: 2017-09-26 10:10:37 2017-09-26 10:10:37 TRADE 2494.50 82 TSUM
2: 2017-09-26 10:10:37 2017-09-26 10:10:37 TRADE 2494.50 82 AS
3: 2017-09-26 10:10:37 2017-09-26 10:10:37 TRADE 2494.50 9 OR
4: 2017-09-26 10:10:37 2017-09-26 10:10:37 TRADE 2494.50 2 OR
5: 2017-09-26 10:10:37 2017-09-26 10:10:37 TRADE 2494.50 1 OR
---
57110: 2017-09-26 11:10:32 2017-09-26 11:10:32 TRADE 2496.00 5 AS
57111: 2017-09-26 11:10:32 2017-09-26 11:10:32 TRADE 2496.00 5 OR
57112: 2017-09-26 11:10:33 2017-09-26 11:10:33 TRADE 2496.25 1 TSUM
57113: 2017-09-26 11:10:33 2017-09-26 11:10:33 TRADE 2496.25 1 AB
57114: 2017-09-26 11:10:33 2017-09-26 11:10:33 TRADE 2496.25 1 OR
R>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.