Commit Graph

2584 Commits

Author SHA1 Message Date
jfkirk bfc992363e TST: Fixes broken test_close_position_event 2015-06-12 17:17:10 -04:00
jfkirk 847b5bdc42 BUG: The 'file_name' metadata arg now overwrites 'symbol', if it is given
This is to fix the issue where 'GOOG_L's metadata lists its symbol as 'GOOG'. To resolve this, the 'file_name' is used as the canonical symbol, if it is given.
2015-06-12 16:09:19 -04:00
Scott Sanderson 4aa5072154 DOC: Add docstring for risk.py:choose_treasury. 2015-06-12 10:59:43 -04:00
jfkirk eced4e700d TST: Adds close position tests for both Equity and Future 2015-06-12 10:07:50 -04:00
jfkirk 4ef8df2fca ENH: Adds handling of Assets passed to AssetFinder as identifiers 2015-06-11 16:49:23 -04:00
jfkirk 3ee3a1226b BUG: Fixes handling of CLOSE_POSITION events for Futures 2015-06-11 11:40:54 -04:00
warren-oneill 0d7e23857e TST: add unittest for CLOSE_POSTION event type for futures, add commission to TestAlgorithm 2015-06-11 11:39:10 -04:00
jfkirk 13180d5348 PERF: Removes unnecessary and expensive caching of values and exposures 2015-06-11 11:35:49 -04:00
jfkirk 7e5c638eb8 PERF: Removes asset lookups on every transaction 2015-06-11 11:35:49 -04:00
jfkirk 1b98d23b91 PERF: Removes asset lookups on ever trade event 2015-06-11 11:35:49 -04:00
jfkirk a5d1f79a37 TST: Reconciles tests with asset management system 2015-06-11 11:35:49 -04:00
jfkirk b84ac01cbf ENH: Adds futures trading and asset management logic to TradingAlgorithm and performance classes 2015-06-11 11:35:49 -04:00
jfkirk 035bfbd514 ENH: Adds AssetFinder and asset metadata management 2015-06-11 11:35:48 -04:00
jfkirk 9da644f767 ENH: Moves calling of TradingAlgorithm.initialize to _create_generator 2015-06-11 10:14:07 -04:00
warren-oneill 3d18a2954f TST:adds algo unittest for ClOSE_POSITON event type, adds commission as parameter to TestAlgorithm 2015-06-11 10:11:01 -04:00
Jonathan Kamens 5ff04c4ea6 Old version of pyflakes required by flake8 2.4.1 2015-06-09 19:21:48 -04:00
Jonathan Kamens 7411ca2b26 MAINT: Upgrade tornado, TA-Lib versions 2015-06-09 17:29:34 -04:00
Jonathan Kamens a9affd5cfc MAINT: Upgrade nose and pyflakes 2015-06-09 13:31:05 -04:00
James Kirk 68dbd5ed4a Merge pull request #593 from grundgruen/close_pos_event
ENH: Add CLOSE_POSTION as DataSource event type
2015-06-08 17:45:25 -04:00
Eddie Hebert c37f914c68 PERF: Use tolerant_equals instead of np.allclose in order types.
np.allclose creates a vector of size 1 if passed a scalar, which showed
up as a bottleneck in algorithms with a large number of
order_target_percent calls.
2015-06-05 20:59:13 -04:00
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
Jonathan Kamens 1097c37e3d MAINT: Peg pip version and fix incompatibility with pip 7.0.3
In d01e718373, we made a change for
compatibility with a change introduced in pip 7.0.0. Then the pip
maintainers went and reverted the change in pip 7.0.2, thereby
breaking our requirements file for the second time in ten days. This
change reverts the prior change so that we are once again compatible
with the current version of pip.

Also, to make it easier for people to avoid pip compatibility issues,
we're now specifying pip>=7.0.3 in etc/requirements.txt.
2015-06-03 14:50:56 -04: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