Commit Graph

212 Commits

Author SHA1 Message Date
Thomas Wiecki 0f88e4133d ENH: New batch_transform feature: compute_only_full. 2013-01-07 12:44:55 -05:00
Thomas Wiecki d1dace948e ENH: Added new kwarg to batch_transform: create_panel. 2013-01-07 12:44:19 -05:00
Thomas Wiecki 2729936aff ENH: batch_transform now supports field filtering. 2013-01-07 12:43:41 -05:00
Thomas Wiecki 0e3b1e76e8 ENH: batch_transform now supports sid-filtering. DOC: Added docs to batch_transform. 2013-01-07 12:43:26 -05:00
Eddie Hebert 59dbffb3aa Changes test sources to use unit test's assert instead of plain assert. 2013-01-06 17:11:38 -05:00
Eddie Hebert a25590b0a1 Exposes the list of trading days contained in a trading environment.
Previously, the list was generated, but only used to calculate
the number of days in the environment.

With exposing this list, working towards a path where the simulation
uses the trading days to determine when to handle market closes.
2013-01-01 13:01:49 -05:00
Eddie Hebert a71226c400 Merge pull request #49 from quantopian/granularity
Granularity
2012-12-30 09:52:06 -08:00
Thomas Wiecki 4615b29713 REF: Renamed granularity to data_frequency. 2012-12-30 11:50:46 -05:00
Eddie Hebert 75e60fdc91 Fixes number of bars to create covering date range in test.
There are only 6 trading days between the open and close specified
in test_perf test.

Also, removes getting the period_end off of the last trade,
since the test can now use the end date specified for the trading
environment.
2012-12-29 18:45:31 -05:00
Eddie Hebert ec745736ac Fixes period_start in test_perf test. 2012-12-28 13:48:47 -05:00
Eddie Hebert 50f4e1fff2 Fixes bug in test where period_end is too early.
Grabs period end before we remove trades.
2012-12-28 13:46:44 -05:00
Eddie Hebert 1c15e983dc Parameterizes test_tracker test with different days' events dropped.
So that the test ensures that perf messages are returned when
data is missing from the beginning, middle, and end of data.
2012-12-28 13:43:01 -05:00
Eddie Hebert 11fa56e5d9 Breaks up performance tracker tests.
The tests using performance tracker don't need the same setup
as the other performance module tests, breaking out so that
we don't call it needlessly.
2012-12-28 12:08:43 -05:00
Eddie Hebert f7e4f57425 Enables performance messages on days that have no trades.
Previously, on days that were trading days, but there with no
event data to process for that day, performance metrics were
not emitted, since the handling was based on having an event
trigger the daily performance metric.

Handled by grouping together performance messages, on market open,
for all days since the last market close.

Also, changes perf_tracker unit test to simulate missing data.

Taken from @richafrank's branch handling the same case.
2012-12-28 11:43:31 -05:00
Eddie Hebert b5867774e9 Reduces the the dataset size for performance tracker test.
So that the test is easier to debug and walk through on paper.

Also, removes randomly created dataset.
2012-12-27 18:39:22 -05:00
Eddie Hebert c436f85758 Removes random test invocation. 2012-12-27 18:39:22 -05:00
Thomas Wiecki 8346155f0e MIN: Override annualizer if set. New handling of granularity (no default arg anymore). Renamed minutely to minute. 2012-12-24 12:55:52 -05:00
Eddie Hebert 21da812c10 Optimizes checking ready state of sources during sorting.
The main bottle neck here was using `len`.
A boolean check is a sufficient test for more items in the queue.

Also, uses all instead of several functions.
2012-12-21 16:46:16 -05:00
Thomas Wiecki daf29c2d39 ENH: Add granularity and annualizer arguments to TradingAlgorithm. Accompanying doc string and unittest. 2012-12-20 12:49:24 -05:00
Eddie Hebert aaefd3270e Merge pull request #43 from quantopian/extend_df_source
ENH: Added DataPanelSource.
2012-12-18 13:18:59 -08:00
Richard Frank 54063854aa Forward-fill missing treasury data
To handle, for instance, Columbus Day (Oct 10),
on which there is no treasury data.

We're only forward-filling data now, and
no longer searching both back and forward in time.
2012-12-14 17:29:27 -05:00
Thomas Wiecki 775c564ea1 ENH: Added DataPanelSource. 2012-12-13 12:55:05 -05:00
Eddie Hebert 11391f356b Merge pull request #41 from quantopian/revert_fix_window
Revert fix window
2012-12-12 16:47:42 -08:00
Richard Frank 095f2dd65b Date bookkeeping fixes in perf and risk
Issues appeared when we were close to the end of our
historical data.

