alpha-xone / xbbg

An intuitive Bloomberg API
https://xbbg.readthedocs.io/
Apache License 2.0
244 stars 51 forks source link

blp.bdib doesn't work for commodity futures #52

Closed josephchenhk closed 2 years ago

josephchenhk commented 2 years ago

Tried to put "GC"/"GC1"/"GCZ" to assets.yml in Comdty, and used the following code to retrieve intraday bar data:

blp.bdib('GCZ1 Comdty', dt='2021-02-19', typ='TRADE')

But just returned empty data. Any advice?

alpha-xone commented 2 years ago

You can put "GC" into assets.yml and use GC1 Comdty / GC2 Comdty to get first / second month of futures data. For now, using futures contract (GC) + exact month (Z1) is not supported yet.

josephchenhk commented 2 years ago

You can put "GC" into assets.yml and use GC1 Comdty / GC2 Comdty to get first / second month of futures data. For now, using futures contract (GC) + exact month (Z1) is not supported yet.

Thanks! It works now. BTW, I could also use 'ref' to identify the exchange info.

Just would like to confirm: bbg only allows for retrieving 3 months 1-min bar data, right? Because if I specify the date earlier, I just received nothing.

Appreciate if any workarounds that could download historical 1 min bar data longer than 3 months. Thanks.

alpha-xone commented 2 years ago

Sometimes up to 6-month data, depending on Bloomberg intraday data availability.