Closed hoeghaa closed 2 years ago
This seems to be more a question related to translating the Excel call to an underlying blpapi
library call. I would suggest asking for help via the terminal. Alternatively you can look at some simple examples here https://matthewgilbert.github.io/blp/quickstart.html
Hi Matthew
Thank you very much for your response and time! Unfortunately, the simple examples does not include examples of options added to the BDH, so I will try to reach help via the terminal.
Have a great weekend!
Best regards,
Jørgen
Fra: Matthew Gilbert @.> Sendt: 19. august 2021 20:59 Til: matthewgilbert/blp @.> Cc: hoeghaa @.>; Author @.> Emne: Re: [matthewgilbert/blp] How to add options to bloomberg bdh query using api in python (#3)
This seems to be more a question related to translating the Excel call to an underlying blpapi library call. I would suggest asking for help via the terminal. Alternatively you can look at some simple examples here https://matthewgilbert.github.io/blp/quickstart.html
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/matthewgilbert/blp/issues/3#issuecomment-902162929, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVFY7DTAW4RRA6GE2JU2Q3LT5VIBXANCNFSM5COMNYDA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Hi @hoeghaa, good point. I have added an example to the documentation showing the use of overrides. You can find it here https://matthewgilbert.github.io/blp/quickstart.html#Using-overrides. For your specific case best to consult FLDS
or Bloomberg HELP HELP but that example should show you how to interact with the library code.
Hi Matthew
Sorry, I didn't see your answer, it looks very helpful, will dive right into it! Once again, thank you!
Best regards, Jørgen
Fra: Matthew Gilbert @.> Sendt: 20. august 2021 19:22 Til: matthewgilbert/blp @.> Cc: hoeghaa @.>; Mention @.> Emne: Re: [matthewgilbert/blp] How to add options to bloomberg bdh query using api in python (#3)
Hi @hoeghaahttps://github.com/hoeghaa, good point. I have added an example to the documentation showing the use of overrides. You can find it here https://matthewgilbert.github.io/blp/quickstart.html#Using-overrides. For your specific case best to consult FLDS or Bloomberg HELP HELP but that example should show you how to interact with the library code.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/matthewgilbert/blp/issues/3#issuecomment-902842317, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVFY7DQJPNUAKFUABHRCWADT52FMXANCNFSM5COMNYDA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Hi Matthew
I have one last question, I hope it's okay..
I have the following code:
now = arrow.now() today = str(now.format('YYYYMMDD')) today_minus_one_year = str(now.shift(days=-365).format('YYYYMMDD')) start_date = today_minus_one_year
Security = 'AAPL US Equity' period = 90 Select_interval = 'D' delta = 25
df_call = blp.bdh([Security], ['PX_LAST','IVOL_Delta','VOLUME_TOTAL_CALL'], start_date=start_date, end_date=today, IVOL_DELTA_LEVEL='DELTALVL'+str(delta), IVOLMATURITY='MATURITY'+str(period)+str(Select_interval), IVOL_DELTA_PUT_OR_CALL='IVOL_CALL')
Which works just fine.
In bdp in Excel, you can add "days=a", and "Sort=D", to get all days and sort in decending order, respectively.
I tried to include it like so:
df_call = blp.bdh([Security], ['PX_LAST','IVOL_Delta','VOLUME_TOTAL_CALL'], start_date=start_date, end_date=today, IVOL_DELTA_LEVEL='DELTALVL'+str(delta), IVOLMATURITY='MATURITY'+str(period)+str(Select_interval), IVOL_DELTA_PUT_OR_CALL='IVOL_CALL', days='a', Sort='D')
but it doesn't work... Can you help me with this?
Best regards,
Jørgen
Fra: Matthew Gilbert @.> Sendt: 20. august 2021 19:22 Til: matthewgilbert/blp @.> Cc: hoeghaa @.>; Mention @.> Emne: Re: [matthewgilbert/blp] How to add options to bloomberg bdh query using api in python (#3)
Hi @hoeghaahttps://github.com/hoeghaa, good point. I have added an example to the documentation showing the use of overrides. You can find it here https://matthewgilbert.github.io/blp/quickstart.html#Using-overrides. For your specific case best to consult FLDS or Bloomberg HELP HELP but that example should show you how to interact with the library code.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/matthewgilbert/blp/issues/3#issuecomment-902842317, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVFY7DQJPNUAKFUABHRCWADT52FMXANCNFSM5COMNYDA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Can you look at code formatting in GitHub issues, it makes reading your questions easier.
If you look at the example in the documentation I linked, overrides are passed as a list of tuples, e.g. overrides=[("EQY_FUND_CRNCY", "EUR")]
. Try changing your call to that format.
I have the following excel-formula:
=@BDH("TSLA US Equity";"IVOL_Delta";start_date;end_date;IVOL_MATURITY=Maturity_90D;IVOL_DELTA_LEVEL=DELTA_LVL_25;IVOL_DELTA_PUT_OR_CALL=IVOL_CALL;days=a;Sort=D;cols=2;rows=1826).
Where the security is TSLA US Equity, the field is IVOL_Delta, start date and end dates speaks for itself, and the options is the remaining.
It works just fine in Excel.
I would like to use the API for python instead, but I don't know how to translate the options to a feasible input, I have tried both as dictionary and as list (could have messed something up though).
I tried the following code without luck (it works if the if I delete the dict and "options=opt" lines):
import pandas from blp import blp
bquery = blp.BlpQuery().start()
opt = {"IVOL_DELTA_LEVEL":"DELTA_LVL_25"}
bquery.bdh( ["TSLA US Equity"], ["PX_LAST","IVOL_Delta","VOLUME_TOTAL_CALL"],#,"OPT_DELTA_MID_RT" start_date="20210801", end_date="20210819", options = opt, ) Thanks in advance!