Commit Graph

2563 Commits

Author SHA1 Message Date
warren-oneill 77fb100ae6 adding type as variable to create_test_panel 2015-06-04 15:50:41 +02:00
warren-oneill 44fbdff4ac added CLOSE_POSITION as source type, added pt.close_position_event(), added process_close_postion(), added close processing to tradesimulation, added unittest for close_position_event 2015-06-04 14:23:46 +02:00
warren-oneill f9d3dbff47 allow passing of data type from data source 2015-06-03 15:10:54 +02:00
jfkirk 9996502573 DEP: Removes use of 'count'-defined test sources
Test sources are now defined by the sim_params period_start and period_end, rather than by the period_start and a defined 'count' of bars. This allows us to consider the sim_params.period_end as the canonical definition of the end of a simulation.
2015-05-28 12:29:33 -04:00
Stewart Douglas b24bd561e7 BUG: Stop account_needs_update from blocking performance updates
Referencing context.account in handle_data() can block updates to account,
portfolio and performance metrics, which can cause unintended changes in
financial performance. Additionally, since context.account metrics are not
updating frequenctly enough (daily, rather than minutely) algos which base
decisions on these metrics can have undesired behavior.

To address this we do not base our decision to update performance on the
state of account_needs_update.

When we call get_account() from the market and minute close methods, we
set the performance_needs_update parameter to False since we just updated
performance.

_get_account() is renamed to _update_account() since the method does not
return account information.

Also remove redundant asset_needs_update = True lines.
2015-05-28 11:15:40 -04:00
Jonathan Kamens d01e718373 MAINT: PIP requirements syntax change for current PIP compatibility 2015-05-26 15:48:42 -04:00
Eddie Hebert 3c862df336 Merge pull request #579 from grundgruen/tracker-days
WIP BUG: env.next_trading_day() not Timezone aware when passed market_open/close
2015-05-26 10:57:51 -04:00
warren-oneill 064d973ec2 pass day instead of market_open to next_open_and_closes and use day instead of market_close for benchmark index 2015-05-26 16:17:55 +02:00
Eddie Hebert 862cfbbd19 MAINT: Group events by type before processing.
Make the ordering in which processing of event types both explicit and
independent of the sort ordering of the incoming sources.

The overhead of creating the list per snapshot and the iterators appears
to be marginal in the minute data case when tested locally.

This patch is intended as part of the path towards making the trade
simulation loop not depend on consuming and tracking every trade event.
The timing of where last_sale_date was needed to be changed was proving
difficult to adapt in the previous model.

Should also allow the removal of sorting of the various source streams.
2015-05-20 11:41:54 -04:00
Scott Sanderson bf3cb6e7a5 Merge pull request #586 from DruRly/DruRly-patch-1
Fix typo in release notes
2015-05-19 10:40:36 -04:00
Jonathan Kamens 723e3e299a MAINT: Upgrade flake8 to 2.4.1 2015-05-19 10:27:20 -04:00
Dru Riley a72fa81bbe Fix typo in release notes 2015-05-18 22:50:39 -04:00
Jonathan Kamens ec395d84f6 MAINT: Switch to python-excel/xlrd.git 2015-05-17 10:24:51 -04:00
Eddie Hebert 1e76be611b MAINT: Remove unused method on performance period.
set_positions is no longer referenced.
2015-05-15 23:31:28 -04:00
Eddie Hebert 9e57198e16 MAINT: Remove unused property on performance period.
The last sale prices property is no longer referenced elsewhere.
2015-05-14 15:46:17 -04:00
Jonathan Kamens 8188d9c975 MAINT: Upgrade pytz to 2015.4 2015-05-13 22:55:10 -04:00
Jonathan Kamens 3790a5631f MAINT: Upgrade certifi to 2015.4.28 2015-05-13 06:04:53 -04:00
Jonathan Kamens 9dab742725 MAINT: Upgrade pandas to 0.16.1 and requests to 2.7.0 2015-05-12 21:21:28 -04:00
Jonathan Kamens e32d79807f TEST: Object serialization test requires a trading environment
The object serialization test case requires a trading environment
because risk report generation requires treasury curves.
2015-05-12 15:25:44 -04:00
Jonathan Kamens 63169961b7 MAINT: Upgrade Logbook to 0.9.1 2015-05-12 14:46:55 -04:00
Jonathan Kamens b3faa1dd3f BLD: New xlrd commitish 2015-05-12 13:56:28 -04:00
Eddie Hebert dba0a99a16 PERF: Use specific methods for processing events.
By having both the trade simulation main loop route events to "process"
methods based on event type and the process methods also checking event
type, there was some duplicated effort in doing that comparison many
times.

A particular case where this was noted in profiling was for the
`process_event` function which was checking if the type was not a trade
and returning early, when in a larger universe of stocks the value
returned False 99% of the time.

Instead provide separate process functions specific to each type,
e.g. e.g. `process_trade` and `process_transaction` and route traffic to
those functions in tradesimulation.

For a universe of 160 stocks on both no-op algo and an algo that rebuys
its universe every day, saw about a 10% increase locally.

Also:

- Add process_benchmark to blotter since internal subclass relies on
logic on benchmark, this allows the internal process_trade to be a
`pass`.

