Commit Graph

55 Commits

Author SHA1 Message Date
fawce 9062b9636a MAINT: refactoring for orders api
- moved Order and Blotter to zipline.finance.blotter
- moved order method from AlgoSimulator to Blotter
- eliminated the set_order method in algorithm
- moved blotter to the algorithm
2013-04-26 19:45:59 -04:00
fawce ca0bce1680 TST: Refactor so tests can exercise internal methods in blotter. 2013-04-18 16:09:24 -04:00
Eddie Hebert 9099d301f3 ENH: Stream benchmark returns as events.
Instead of creating a list of benchmarks in the risk module,
stream benchmarks through the system as events, starting from the
algorithm generator.

Works towards more easily setting arbritrary pricing data as
a a benchmark, as well as working towards live minutely benchmarks.
2013-04-15 11:43:13 -04:00
Eddie Hebert 35f57ada3e ENH: Send transactions and orders as standalone events.
- Add transaction and order types
- Move TransactionSimulator from trading.py to tradesimulation.py
  (only used by other members of the tradesimulation module)
- Make Transaction an independent event, like dividend
- Add Blotter class.
- Flatten the transaction events to be independent of trade bar events
- Make orders into events that reach performance (need to add
handling)
- Issue IDs to orders and tracking each transaction's order id.
- Make volume share slippage fill orders independently, rather than
  aggregating them into a single transaction.
- Perf tracker holds orders, serializes them with transactions.
- Order state defined and maintained by order class.
- Minutely emission of orders based on last_modified date.
2013-04-14 18:59:57 -04:00
Eddie Hebert 48a691e9a7 TST: Group test trades for transaction simulator by date.
Group by date to prepare for other values to be added per dt.
2013-04-12 11:13:23 -04:00
Eddie Hebert 3883f79ece TST: Remove unused trade_delay parameter from transaction_sim method. 2013-04-12 11:04:01 -04:00
Eddie Hebert 58af62f18d REL: Update copyright on all files touched since end of 2012.
s/Copyright 2012/Copyright 2013/
2013-04-05 14:28:15 -04:00
Tony Worm 086679c3d6 ENH: Adds new order types.
Adds the following order types:
- market
- limit
- stop
- stop limit
2013-03-19 14:32:11 -04:00
fawce 2c7355a0dc Refactoring of TradingEnvironment to isolate the global state: index symbol and exchange timezone. Parameters that define the simulation (start, end, and capital base) were put in a new class, SimulationParameters.
Global state for the financial simulation environment is accessed through the
zipline.finance.trading module, which now contains a module variable:
environment.

Parameters are passed into an algorithm as a keyword argument, sim_params.
SimulationParameters creates a trading day index for the test period that
can be used to find trading days, calculate distance between trading days,
and other common operations. The sim params index is just selected from the
global state.

================

Details:

    - adding delorean to the requirements.
    - made index symbol a parameter for loading the benchmark data. changed
    messagepack storage to be symbol specific.
    - ported risk, performance, algorithm, transforms, batch transforms
    and associated tests to use simulation parameters and global environment
    - factory and sim factory use global state and sim params
    - factory method parameter names now reflect the class expected
2013-02-18 10:24:32 -05:00
Eddie Hebert a25590b0a1 Exposes the list of trading days contained in a trading environment.
Previously, the list was generated, but only used to calculate
the number of days in the environment.

With exposing this list, working towards a path where the simulation
uses the trading days to determine when to handle market closes.
2013-01-01 13:01:49 -05:00
Eddie Hebert 0617e53d69 Upgrades flake8 from 1.5 -> 1.6
Also, removes flake8 ignores, since the warnings that were
at odds with eachother now work.
2012-11-19 12:49:09 -05:00
Tobias Brandt cf4d7ca353 Fixed unittest2 import error on Python 2.7
Changed all unittest2 imports to unittest
2012-11-12 10:49:14 -05:00
Eddie Hebert 04642c0077 Removes leased sockets from unit test.
The leased sockets were from a previous architecture.
2012-10-25 10:37:58 -04:00
Eddie Hebert 7904773d00 Updates flake8 to latest.
The latest flake8 release in now 1.5, which pulls in pep8: 1.3.4a0

The upgrade pep8 has changes to what it picks up as lint.
Making code base compatible, so that new devs can install pep8
from PyPI and not have friction over the version difference.

Currently using these ignores in the config file:

```
[pep8]
ignore = E124,E125,E126
```

Ignoring these since they are difficult to squash while maintaining
an 80 char line length, and appear spurious.
Should address later.

Updates Travis config, README, and pip requirements to reflect change.
2012-10-22 11:57:16 -04:00
Eddie Hebert 23076ae7f1 Allows for collapsed orders by changing the current order filter.
Changes our filter so that instead of just checking for the current
day, we ensure that orders are before or on the current event time.

