Skip to content

Commit

Permalink
remove unessesary files
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-abuke committed Jun 21, 2024
1 parent e22cef8 commit 79503c7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 57 deletions.
20 changes: 16 additions & 4 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
from . import models, schemas, database
import pandas as pd
import json
import os, sys

from utils.backtest import run_backtest
cwd=os.getcwd()
sys.path.append(f"{cwd}/backend/utils/")
sys.path.append(f"{cwd}/scripts/")

print("The os is :: ", os.getcwd())

from backend.utils.backtest import run_backtest

models.Base.metadata.create_all(bind=database.engine)

Expand All @@ -20,11 +27,11 @@ def get_db():

@app.get('/health')
def check_health():
return "healthy"
return "API is healthy"

@app.post('/indicators/', response_model=schemas.Indicator)
def create_indicator(indicator: schemas.IndicatorCreate, db: Session = Depends(get_db)):
db_indicator = models.Indicator(**indicator.dict())
db_indicator = models.Indicator(**indicator.model_dump())
db.add(db_indicator)
db.commit()
db.refresh(db_indicator)
Expand All @@ -37,7 +44,7 @@ def read_indicators(skip: int = 0, limit: int = 10, db: Session = Depends(get_db

@app.post('/scenes/', response_model=schemas.Scene)
def create_scene(scene: schemas.SceneCreate, db: Session = Depends(get_db)):
db_scene = models.Scene(**scene.dict())
db_scene = models.Scene(**scene.model_dump())
db.add(db_scene)
db.commit()
db.refresh(db_scene)
Expand Down Expand Up @@ -74,6 +81,11 @@ def perform_backtest(scene_id: int, db: Session = Depends(get_db)):

return backtest_results

@app.get('/run_backtest/', response_model=List[schemas.BacktestResult])
def run_backtests(scene: schemas.SceneCreate, db: Session = Depends(get_db)):
db_scene = models.Scene(**scene.model_dump())
return db_scene

@app.get('/backtest_results/', response_model=List[schemas.BacktestResult])
def read_backtest_results(skip: int = 0, limit: int = 10, db: Session = Depends(get_db)):
backtest_results = db.query(models.BacktestResult).offset(skip).limit(limit).all()
Expand Down
40 changes: 0 additions & 40 deletions explain_stocs_py.txt

This file was deleted.

14 changes: 7 additions & 7 deletions notebooks/backtesting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -646,7 +646,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -655,7 +655,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -676,7 +676,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -689,7 +689,7 @@
{
"data": {
"text/plain": [
"[{'Period': 25,\n",
"[{'Period': 20,\n",
" 'Gross Profit': 866.7200000000012,\n",
" 'Net Profit': 866.7200000000012,\n",
" 'Number of Trades': 1,\n",
Expand All @@ -699,13 +699,13 @@
" 'Sharpe Ratio': 1.0}]"
]
},
"execution_count": 21,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"run_backtest({\"indicator_name\": \"SMA\", \"period\": 25}, df)"
"run_backtest({\"indicator_name\": \"SMA\", \"period\": 20}, df)"
]
}
],
Expand Down
6 changes: 0 additions & 6 deletions requirements..txt

This file was deleted.

0 comments on commit 79503c7

Please sign in to comment.