Commit Graph

1532 Commits

Author SHA1 Message Date
Eddie Hebert 45bca4301f REL: v0.5.9
Highlights:

- Benchmark updating now permits empty ranges.
  (Fixes runtime crash when running immediately after Easter 2013.)
- Risk metrics
  - Performance improvents from converting to numpy and pandas.
    <@wesm, wesmckinn@gmail.com>
  - Refactoring of risk metric calculation out of class structure.
2013-04-02 11:22:31 -04:00
Eddie Hebert 05a03bcf21 BUG: Fix error during benchmark update over empty period.
On ranges with missing data from Yahoo, e.g.:
On 2013-04-2 the date range of April 2013-03-29 failed because
of the first day in the range being Good Friday, and the API not
yet updating for the Monday after.

Handle the 404 that is found by raising and warning that no
benchmark data was found, but continuing on.
2013-04-02 11:13:26 -04:00
Eddie Hebert dd172dd42a MAINT: Use trading day increment instead of timedelta in test factory.
In the test factory creation of returns, the date creation was using
a timedelta of one day instead of incrementing by trading days.

Working towards changing risk module behavior which would leverage
the trading day map, but tests fail because non-trading days are
created.

Remove `factory.create_returns`, moving uses of that function to us
`factory.create_returns_from_period`, since the number of days input
for `create_returns` was more difficult to use when specifying ranges
over arbirtray dates.
2013-04-01 23:52:50 -04:00
Eddie Hebert 210a43a306 MAINT: Factor out risk metric logic from risk objects.
Move the risk metric definitions to functions at the module level
with defined parameters.

Both risk implementations call these functions, where the difference
between risk implementations is with which internal data they
send to the various risk metrics.

Metrics moved:
- Sharpe Ratio
- Sortino Ratio
- Information Ration
- Alpha
2013-04-01 12:43:27 -04:00
Eddie Hebert 63063b1ebe DEV: Fixes typo in git stash message comparison. 2013-04-01 12:05:40 -04:00
Eddie Hebert 702e6f00d2 MAINT: Use numpy for risk period returns.
Following the lead of the RiskMetricsBatch conversion to use
more pandas and numpy.
Bringing the iterative and batch versions closer together as we
work towards folding them into one.
2013-03-29 17:06:54 -04:00
Eddie Hebert c6f8f430d7 DEV: Handles empty stash case in pre-commit hook.
Handles the case when reword is called and the `commit --amend` invokes
the pre-commit hook, when there is no stash the `git stash pop -q`
in that case leaves the rebase in an odd state.
Fixes by only calling the stash pop if changes were saved.
2013-03-29 17:06:37 -04:00
Eddie Hebert 147e806bb0 MAINT: Moves exchange to utc conversion inside of environment object.
So that the environments' exchange time is used without having to
specify it independently.

Also, moves uses of Delorean.shift for the exchange conversion inside
of environment to use the exchange_dt_to_utc method.
2013-03-28 12:29:52 -04:00
Eddie Hebert 10825c9a1d MAINT: Updates copyright year on finance module. 2013-03-28 09:24:53 -04:00
Eddie Hebert 7679e5a581 ENH: Wires minutely emission of data from performance tracker.
Wires up performance tracker so that when `emission_rate` is set
to `minute`, the performance packets are sent out every minute,
instead of once per day.

Please note, the performance packets that are generated are not
ready for prime time consumption, this patch is merely a step towards
hooking up the ability to inspect minute data.

Known issues:
- The packets do not currently include risk information.
  Since we need to consider how this affects the denominators
  of the risk calculations.
2013-03-27 16:58:56 -04:00
Wes McKinney 20d50450b6 ENH: use array and pandas operations to speed up risk computations 2013-03-27 13:42:46 -04:00
Eddie Hebert d87213a5f1 MAINT: Adds floating point tolerance to risk metric comparison tests.
In preparation of changing how risk metrics are calculated,
this makes the checking of results more tolerant to floating point
rounding, since upcoming changes change the results by a neglible margin.
2013-03-27 13:42:16 -04:00
Eddie Hebert 7dfa0d1980 REL: v0.5.8
- Fixes bug/confusion caused by pandoc conversion in setup.py
- Slight refactorings, removing missing methods, etc.
2013-03-27 13:04:24 -04:00
Eddie Hebert 09af6fb721 BUG: Avoids install errors caused by lack of pandoc binary.
The pyandoc module throws an OSError of:
"No such file or directory",
when the underlying pandoc binary does not exist.