This adds a delay, (defaulting to one minute), to the order so that we
avoid filling an order exactly when it is placed.
2012-10-11 13:42:53 -04:00
Eddie Hebert c510cab915 Removes unit test exercising expiring orders.
We have removed expiring orders, so this tests behavior that currently
doesn't exist.
2012-10-10 16:19:06 -04:00
fawce 16b0d71506 refactoring of algorithm to make it work for both batch style run method, and generator style consumption. removed the portfolio property from the data parameter. added set_slippage and set_commission methods to algorithm. removed timeout tracking. 2012-10-10 16:06:32 -04:00
Eddie Hebert bbf2317c57 Saving point for adding license files. 2012-10-08 17:32:40 -04:00
Eddie Hebert 77af1ca632 Applies PEP-8 and pyflakes style to tests and zipline.
Mostly whitespace, line width and other spacing changes.
Also, removes use of deprecated has_key in favor of `in`

Going forward new patches should pass running `flake8` before
submission.
2012-10-05 12:14:09 -04:00
Eddie Hebert 259498dad2 Removes unused modules. 2012-10-03 10:59:04 -04:00
fawce 1caefbff43 tests are passing for independent commission model 2012-09-28 23:12:41 -04:00
fawce 1267f66dbe removed old refs 2012-09-14 19:42:55 -04:00
fawce 57a1834c5a refactored so that slippage is implemented as pluggable classes. 2012-09-13 21:22:01 -04:00
fawce 50de0f5e39 support of qexec refactoring 2012-09-12 00:30:37 -04:00
fawce b046518c45 tests passing with new lines.py. Still some zmq references left. 2012-09-08 22:44:22 -04:00
Eddie Hebert 06742e27a1 Removes unused import. 2012-08-24 23:36:04 -04:00
Jonathan Kamens a2376cb87a test_finance.py no longer needs drain_zipline 2012-08-21 16:16:35 -04:00
scottsanderson a68a48b62e removed deprecated test and refactored tradesimulation time compression logic 2012-08-18 17:07:20 -04:00
fawce aeb50da170 fixes for unit tests, back to 50/51 passing. 2012-08-07 14:42:43 -04:00
fawce 80f2acc674 test fixes 2012-07-27 23:33:43 -04:00
fawce 83da8d2310 fixed logging for tests 2012-07-26 18:45:42 -04:00
fawce abf9c8efa5 exception handling code revised. gevent, pypy, and threadsim vestiges removed.
devel flag removed.
2012-07-26 16:22:13 -04:00
fawce c02d15016a added timeouts for component when waiting to hear from the monitor. proof of concept exception relay for algorithm's initialize method. 2012-07-24 23:43:40 -04:00
fawce d950973f0d added a proc join to ensure we block on the simulation fully exiting all processes. 2012-07-24 17:43:49 -04:00
fawce ad10f2aa85 fixed up tests to abandon thread simulator. 2012-07-24 16:43:02 -04:00
fawce d0e987a8e8 tests passing using the process simulator. 2012-07-24 14:00:33 -04:00
fawce fc1882daaa enabled logging with a logbook zmq logger from within the algorithm. 2012-07-22 07:33:42 -04:00
Stephen Diehl 9cbcf424b4 Update tests. 2012-07-05 15:14:55 -04:00
Stephen Diehl bcd1ccae4d Restore passing test_performance. 2012-07-03 13:27:01 -04:00
fawce 5f878300a0 switched from pub/sub to push/pull for merge -> client socket. also purged source_id from the constructors of all datasources. 2012-07-03 12:11:22 -04:00
fawce 31e0e8208c switching to use push/pull for traffic btw merge and client 2012-07-03 11:37:58 -04:00
Stephen Diehl 3b0a591758 Backport logging setup for test_finance 2012-07-03 10:55:32 -04:00
fawce 433170df9b removed old order protocol cruft. 2012-05-28 21:39:54 -04:00
fawce cc188a9d6e bumped timeouts for jenkins, took trace out of log test 2012-05-21 11:35:29 -04:00
fawce ba2783081c switched SID to sid 2012-05-18 21:46:42 -04:00
Stephen Diehl 8d864462ff Fix DataSource id/get_id mixup. 2012-05-16 16:19:08 -04:00
fawce 93cc4bc172 fixed imports in optimize factory and tests. also added skip annotations, because jenkins will never run them successfully. 2012-05-16 12:17:13 -04:00
Stephen Diehl 1b46a0d5d3 Move simulator to core. 2012-05-14 14:05:41 -04:00
Stephen Diehl d399edd419 Fix ndict woes. 2012-05-14 13:49:45 -04:00
Stephen Diehl e04415e63f Remove all namedicts. 2012-05-14 11:35:43 -04:00