diff --git a/app/services/backtest_service.py b/app/services/backtest_service.py index e69de29..110ac4e 100644 --- a/app/services/backtest_service.py +++ b/app/services/backtest_service.py @@ -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) diff --git a/tests/unit/test_backtest_service.py b/tests/unit/test_backtest_service.py index e69de29..0683fc5 100644 --- a/tests/unit/test_backtest_service.py +++ b/tests/unit/test_backtest_service.py @@ -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()