Skip to content

Commit

Permalink
conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
AbYT101 committed Jun 22, 2024
2 parents 08e06d1 + fe815e6 commit a6cbefa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
3 changes: 3 additions & 0 deletions run_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mlflow server --host 127.0.0.1 --port 5050
python3 run.py

39 changes: 7 additions & 32 deletions tests/unit/test_backtest_service.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
import json
import pytest
from flask import Flask
from flask_testing import TestCase
from app import create_app, db
from app.models.backtest import Indicator, Backtest, Parameter, Result
import unittest
from app.services.backtest_service import BacktestService

class BacktestTestCase(TestCase):
def create_app(self):
app = create_app('testing') # Assume you have a testing config
return app

def setUp(self):
db.create_all()
# Add sample indicators
indicator1 = Indicator(name='Indicator 1', description='Description 1')
indicator2 = Indicator(name='Indicator 2', description='Description 2')
db.session.add(indicator1)
db.session.add(indicator2)
db.session.commit()

def tearDown(self):
db.session.remove()
db.drop_all()

def test_run_backtest(self):
with open('backtest_request.json') as f:
data = json.load(f)

response = self.client.post('/backtest', json=data)
self.assertEqual(response.status_code, 201)
self.assertIn('backtest_id', response.json)
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__':
pytest.main()
unittest.main()

0 comments on commit a6cbefa

Please sign in to comment.