r - Importing option chain data from Bloomberg -


i import bloomberg r specified day entire option chain particular stock, i.e. expiries , strikes exchange traded options. able import option chain non-specified day (today):

bbgdata <- bds(connection,sec,"opt_chain") 

where connection valid bloomberg connection , sec bloomberg security ticker such "tls au equity"

however, if add fields doesn't work, i.e.

bbgdata <- bds(connection, sec,"opt_chain", testdate, "opt_strike_px", "maturity", "px_bid", "px_ask") bbgdata <- bds(connection, sec,"opt_chain", "opt_strike_px", "maturity", "px_bid", "px_ask") 

similarly, if switch using historical data function doesn't work

bbgdata <- datedatahist <- bdh(connection,sec,"opt_chain","20160201") 

i need data 1 day, specified day, , including additional fields

hint: think issue every field following "opt_chain" dependent on result of "opt_chain", example strike price given code in "opt_chain", unsure how introduce conditionality r bloomberg query.

it's better use field chain_tickers , related overrides when retrieving option data given underlying bloomberg. can, example, request points given moneyness getting chain_tickers override of chain_strike_px_ovrd equal 90%-110%.

in either case need use tickers result of first request in second request if want retrieve additional data. so:

option_tickers <- bds("tls au equity","chain_tickers",                        overrides=c(chain_strike_px_ovrd="90%-110%"))  option_prices <- bdp(sapply(option_tickers, paste, "equity"), c("px_bid","px_ask")) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -