Commit Graph

2172 Commits

Author SHA1 Message Date
Eddie Hebert 26b2a466cf BLD: Update pytz to latest version.
2014.3 -> 2014.4
2014-06-02 22:15:01 -04:00
Thomas Wiecki 40001f3509 STY: Remove warning when ordering zero shares.
Many algorithms that use the new order methods like order_target()
will legitimately try to order 0 shares many times. The printed
warning at every turn is quite annoying and too verbose. We do not
display it on Quantopian either so I'm removing it here as well.
2014-06-02 15:50:21 +02:00
Eddie Hebert 1705428aa4 BLD: Remove pip-tools dependency.
Instead of `pip-review`, now using `pip list --outdated`
2014-05-31 21:56:10 -04:00
Eddie Hebert d384f63e25 BLD: Update tornado to latest.
Upgrade from 3.2 -> 3.2.1
Used for matplotlib, which is imported during tests to make
sure that examples are working.
2014-05-30 15:48:10 -04:00
Eddie Hebert 45c3fafaae BLD: Update xlrd package to latest.
xrld is used for reading the risk answer key.
Update 0.9.2 -> 0.9.3
2014-05-30 14:58:08 -04:00
Eddie Hebert f481d9e7df BLD: Update Markdown library.
Should be orthogonal to any trading simulation, Markdown is
merely used for packaging and converting the README.
2014-05-30 14:47:37 -04:00
Eddie Hebert 93acee4091 BLD: Keep Travis lint and test packages in sync with requirements file.
Instead of hard-coding the package versions in the Travis config,
grep the version number out of the requirements_dev.txt file,
so that the versions do not drift.
2014-05-30 14:11:44 -04:00
Eddie Hebert 2debde31ba BLD/STY: Upgrade to latest versions of lint checkers.
Upgrade pep8 1.4.6 -> 1.5.7
Upgrade pyflakes 0.7.3 -> 0.8.1

Also, tweak some line indentations which now show up as errors,
because of the fixes/changes to visual indent detection between
pep8 versions.
2014-05-30 12:44:10 -04:00
Eddie Hebert 2c8e019835 BLD: Update nose to latest version.
nose 1.3.0 -> 1.3.3
2014-05-29 23:20:30 -04:00
Eddie Hebert 99ecffdb42 BLD: Remove deprecated pip --use-mirrors flag.
With release 1.5 pip deprecated the --use-mirrors flag,
since that release the flag is a noop and raises a deprecation warning.
2014-05-29 13:18:00 -04:00
Eddie Hebert 46820ee796 BLD: Update pyparsing to 2.0.2
2.0.1 -> 2.0.2

pyparsing is a dependency of matplotlib and should not affect
Zipline simulations.
2014-05-29 13:13:56 -04:00
Scott Sanderson 0338dd73e1 ENH: Filter out empty lists from get_open_orders.
Filter out empty lists from `get_open_orders` so that we have consistent
behavior between the case where a user has never placed an order and the case
where the user has placed an order but it has been executed or cancelled.

A nice side-effect, which was the impetus for this change, is that you can
check if you have any open orders by doing:

```
len(get_open_orders()) == 0
```

Also adds a test for the behavior of `get_open_orders`, which was previously
lacking.
2014-05-29 13:04:53 -04:00
Eddie Hebert 00f89a69b4 BLD: Make TA-Lib install compatible with pip >= 1.5
Since TA-Lib's releases are hosted on Github instead of PyPI,
add the `allow-external` and `allow-unverified` flags for just
TA-Lib.

This change means that versions of pip < 1.5 can not be used,
since the flags do not exist in those versions.
2014-05-28 13:47:40 -04:00
Eddie Hebert caa14ee8f0 BLD: Order build of pandas before statsmodels.
pandas is required for statsmodels, so order installs so
that pandas is available for at build time for statsmodels
2014-05-28 12:03:09 -04:00
Eddie Hebert b34191bb01 BLD: Order scipy install before statsmodels.
statsmodels requires scipy to build, so list the scipy install
before statsmodels so that ordered_pip.sh will install it beforehand.
2014-05-28 11:44:19 -04:00
Eddie Hebert ce4567b4bb BLD: Upgrade pytz to 2014.3
Keep library up to date.
2014-05-27 16:51:09 -04:00
Eddie Hebert 2ef576a758 BLD: Upgrade Logbook to 0.7.0
Keep library up to date.
2014-05-27 16:50:29 -04:00
Eddie Hebert 543165fa05 BLD: Upgrade Cython dependency.
Upgrade Cython from 0.20 -> 0.20.1 to keep package up to date.
2014-05-27 16:10:19 -04:00
Eddie Hebert dbaf0facda BLD: Upgrade six library to 1.6.1
From 1.5.2 -> 1.6.1