This error has caused confusion for numerous people during pip
installation.

pandoc is only needed on upload to PyPI to convert to ReST.
So, instead of doing a try/except on the `import pandoc` for all cases,
now checking whether or not 'upload' was invoked when calling setup.py,
so that only maintainers have to worry about installation of pandoc.

By only exercising the pandoc logic when
2013-03-27 12:27:17 -04:00
Eddie Hebert 94e70a394b MAINT: Restricts dates to trading calendar in risk comparison test.
Converts the risk iterative and batch comparison tests to use
the trading environments next date, instead of just advancing by day,
so that the returns being passed into the RiskMetrics in the unit
test are using the same trading calendar as the internal checks for
trading days.

Fixes a case where empty return periods were being into
`calculate_period_returns`

Clearing the way for the pandas based optimization of the risk module.
2013-03-27 11:42:40 -04:00
Eddie Hebert 41d3c72627 MAINT: Removes unused currentValue method on Position object.
This method became unused when vectorizing position totals.
2013-03-26 22:33:19 -04:00
Eddie Hebert 736a4babf0 MAINT: Renames parameter to TradeSimulationClient.
Renames from environment -> sim_params to match the type of the
argument passed.

(A refactoring had changed it to SimulationParams.)
2013-03-26 17:09:48 -04:00
jbredeche 9f17ccab39 Merge pull request #114 from quantopian/filter_sources
adds an optional filter to the algorithm's date_sorted_sources
2013-03-26 13:53:47 -07:00
fawce 241a43bb13 ENH: Adds an optional filter to the algorithm's date_sorted_sources
So that a filter function can filter out sids on a 'static' source,
when the universe of sids changes.

e.g. when using fetch_csv with a changing universe of stocks.
2013-03-26 16:48:34 -04:00
fawce 09627c2809 adds an optional filter to the algorithm's date_sorted_sources 2013-03-26 14:54:33 -04:00
Eddie Hebert a05039c514 MAINT: Uses Transaction object in tests instead of ndict.
So that Transaction object behavior is exercised, uses the Transaction
object in performance module tests instead of ndict.

Also, adds fields to the __init__ of Transaction, to make the
definition of the object more well defined.
2013-03-25 23:51:34 -04:00
Eddie Hebert f2d618b466 MAINT: Moves create_trade out of gens.utils
Slight refactoring of moving create_trade so that it's alongside
other testing/mock data utilities, instead of part of the gens module.
2013-03-25 23:51:25 -04:00
Eddie Hebert 45e28a4b9d MAINT: Updates copyright year on gens.utils module. 2013-03-25 23:51:20 -04:00
Eddie Hebert 33a1ed305f MAINT: Removes alternate function from gens.utils
This function is no longer refrenced elsewhere in the codebase.
2013-03-25 23:51:12 -04:00
Eddie Hebert 5118789e9b MAINT: Removes unused mock data function from gens.utils
This function is unused, and on the general path of moving testing
functions out of gens.utils
 # Please enter the commit message for your changes. Lines starting
2013-03-25 23:50:59 -04:00
Eddie Hebert 47f3192728 MAINT: Updates copyright year of perf_tracking tests. 2013-03-25 23:50:23 -04:00
Eddie Hebert 6f1cbcbc4f MAINT: Moves internal state variables in performance tracker.
Slight refactoring of grouping the tracking variables in the
PerformanceTracker together.

So that it's easier to see which are config members and which are
members used to track internal state.
2013-03-25 12:44:45 -04:00
Eddie Hebert 19a1279385 REL: v0.5.7
Highlights, with thanks to contributors inline:

- Runtime performance improvements
- Fixed the omission of peformance messages on days with no trades
- Changes to batch_transform implementation
-- supports sid filtering
-- performance improvements using pandas
-- added an option for only computating when there is a window length's
   worth of data
- Added new risk metrics
-- Sortino
-- information ration
  (Ryan Day, ryanday2@gmail.com @rday)
- Added stop and limit orders
  (Tony Worm, verdverm@gmail.com @verdverm)
- Added variable recording
- Deprecated market_aware and delta kwargs to EventWindow
- Fixes to trading calendars for missing holidays
- Added TradingEnviorment context manager
- Added support for streaming through dividends
- Yahoo source now has OHLC
- Updates downloaded benchmark and treasury data when new data is available.
  (Ryan Day, ryanday2@gmail.com @rday)
- Added optional adjustment of Yahoo data
  (Jeremiah Lowin, jlowin@lowindata.com @jlowin)
