Skip to content

Commit

Permalink
feat: allow cors origin all
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-abuke committed Jun 25, 2024
1 parent 35b8854 commit 9d1605b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
35 changes: 35 additions & 0 deletions 0.5.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Collecting nixtla
Downloading nixtla-0.5.1-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: httpx in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from nixtla) (0.27.0)
Requirement already satisfied: pandas in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from nixtla) (2.2.2)
Requirement already satisfied: pydantic in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from nixtla) (2.7.4)
Requirement already satisfied: requests in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from nixtla) (2.32.3)
Collecting tenacity (from nixtla)
Downloading tenacity-8.4.1-py3-none-any.whl.metadata (1.2 kB)
Collecting utilsforecast>=0.1.7 (from nixtla)
Downloading utilsforecast-0.1.11-py3-none-any.whl.metadata (7.4 kB)
Requirement already satisfied: numpy in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from utilsforecast>=0.1.7->nixtla) (1.26.4)
Requirement already satisfied: packaging in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from utilsforecast>=0.1.7->nixtla) (24.1)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pandas->nixtla) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pandas->nixtla) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pandas->nixtla) (2024.1)
Requirement already satisfied: anyio in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpx->nixtla) (4.4.0)
Requirement already satisfied: certifi in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpx->nixtla) (2024.6.2)
Requirement already satisfied: httpcore==1.* in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpx->nixtla) (1.0.5)
Requirement already satisfied: idna in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpx->nixtla) (3.7)
Requirement already satisfied: sniffio in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpx->nixtla) (1.3.1)
Requirement already satisfied: h11<0.15,>=0.13 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from httpcore==1.*->httpx->nixtla) (0.14.0)
Requirement already satisfied: annotated-types>=0.4.0 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pydantic->nixtla) (0.7.0)
Requirement already satisfied: pydantic-core==2.18.4 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pydantic->nixtla) (2.18.4)
Requirement already satisfied: typing-extensions>=4.6.1 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from pydantic->nixtla) (4.12.2)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from requests->nixtla) (3.3.2)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from requests->nixtla) (2.2.2)
Requirement already satisfied: six>=1.5 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from python-dateutil>=2.8.2->pandas->nixtla) (1.16.0)
Requirement already satisfied: exceptiongroup>=1.0.2 in c:\users\user\downloads\ten_academy\week9\scalable_backtesting_infrastructure_for_crypto_trading\backtest\lib\site-packages (from anyio->httpx->nixtla) (1.2.1)
Downloading nixtla-0.5.1-py3-none-any.whl (71 kB)
---------------------------------------- 71.4/71.4 kB 561.5 kB/s eta 0:00:00
Downloading utilsforecast-0.1.11-py3-none-any.whl (40 kB)
---------------------------------------- 40.6/40.6 kB 978.0 kB/s eta 0:00:00
Downloading tenacity-8.4.1-py3-none-any.whl (27 kB)
Installing collected packages: tenacity, utilsforecast, nixtla
Successfully installed nixtla-0.5.1 tenacity-8.4.1 utilsforecast-0.1.11
14 changes: 13 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List
from fastapi import FastAPI, Depends, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy.orm import Session, joinedload
from sqlalchemy.exc import IntegrityError
import pandas as pd
Expand All @@ -9,7 +10,7 @@
from .auth import router as auth_router
from kafka_topic.kafka_config import get_kafka_producer, SCENE_TOPIC, RESULT_TOPIC, get_kafka_consumer

from backend.utils.backtest import run_backtest
from scripts.backtesting.main import run_backtest
from backend.utils.init_data import initialize_data

get_db = database.get_db
Expand All @@ -21,6 +22,17 @@

app = FastAPI()

# allow all origins
origins = ["*"]

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

@app.on_event("startup") # TODO update the code with lifespan dependency
def start_kafka_consumer():
threading.Thread(target=consume_scene_parameters).start()
Expand Down

0 comments on commit 9d1605b

Please sign in to comment.