-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update backtest service functionality and corresponding unit tests A…
…ddresses issue #28
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import sys | ||
import os | ||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) | ||
from scripts.backtest_runner import run_backtest, RsiBollingerBandsStrategy | ||
|
||
class BacktestService: | ||
@staticmethod | ||
def execute_backtest(symbol, start_date, end_date): | ||
return run_backtest(RsiBollingerBandsStrategy, symbol, start_date, end_date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import unittest | ||
from app.services.backtest_service import BacktestService | ||
|
||
class TestBacktestService(unittest.TestCase): | ||
def test_execute_backtest(self): | ||
result = BacktestService.execute_backtest('BTC/USDT', '2023-06-20', '2024-06-20') | ||
self.assertIn('Ending Portfolio Value', result) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |