Skip to content

Commit

Permalink
gzip test data
Browse files Browse the repository at this point in the history
  • Loading branch information
a-campbell committed Nov 21, 2015
1 parent 4bacfa9 commit 2970efe
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pyfolio/tests/test_round_trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pandas.util.testing import (assert_frame_equal)

import os
import gzip

from pyfolio.round_trips import (extract_round_trips,
add_closing_transactions)
Expand Down Expand Up @@ -98,14 +99,16 @@ def test_txn_pnl_matches_round_trip_pnl(self):
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))

test_txn = read_csv(__location__ + '/test_data/test_txn.csv',
test_txn = read_csv(gzip.open(
__location__ + '/test_data/test_txn.csv.gz'),
index_col=0, parse_dates=0)
test_pos = read_csv(__location__ + '/test_data/test_pos.csv',
test_pos = read_csv(gzip.open(
__location__ + '/test_data/test_pos.csv.gz'),
index_col=0, parse_dates=0)

transactions_closed = add_closing_transactions(test_pos, test_txn)
transactions_closed['txn_dollars'] = transactions_closed.amount * \
-1. * transactions_closed.price
-1. * transactions_closed.price
round_trips = extract_round_trips(transactions_closed)

self.assertAlmostEqual(round_trips.pnl.sum(),
Expand Down

0 comments on commit 2970efe

Please sign in to comment.