stock 실계좌 예수금 정보 추가
This commit is contained in:
@@ -230,24 +230,8 @@ def create_portfolio_item(req: PortfolioItemRequest):
|
|||||||
return {"id": item_id, "ok": True}
|
return {"id": item_id, "ok": True}
|
||||||
|
|
||||||
|
|
||||||
@app.put("/api/portfolio/{item_id}")
|
|
||||||
def update_portfolio(item_id: int, req: PortfolioUpdateRequest):
|
|
||||||
"""포트폴리오 종목 수정"""
|
|
||||||
if get_portfolio_item(item_id) is None:
|
|
||||||
return JSONResponse(status_code=404, content={"error": "Item not found"})
|
|
||||||
update_portfolio_item(item_id, **req.dict())
|
|
||||||
return {"ok": True}
|
|
||||||
|
|
||||||
|
|
||||||
@app.delete("/api/portfolio/{item_id}")
|
|
||||||
def delete_portfolio(item_id: int):
|
|
||||||
"""포트폴리오 종목 삭제"""
|
|
||||||
if not delete_portfolio_item(item_id):
|
|
||||||
return JSONResponse(status_code=404, content={"error": "Item not found"})
|
|
||||||
return {"ok": True}
|
|
||||||
|
|
||||||
|
|
||||||
# --- Broker Cash API ---
|
# --- Broker Cash API ---
|
||||||
|
# /{item_id} 라우트보다 반드시 먼저 정의해야 /cash가 item_id로 매칭되지 않음
|
||||||
|
|
||||||
class BrokerCashRequest(BaseModel):
|
class BrokerCashRequest(BaseModel):
|
||||||
broker: str
|
broker: str
|
||||||
@@ -275,3 +259,20 @@ def remove_broker_cash(broker: str):
|
|||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
|
@app.put("/api/portfolio/{item_id}")
|
||||||
|
def update_portfolio(item_id: int, req: PortfolioUpdateRequest):
|
||||||
|
"""포트폴리오 종목 수정"""
|
||||||
|
if get_portfolio_item(item_id) is None:
|
||||||
|
return JSONResponse(status_code=404, content={"error": "Item not found"})
|
||||||
|
update_portfolio_item(item_id, **req.dict())
|
||||||
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
|
@app.delete("/api/portfolio/{item_id}")
|
||||||
|
def delete_portfolio(item_id: int):
|
||||||
|
"""포트폴리오 종목 삭제"""
|
||||||
|
if not delete_portfolio_item(item_id):
|
||||||
|
return JSONResponse(status_code=404, content={"error": "Item not found"})
|
||||||
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user