matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
242 stars 67 forks source link

BDS type of call #25

Closed ahmasoh1992 closed 6 years ago

ahmasoh1992 commented 6 years ago

Hey Guys,

If I want to do a BDS type of call, say:

=BDS("SPX Index","INDX_MWEIGHT_HIST", "END_DATE_OVERRIDE=20151231")

I assume it's along the lines of:

con.ref(["SPX Index"],"INDX_MWEIGHT_HIST", [("END_DATE_OVERRIDE","20150715")])

But this seems to throw up:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "...\Python27\site-packages\pdblp\pdblp.py", line 242, in ref
    ovrds, [])
  File "...\Python27\site-packages\pdblp\pdblp.py", line 125, in _create_req
    for ovrd_fld, ovrd_val in ovrds:
ValueError: need more than 1 value to unpack

Know what's going on?

cedricyau commented 6 years ago

Try a comma after the tuple.

[("END_DATE_OVERRIDE","20150715"), ] On Tue, Feb 13, 2018 at 10:52 AM ahmasoh1992 notifications@github.com wrote:

Hey Guys,

If I want to do a BDS type of call, say:

=BDS("SPX Index","INDX_MWEIGHT_HIST", "END_DATE_OVERRIDE=20151231")

I assume it's along the lines of:

con.ref(["SPX Index"],"INDX_MWEIGHT_HIST", [("END_DATE_OVERRIDE","20150715")])

But this seems to throw up: Traceback (most recent call last): File "", line 1, in File "...\Python27\site-packages\pdblp\pdblp.py", line 242, in ref ovrds, []) File "...\Python27\site-packages\pdblp\pdblp.py", line 125, in _create_req for ovrd_fld, ovrd_val in ovrds: ValueError: need more than 1 value to unpack

Know what's going on?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matthewgilbert/pdblp/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/AF1yH98IUgqEuX-nVYAFLnSAZ5lfxLXJks5tUa-8gaJpZM4SD99N .

-- Cedric Yau cedricyau@gmail.com

ahmasoh1992 commented 6 years ago

Wow thanks, why does that work? Is that a bug?

matthewgilbert commented 6 years ago

This is not a bug, the syntax for accessing the Bcon.ref (and the rest of pdblp) is not a direct translation of the excel syntax.