Commit Graph

1853 Commits

Author SHA1 Message Date
Eddie Hebert b9dfda01d2 DOC: Add annotations file for answer key.
Currently, just provide a way to render to some of the data extracted.
Intended to have more thorough documentation of the spreadsheet,
explaining derivation/calculations in each sheet and column.
2013-08-15 15:09:46 -04:00
Eddie Hebert b94d10cfb6 TST: Add answer key indexes for cumulative risk metrics.
Add indexes for Sharpe, returns and other values needed for
reading answers for cumulative risk metrics.

Prepare for unit test and matching change of implementation.
2013-08-15 15:09:44 -04:00
Eddie Hebert f3fd9d598a TST: Add parser for date values from answer key.
Refactor the reading of values from the Excel spreadsheet so that
parsers are configurable by index.

Needed so that we can parse columns that have dates, in addition
to floats as previously.
2013-08-15 15:08:42 -04:00
Eddie Hebert 3732c105b8 TST: Improve answer key interface.
Instead of using the indexes defined in the answer key class
to index back into the answer key object, populate the answers
so that they are available as members of the answer key object.

Update period risk test to use new answer key structure.

Also, remove the rounding behavior from the answer sheet, leaving
the rounding to the consumer of the answer key values, so that
the values can be retrieved from the spreadsheet during answer
key __init__ without knowledge of the decimal point that the calling
code expects.
Correspondingly, change period risk tests to use
np.testing.assert_almost_equal when doing floating point comparison.
2013-08-14 22:41:52 -04:00
Eddie Hebert de4671213b TST: Reduce cumulative risk test to stub.
Remove tests that were a copy of period risk behavior, to prepare
for adding cumulative risk specific tests.
2013-08-14 22:35:57 -04:00
Eddie Hebert ddcddc9351 MAINT: Create separate test risk modules.
As these modules diverge, the tests for each module should
distinguish those changes.
2013-08-14 15:09:01 -04:00
Eddie Hebert 1501e659ce TST: Rename notebook with link to answer key.
Move to a new notebook, the AnswerKeyLink will be for a permalink
to the current version of the answer key, of which the output
won't be too noisy in git.

The annotation notebook will also be kept in source control, but
without output, since the table html output is large.
2013-08-14 14:47:19 -04:00
Eddie Hebert 6f73f68d24 TST: Add output of answer key annotations to notebook.
For more improved viewing experience via nbviewer.ipyhton.org,
include the output of the notebook.

When saving/updating this file, a fresh kernel and evaluation of
the entire notebook should be used so that the cell numbers stay
in order.
2013-08-14 13:12:50 -04:00
Eddie Hebert ead9fc953f TST: Begin annotation notebook for risk answer key.
Read tests.risk.answer_key module into an IPython notebook, to start
a base to which answer key values and explanations can be added and
display without access to Excel.

For now, the notebook just provides the latest download link for
the spreadsheet.
2013-08-14 12:36:47 -04:00
Eddie Hebert bb8a734ae2 TST: Improve cumulative risk metrics sheet in answer key.
Update answer key for cumulative risk:
- Annualization of Sharpe
- Use 10 year period
- Use of daily returns vectors instead of compounded return scalar.

No tests or risk module code are currently reading off of this sheet,
but developing it ahead of work in risk module so that the sheet can
be examined and vetted.
2013-08-14 11:34:48 -04:00
Eddie Hebert cbac1bd6cb TST: Update answer key checksums on upload.
Automate the updating of the answer key when a new key is uploaded
to S3, so that keeping the latest value in sync is more likely.
2013-08-14 11:30:15 -04:00
Eddie Hebert 1295f45e13 MAINT: Switch treasury curves from Series to DataFrame.
Instead of using a pandas Series of with dictionaries as the
values treasury curves, use a DataFrame which more naturally fits
the data type of a having a timeseries with mulitple values.

