Comments (2)
any example ids?
If a security has prices on weekends, it should be returned by bdh by default? see example below.
Rblpapi::bdh('XBTUSD Curncy', 'px_last', as.Date('2022-06-01'), as.Date('2022-06-15'))
date px_last
1 2022-06-01 31536.68
2 2022-06-02 30008.35
3 2022-06-03 29793.14
4 2022-06-04 29703.51
5 2022-06-05 29626.05
6 2022-06-06 31462.05
7 2022-06-07 29578.62
8 2022-06-08 30368.18
9 2022-06-09 30408.67
10 2022-06-10 29973.15
11 2022-06-11 28886.39
12 2022-06-12 27406.19
13 2022-06-13 23936.07
14 2022-06-14 22348.38
15 2022-06-15 20538.67
If a security has no data on weekends or holidays (or just missing data), you can fill it like this for all calendar days.
Rblpapi::bdh('BBSW3M Index', 'px_last', as.Date('2022-01-01'), as.Date('2022-01-15'))
date px_last
1 2022-01-04 0.0649
2 2022-01-05 0.0650
3 2022-01-06 0.0693
4 2022-01-07 0.0673
5 2022-01-10 0.0683
6 2022-01-11 0.0663
7 2022-01-12 0.0662
8 2022-01-13 0.0650
9 2022-01-14 0.0728
Rblpapi::bdh('BBSW3M Index', 'px_last', as.Date('2022-01-01'), as.Date('2022-01-15'), options = c('nonTradingDayFillOption' = 'ALL_CALENDAR_DAYS'))
date px_last
1 2022-01-01 0.0677
2 2022-01-02 0.0677
3 2022-01-03 0.0677
4 2022-01-04 0.0649
5 2022-01-05 0.0650
6 2022-01-06 0.0693
7 2022-01-07 0.0673
8 2022-01-08 0.0673
9 2022-01-09 0.0673
10 2022-01-10 0.0683
11 2022-01-11 0.0663
12 2022-01-12 0.0662
13 2022-01-13 0.0650
14 2022-01-14 0.0728
15 2022-01-15 0.0728
Other ways of filling data
bdh_fill_opt <- function(fill_opt, fill_with_prev = TRUE) {
# see bloomberg developer guide pdf
fill_opt <- match.arg(fill_opt, c(
'NON_TRADING_WEEKDAYS', # if date is non trading date but is mon-fri, it will be returned
'ALL_CALENDAR_DAYS',
'ACTIVE_DAYS_ONLY'
))
opt <- c('nonTradingDayFillOption' = fill_opt)
if (!fill_with_prev) {
opt <- c(opt, 'nonTradingDayFillMethod' = 'NIL_VALUE')
}
opt
}
If you just want to show the calendar days without actually filling them with previous day's data
Rblpapi::bdh('BBSW3M Index', 'px_last', as.Date('2022-01-01'), as.Date('2022-01-15'), options = bdh_fill_opt('ALL_CALENDAR_DAYS', fill_with_prev = F))
date px_last
1 2022-01-01 NA
2 2022-01-02 NA
3 2022-01-03 NA
4 2022-01-04 0.0649
5 2022-01-05 0.0650
6 2022-01-06 0.0693
7 2022-01-07 0.0673
8 2022-01-08 NA
9 2022-01-09 NA
10 2022-01-10 0.0683
11 2022-01-11 0.0663
12 2022-01-12 0.0662
13 2022-01-13 0.0650
14 2022-01-14 0.0728
15 2022-01-15 NA
from rblpapi.
Have you tried passing 7D-7 BUS DAY NO HOLIDAY in the options?
from rblpapi.
Related Issues (20)
- Installation failure Rblpapi MacOS HOT 6
- How do I connect to Bloomberg Anywhere HOT 1
- getBars doesn't work for equities HOT 6
- Hourly OHLCV in subscription and orders HOT 9
- Cannot install with Newer version of R, 4.2.1 HOT 4
- Connection failed using Bloomberg Everywhere version in OS X environment HOT 1
- Remove dependence on fts
- Larger cap for lookupSecurity maximum results HOT 8
- Bdp returns NA value for id_bb_company HOT 4
- Filling holidays historical prices with the last available price HOT 4
- Could I get a Pay Index through Rblpapi? HOT 4
- Downloading Yield Curve Data HOT 1
- Connection funnyness HOT 5
- documenting valid periodicitySelection options, semiannual not supported HOT 3
- Page Data Service HOT 4
- Downloading Credit Default Swaps (CDS) HOT 4
- Is there any plan to update Blpapi headers and run-time? HOT 1
- BQL implementation request HOT 1
- Server Api connection string HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rblpapi.