Commit Graph

2244 Commits

Author SHA1 Message Date
Delaney Granizo-Mackenzie 79041df093 Created 0.7.1 release notes 2014-07-29 12:59:00 -04:00
Delaney Granizo-Mackenzie 3b9fa53719 Merge pull request #378 from quantopian/fixed-zero-last-sale-price
BUG: Fixed random dips in returns as shown to user.
2014-07-29 12:15:23 -04:00
Delaney Granizo-Mackenzie 0fd78cd54a BUG: Fixed random dips in returns as shown to user.
Previously the last sale price was not correctly being set on
positions when the transaction arrived before the trade event.
The last sale price was defaulted to zero and never updated. This resulted
in one holding stocks that were bough >>0 and now had value 0 from
the perspective of returns. The returns would display correctly again
when the next trade of that security happened. For most securities trading is
frequent enough that there's no issue, but for some illiquid ones it took
hours to fix itself.

Updated test_perf_tracking:TestPerformanceTracker.test_minute_tracker
This test was based on assuming that last_sale_price was zero,
allowing the sharpe ratio to be calculated. The sharpe ratio can no longer
be calculated for this specific tested scenario and the test has been changed
accordingly.
2014-07-29 11:07:13 -04:00
Thomas Wiecki 2a71f8353a DOC: Fix readme example and update dependency doc. 2014-07-26 09:28:44 +02:00
Thomas Wiecki 97781dc39e BLD: Update md5 sum in meta.yaml. 2014-07-25 19:37:17 +02:00
Thomas Wiecki a7de02176b Bump version: 0.7.0rc1 → 0.7.0 2014-07-25 19:34:49 +02:00
Thomas Wiecki 6dc9c1b8ae BUG: Fix comparison for pandas 0.14. Closes #377. 2014-07-25 19:31:25 +02:00
Thomas Wiecki d4d0477eb5 BLD: Add Python as a conda dependency. 2014-07-22 11:09:49 +02:00
Delaney Granizo-Mackenzie 62c9b96674 Merge pull request #372 from quantopian/moved-perf-tracker-assignment
BUG: Put initialization of perf_tracker back in __init__
2014-07-21 13:48:22 -04:00
Delaney Granizo-Mackenzie 97c88c3c30 BUG: Put initialization of perf_tracker back in __init__
The initialization of perf_tracker had been moved from __init__
in TradingAlgorithm to _create_generator. This caused perf_tracker
to not be ready when portfolio requested it. portfolio was consequently
not ready for access in init. portfolio can now be accessed in init
again, assuming valid sim_params are passed. Otherwise it will be
available in handle_data() after _create_generator() is called.
2014-07-21 12:17:07 -04:00
Thomas Wiecki 0ff6a1cc1b BLD: Update md5 sum. 2014-07-21 15:05:29 +02:00
Thomas Wiecki 5b1afe166b DOC: Update release notes for 0.7 2014-07-21 14:31:40 +02:00
Scott Sanderson d610ea0a3b DOC: Rename 'guid' to 'id' in dividend tracking logic. 2014-07-18 15:04:20 -04:00
Scott Sanderson 1039919340 STY: In test_perf_tracking, import datetime/timedelta via from-import. 2014-07-18 15:04:20 -04:00
Scott Sanderson 4712891e88 ENH: Remove dividends from the event stream.
Removes support for handling dividends as part of the algorithm
simulation stream, replacing it with an API in `TradingAlgorithm` for
supplying dividends as a DataFrame.
2014-07-18 15:04:20 -04:00
Scott Sanderson a8431944aa MAINT: Add comments and rename methods in PerformanceTracker.
The function that handles a market close for daily frequency changed from
`handle_market_close` to `handle_market_close_daily`.

The function that is called at on the closing minute each day when running
minutely changed from `handle_intraday_close` to
`handle_intraday_market_close`.
2014-07-18 15:04:20 -04:00
Scott Sanderson 0176279404 MAINT: Refactor AlgorithmSimulator.transform.
Breaks out the main snapshot processing loop into its own function, and does
some minor variable renaming-shuffling.

Adds `TradingAlgorithm.on_dt_changed`, a function to be called when the
simulation dt changes, prior to processing any events.