Should allow easier slicing/manipulation of the treasury curves,
e.g. getting 10 year curves would now be:
```
treasury_curves['10year']
```
2013-08-13 23:13:19 -04:00
John Ricklefs 36fe790624 BUG: Update market_open value for performance when updating market_close. 2013-08-13 09:23:28 -04:00
Eddie Hebert faee91876f MAINT: Add formatting for printing of answer key DataIndex.
Output format of the range compatible with Excel, so that it
can be copy and pasted back into the spread sheet for easier
corroboration.
2013-08-09 17:32:17 -04:00
Thomas Wiecki b89886297f STY: autopep8 codebase. 2013-08-08 16:46:44 -04:00
Thomas Wiecki a43a122829 TST: Forgot to add order method test algos. 2013-08-08 16:37:31 -04:00
Thomas Wiecki e590da75fb BUG: Typo in test_batchtransfom. 2013-08-08 16:01:22 -04:00
Thomas Wiecki 7a65f4579e Pulled in PR 137 to add new order methods. 2013-08-08 15:57:24 -04:00
Thomas Wiecki b1fdebfb7c TST: Added tests for new order methods. 2013-08-08 15:55:08 -04:00
Jeremiah Lowin 48486c9814 ENH: New order methods. 2013-08-08 15:54:59 -04:00
Richard Frank c64a585e54 BUG: TransactionVolumeExceedsOrder was referenced but not defined 2013-08-08 13:21:16 -04:00
Ben McCann eae5803910 BUG: Calculate benchmark returns for first day
Before we were setting benchmark returns on the first day
to 0. This commit changes this by calculating the benchmark
return from open to close.

According to @eherbert this is also what the answer key does.
2013-08-08 12:20:04 -04:00
Thomas Wiecki 9694dfbbfe DOC: Removed mathjax from docs. Closes #73. 2013-08-08 11:22:31 -04:00
Thomas Wiecki 43889f4a16 BUG: version tag should be a string. 2013-08-08 11:22:03 -04:00
Thomas Wiecki 2026937dc9 BLD: Add version to zipline, bump to 0.5.11.dev
zipline.__version__ is now present. Closes #94.

Moreover, git master should have a .dev version string according
to convention. Releases then get the .dev label removed.
2013-08-08 11:12:10 -04:00
Thomas Wiecki 433c138edf DOC: Updated example in readme and added python-dateutils dependency. Closes #139. 2013-08-08 11:08:48 -04:00
Thomas Wiecki f75d781b02 DOC: Fix talib sphinx warnings. Closes #171. 2013-08-08 10:50:00 -04:00
Eddie Hebert c31bbee424 MAINT: Create separate page in risk answer key for period returns.
Copy the `Sim` sheet to `Sim Cumulative` as well as rename it to
`Sim Period`.

Update the answer key module accordingly.
2013-08-07 17:16:01 -04:00
Eddie Hebert 5b2a23ddd0 MAINT: Break period and cumulative risk metrics into submodules.
In anticipation of changing the sharpe, beta, et al. calculations
dependent on whether the period returns or the overall returns
are being calculated.
2013-08-06 17:49:19 -04:00
Eddie Hebert 66e7f48cdd MAINT: Split apart risk metrics classes.
Also remove test that compares risk metrics batch to iterative,
since the 'iterative' calculations, replaced by the cumulative
calculations, will intentionally drift from the results in the risk
report due to annualization and other factors.

Work towards having separate calculations for the fixed periods versus
the cumulative/headline risk metrics.
Different sumbodules for each type should help make the calculations
type distinct and easier to find.
2013-08-06 17:21:34 -04:00
Eddie Hebert 4a11a872fc MAINT: Move risk to its own module.
In anticipation of splitting apart the different risk classes
into their own submodules, a distinct risk module should help
organize those new classes.
2013-08-06 17:19:43 -04:00
Jonathan Kamens 3541115b4e BUG: Trading calendar dates should always be midnight UTC
For consistency, datetimes returned by the trading calendar should
always show HHMMSS of midnight UTC. Not only is this useful for
consistency, but it also allows us to check if a particular date() is
in an array of these datetimes, because they will hash to the same
thing. For example:

early_closes = get_early_closes()
... later ...
if current_bar_datetime.date() in early_closes:
    ... today closes early ...

