-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting historical FX rates. #64
Comments
For historical data you should use con.bdh("USDHKD BGN Curncy", "PX_LAST", start_date='20170331' end_date='20170406')
Also for future reference its good to set |
Thanks for your input. Can you elaborate on how setting con.debug can indicate what sort of data I am receiving back, specifically whether it is historical or current? What should I be looking out for? The tutorial had one or two examples where the date was overridden and naturally I followed it. Before the current incident, there was another time that I was using pdblp to get historical weights of the index constituents at the end of the last 12 quarters. I thought I was getting the correct values only to realize much later that the differences were actually second-by-second real-time weight variations of the index due to the price of the constituents changing. It took me ages to debug it and find the right syntax for it. |
At it's core At a high level if you want historical data, use Below is an example In [1]: import pdblp
In [2]: con = pdblp.BCon(debug=True, port=8194, timeout=5000).start()
In [3]: con.bdh('SPY US Equity', 'PX_LAST', '20150629', '20150630')
|
Code Sample, a copy-pastable example if possible
Problem description
I am just trying to get the historical FX rates for two (sufficient for MCVE) dates and I am getting the same values for both dates, which I suspect is the current value. I have looked at the examples in the tutorial and API but I can't see anything specific to this case. What am I missing? Thanks.
Expected Output
2017-03-31 7.7709
2017-04-06 7.7700
Version Information
'0.1.8'
The text was updated successfully, but these errors were encountered: