bpsmith / tia

Toolkit for integration and analysis
BSD 3-Clause "New" or "Revised" License
404 stars 165 forks source link

Has anyone been able to successfully use RT_PX_CHG_PCT_1D to retrieve real time pct change data? #55

Open viphilar opened 4 years ago

viphilar commented 4 years ago

I am trying to implement the python equivalent of the excel command, BDP("SPX Index", "RT_PX_CHG_PCT_1D") but I see NaN. Anyone knows how to fix this?

Here is how I am using it in my python code. I have a dataframe, df that holds indexes like SPX Index, etc. I use the get_reference_data() method to retrieve real time %age change of price but I get NaN:

temp = LocalTerminal.get_reference_data(df['Index'], ['RT_PX_CHG_PCT_1D'], ignore_field_error=1, ignore_security_error=1) newDf = temp.as_frame()

My output is:

                  RT_PX_CHG_PCT_1D

SPX Index NaN

Any thoughts?

dpsugasa commented 4 years ago

I believe you need to pass the IDs as a list. I am assuming that your df.index is a variety of BBG tickers. I would try your code using 'SPX Index' to see if it works as expected. If so, then it is very likely how you are passing the tickers. Depending on what your index looks like you can try list(df.index) or similar.

On Fri, 23 Aug 2019, 16:43 viphilar, notifications@github.com wrote:

I am trying to implement the python equivalent of the excel command, BDP("SPX Index", "RT_PX_CHG_PCT_1D") but I see NaN. Anyone knows how to fix this?

Here is how I am using it in my python code. I have a dataframe, df that holds indexes like SPX Index, etc. I use the get_reference_data() method to retrieve real time %age change of price but I get NaN:

temp = LocalTerminal.get_reference_data(df['Index'], ['RT_PX_CHG_PCT_1D'], ignore_field_error=1, ignore_security_error=1) newDf = temp.as_frame()

My output is:

              RT_PX_CHG_PCT_1D

SPX Index NaN

Any thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bpsmith/tia/issues/55?email_source=notifications&email_token=AGL2ISD4O4T6TJIZU3VSOCTQGAATJA5CNFSM4IPA7FOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHCLBLQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AGL2ISDKZLE6FTXIBUT6263QGAATJANCNFSM4IPA7FOA .