Commit Graph

505 Commits

Author SHA1 Message Date
Jean Bredeche ec441c55ea BUG: Fix HolidayCalendar init 2016-08-09 09:10:43 -04:00
Scott Sanderson a265356082 MAINT: Remove unused variable. 2016-08-05 16:03:00 -04:00
Scott Sanderson c77d51de83 MAINT: Isolate global calendar state.
Encapsulate the shared global calendar map in an object.

This allows consumers that don't want to participate in custom
registration to pass around a calendar dispatcher, and would make it
easier to support contextual management of the global calendar map if we
want to do that in the future.

As a bonus, we now only create one instance of each calendar, instead of
one per alias.
2016-08-05 15:25:02 -04:00
Jean Bredeche 9ae725b940 ENH: update register_calendar API to take a specific name 2016-08-02 23:12:07 -04:00
Jean Bredeche 6020752a1d TST: Filter out pandas performance warnings in tests (for now) 2016-08-02 23:12:07 -04:00
Jean Bredeche 2854c77d55 ENH: Clock now fires a BEFORE_TRADING_START_BAR event.
`AlgorithmSimulator` listens to that event to call the algorithm's
`before_trading_start` method.
2016-08-02 23:12:07 -04:00
Joe Jevnik 7e99094cb1 ENH: add __len__ and fix iteration for negative step 2016-08-02 18:53:57 -04:00
Joe Jevnik 19ecb8d5e8 TST: add tests for range.__eq__ 2016-08-02 14:25:10 -04:00
Joe Jevnik 6708ef1bdf ENH: update assets-db-error-msg 2016-08-02 14:25:10 -04:00
Joe Jevnik 4265a13edf Revert "Merge pull request #1354 from quantopian/revert-1302-point-in-time-asset-db"
This reverts commit 3b633011c6, reversing
changes made to 70ac5323de.
2016-08-02 14:25:10 -04:00
Joe Jevnik 9103516e82 Merge pull request #1313 from nathanwolfe/master
BUG: Add support for Panel data in accordance with documentation
2016-07-29 20:11:56 -04:00
Nathan Wolfe 96dc1c3721 BUG: Generate sim_params within run_algorithm, fix it for raw data
Previously, run_algorithm caused an error if run on raw (non-bundle)
data, because of uninitialized variables. Initializing those variables
to None to allow run_algorithm to work with Panel data, etc.

Also, run_algorithm did not create sim_params for the TradingAlgorithm
instance it created; this kicked the can to TradingAlgorithm, which
gets default sim_params with data_frequency 'daily'. To support minute
bars, changing run_algorithm to create its own sim_params with the
data_frequency specified in its arguments.
2016-07-29 17:11:49 -04:00
Joe Jevnik 814a2be7b7 Revert "Point in time asset db" 2016-07-27 23:29:08 -04:00
Joe Jevnik 92d79f76aa MAINT: remove unused 'let' function 2016-07-26 13:34:58 -04:00
Joe Jevnik fc297544e0 MAINT: py2 compat 2016-07-26 13:34:58 -04:00
Joe Jevnik 7fd8c29880 ENH: add point in time aspect to equity symbol mapping
Changes the overlap behavior so that it is an error to write data which
would have two companies holding the same ticker. Other than one test
around which company would win in that case, all the other tests are
passing. That single test has been changed to check the write-time
error.
2016-07-26 13:34:58 -04:00
Joe Jevnik 54be3858ba TST: adds test bundle to builtins to make it easier to rebuild when the asset db changes 2016-07-26 13:34:58 -04:00
LotannaEzenwa f43941933f ENH: Makes working_dir work on Windows. Updates bundle core 2016-07-25 13:10:23 -04:00
Jean Bredeche 21aca754ba ENH: Reorganized internal calendar implementation.
Added tests for CME calendar.

Added ICE calendar (and tests).

