Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Byte-compiled / optimized / DLL files
__pycache__/
.pytest_cache/
*.py[cod]

# C extensions
Expand Down
7 changes: 5 additions & 2 deletions prophet/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime as dt
import pandas as pd

from prophet.analyze import Analysis
from prophet.portfolio import Portfolio
Expand Down Expand Up @@ -57,8 +58,10 @@ def run_backtest(self,
raise ProphetException("Must set an order generator by calling"
"set_order_generator.")

timestamps = trading_days[(trading_days >= start) &
(trading_days <= end)]
start_utc = pd.to_datetime(start, utc=True)
end_utc = pd.to_datetime(end, utc=True)
timestamps = trading_days[(trading_days >= start_utc) &
(trading_days <= end_utc)]
effective_start = timestamps[0]

data = self._generate_data(start=effective_start,
Expand Down
2 changes: 1 addition & 1 deletion prophet/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, cache_path=None, data_path=None):
data_path=data_path)

def run(self, data, start, end, symbols, source, lookback=0):
data_start = self.get_data_start(start, lookback)
data_start = self.get_data_start(start, lookback).replace(tzinfo=None)

# Current caching implementation based on Zipline
symbols_data = dict()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def test_quickstart():

prophet.register_portfolio_analyzers(default_analyzers)
analysis = prophet.analyze_backtest(backtest)
assert round(analysis['sharpe'], 10) == 1.1083876014
assert round(analysis['average_return'], 10) == 0.0010655311
assert round(analysis['cumulative_return'], 10) == 2.2140809296
assert round(analysis['volatility'], 10) == 0.0152607097
assert round(analysis['sharpe'], 10) == 1.0967430073
assert round(analysis['average_return'], 10) == 0.0010501702
assert round(analysis['cumulative_return'], 10) == 2.1604345132
assert round(analysis['volatility'], 10) == 0.0152004028

today = datetime(2014, 11, 10)
expected_orders = Orders(Order(symbol='AAPL', shares=100))
Expand Down