-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (25 loc) · 910 Bytes
/
Copy pathapp.py
File metadata and controls
33 lines (25 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import uvicorn
from fastapi import FastAPI
from financial_statements.main import get_statement
app = FastAPI()
@app.get("/")
def root():
message = {
"Code": "200",
"message": "You've succesfully reached Financial_API",
}
return message
@app.get("/stockinfo/")
def ticker(ticker: str = "BRK.A"):
return {"Ticker": ticker}
@app.get("/financials/")
def get_arg_values():
return {"details":"Keys are input and values are expected result",
"is":"Income Statement",
"cfs": "Cash-Flow Statement",
"bs":"Balance Sheet"}
@app.get("/financials/{statement_type}/")
def financials(statement_type: str, ticker: str, years_of_data: int = 5):
return get_statement(statement_type, ticker, years_of_data)
if __name__ == "__main__":
uvicorn.run("server.api:app", host="0.0.0.0", port=8000, reload=True)