Added CFE calendar (and tests).
2016-07-19 22:27:34 -04:00
Andrew Daniels 6cebf05417 BUG: Further corrections for days_at_time (#1334)
* BUG: Further corrections for days_at_time

- Revert to using DateOffset, as Timedelta doesn't handle offsetting by
  one day over a tz change properly:

    In [12]: pd.Timestamp('2004-04-05', tz='America/Chicago') + pd.Timedelta(days=-1)
    Out[12]: Timestamp('2004-04-03 23:00:00-0600', tz='America/Chicago')

    In [13]: pd.Timestamp('2004-04-05', tz='America/Chicago') + pd.DateOffset(days=-1)
    Out[13]: Timestamp('2004-04-04 00:00:00-0600', tz='America/Chicago')

  By creating a DateOffset using the `days` kwarg, the issue previously
  fixed in bcc867b is addressed.

- To preempt any other pandas issues around day offsets, changes to
  performing these with no timezone, then localizing to the local
  timezone when shifting the time.
- Adds unit test for days_at_time

* STY: Remove unused import
2016-07-19 13:19:40 -04:00
Andrew Daniels bcc867b143 BUG: Use Timedelta instead of DateOffset in days_at_time calendar helper
Prior to pandas 17, there were issues with offsetting dates with
DateOffset around discontinuities (like the start of DST). We can use
Timedelta here instead, which handles these edge cases.
2016-07-18 17:11:11 -04:00
Joe Jevnik 835fab8ebd Merge pull request #1323 from quantopian/pmap-blaze-query
ENH: Adds the ability to run blaze queries concurrently
2016-07-14 18:40:57 -04:00
Joe Jevnik 5473ec240d ENH: Adds the ability to run blaze queries concurrently 2016-07-14 17:32:30 -04:00
Jean Bredeche 3d6fdc0755 Make sure we are passing ints to nth. 2016-07-13 20:40:57 -04:00
Jean Bredeche 6fb4923cc7 Re-implemented the Calendar API.
Instead of having separate ExchangeCalendar and TradingSchedule objects, we
now just have TradingCalendar.  The TradingCalendar keeps track of each
session (defined as a contiguous set of minutes between an open and a close).
It's also responsible for handling the grouping logic of any given minute
to its containing session, or the next/previous session if it's not a market
minute for the given calendar.
2016-07-12 13:13:50 -04:00
Eddie Hebert 51eda06323 MAINT: Add equity to naming of bar data classes.
In preparation of adding futures, add equity to the names of both the
classes and methods for writing bcolz data. Futures data will use a
different minutes per day with a separate reader. This change will allow
both equity and futures fixtures to be side by side.

Also, break out the method which generates the dataframes and trading
days member into fixtures (`EquityMinuteBarData` and
`EquityDailyBarData`) on which the `*BarReader` fixture depends.  This
fixture is separated out to enable reader/writers in different formats
to use the same data setup. (There is internal code which needs to write
minute and daily bar data in a database format.)
2016-06-30 08:21:42 -04:00
Andrew Daniels 4fd444dbb2 MAINT: Disable deprecation warning for tradingcalendar
The new calendar API is currently in flux, so disabling the deprecation
warning for tradingcalendar. To be re-enabled once the new API is
stabilized.
2016-06-28 10:06:11 -04:00
Eddie Hebert a721380664 MAINT: Remove unused test factory functions.
`create_commission` and `create_minutely_trade_source` are no longer
used.
2016-06-27 13:06:41 -04:00
Richard Frank 69b6cff964 Merge pull request #1289 from quantopian/wildcard
wildcard object and doctests
2016-06-22 18:09:57 -04:00
Joe Jevnik bfa3e6f153 TST: 32b compat doctests 2016-06-21 15:07:03 -04:00
Joe Jevnik efd7bf72c3 TST: py3 compat doctests 2016-06-21 15:07:03 -04:00
Joe Jevnik 5925107052 TST: fix doctests to actually run 2016-06-21 15:07:03 -04:00
Andrew Liang 65bf854897 Merge pull request #1296 from quantopian/fix_month_start_rule
BUG: get_first_trading_day_of_month needs to return normalized dt
2016-06-21 12:55:06 -04:00
Andrew Liang 1643bd1db6 BUG: get_first_trading_day_of_month needs to return normalized dt 2016-06-21 12:26:40 -04:00
Andrew Daniels dd38ca9747 BUG: Removes Hurricane Sandy closings from CME exchange calendar
Since the CME calendar was based off of the NYSE calendar, closings for
Hurricane Sandy were included, but shouldn't have been for CME.

This is the explanation we had included prior to the new exchange
calendars:

http://en.wikipedia.org/wiki/Hurricane_sandy

We *do not* add any non-trading days for Hurricane Sandy. Although
trading on CME Group exchanges was disrupted, trading still occurred at
some point on each day. Importantly, the disruptions do not appear to
have affected the expiration dates stipulated in the futures contracts
expiring during this period.

Trading of CME US equity index futures & NYMEX futures was disrupted due
to the hurricane's impact on New York. CME US equity index futures
markets were disrupted on October 29th 2012, but reopened at 5:00pm CT.

The US equity index markets were closed from 8:15am CT on October 30,
both for the trading floor and CME Globex. The trading floor of the
NYMEX was closed on October 30, but all floor-trading products were
available electronically on CME Globex.

Source:
http://investor.cmegroup.com/investor-relations/releasedetail.cfm?ReleaseID=716923

    October 2012
Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6
 7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

Also see:
-- http://www.chicagobusiness.com/article/20121029/NEWS01/121029818/cme-cboe-other-markets-closed-for-hurricane-sandy-about-500-local-flights-scrapped
-- http://money.cnn.com/2012/10/29/investing/hurricane-sandy-stock-markets
2016-06-21 10:31:35 -04:00
Eddie Hebert 87843e22fe MAINT: Remove unused module.
Remove module, last usage was removed during lazy access pattern
rewrite.
2016-06-21 09:50:00 -04:00
Andrew Daniels 306839e6e3 MAINT: Creates deprecation warning for tradingcalendar imports
The tradingcalendar module has been replaced by the new exchange
calendars and trading schedules.  Issues a ZiplineDeprecationWarning at
tradingcalendar module scope to be triggered on imports.
2016-06-16 09:40:29 -04:00
Andrew Liang ba3ba053cb MAINT: Refactor schedule function rules
Refactor to eliminate unnecessary type coercion. Reduce some code
duplication
2016-06-14 13:55:59 -04:00
Andrew Liang 28b1da443e MAINT: Raise when trying to get a date outside trading calendar
next_scheduled_day and previous_scheduled day should raise if
trying a return a date outside the calendar. Previously it just
returns None, but it should be made consistent with the behavior
of add_scheduled_days
2016-06-13 09:07:16 -04:00
Jean Bredeche 1505c62daf REV: Restore old tradingcalendar.py 2016-06-09 13:56:40 -04:00
Jean Bredeche b1428aaad1 DEV: Cleaned up trading_minute_window
Removed it from ExchangeCalendar.

Fixed TradingSchedule’s implementation to be much faster.  Removed the
`step` parameter.
2016-06-08 13:34:23 -04:00
Jean Bredeche e1e12534c5 ENH: speed up calculation of all trading minutes. 2016-06-08 13:34:23 -04:00
Jean Bredeche 1208aaf1d9 Fix from bad rebase. 2016-06-08 13:34:23 -04:00
jfkirk 3b8b6d55e0 STY: Cleans up ExchangeCalendar construction 2016-06-08 13:34:22 -04:00
jfkirk 4a20157a25 BUG: Python 3 time compatibility 2016-06-08 13:34:22 -04:00
jfkirk 2a8f69fc01 MAINT: DataPortal env -> asset_finder 2016-06-08 13:34:22 -04:00
Andrew Daniels 53fcdde66d Fixes for CMEExchangeCalendar
Note that a lot of this duplicates what we have for
NYSEExchangeCalendar.
2016-06-08 13:34:22 -04:00
jfkirk 77cdec161a BUG: Changes type of early_closes to DatetimeIndex 2016-06-08 13:34:21 -04:00
jfkirk 156be81b14 ENH: Adds BMF, LSE, TSX to get_calendar 2016-06-08 13:34:21 -04:00
jfkirk 2a81c2066f ENH: Adds the option to force calendar registration 2016-06-08 13:34:21 -04:00