Commit Graph

1435 Commits

Author SHA1 Message Date
Jean Bredeche 1f8e194e09 BUG: Position cost basis was calculated incorrectly for Futures
For futures, we need to divide the position’s commission by the
contract size to get a per-unit commission in order to properly update
the position’s cost basis.
2017-04-24 15:41:20 -04:00
Jean Bredeche b1248cb6d6 REF: Explicitly use Assets in Position, Order, Transaction
(Instead of `sid`, which were already usually assets)

Perf packets are unchanged and still emit `sid`: int
2017-04-24 15:41:13 -04:00
dmichalowicz f3086c548d API: Add factory for calendars 2017-04-24 09:37:32 -04:00
dmichalowicz 67dd149660 BUG: Ordered contracts could end prematurely 2017-04-21 15:52:21 -04:00
Andrew Daniels 4c334c6c38 PERF: Optimize session close lookups in resample bar reader (#1749)
Optimize session close lookups in MinuteResampleSessionBarReader:

- Adds `session_closes_in_range` method (along with
  `session_opens_in_range`) to TradingCalendar to allow vectorized
  retrieval of all values in a range of sessions.
- Improves code path for resampling a single session's worth of data (as
  is the case when calling `get_value`), since we don't actually need to
  look up the close minute.
2017-04-11 16:35:04 -04:00
Andrew Daniels 6dd1616c15 PERF: Use scalar lookups for TradingCalendar.schedule
When retrieving the open and close for a given session, we only care
about the scalar values, so using DataFrame.at instead of DataFrame.loc
is significantly faster.
2017-04-10 17:23:07 -04:00
dmichalowicz f6e1a95ca9 ENH: Preliminary support for Futures slippage and commission models 2017-04-10 14:37:20 -04:00
Maya Tydykov ea419492a2 Merge pull request #1739 from quantopian/fix-zipline-and-pandas-bug
Fix zipline and pandas bug
2017-04-07 12:22:06 -04:00
dmichalowicz 6f1d4b4a5f BUG: OrderedContracts chain could sometimes terminate on first contract 2017-04-07 10:01:22 -04:00
Andrew Daniels f4f2048a68 PERF: Avoid repeated recursive calls when getting forward-filled close
Instead of recursively calling `DailyHistoryAggregator.closes` until we
find a non-nan close, we can instead call `load_raw_arrays` once, and
find the value from the returned array.
2017-04-06 09:51:01 -04:00
Maya Tydykov 497708d86e BUG: address pandas normalization bug on non-sorted DT index 2017-04-04 17:00:32 -04:00
dmichalowicz 483ec5dae8 TST: Make TradingEnvironment resources static 2017-04-04 10:58:45 -04:00
dmichalowicz cf68953bf2 TST: Use 'us_futures' calendar in test fixtures 2017-04-03 10:18:03 -04:00
dmichalowicz 99dfe5961d BUG: Getting continuous future current contract failed on None 2017-03-30 12:09:55 -04:00
dmichalowicz 7829541112 EHN: Make continuous future adjustment style an argument 2017-03-29 08:49:12 -04:00
dmichalowicz 0d157859e0 BUG: Open and close resampling code could hit index errors 2017-03-28 16:06:29 -04:00
Jean Bredeche 6cf81a3f1c ENH: Allow override of order amount rounding. (#1722)
* ENH: Use regular rounding to calculate order amounts.

We previously tried to prevent accidental over-ordering by truncating
orders down unless they were within 1e-4 of the next higher integer.
Unfortunately, this makes it easy for a sell order to be one share short
of the desired position.

Using regular rounding treats both buys and sells in the same way.

* ENH keep non-rounding behavior consistent, but leave code structured to make easier to override

* DOC make round_order public and describe behavior in docstring
2017-03-27 20:44:12 -04:00
Freddie Vargus ca9da830fd STY: Add newline 2017-03-27 09:59:08 -04:00
Freddie Vargus 598444a2e8 TST: Test for adhoc holidays in CFEExchangeCalendar 2017-03-27 09:56:40 -04:00
Maxwell Rounds d66f7f53a0 ENH: Adding CFE Adhoc Holidays
The CFE was closed along with the NYSE in observation of the days of
mourning in honor of the passing of presidents Gerald Ford and Ronald
Reagan. The CFE also observed the closures due to Hurricane Sandy,
along with NYSE. Adding those adhoc holidays to exchange_calendar_cfe
and removing them from cfe.csv in tests. To fit with
USNationalDaysofMourning, also removing the closure in observation of
the day of mourning in honor of the passing of president Nixon in
1994, despite the fact that the exchange did not exist at that time.

Signed-off-by: Maxwell Rounds <maxwell.j.rounds@gmail.com>
2017-03-26 15:54:14 -07:00
David Michalowicz 15b8832421 Merge pull request #1718 from quantopian/more-generic
Add ContinuousFuture to lookup_generic
2017-03-25 09:23:35 -04:00
dmichalowicz c86798bc16 ENH: Add ContinuousFuture to lookup_generic 2017-03-25 09:04:17 -04:00
dmichalowicz 158d90a9ec ENH: Allow DataPortal.get_spot_value to accept multiple assets 2017-03-25 09:02:10 -04:00
Andrew Daniels 43d6004cff ENH: Adds StaticSids pipeline filter (#1717)
Useful for avoiding the need to create Asset objects when sids are
easier to use.

This is based off the existing implementation of StaticAssets, and
StaticAssets is now implemented as a wrapper around StaticSids.
2017-03-22 14:28:54 -04:00
dmichalowicz bb801344e9 ENH: Better error message for non-existent root symbol 2017-03-16 11:18:17 -04:00
Maya Tydykov f4455179d4 Merge pull request #1710 from quantopian/sort-pipeline-data-on-asofdate
Sort pipeline data on asofdate
2017-03-15 14:40:11 -04:00
Maya Tydykov 6e4060fc4f BUG: sort data on asof_date to resolve ts conflicts
MAINT: fix arg default and update docstring
2017-03-15 14:10:58 -04:00
Jean Bredeche ea1fb05676 ENH: teach BarData about current session's minutes 2017-03-15 13:40:33 -04:00
Joe Jevnik 153f6636c7 BUG: fix label array code dtype condense 2017-03-08 20:54:57 -05:00
Ana Ruelas b4e97bc9d8 TST: Add tests for winsorize factor 2017-03-07 17:14:27 -05:00
Ana Ruelas 309ec73faa ENH: Add winsorize factor 2017-03-06 14:08:28 -05:00
Joe Jevnik f90cd1ca0f Merge pull request #1672 from quantopian/narrow-labelarray
narrow labelarray
2017-03-02 19:32:56 -05:00
Joe Jevnik 35338df2b7 TST: add roundtrip check 2017-03-01 15:15:16 -05:00
Jean Bredeche f11b6467ac Rename _attrs_to_check to asdict 2017-02-23 11:32:04 -05:00
Andrew Daniels ba484e5469 MAINT: Removes unnecessary capital_base arg to TradingAlgorithm (#1677)
Capital base is included in the sim params, so we should define the
value there, or use the default.

This change also unifies the default capital base as 1e5, as was
previously defined in algorithm.py.
2017-02-17 09:04:50 -05:00
dmichalowicz 6d47a36166 ENH: Eliminate potential look-ahead bias in volume rolls 2017-02-16 09:01:16 -05:00
Maya Tydykov 4075971db4 Merge pull request #1684 from quantopian/fix-earnings-estimates-1-day-bug
BUG: fix loader bug for 1 day
2017-02-15 17:20:31 -05:00
Maya Tydykov 382eef0e3d BUG: fix loader bug for 1 day 2017-02-15 16:44:45 -05:00
Andrew Daniels 296307a632 TST: Adds TestingSlippage slippage model (#1679)
Allows specifying a constant number of shares filled per tick.

Also adds the WithConstantEquityMinuteBarData fixture, relocated from
internal repo.
2017-02-09 08:56:15 -05:00
Eddie Hebert 3d47aee2ab STY: Wrap/reformat lines over 80 chars.
Newer versions of flake8 detect these versions, though current zipline version
of flake8 does not.
2017-02-08 00:47:33 -05:00
Joe Jevnik d66309a3a0 TST: add tests for inferred width labelarray 2017-02-07 16:28:13 -05:00
dmichalowicz dd78bfa4e8 Change to a 10.5 hour futures calendar 2017-02-06 11:41:29 -05:00
Gus Gordon b45c52b453 Bump empyrical to 0.2.2 (#1674)
* Bump empyrical to 0.2.2

* Update example data for tests
2017-02-04 16:14:33 -05:00
Eddie Hebert 512c2bfb83 TST: Remove duplicate key in fixture config.
Should be no functional change.
2017-02-02 23:10:14 -05:00
Joe Jevnik 82361e0542 ENH: store the 'codes' for a labelarray in the narrowest int type possible 2017-02-02 20:58:36 -05:00
Maya Tydykov b1cae1b76a Merge pull request #1661 from quantopian/optionally-apply-deltas-adjustments
Optionally apply deltas adjustments
2017-01-31 15:40:43 -05:00
Maya Tydykov 5a9e91b567 TST: add arg to test assertion 2017-01-31 15:19:05 -05:00
Scott Sanderson 2fb90b4a25 Merge pull request #1667 from quantopian/pricing-fixture-cleanups
Pricing fixture cleanups
2017-01-31 10:32:17 -05:00
Maya Tydykov ae4511360f Merge pull request #1665 from quantopian/determine_overwrite_type_dynamically
Determine overwrite type dynamically
2017-01-31 10:06:21 -05:00
Maya Tydykov 66d1a0ce78 TST: add test cases for int and object dispatching 2017-01-31 09:43:39 -05:00