There should be no difference in behavior as a result of this change.
2014-07-18 15:04:20 -04:00
Thomas Wiecki 8d16efc5c4 Bump version: 0.7.0 → 0.7.0rc1 2014-07-18 15:38:30 +02:00
Thomas Wiecki d6f26274ac Bump version: 0.6.1 → 0.7.0 2014-07-18 15:38:20 +02:00
Thomas Wiecki 5199031b68 BLD: Update .bumpversion.cfg to new config file specs. 2014-07-18 15:36:08 +02:00
Thomas Wiecki e139294551 DOC: Typos in release announcements. 2014-07-17 17:29:54 +02:00
Thomas Wiecki 0bfb18f23b DOC: Update release notes for 0.7. Add tutorial link to README. 2014-07-17 17:23:30 +02:00
Thomas Wiecki eae41b8e7a DOC: Add tutorial and update examples to use history. 2014-07-16 17:30:23 +02:00
Thomas Wiecki 443bc718f4 Merge branch 'history_support_daily_input' 2014-07-16 17:22:32 +02:00
Thomas Wiecki 78d2a7ef9a TST: Add unittest for daily history with midnight dt. 2014-07-16 15:17:02 +02:00
Thomas Wiecki 845712e5eb MAINT: Factor out column conversion in HistoryContainer.
We can't be sure that security identifiers can be converted
to int. In fact, most of the times they are strings. This
adds an identity function that can be overwritten if such
a conversion is necessary (as on Quantopian).
2014-07-16 15:17:02 +02:00
Thomas Wiecki 6de4d32ee1 ENH: Change open and close to midnight if using daily input data. 2014-07-16 15:16:57 +02:00
Eddie Hebert 4980928394 MAINT: Remove redundant perf_tracker member.
The perf_tracker member of TradingMember was set to None twice
during __init__.

Remove one of those instances.
2014-07-12 00:06:09 -04:00
Delaney Granizo-Mackenzie 9b01d78f5d ENH: Implemented AUTO_INITIALIZE feature.
Created a new flag in TradingAlgorithm that enables subclasses to
decide if they want to handle setting self.initialized = True.
Before it was the responsibility of an overriding subclass to set
initalized = True. This was causing problems because it's easy to
forget this. Now it is the responsibility of TradingAlgorithm
unless explicity stated otherwise.
2014-07-08 14:03:53 -04:00
Delaney Granizo-Mackenzie 3521a11ed4 ENH: Added informative message for calling order in init.
Previously, calling order() in initalize resulted in a weird
stack trace. It now returns a well formulated error that is
readable to the user through the API. Adding a slippage
kwarg to test_algorithm and simfactor was necessary because
slippage can only be called during init. Previously initaliazed
was never set to true and calls to init-only function were sprinkled
around the code in non-init sections. Code changes were to enforce
init-only rules.
2014-07-08 14:03:53 -04:00
Delaney Granizo-Mackenzie 6baabc5975 Update zipline-0.6.2.md 2014-07-02 11:20:12 -04:00
Delaney Granizo-Mackenzie 3a48eb9bc2 Update zipline-0.6.2.md 2014-07-02 11:03:17 -04:00
Delaney Granizo-Mackenzie 6920fec9a3 Update zipline-0.6.2.md
Added a note about record functionality.
2014-07-02 10:57:27 -04:00
Thomas Wiecki d105d615d0 MAINT: Removed undocumented and untested sources for pytables and csv. Closes #267. 2014-07-02 11:32:27 +02:00
Thomas Wiecki 8d09305c36 BUG: Fix constant of trading hours to be 6.5. Fixes #214. 2014-07-02 11:26:35 +02:00
Delaney Granizo-Mackenzie c3169f60cd ENH: Added dynamic name functionality to record() API function.
Added the ability to pass *args before the **kwargs so that positional
arguments of the form name, value can be recorded.
2014-06-30 14:09:09 -04:00
Scott Sanderson 75b415ac48 BUG: Algo no longer crashes after creating new history column.
Fixes an issue that caused a crash if a user assigned a new column into a
returned history DataFrame.  This occurred because we re-use DataFrames between
history() calls, so the new column caused an index-size mismatch on the next
attempted calculation.