Yielding DONE event with both perf and risk messages now
2012-12-12 15:23:26 -05:00
Richard Frank e7b504f4ca Removed list of trading days since we already have an OrderedDict 2012-12-12 15:23:26 -05:00
Thomas Wiecki f8e4d8ade6 Revert "BUG: EventWindow now always contains constant number of days."
This reverts commit 7a0a6f5231.
2012-12-11 12:12:51 -05:00
Thomas Wiecki a14d702a0d STY: Replaced hardcoded values with variables. 2012-12-06 15:26:49 -05:00
Thomas Wiecki dfefaafd03 BUG: Fixed source unittest (regression in testing source). 2012-12-06 14:46:33 -05:00
Thomas Wiecki ba46c6292f ENH: DataPanel is now created more flexible over all sids and all given fields. Added unittest to test for nan-filling. Added backwards filling by default. 2012-12-06 14:43:20 -05:00
Thomas Wiecki 5f6839beea BUG: Refactored batch_transform unittests and fixed some bugs. 2012-12-06 12:36:47 -05:00
Thomas Wiecki 7a0a6f5231 BUG: EventWindow now always contains constant number of days. 2012-12-06 12:33:18 -05:00
Thomas Wiecki f81addb7df ENH: batch_transform now adds arbitrary keys to datapanel. 2012-12-03 13:41:37 -05:00
Eddie Hebert e266d926f3 Updates quarter utilities to fix offset.
Also, includes tests of quarter utilities.

Thanks to @richafrank.
2012-11-28 10:53:08 -05:00
Richard Frank 4d41070585 Fix for slippage time getting out of sync with algo.
Moved grouping by date earlier in the pipeline of generators,
prior to any date-dependent state getting involved.  Grouping
pulls from the pipeline until the start of the next group,
which is in the next day.  The effect of grouping after
slippage but before handle_data is that slippage and the algo
are out of sync by a transaction.
2012-11-27 13:38:50 -05:00
Eddie Hebert ab6b754922 Changes EventWindow parameter of days to window length.
The days parameter was causing confusion when explaining the
usage of the batch_transform decorator.
2012-11-20 11:52:27 -05:00
Eddie Hebert cf0de17b13 Merge pull request #22 from quantopian/fix_batch_transform_days
BUG: batch_transform was wrongly updating when days < refresh_period.
2012-11-19 12:40:26 -08:00
Eddie Hebert 0617e53d69 Upgrades flake8 from 1.5 -> 1.6
Also, removes flake8 ignores, since the warnings that were
at odds with eachother now work.
2012-11-19 12:49:09 -05:00
Thomas Wiecki 4c02fea6e2 BUG: batch_transform was wrongly updating when days < refresh_period. 2012-11-19 10:20:24 -05:00
Eddie Hebert d5697cdf0a Fixes under-incrementation of risk report.
We were only incrementing the risk report by one day, and never
checking to see if that day we incremented into was a trading day
or not.

We now increment by day until we are on a trading day.

With an assist from @twiecki on:

Adapted test_risk_compare_batch_iterative to work with fixed
iterative risk class.
2012-11-15 14:13:04 -05:00
Tobias Brandt cf4d7ca353 Fixed unittest2 import error on Python 2.7
Changed all unittest2 imports to unittest
2012-11-12 10:49:14 -05:00
Thomas Wiecki 126e9fdf26 Fixed batch_transform window length not being market aware.
Added accompanying unittest.

Minor refactoring of unittests and factory.
2012-11-06 21:13:27 -05:00
Eddie Hebert 086c12ddf8 Locks down the ability to easily override the algo's portfolio.
Starting down the path of making the portfolio completely read-only
with respect to the handle_data in algo.

The portfolio should only be changed during the course of running
the algorithm by the simulator.

This doesn't do a 100% protection, i.e. an algo could use _portfolio,
or the set_attr property, but hoping this helps guides algo writing
to treat the portfolio as read-only.
2012-11-05 13:40:23 -05:00
Eddie Hebert 04642c0077 Removes leased sockets from unit test.
The leased sockets were from a previous architecture.
2012-10-25 10:37:58 -04:00
Eddie Hebert 657f93165d Removes unused test class member and corresponding import.
Leased sockets is from an older architecture.
2012-10-25 07:17:35 -04:00
Thomas Wiecki c0b161287d Fixed odd bug that caused the first day not to get simulated. This triggered some changes to the batchtransform unittests. 2012-10-23 17:57:27 -04:00
Eddie Hebert bad6296d24 Merge pull request #2 from quantopian/yahoo_finance_loader
Added yahoo finance loader.
2012-10-22 09:07:25 -07:00
Eddie Hebert 7904773d00 Updates flake8 to latest.
The latest flake8 release in now 1.5, which pulls in pep8: 1.3.4a0

The upgrade pep8 has changes to what it picks up as lint.
Making code base compatible, so that new devs can install pep8
from PyPI and not have friction over the version difference.

Currently using these ignores in the config file:

```
[pep8]
ignore = E124,E125,E126
```

Ignoring these since they are difficult to squash while maintaining
an 80 char line length, and appear spurious.
Should address later.

Updates Travis config, README, and pip requirements to reflect change.
2012-10-22 11:57:16 -04:00
Thomas Wiecki ae1644fe35 Added yahoo finance loader. 2012-10-22 09:28:56 -04:00
Thomas Wiecki d468d05ba4 Removes optimize directory and optimize unittests which live on a separate branch yet. Was not functional yet and should thus not be in the main branch. 2012-10-22 08:51:30 -04:00
Thomas Wiecki 15ac658024 Restructured file hierarchy. Transforms now live in transforms (transform.py is now transforms/utils.py). Sources are in sources.py. VWAP is now MovingVWAP. 2012-10-19 18:10:51 -04:00