If if the datetimes returned by the trading calendar functions don't
have 00:00:00 for HHMMSS, then the "in" check above will fail because
the date and the datetimes in early_closes won't hash to the same
thing.
2013-08-06 15:53:41 -04:00
Jonathan Kamens 2ca4d3cff7 MAINT: Update Dev requirements
Upgrade matplotlib in Dev requirements to 1.3.0, and add tornado==3.1
and pyparsing==2.0.1 which are required by matplotlib.
2013-08-06 11:59:26 -04:00
Eddie Hebert e85306524b BUG: Prevent crashes for TALib functions when stocks have nans.
If a stock stops gettign updated values, e.g. if a stock rolls out
of a universe strategy, currently the underlying batch transform
for TALib may have nans (which is another issue that could be addressed),
the nans cause crashes when passed to some TALib function, e.g. Bollinger
Bands are incompatible with all nan values.

So, drop sids that only have nan values for the current data panel.
2013-08-05 18:17:20 -04:00
Eddie Hebert adb10d9829 BLD: Rename extra requirements to goodies.
Since these modules are not requirements, make the name more clear
about the distinction. Especiall, so that build scripts do not pick
up this file when including wildcards whit a requirements prefix.
2013-08-05 16:41:53 -04:00
Eddie Hebert cfcafa8102 BLD: Update extra requirements to latest versions.
scikits.learn was renamed to scikit-learn
2013-08-05 16:35:09 -04:00
Eddie Hebert e5a9b08abf BLD: Update nose-paremeterized to latest release. (1.3.0) 2013-08-05 13:52:58 -04:00
Eddie Hebert 73eb3f12f5 BUG: Prevent unintended keys from appearing in data bar.
The defaultdict behavior was allowing both algo code and
TradingAlgorithm wrappers to add unintended keys.

Remove use of defaultdict in favor of a dictionary that explicitly
adds the values in tradesimulation, otherwise allow a KeyError
if the bar is indexed with a sid that doesn't exist.

Also, when iterating over the keys in the data bar, only return
those keys that have pricing data.
2013-08-01 22:41:58 -04:00
Thomas Wiecki 963324723c STY: Flake8 line break. 2013-08-01 17:14:56 -04:00
Ben McCann 8dd4230fd0 ENH: Plot benchmark returns in DMA example. 2013-08-01 16:55:12 -04:00
Thomas Wiecki e1475cc24f BUG: cum_perfs defined but not used. 2013-08-01 16:33:26 -04:00
Thomas Wiecki 1635a54fb8 ENH: Add print of monthly Sharpe to DMA example. 2013-08-01 16:09:38 -04:00
Thomas Wiecki 37bab9bb72 ENH: Safe risk_report in TradingAlgorthm. 2013-08-01 16:08:56 -04:00
Eddie Hebert 376ae33264 PERF: Remove deepcopy from EventWindow ticks.
The deepcopy of events into the EventWindow's ticks was causing
a significant increase in memory consumption, e.g. an algorithm with
almost 200 sids and 14 vwaps removing the deepcopy reduces the amount
of memory consumed by about 40%.

The downside is that if an event's properties are changed, which is
not advised, later on, then the signal derived from vwap etc.
may be changed.
2013-07-31 18:55:07 -04:00
Eddie Hebert 7139ac7061 TST: Update answer key spreadsheet.
Point tests at version of answer key with explicit use of sample
vs. population for covariance and variance via, `COVARIANCE.S` and
`VAR.S`
2013-07-29 14:47:31 -04:00
Eddie Hebert 3c305bbe35 TST: Add script to automate upload of risk answer sheet to S3.
For maintainer use, requires AWS credentials for the account where
the `zipline-test-data` bucket is hosted.

Script does the following steps which used to be manual:
- Create a key name based on the md5 of the answer key file.
- Upload the answer key to S3 bucket.
- Make the file publically downloadable over HTTP.
2013-07-29 14:42:53 -04:00
Eddie Hebert 8dc3bb82e5 BLD: Update pandas to 0.12.0 2013-07-29 07:41:56 -04:00
Thomas Wiecki d054008990 BLD: Bumped version to 0.5.10. 2013-07-27 09:50:37 -04:00
jbredeche 9033043078 Merge pull request #207 from quantopian/splits_fixes
fixing some bugs with splits (ratios and empty positions)
2013-07-25 09:28:38 -07:00
Jean Bredeche 8f1d599fc6 fixing some bugs with splits (ratios and empty positions) 2013-07-24 15:26:15 -07:00