Ideally we would fix this by in-place dropping the columns, but that isn't
supported in pandas 0.12.0, so instead we just return a complete copy of the
frame.  We should re-evaluate this implementation when we're on a more modern
pandas version.
2014-06-30 12:09:03 -04:00
Thomas Wiecki f8e84ecd48 MAINT: Remove unused annualizer code. 2014-06-30 17:28:02 +02:00
Thomas Wiecki 10885e1b77 MAINT: One way to set sim_params and data_frequency.
There were sevaral places you could supply sim_params
in TradingAlgorithm (__init__, run). This got confusing
as its not clear who updated what and which one was the
correct one to use at each time.

Then there were to ways to define data_frequency, one in
__init__() and one in the sim_params which also added code
complexity.

This refactor makes it explicit that sim_params are to be
passed to __init__() only. Moreover, data_frequency is
only stored in sim_params. For backwards compatibility,
it can still be supplied separately but will link to
the one in sim_params.

For example, you could create new sim params via:

sim_params = create_simulation_parameters(data_frequency='minute')
algo = MyAlgo(sim_params)
algo.run(data)

In addition, perf_tracker only gets initialized in one place:
_create_generator() which should also make the various ways
of running an algorithm more deterministic.

This also fixes a bug with SimulationParameters where
you could not change the period_start. Unfortunately, the
current implementation still requieres an implicit call to
update the internal variables.
2014-06-30 17:28:02 +02:00
Scott Sanderson 4c9cf1321d PERF: Replace .ix usages with with .loc in TradingEnvironment.
Replace usage of .ix in TradingEnvironment with .loc when we know that we're
using an index key.

DataFrame.ix can be used with either integer or key-based indices, and as such
it incurs an overhead for figuring out which you meant.
2014-06-26 17:17:08 -04:00
Scott Sanderson 6a2ee7c417 BUG: History no longer fails on length-1 '1m' price-only HistorySpecs
The bug occurred because there is a special case in the initial window setup
code for handling the case where only a length-1 history is used for a given
frequency.  Previously, the code was incorrectly calculating the period end
using a hard-coded expression for the end of the day (the correct behavior for
a length-1 '1d' history), and then using the frequency object to calculate the
period start for the window.  In the case of length 1 '1m' data, this resulted
in an initial window whose start and end was the last minute of the day rather
than the first minute of the day.  For non-price fields, this error doesn't
matter, because the window is only used for rolling digests (which doesn't
happen when there's only a length-1 history), and for the forward-filling logic
(which only happens on price fields).  For a length-1 '1m' price, however, the
incorrect window causes us to attempt to forward-fill an empty panel, resulting
in an IndexError when we do an iloc[0] on a length-0 axis.
2014-06-25 10:54:45 -04:00
Thomas Wiecki 1b571a53a5 BLD: Second try at coverage integration. 2014-06-18 20:20:59 +02:00
Thomas Wiecki be1ccd169a DOC: Add coverage badge to README. 2014-06-18 20:00:16 +02:00
Thomas Wiecki d4e05090a3 BLD: Add coverage integration. 2014-06-18 19:59:06 +02:00
Thomas Wiecki ff11628cd3 DOC: Wrong link for badges. 2014-06-18 17:46:59 +02:00
Thomas Wiecki d6a392e394 DOC: Add version and download counter to README. 2014-06-18 17:45:33 +02:00
Scott Sanderson fe52254bc2 BUG: Rolling back Logbook version due to incompatibility with Processor/filter
interactions.
2014-06-16 13:52:09 -04:00
Thomas Wiecki 96bdb22db9 BUG: RollingPanel was not behaving correctly in corner cases.
There quite some bugs in certain corner cases. Dropping of obsolete
axes was not working correctly, roll over could cause obsolete axes
to not drop. The tests are much more stringent now as well.
2014-06-14 21:07:02 +02:00
Thomas Wiecki e4c974f4b8 ENH: Add removal of elements in benchmark. 2014-06-11 16:50:53 +02:00
Scott Sanderson 79c91897ba ENH: Add freq_filter argument to HistoryContainer.update_digest_panels.
Adds a new argument, `freq_filter`, to `HistoryContainer.update_digest_panels`,
which can be used to supply a predicate determining which digest panels are
updated by the call.  This is useful for supporting initialization/backfilling
of multi-frequency panels in subclasses.
2014-06-09 17:42:41 -04:00