Update main.py
Browse files
main.py
CHANGED
|
@@ -2,7 +2,7 @@ from fastapi.responses import HTMLResponse
|
|
| 2 |
from fastapi.templating import Jinja2Templates
|
| 3 |
from fastapi import FastAPI, Request, HTTPException
|
| 4 |
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
-
from pycatchs.
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
@@ -35,7 +35,15 @@ async def read_root(request: Request):
|
|
| 35 |
@app.get('/data')
|
| 36 |
async def get_data(ticker: str, date: str, qty: int):
|
| 37 |
try:
|
| 38 |
-
response =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return response
|
| 40 |
except:
|
| 41 |
return {"Timeout" : "Error"}
|
|
|
|
| 2 |
from fastapi.templating import Jinja2Templates
|
| 3 |
from fastapi import FastAPI, Request, HTTPException
|
| 4 |
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
+
from pycatchs.stdb import get_equity_data, get_stocks_data
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
|
|
| 35 |
@app.get('/data')
|
| 36 |
async def get_data(ticker: str, date: str, qty: int):
|
| 37 |
try:
|
| 38 |
+
response = get_equity_data(ticker, date, qty)
|
| 39 |
+
return response
|
| 40 |
+
except:
|
| 41 |
+
return {"Timeout" : "Error"}
|
| 42 |
+
|
| 43 |
+
@app.get('/stocks')
|
| 44 |
+
async def get_stocks_data():
|
| 45 |
+
try:
|
| 46 |
+
response = get_stocks_data()
|
| 47 |
return response
|
| 48 |
except:
|
| 49 |
return {"Timeout" : "Error"}
|