Skip to content

Commit

Permalink
TST: Update to empyrical, increase test coverage
Browse files Browse the repository at this point in the history
ENH: Resolve rebase conflict by using updated example_data.tar

TST: Increase test coverage for risk portion of zipline
  • Loading branch information
Ana Ruelas committed Aug 23, 2016
1 parent 57d1bb8 commit f57fe0a
Show file tree
Hide file tree
Showing 69 changed files with 222 additions and 172 deletions.
2 changes: 1 addition & 1 deletion conda/qrisk/bld.bat → conda/empyrical/bld.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"%PYTHON%" setup.py install
"%PYTHON%" setup.py install
if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.
Expand Down
2 changes: 1 addition & 1 deletion conda/qrisk/build.sh → conda/empyrical/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

$PYTHON setup.py install
$PYTHON setup.py install

# Add more build steps here, if they are necessary.

Expand Down
33 changes: 33 additions & 0 deletions conda/empyrical/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package:
name: empyrical
version: "0.1.9"

source:
fn: empyrical-0.1.9.tar.gz
url: https://pypi.python.org/packages/15/6b/de1d277d4342d2cecc8134f4935248853f32299cdd9b01728b0ec420c350/empyrical-0.1.9.tar.gz
md5: 2c8b928cae192fc9cb8b7104608eec56

requirements:
build:
- python
- setuptools
- numpy x.x
- pandas >=0.16.1
- scipy >=0.15.1
- bottleneck >=1.0.0

run:
- python
- numpy x.x
- pandas >=0.16.1
- scipy >=0.15.1
- bottleneck >=1.0.0

about:
home: https://github.com/quantopian/empyrical
license: Apache Software License
summary: 'empyrical is a Python library with performance and risk statistics\ncommonly used in quantitative finance'

# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
27 changes: 0 additions & 27 deletions conda/qrisk/meta.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion etc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ intervaltree==2.1.0
cachetools==1.1.5

# For financial risk calculations
qrisk==0.1.4
empyrical>=0.1.9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"names": ["open", "high", "low", "close", "volume", "day", "id"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nbytes": 98584, "shape": [24646], "cbytes": 131072}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"chunklen": 32768, "dtype": "uint32", "expectedlen": 24646, "dflt": 0, "cparams": {"shuffle": true, "clevel": 5}}

Large diffs are not rendered by default.

Empty file.
14 changes: 4 additions & 10 deletions tests/risk/test_risk_cumulative.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
import pandas as pd
import zipline.finance.risk as risk
from zipline.utils import factory
import pandas as pd

from zipline.testing.fixtures import WithTradingEnvironment, ZiplineTestCase

from zipline.finance.trading import SimulationParameters

from . import answer_key
ANSWER_KEY = answer_key.ANSWER_KEY

RETURNS_BASE = 0.01
RETURNS = [RETURNS_BASE] * 251

Expand All @@ -38,16 +34,10 @@ class TestRisk(WithTradingEnvironment, ZiplineTestCase):

def init_instance_fixtures(self):
super(TestRisk, self).init_instance_fixtures()
<<<<<<< 30f5a8fcfa4a194f05d58f50cf0a2b06dd8085cc


start_session = pd.Timestamp("2006-01-01", tz='UTC')
end_session = pd.Timestamp("2006-12-29", tz='UTC')

=======
start_date = pd.Timestamp('2006-01-01', tz=pytz.utc)
end_date = pd.Timestamp('2006-12-29', tz=pytz.utc)
>>>>>>> ENH: Change datetime.datetime to pd.Timestamp in tests
self.sim_params = SimulationParameters(
start_session=start_session,
end_session=end_session,
Expand Down Expand Up @@ -150,3 +140,7 @@ def test_max_drawdown(self):
all(isinstance(x, float)
for x in self.cumulative_metrics.max_drawdowns),
True)

def test_representation(self):
assert all([metric in self.cumulative_metrics.__repr__() for metric in
self.cumulative_metrics.METRIC_NAMES])
Loading

0 comments on commit f57fe0a

Please sign in to comment.