Keep package up to date.
2014-05-27 15:55:36 -04:00
Eddie Hebert cfd3656d28 BLD: Upgrade requests dependency to 2.3.0
Upgrade requests from 2.2.0 to 2.3.0

To keep up-to-date, Changelog does not appear to have any changes
that would affect our usage one way or the other.
2014-05-27 15:08:09 -04:00
Eddie Hebert 9572c55a9d STY: Remove trailing empty line from requirements file. 2014-05-27 11:56:09 -04:00
Scott Sanderson ecd9bff0d6 PERF/BUG: Make the portfolio property call updated_portfolio.
Make the portfolio property on TradingAlgorithm call `updated_portfolio`
internally.  This prevents needless recomputation of the portfolio between
calls to `handle_data`, and also prevents issues where the portfolio object
could be unexpectedly modified in place in the body of a `handle_data` call.

Noteworthy finding in the course of investigating this bug:

If you modify a Python dictionary while iterating over it, the language will
only throw an exception if the size of the dictionary changes between loop
iterations; this means that you can do:
```
x = {1:1, 2:2, 3:3}
for k in x:
    old_val = x[k]
    del x[k]
    x[f(k)] = old_val
    print k
```
and you'll only get an error if f(k) is already a key in the dictionary.
This can lead to bizarre/nondeterministic behavior in the key iterator.
2014-05-27 11:20:13 -04:00
Eddie Hebert 146ec9329b BLD: Upgrade numpy from 1.8.0 -> 1.8.1
Keep numpy package up to date.
1.8.1 is a bug fix release, so should be no breaking changes.
2014-05-23 16:19:43 -04:00
Jonathan Kamens 96d8ebec3d BLD: List patsy before statsmodels in requirements.txt 2014-05-21 05:25:05 -04:00
Jonathan Kamens 03e40fd057 BLD: statsmodels requires patsy
Since statsmodels requires patsy, and statsmodels is now in
requirements.txt instead of requirements_dev.txt, patsy also needs to
be in requirements.txt instead of requirements_dev.txt.
2014-05-21 05:15:56 -04:00
Scott Sanderson fd0d0a84d8 DOC: More generic PostInit error messages.
Make the error messages for {DoBadThing}PostInit no longer reference "the
simulation", since the algorithm may not actually be running as a simulation.
2014-05-20 14:52:34 -04:00
Tony Lambiris 32a29088fe BLD: Move statsmodels from dev requirements into main requirements.
Pandas website states statsmodels is needed for parts of pandas.stats.
Also, update statsmodels to 0.5.0.

Upgrade of version is to both keep up to date, and to improve
performance on lazy imports, as fixed by
https://github.com/statsmodels/statsmodels/issues/573
2014-05-20 12:56:57 -04:00
Scott Sanderson 2be999e277 DOC: Update release notes for all_api_methods helper. 2014-05-14 11:34:09 -04:00
Scott Sanderson c3075f0ece ENH: Add a classmethod to TradingAlgorithm to get all API methods. 2014-05-14 11:24:33 -04:00
David Edwards c045f3a868 MAINT: deleted duplicate attribute in Portfolio
Deleted duplicate of Portfolio.portfolio_value in zipline.protocol. It
was defined on line 75 and line 82.
2014-05-13 10:17:50 -04:00
Scott Sanderson 2976a0dc5f DOC: Update release notes for trading controls. 2014-05-12 18:11:48 -04:00
Scott Sanderson 644486e6da ENH: Add trading controls to zipline API.
Adds four new methods to the Zipline API that can be used as circuit-breakers
to interrupt the execution of an algorithm.  The API methods are:

`set_max_position_size`
`set_max_order_size`
`set_max_order_count`
`set_long_only`