2013-03-25 12:44:45 -04:00
Richard Frank eb6b7c08fc MAINT: Using zone attribute of tzinfo instead of string 2013-03-25 11:52:29 -04:00
Richard Frank fdf38d3562 BUG: Moved asserts back to before calculations that rely on them.
This means we get a failed assert immediately, instead of an
OverflowError later.
2013-03-25 11:52:29 -04:00
Eddie Hebert 2504874a84 DEV: Updates README with numpy installation tip.
Adds `pip install numpy` to the installation notes,
since `pip install zipline` will not work out of the box
if numpy is not installed beforehand.
2013-03-22 13:54:10 -04:00
fawce 5b59bf3453 Merge branch 'master' of github.com:quantopian/zipline 2013-03-21 15:14:48 -04:00
fawce 0e0fecf4ee allows config to force no datasources by passing a None.
absence of the parameter triggers the default.
2013-03-21 15:13:56 -04:00
Eddie Hebert 832c93134f MAINT: Removes comment referreing to removed started_at member. 2013-03-20 22:18:30 -04:00
Eddie Hebert 279e125ab8 MAINT: Pull initialization of simulation dt out of event loop.
Fakes a 'peek' into the data stream, so that the 'do we have a
simulation_dt?' check isn't called on each leoop iteration.
2013-03-20 14:34:12 -04:00
Eddie Hebert 08882bc8aa MAINT: Updates copyright on risk module. 2013-03-20 14:30:11 -04:00
Eddie Hebert 5dc449ba19 MAINT: Changes boolean check for snapshot existence in performance.
Small tweak to check for existence of elements using built-in
boolean of lists, instead of checking for `len`.
2013-03-20 13:19:39 -04:00
Eddie Hebert 75049fdd15 MAINT: Removes unused started_at member from performance tracker. 2013-03-20 13:05:38 -04:00
Eddie Hebert 3707c7b225 MAINT: Changes name of grouping of by dt in generator chain.
Changes name to `grouped_by_dt` instead of `grouped_by_date` to
clarify that the grouping is by dt, which can be by minute, instead
of grouping by calendar date.
2013-03-20 12:12:33 -04:00
Eddie Hebert 95a9b7b3c2 MAINT: Updates docstring for performance tracker class. 2013-03-20 11:27:57 -04:00
Eddie Hebert 060b565cdc DEV: Adds stashing to pre-commit hook.
So that the code that is linted/tested is only the staged commits.
Useful when editing by only staging parts of files via git.
2013-03-20 11:00:38 -04:00
Eddie Hebert 8bf4c60169 MAINT: Removes unused member from performance tracker class.
`last_dict` is not referenced elsewhere.
2013-03-20 10:46:59 -04:00
fawce d740394184 Merge branch 'master' of github.com:quantopian/zipline 2013-03-20 02:23:08 -04:00
fawce 93e22aa8b7 added more acceptable number types for event fields in batch
transforms.
2013-03-20 02:21:44 -04:00
Eddie Hebert f054835cd1 DEV: Provides an example pre-commit hook.
This pre-commit hook can be activated by copying or symlinking to
the .git/hooks directory

This particular commit hook is best suited for git versions < 1.8.2
The running of nosetests would be better suited for a push hook,
but those are not added until 1.8.2.
2013-03-19 23:33:36 -04:00
Eddie Hebert 0169251c89 MAINT: Removes unused init method from algorithm.
The init method had been copied to method called initialize,
to avoid confusion with __init__
2013-03-19 22:59:38 -04:00
Eddie Hebert d2bdfc931d BUG: Fixes error added while rearticulating sim_params.
Previous attempt to make sim_parms logic clearer had clobbered the
override logic when sim_params is passed to the run function.

Added a few comments as well as restructuring how the sim_params
that are passed to run overrides the default values or not.

This also makes the passing of sim_params to run to no longer have
the side-effect of overwriting the default sim_params.
2013-03-19 22:46:04 -04:00
Eddie Hebert ccef17dec6 MAINT: Fixes comment about perf type. 2013-03-19 21:35:01 -04:00
Eddie Hebert a645b2a86e MAINT: Fixes comment about returned performance types.
The simulator had been changed to return dictionary objects instead
of ndicts.
2013-03-19 20:56:56 -04:00
Eddie Hebert 50e0334b3d STY: Uses if/else for setting sim_params in algorithm.
Instead of checking 'if' and then 'if not', uses an if/else.
2013-03-19 20:53:44 -04:00