Added a Backtest class, which replaces the script in backtest.py. Also added an examples directory, to make strategy testing straightforward.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from qsforex.backtest.backtest import Backtest
|
||||
from qsforex.execution.execution import SimulatedExecution
|
||||
from qsforex.portfolio.portfolio import Portfolio
|
||||
from qsforex import settings
|
||||
from qsforex.strategy.strategy import TestStrategy, MovingAverageCrossStrategy
|
||||
from qsforex.data.price import HistoricCSVPriceHandler
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Trade on the "Cable" - GBP/USD
|
||||
pairs = ["GBPUSD"]
|
||||
|
||||
# Create the strategy parameters for the
|
||||
# MovingAverageCrossStrategy
|
||||
strategy_params = {
|
||||
"short_window": 500,
|
||||
"long_window": 2000
|
||||
}
|
||||
|
||||
# Create and execute the backtest
|
||||
backtest = Backtest(
|
||||
pairs, HistoricCSVPriceHandler,
|
||||
MovingAverageCrossStrategy, strategy_params,
|
||||
Portfolio, SimulatedExecution,
|
||||
equity=settings.EQUITY
|
||||
)
|
||||
backtest.simulate_trading()
|
||||
Reference in New Issue
Block a user