alpha-xone / xbbg

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

BDS with custom portfolio returns nothing #20

Closed walterkissling closed 3 years ago

walterkissling commented 4 years ago

Hello, I am able to pull portfolio information for a custom portfolio in Excel and in xbbg using BDP only. When I try to pull data using BDS nothing is returned.

The code I am using is: blp.bds('<PORT ID> Client','PORTFOLIO_DATA')

And the results is just "__". If I use the same formula in Excel it works fine.

Anyone having the same issue?

walterkissling commented 3 years ago

In case anyone is interested, the fix is to create a new function, much like BDP, but replace:

request = service.createRequest('ReferenceDataRequest')

with

request = service.createRequest('PortfolioDataRequest')

alpha-xone commented 3 years ago

Thanks for update. In this case we may need to create another bd function to connect to this portfolio request.

alpha-xone commented 3 years ago

added one parameter to solve this temporarily. could you check out if it works: https://github.com/alpha-xone/xbbg/blob/e5c4e43d8697eca16389926e5ccf130a12c8b896/xbbg/blp.py#L56

Can install below beta to try out: pip install xbbg==0.7.1b3

walterkissling commented 3 years ago

Thanks! Yes it works fine.

alpha-xone commented 3 years ago

Great

itsfreddyrb commented 1 year ago

Hello guys, I know this is an old thread but I really need some help. I am trying to retrieve all the data of a portfolio and I keep getting {} as response.

This is what I am running:

`def getPortfolio():

portfolio = request.args.get('portfolio')

result = blp.bds(tickers=["U302412345-20", flds=['PORTFOLIO_DATA'], use_port=True) result_object = result.to_json[orient = 'columns']

return result_object `

If anyone could give me a light. There's equities, cash, and some other things in that portfolio ID I am calling.

Thanks.

mg3146 commented 1 year ago

What kind of portfolio is that / ticker is that ? On Feb 17, 2023 at 11:32 PM -0500, itsfreddyrb @.***>, wrote:

Hello guys, I know this is an old thread but I really need some help. I am trying to retrieve all the data of a portfolio and I keep getting {} as response. This is what I am running: def getPortfolio(): portfolio = request.args.get('portfolio') result = blp.bds(tickers=["U302412345-20", flds=['PORTFOLIO_DATA'], use_port=True) result_object = result.to_json[orient = 'columns'] return result_object If anyone could give me a light. There's equities, cash, and some other things in that portfolio ID I am calling. Thanks. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

itsfreddyrb commented 1 year ago

That's the portfolio ID. What am I supposed to pass? Thanks.

mg3146 commented 1 year ago

Oh I just didn’t even know this was possible, kinda neat On Feb 18, 2023 at 7:40 PM -0500, itsfreddyrb @.***>, wrote:

That's the portfolio ID. What am I supposed to pass? Thanks. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

itsfreddyrb commented 1 year ago

Yes, it would be neater if I knew how to do it 😂😂😂

mg3146 commented 1 year ago

Haha, I hear you.  I guess first question is, how do you do in the excel API? Same way you have it in the code ? On Feb 19, 2023 at 11:10 AM -0500, itsfreddyrb @.***>, wrote:

Yes, it would be neater if I knew how to do it 😂😂😂 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

itsfreddyrb commented 1 year ago

Yep, doing exactly that. But I'm getting { } and that's it.

mg3146 commented 1 year ago

Is there anything in Result before calling to json ? On Feb 19, 2023 at 12:12 PM -0500, itsfreddyrb @.***>, wrote:

Yep, doing exactly that. But I'm getting { } and that's it. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

itsfreddyrb commented 1 year ago

Nope, nadda..

itsfreddyrb commented 1 year ago

Anyone has any idea? @alpha-xone ?

walterkissling1 commented 1 year ago

Don't know if you figured it out already but I think what's missing is you need to append the world "Client" at the end of the portfolio id. So in your example it would be "U302412345-20 Client".