Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Adds a suite of new functions for querying data from the trading calendar. These include: `previous_trading_day` `minutes_for_days_in_range` (minutely version of `days_in_range`) `previous_open_and_close` (inverse of `next_open_and_close`) `next_market_minute` `previous_market_minute` `open_close_window` (get a range of opens/closes with slicing semantics) `market_minute_window` (get a range of minutes with slicing semantics) Also refactors `test_finance` to move `TradingEnvironment` tests into their own TestCase.
Overhauls `HistoryContainer` in prep for support of more than one frequency. Major changes: - Methods/variables referring to "day" have been renamed/generalized. - `current_day_panel` became `buffer_panel`, which is now a `RollingPanel` - `prior_day_panel` became a dictionary mapping `Frequency` objects to "digest panels", which are instances of `RollingPanel`. - Hard-coded daily rollover replaced with a notion of a "current window" for each unique frequency managed by the panel. - When the end of the current window is reached for a given frequency, we compute an aggregate bar (code refers to this as a "digest"), which is appended to a panel associated with that frequency. - Window rollover dates are managed by a pair of dictionaries, `cur_window_starts` and `cur_window_closes`. The `Frequency` class is responsible for computing window bounds based on the open/close of the previous window. - Semantic change to the `open_price` field: `open_price` now always contains the price of the first trade occurring in the given window. Previously it contained the price of the first minute in the window, returning NaN it the security happened not to trade in the first minute.
(This comment mostly applies for Emacs users.)
Hmm, maybe we should think about having a
Whether that value is
I can't recall if we tried to, and dropped it because of an issue with timezones, but we might be able to use the
Something like (assuming trading_day is set in the
Wouldn't call that a blocking change here, but worth investigating.
Looks good. /signoff
Have you profiled this versus the current implementation with a
Fixes an issue where, if `ffill=False`, `get_history` would return nans for every entry in the history frame except the last one.