alpha-xone / xbbg

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

issue with generic commodity tickers >9th future #25

Closed sapre101 closed 3 years ago

sapre101 commented 3 years ago

hi there. i think there may be a bug for generic commodity ticker greater than the 9th future;

the following code will not work; data=blp.bdtick('SB11 Comdty' , '2020-12-04')

workaround as follows DOES work; data=blp.bdtick('SB11 Comdty' , '2020-12-04', ref='SB1 Comdty')

(same workaround as you suggested for 'C 1 Comdty', 'W 1 Comdty')

will use workaround for now, but wanted to bring to your attention...

many thanks

Traceback (most recent call last):

File "", line 1, in bbg()

ERROR MESSAGE: File "C:\m_PyFolioProject\Bloomberg_Intraday_data.py", line 118, in bbg b=blp.bdtick(ticker, date,) # ref='SB1 Comdty')

File "c:\mypythonvenv\lib\site-packages\xbbg\blp.py", line 306, in bdtick dt=dt, ticker=ticker, session=session, tz=exch.tz, **kwargs

File "c:\mypythonvenv\lib\site-packages\pandas\core\generic.py", line 5139, in getattr return object.getattribute(self, name)

AttributeError: 'Series' object has no attribute 'tz'

alpha-xone commented 3 years ago

thanks for point out - easy fix at the next release.

didn't expect people would be interested in the long-term contracts at this extreme - liquidities hardly provide enough meaningful insights.

sapre101 commented 3 years ago

Great.

indeed, most users wont be interested in the far end of the curve.. i have positions in some of these deferred contracts hence my interest :) Many thanks

alpha-xone commented 3 years ago

this is in 0.7.4b1 now