Internally, these methods are implemented by each registering a TradingControl
callback object with the TradingAlgorithm.  During
TradingAlgorithm.__validate_order_params (and thus before any side-effects of
the order call occur), each callback's `validate` method is called with
information about the order to be placed and the algorithm's current state,
raising an exception if the callback detects that an error condition has been breached.
2014-05-12 17:51:09 -04:00
Eddie Hebert 9953c7ea28 DOC: Update release notes. 2014-05-12 14:34:46 -04:00
Pankaj Garg 6e9dc6e552 BUG: Use env_trading_calender for open and closes data
TradingEnvironment class uses env_trading_calendar for trading days,
but the default trading calendar for open_and_close data, which causes
errors later, because of misalignment of trading days.

The issue can be resolved by using env_trading_calendar for
open_and_closes as well
2014-05-12 14:29:21 -04:00
twiecki c44458790a DOC: Add release notes for 0.6.2. 2014-05-07 15:34:46 -04:00
twiecki 8422006165 DOC: Fix typo in release announcement. 2014-05-07 15:34:46 -04:00
twiecki 12b651d9f0 DOC: Update README on conda installation, CLI and new example algo. 2014-05-07 15:34:46 -04:00
twiecki 59f8dfd94c DOC: Add note on installation to setting up dev env. 2014-05-07 15:34:46 -04:00
twiecki c9a75c7b42 STY: Rename run_algo to run_pipeline. 2014-05-07 15:34:42 -04:00
twiecki 2bfc2f9d93 DOC: Add doc strings. 2014-05-07 15:34:41 -04:00
twiecki f5086e4b0e ENH: Add IPython cell magic.
When zipline is imported it checks whether
it runs in the IPython notebook. If it does,
it registers a %%zipline magic that takes the
same arguments as the CLI with the addition of
a -o for specifying the output variable to store
the performance frame in.

The algo code in the cell is, as of yet, executed
in its own environment rather than that of the
IPython NB which is probably what we want.

Also adds cli option to save the perf dataframe
to a pickle file.

Also adds an IPython notebook buyapple example.
2014-05-07 15:34:41 -04:00
twiecki 5b45c46502 TST: Add tests for parse_args(). 2014-05-07 15:34:41 -04:00
twiecki f9fded97ac ENH: Implement CLI.
Add a CLI that reads in an algorithm, loads data,
run the algorithm, and output performance metrics.

The examples are adapted to the new zipline API and
analyses are split into separate files.

Also add config files that run the example
algorithms with preset settings.
2014-05-07 15:34:36 -04:00
Eddie Hebert fde40192cf WIP: Initial port of qprof run script. 2014-05-07 14:15:40 -04:00
Eddie Hebert 5d9a18c538 REL: Release notes file for 0.6.1 2014-05-05 16:19:18 -04:00
Scott Sanderson f41c37a606 ENH: Add the ability to specify an exchange on an ExecutionStyle.
Adds the exchange property the interface for ExecutionStyle and adds an
exchange parameter to the interface of all the existing ExceutionStyles.
Subclasses wishing to support the ability to specify an exchange should set the
_exchange attribute in __init__.
2014-04-29 17:35:12 -04:00
fawce ebf16720ef BUG: security is no longer an int. 2014-04-25 18:29:49 -04:00
Scott Sanderson 5373b6797c ENH: Treat stop and limit prices differently when rounding.
Stop and limit prices both trigger when a price crosses some threshold, but
they trigger in "opposite directions".  For example, on a buy, a limit price is
triggered when a price falls below a specified value, whereas a stop price
triggers when the price exceeds a specified value.

Our current stop/limit price rounding logic is asymmetric, preferring to "round
to improve" the specified price.  This change makes it so that we interpret
"improvement" in opposite directions for stop vs limit prices.
2014-04-25 12:02:23 -04:00
Richard Frank 17df628171 DOC: Replaced "i.e." with "e.g." where appropriate in module 2014-04-24 14:01:05 -04:00
Richard Frank f21bbe58fc ENH: Allow for stock dividends, and in particular, Google's
recent 2 for 1 stock split, where 1 class C share was distributed
for each share of class A held.

Now a dividend can specify a sid and ratio of stock that will be paid
to owners of the original security.  If the ratio is 2.0, then for every
existing share, two shares will be paid.
2014-04-24 14:00:39 -04:00