matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
241 stars 68 forks source link

Not really issue, more just question about FILL=P and Days=A overrides #42

Closed NoahKauffman closed 6 years ago

NoahKauffman commented 6 years ago

Hi Mathew -

I could not find in your tutorial how to override for fill=p (which is a standard override of most bbg fields, to allow for backfilling to the prev value). Days=A also is an override that allows you to force showing every actual day (i.e. not hiding weekends).

I notice the following overrides are not recognized:

con.bdh('GBPUSD Curncy', ['PX_LAST'],'20080101', '20180703',ovrds=[('FILL','P')]) con.bdh('GBPUSD Curncy', ['PX_LAST'],'20080101', '20180703',ovrds=[('DAYS','A')])

con = pdblp.BCon(debug=True, port=8194) con.start()

13JUL2018_11:50:39.410 14824:9772 WARN blpapi_platformcontroller.cpp:347 blpapi.session.platformcontroller.{4} Connectiv ity restored.

con.bdh('GBPUSD Curncy', ['PX_LAST'],'20080101', '20180703',ovrds=[('FILL','P')]) DEBUG:root:Sending Request: HistoricalDataRequest = { securities[] = { "GBPUSD Curncy" } fields[] = { "PX_LAST" } startDate = "20080101" endDate = "20180703" overrides[] = { overrides = { fieldId = "FILL" value = "P" } } }

DEBUG:root:Message Received: HistoricalDataResponse = { responseError = { source = "bbdbh3" code = 27 category = "BAD_ARGS" message = "Invalid override field id specified [nid:65] " subcategory = "INVALID_OVERRIDE_FIELD" } }

Traceback (most recent call last): File "", line 1, in File "C:\Python35\lib\site-packages\pdblp\pdblp.py", line 165, in bdh elms, ovrds) File "C:\Python35\lib\site-packages\pdblp\pdblp.py", line 201, in _bdh_list has_security_error = (msg.getElement('securityData') File "C:\Python35\lib\site-packages\blpapi\message.py", line 127, in getElement return self.asElement().getElement(name) File "C:\Python35\lib\site-packages\blpapi\element.py", line 347, in getElement _ExceptionUtil.raiseOnError(res[0]) File "C:\Python35\lib\site-packages\blpapi\exception.py", line 145, in raiseOnError _ExceptionUtil.raiseException(errorCode, description) File "C:\Python35\lib\site-packages\blpapi\exception.py", line 137, in raiseException raise errorClass(description, errorCode) blpapi.exception.InvalidArgumentException: Choice sub-element not found for name 'securityData'. (0x00020002)

con.bdh('GBPUSD Curncy', ['PX_LAST'],'20080101', '20180703',ovrds=[('DAYS','A')]) DEBUG:root:Sending Request: HistoricalDataRequest = { securities[] = { "GBPUSD Curncy" } fields[] = { "PX_LAST" } startDate = "20080101" endDate = "20180703" overrides[] = { overrides = { fieldId = "DAYS" value = "A" } } }

DEBUG:root:Message Received: HistoricalDataResponse = { responseError = { source = "bbdbh2" code = 27 category = "BAD_ARGS" message = "Invalid override field id specified [nid:65] " subcategory = "INVALID_OVERRIDE_FIELD" } }

Traceback (most recent call last): File "", line 1, in File "C:\Python35\lib\site-packages\pdblp\pdblp.py", line 165, in bdh elms, ovrds) File "C:\Python35\lib\site-packages\pdblp\pdblp.py", line 201, in _bdh_list has_security_error = (msg.getElement('securityData') File "C:\Python35\lib\site-packages\blpapi\message.py", line 127, in getElement return self.asElement().getElement(name) File "C:\Python35\lib\site-packages\blpapi\element.py", line 347, in getElement _ExceptionUtil.raiseOnError(res[0]) File "C:\Python35\lib\site-packages\blpapi\exception.py", line 145, in raiseOnError _ExceptionUtil.raiseException(errorCode, description) File "C:\Python35\lib\site-packages\blpapi\exception.py", line 137, in raiseException raise errorClass(description, errorCode) blpapi.exception.InvalidArgumentException: Choice sub-element not found for name 'securityData'. (0x00020002)

Maybe there is something strange about these generic overrides though? When you look under FLDS in bloomberg, they are not listed as an override, but they generically work with any field when I pull in Excel.

Let me know if i have specified the syntax incorrectly.

Best!

matthewgilbert commented 6 years ago

Hi Noah,

Please look into adding a more concise title and formatting your question appropriately so that it is more legible. Check out https://guides.github.com/features/mastering-markdown/

matthewgilbert commented 6 years ago

@NoahKauffman I assume you have resolved this issue since I have not heard back? I am going to close this. In the future for usage questions I think a more appropriate venue for asking these would be StackOverflow. There is now currently a pdblp tag which you can use there. An example is https://stackoverflow.com/questions/51383505/field-override-for-bdh-in-pdblp