Importing option chain data from Bloomberg
<p>I would like to import from Bloomberg into R for a specified day the entire option chain for a particular stock, i.e. all expiries and strikes for the exchange traded options. I am able to import the option chain for a non-specified day (today):</p>

<pre><code>bbgData &lt;- bds(connection,sec,"OPT_CHAIN")
</code></pre>

<p>Where connection is a valid Bloomberg connection and sec is a Bloomberg security ticker such as "TLS AU Equity"</p>

<p>However, if I add extra fields it doesn't work, i.e.</p>

<pre><code>bbgData &lt;- bds(connection, sec,"OPT_CHAIN", testDate, "OPT_STRIKE_PX", "MATURITY", "PX_BID", "PX_ASK")
bbgData &lt;- bds(connection, sec,"OPT_CHAIN", "OPT_STRIKE_PX", "MATURITY", "PX_BID", "PX_ASK")
</code></pre>

<p>Similarly, if I switch to using the historical data function it doesn't work</p>

<pre><code>bbgData &lt;- dateDataHist &lt;- bdh(connection,sec,"OPT_CHAIN","20160201")
</code></pre>

<p>I just need the data for one day, but for a specified day, and including the additional fields</p>

<p>Hint: I think the issue is that every field following <code>"OPT_CHAIN"</code> is dependent on the result of <code>"OPT_CHAIN",</code> so for example it is the strike price given the code in <code>"OPT_CHAIN",</code> but I am unsure how to introduce this conditionality into the R Bloomberg query.</p>