Commit Graph
3272 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
Jean BredecheandGitHub 123398d0e4 Merge pull request #1760 from quantopian/constant-futures
TST: New fixture for constant futures data
2017-04-24 14:33:47 -04:00
Jean Bredeche ec6492c84e TST: New fixture for constant futures data 2017-04-24 14:15:26 -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 DanielsandGitHub 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 bd7f121e85 PERF: Only get session close in MinuteResampleSessionBarReader
We only need the close, not the open.
2017-04-10 17:23:07 -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
David MichalowiczandGitHub aad5cd362e Merge pull request #1738 from quantopian/slippage-and-commissions-futures
Add preliminary support for Futures slippage models
2017-04-10 15:05:28 -04:00
Andrew DanielsandGitHub 33442a9977 Merge pull request #1742 from quantopian/only-get-value-once
MAINT: Refactor DataPortal._get_minute_spot_value to avoid two lookups
2017-04-10 14:56:29 -04:00
dmichalowicz f6e1a95ca9 ENH: Preliminary support for Futures slippage and commission models 2017-04-10 14:37:20 -04:00
dmichalowicz e2fadae5ec API: Make certain continuous future arguments optional 2017-04-07 14:02:36 -04:00
Maya TydykovandGitHub 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
Joe JevnikandJoe Jevnik df82d3a221 BUG: reload_symbol_maps should clear the equity_supplementary_maps 2017-04-06 19:04:09 -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
Andrew Daniels 13b5b7efdc MAINT: Refactor DataPortal._get_minute_spot_value to avoid two lookups 2017-04-06 08:54:17 -04:00
dmichalowicz 6ffd029537 CRUFT: Remove ContinuousFuture adjustment method 2017-04-05 15:25:50 -04:00
Freddie VargusandGitHub 0746fc7597 Merge pull request #1731 from quantopian/update-assetdbwriter-docs
DOC: Show exchange as required for equities
2017-04-04 23:27:50 -04:00
Scott SandersonandGitHub b8b504b724 Merge pull request #1740 from quantopian/guarantee-can-trade-order
BUG: Return from can_trade in same order as input.
2017-04-04 18:39:53 -04:00
Scott Sanderson fb3efc6d75 MAINT: Guarantee bool dtype for can_trade. 2017-04-04 17:26:38 -04:00
dmichalowicz 0178ea03ea REV: Only use benchmark csv files in source for testing 2017-04-04 17:18:49 -04:00
Scott Sanderson f3aba5f281 BUG: Return from can_trade in same order as input.
This matches the behavior of history and data.current.
2017-04-04 17:12:21 -04:00
Maya Tydykov 497708d86e BUG: address pandas normalization bug on non-sorted DT index 2017-04-04 17:00:32 -04:00
Maya Tydykov e1d63dcee4 BUG: test DatetimeIndex equality correctly 2017-04-04 17:00:16 -04:00
Freddie Vargus 0c246a7de1 DOC: Show exchange required for equities 2017-04-04 15:02:00 -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
Eddie HebertandGitHub a006b4bbab Merge pull request #1734 from quantopian/prepare-for-validity-checks
MAINT: Prepare parameter check for adding an additional check.
2017-03-30 14:02:03 -04:00
dmichalowicz 99dfe5961d BUG: Getting continuous future current contract failed on None 2017-03-30 12:09:55 -04:00
Eddie Hebert c69b4f6352 MAINT: Prepare parameter check for adding an additional check.
Should be no functional change.

By making the raise on `if not isinstance` instead of doing a continue on `if
isinstance` (with a raise at the end of the loop if no 'good' conditions were
met'), the function should be more amenable to adding an additional validity
check, after the type check passes.

This is on the path to adding an additional validity checks parameter to
`check_parameters`, e.g. adding an 'is positive' check.
2017-03-30 10:47:29 -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
Eddie Hebert ed62d8a66a MAINT: Clear up naming and logic in resample close.
- Instead of maintaining a separate `j` value, set the bounds of the range so
that `i` is the values emitted by the range.
- Change `close_loc` to `prev_close_loc` since the market close location is used
to ensure that the data index stops at the market open if the entire day is
nans.
- Change the setting of `loc` to be done before the loop which check for nans,
instead of setting to the previous close loc at the end of the loop.

This prepares for a separate fix to prevent out of bounds access when the first
session has nans for all minutes.
2017-03-28 13:30:12 -04:00
Eddie Hebert 3249d848e9 STY: Cleanup trailing whitespace in resample module. 2017-03-28 12:16:39 -04:00
Jean BredecheandPaul Sutherland 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
Maxwell RoundsandMaxwell 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 MichalowiczandGitHub 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 DanielsandGitHub 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
Freddie VargusandGitHub 5fd20e182f Merge pull request #1683 from shadiakiki1986/bugfix_index_should_be_int
BUG: Convert index to int so that the pandas indexing doesnt fail
2017-03-16 13:36:10 -04:00
dmichalowicz bb801344e9 ENH: Better error message for non-existent root symbol 2017-03-16 11:18:17 -04:00
David MichalowiczandGitHub bafe8eab6a Merge pull request #1714 from quantopian/test-fixture-fix
Equity daily data test fixture was using wrong sids
2017-03-15 16:44:05 -04:00
Maya TydykovandGitHub 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
dmichalowicz b907b2557e TST: Equity daily data test fixture was using wrong sids 2017-03-15 13:16:45 -04:00
Eddie Hebert c3509fcca3 MAINT: Apply linter recommendations to adjustments module.
Remove unused variables.

Add type for values used to access arrays.
2017-03-15 11:26:38 -04:00