- Add warning on unrecoginzed event types.
2015-05-08 12:44:32 -04:00
Eddie Hebert 72ab9e74dd MAINT: Remove unused event_count from tracker.
event_count is not referenced anywhere, so remove extra bit of state
tracking.
2015-05-05 16:31:02 -04:00
Eddie Hebert 3bc3316248 Merge pull request #575 from quantopian/remove-dependency-on-intraday-risk-metrics
Reduce memory footprint of minute emission algorithms.
2015-05-04 14:12:24 -04:00
Eddie Hebert 16a615f3f0 MAINT: Use setitem syntax instead of update for tracker dict addition.
Since only value is being changed, use the setitem brackets intsead of
calling updated.
2015-05-04 14:02:47 -04:00
Eddie Hebert 63dbea5da4 ENH: Remove unused minute risk containers.
The risk containers that are actually used for reports use the
'cumulative' style container which has an index of days, not minutes.

The minute containers and copying of data etc. were causing an expanding
memory footprint.
2015-05-04 13:56:29 -04:00
Eddie Hebert da0a5bbc3f MAINT: Remove dependence on intraday risk for benchmark returns.
The intraday_risk_metrics is being removed since the values are not
used; cumulative risk metrics with the last value updated to the latest
close has been used for some time.

Before the removal of intraday_risk_metrics, the position trackers
passing of benchmark returns to the cumulative risk metrics needs to no
longer depend on the calculations done by the intraday stats. So instead
use the all_benchmark_returns stored in the tracker directly.
2015-05-04 13:56:29 -04:00
Eddie Hebert 4908d5577e MAINT: Remove unsued perf_key property on simulation object.
The perf_key property is no longer referenced.
2015-05-04 13:11:31 -04:00
Jonathan Kamens 84eb25faab Merge pull request #577 from quantopian/minor_zipline_path_fix
BUG: Correct method for finding security lists directory
2015-05-04 11:30:43 -04:00
Eddie Hebert c43d504212 MAINT: Remove unused hash_args from simulation object.
The `get_hash` method on the AlgorithmSimulator is never called, so
remove.
2015-05-04 11:03:01 -04:00
Jonathan Kamens cd98b52454 BUG: Correct method for finding security lists directory
The correct thing to look at to figure out where the root of the
zipline tree is, is `zipline.__file__`, not `zipline.__path__`. The
latter could contain multiple directories in it, and is not intended
to be `os.path.join()`ed as the previous code was doing.
2015-05-04 10:42:40 -04:00
Jonathan Kamens fd0530d889 MAINT: Flake8 2015-05-01 11:03:01 -04:00
Jonathan Kamens 557e6a3009 Every setup_logger needs a teardown_logger 2015-05-01 07:38:42 -04:00
Jonathan Kamens 656bd86c17 TST: One more overwrite_sim_params=False needed 2015-04-30 15:38:09 -04:00
Jonathan Kamens c94880af2c TST: Suppress warnings in test_history_add_field_* tests
Temporarily suppress warnings for one line of the
test_history_add_field_* tests to work around #576 until it's fixed.
2015-04-30 15:31:21 -04:00
Jonathan Kamens 5c546b4f6c TST: overwrite_sim_params=False in tests when using list of sources
When specifying a list of sources to algorithm.py:run in a unit test,
specify overwrite_sim_params=False to suppress the unnessary
UserWarning.
2015-04-30 15:30:19 -04:00
Jonathan Kamens 8f9f65bdc6 MAINT: Flake8 2015-04-30 14:31:01 -04:00
Jonathan Kamens 73459333ef TST: Fix DeprecationWarning in xlrd by using custom version of it 2015-04-30 14:24:47 -04:00
Jonathan Kamens dcb8aa06af TST: Simplify test_examples and convert to unittest TestCase
Also, remove use of os.chdir() in the test, which causes other tests
to break by changing the current directory in the middle of the test
run.
2015-04-30 14:24:30 -04:00
Jonathan Kamens 7bb2677a9d TST: Convert test_munge.py tests to unittest format 2015-04-30 13:27:46 -04:00
Jonathan Kamens 865a20099a MAINT: Use "difference" instead of "-" to make Pandas happy 2015-04-30 13:19:00 -04:00
Jonathan Kamens d1b1708ccb Merge pull request #574 from quantopian/do_not_modify_security_lists_directory
TST: Don't modify master security lists directory during tests
2015-04-30 13:01:09 -04:00
Jonathan Kamens ca0f906b11 TST: Don't modify master security lists directory during tests
Rather than drop files temporarily into the master security lists
directory during unit tests, create temporary directories for the
tests. This avoids issues when the tests are being run at the same
time as other code that uses the real security lists data.
2015-04-29 21:41:32 -04:00
Eddie Hebert 00ea7b04d1 PERF: Reduce memory usage during risk metric calculations.
For beta calculation:

Remove `.dropna` , since it was creating a new
Series and Index which inflated memory usage as algorithm run time
progressed.

For downside risk calculations:

Instead of using pd.Series calculations, pass the underlying
numpy array which have already been sliced to the exact dt, so that the
call to `round` does not create a new Series.
2015-04-28 13:22:04 -04:00
Jonathan Kamens e5a93b6f7e MAINT: Upgrade requests to 2.6.2 2015-04-24 07:12:07 -04:00
Eddie Hebert a4f85b9436 Merge pull request #570 from quantopian/orders-by-modified-leak
Remove leaky defaultdicts
2015-04-23 15:43:03 -04:00
Jonathan Kamens 5ea4886dc1 MAINT: Upgrade requests to 2.6.1 2015-04-23 10:56:54 -04:00
Jonathan Kamens d39c0e830f Merge pull request #568 from quantopian/new_tweak_warnings_module
Scrubbing known warnings
2015-04-22 22:29:50 -04:00
Andrew Liang f44c15bb38 Scrubbing known warnings 2015-04-22 22:07:25 -04:00
Jonathan Kamens 74306f5d2d MAINT: Upgrade Markdown to 2.6.2 2015-04-22 21:12:44 -04:00