Back to Community
how to get previous month's daily price data and number of trading days?

Hi folks,

2 questions:

(1) I would like to get daily prices of the previous month. Tried

price_history = data.history(
context.security,
fields='price',
bar_count= 20,
frequency='1d'
).iloc[0:-1]

However, take 04/2017, it only returns daily prices from 03/07/2017 to 03/31/2017. Anyone has any solution?

(2) I would like to get number of trading days (count) for any month, any built-in functions? If not, any advice or solutions?

Many thanks!