Skip to content

Commit 00e44fd

Browse files
authored
Merge pull request #169 from Intelligent-Advisor-Sem-4/main
Final final final
2 parents 145242f + cdda654 commit 00e44fd

File tree

7 files changed

+231
-109
lines changed

7 files changed

+231
-109
lines changed

API/profile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def ping():
2525

2626
@router.post("/optimize_portfolio", status_code=status.HTTP_200_OK)
2727
async def optimize_portfolio(request: Input):
28+
print(request)
2829
try:
2930
return build_portfolio_response(request)
3031
except Exception as e:

classes/profile.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
from pydantic import BaseModel
22
from typing import List, Optional
33
from models.models import AssetStatus
4+
from datetime import datetime, timedelta
45

56

67
class Input(BaseModel):
78
tickers: List[str]
8-
start_date: str = "2020-01-01"
9-
end_date: str = "2024-01-01"
9+
start_date: str = (datetime.today() - timedelta(days=30)).strftime("%Y-%m-%d") # Default to 30 days ago
10+
end_date: str = datetime.today().strftime("%Y-%m-%d") # Default to today
1011
num_portfolios: int = 10000
1112
investment_amount: float
1213
target_amount: float
1314
years: float
1415
risk_score_percent: Optional[float] = None # NEW: user's quiz risk percent (0-100)
15-
use_risk_score: bool = False # NEW: whether user selects custom risk
16+
use_risk_score: bool = False # NEW: whether user selects custom risk
17+
1618

1719
class Ticker(BaseModel):
1820
ticker_symbol: str
1921
asset_name: Optional[str] = None
2022
sectorDisp: Optional[str] = None
21-
currency:str
22-
status:AssetStatus
23+
currency: str
24+
status: AssetStatus
25+
2326

2427
class Tickers(BaseModel):
2528
tickers: List[Ticker]
2629

30+
2731
class RiskScoreIn(BaseModel):
2832
user_id: str
29-
score: float
33+
score: float
34+
3035

3136
class RiskScoreOut(BaseModel):
32-
score: float
37+
score: float

0 commit comments

Comments
 (0)