Commit Graph

567 Commits

Author SHA1 Message Date
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 a5d1f79a37 TST: Reconciles tests with asset management system 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
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
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
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
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
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 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 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
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
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
Brian Fink 8baf52fe01 ENH: Add max leverage account guard 2015-04-10 15:19:54 -04:00
warren-oneill 61571601ac added test for initialization of max_date in TradingEnvironment and removed trading_day from max_date if statement. 2015-04-08 16:57:32 -04:00
warren-oneill 6432631981 uncommenting out test_calendar_vs_environment 2015-04-08 16:57:01 -04:00
Thomas Wiecki d578d5825e BUG: Filter nans in DataFrame and Panel sources.
If a SID hasn't started trading yet, pandas' convention is to use nans.
Before this change, zipline would raise an exception if there were nans in the
input data.

We now skip events where the prices contains a nan and has not been traded
before (in which case forward fill).

Fixes #446.
2015-04-08 17:00:22 +02:00
Eddie Hebert 314b22656f MAINT: Remove left over simple transform code.
Remove pieces that are no longer used now that the simple transforms are
wrappers around history via the SIDData object.

Move window length related pieces into batch_transform, since the rest
of the utils module is no longer used.
2015-03-30 14:18:39 -04:00
Jonathan Kamens fa755d54a7 STY: Flake8 2015-03-19 17:21:25 -04:00
Jonathan Kamens e942275108 STY: Flake8
Upgrade the version of the flake8, pep8, and mccabe PyPI packages, and
make the code changes necessary for compatibility with the updated
packages.
2015-03-19 17:21:25 -04:00
jfkirk 84d4fa3c08 ENH: Adds Equity and Future classes as extensions of Asset class 2015-03-19 13:23:40 -04:00
jfkirk 2fd2f02c2a MAINT: Refactors Security to Asset
This commit refactors the Security cython class to Asset, and refactors some fields of the class accordingly. This change is so the terminology is consistent and correct when Asset is extended to asset types that are not securities, such as futures.
2015-03-19 13:23:40 -04:00
Eddie Hebert e69cf46e63 TST/BUG: Remove incorrect time period from hardcoded date.
Incompatible with changes to date parsers which reject the mismatch of
13:31 and AM.
2015-03-19 10:15:05 -04:00
Dale Jung 7892a6943f RFT: Remove Position management from PerformancePeriod. This cuts down
on the number of per-tick update that occur since they were duplicated
per each PerformancePeriod. Also opens up the path to cythonizing the
entire object
2015-03-18 22:48:14 -04:00
Jonathan Kamens 6cd2f4f1f2 TEST: Update Security class unit tests for Python3 compatibility 2015-03-12 10:32:26 -04:00
Jonathan Kamens e19f02a2ec BUG: Handle all possible types of Security object __richcmp__ args
A cython __richcmp__ function isn't allowed to assume that its first
argument is the same as the type of the class to which it belongs, so
our code needs to account for either of its two arguments being of the
wrong type.

Furthermore, the correct way for __richcmp__ to handle when it doesn't
know how to do a comparison is to return NotImplemented.
2015-03-10 20:36:52 -04:00
Jonathan Kamens 716bdbb7cd BUG: Fix >= comparison for Cythonized Security object
The >= comparison for the Cythonized Security object was actually
doing <=. Fix this and add unit tests for all the Security object rich
comparison operators.
2015-03-08 09:31:50 -04:00
Delaney Granizo-Mackenzie c49b00e9a1 Merge pull request #510 from quantopian/move-serialization-methods-into-zipline
MAINT: Added pickle protocol methods into zipline.
2015-03-05 15:06:54 -05:00
Delaney Granizo-Mackenzie b095f09472 MAINT: Added pandas version check to version testing
Now version testing will only be run if the pandas version is
current. This is to allow the test matrix to pass on travis.
The version must be updated in file whenever pandas is upgraded.
2015-03-05 11:47:57 -05:00
Delaney Granizo-Mackenzie a2bc6dd1f5 BUG: Fixed bug with returning non-primitive dicts. 2015-03-04 17:47:48 -05:00
Delaney Granizo-Mackenzie 51677ea700 ENH: Added Dale's verbose serialization error tracking.
Thanks, Dale.
2015-03-04 17:18:29 -05:00
Delaney Granizo-Mackenzie fd0f07aab9 MAINT: Added new sample saved state. 2015-03-04 16:28:36 -05:00
Delaney Granizo-Mackenzie f9afb132e3 BUG: Fixed bugs in the file paths to the sample saved state. 2015-03-04 15:57:59 -05:00
jfkirk 0375b350b8 ENH: Adds Security cython class in new package 'zipline.assets'
The class is not yet used. Adding this class is part of the effort to allow Zipline
simulation of more types of assets than stocks.

DEV: Adds build_ext to .travis.yml
2015-03-04 14:19:29 -05:00
Delaney Granizo-Mackenzie 1f69126854 ENH: Added testing for versioning of serialized state. 2015-03-04 14:17:13 -05:00
Delaney Granizo-Mackenzie 5c756a84c5 ENH: Added tests for pickling zipline objects. 2015-03-04 14:17:13 -05:00
Delaney Granizo-Mackenzie 0f0b97e5ac MAINT: Refactored testing code. 2015-03-04 14:17:12 -05:00
Delaney Granizo-Mackenzie 56d87c5170 ENH: Added testing for serialization. 2015-03-04 14:17:12 -05:00