Commit Graph

2555 Commits

Author SHA1 Message Date
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
Jonathan Kamens 8ee7f6bd79 List dependencies before the things that depend on them
Because we use ordered_pip.sh to install requirements files, we want
dependencies in requirements_dev.txt to be listed _before_ the things
that depend on them, rather than after. Otherwise, with
ordered_pip.sh, stuff will get installed implicitly, and perhaps the
wrong version.
2015-04-22 16:06:33 -04:00
Eddie Hebert d343e06593 BUG: Remove use of defaultdict leading to memory growth.
defaultdict behavior was adding and never releasing a list and Timestamp
every time to_dict was called.
2015-04-22 10:46:20 -04:00
Eddie Hebert ec63397d28 BUG: Stop addition of new list in orders_by_modified on every dt.
Remove use of defaultdict for orders_by_modified, which was causing an
empty list to be added every time to_dict was called with a specified
dt.

Nnoticed in the minute emission case when hunting another memory leak,
every simulation minute a new Timestamp and list was created and never
let go.
2015-04-22 10:40:08 -04:00
warren-oneill fdd4940faf make calendar test compare generated calendar with the benchmark calendar
renaming cal_days to bench_days
2015-04-20 15:02:30 -04:00
Eddie Hebert 0fa44471be MAINT: Change expected type of treasury curves from load to DataFrame.
Instead of converting the curves back and forth from dictionaries to
DataFrame and back, use the DataFrame format when passing to
environment.
2015-04-20 10:26:09 -04:00
Brian Fink 82d2ddfa90 BUG: Fix limit orders
Only fill limit order if impacted fill price is better than the limit price.
If a limit order is partially filled, only fill the remaining shares if the
impacted fill price is better than the limit price.
2015-04-16 17:09:14 -04:00
Benjamin Berman ef598c7130 BUG: Handle a ValueError on from_csv calls
The cached market data could be corrupted. Pandas raises a ValueError in
that case, and this error handles it.
2015-04-14 12:40:37 -04:00
Scott Sanderson 885db87dea MAINT: Use logger instead of printing in loader.py
Makes it easier to filter logs when they're not desired.
2015-04-14 12:40:37 -04:00