stock 실현손익 보여줄 수 있게 화면 구성 추가

This commit is contained in:
2026-03-19 23:36:33 +09:00
parent b8d6dac70a
commit 248835fa54
3 changed files with 1086 additions and 2 deletions

View File

@@ -221,6 +221,31 @@ export function clearTodos() {
return apiDelete('/api/todos/done');
}
// ── 실현손익 내역 API ─────────────────────────────────────────────────────────
// GET /api/portfolio/sell-history?broker=X&days=N → { records: [...] }
// POST /api/portfolio/sell-history → 저장된 레코드 반환
// DELETE /api/portfolio/sell-history/:id → { ok: true }
export function getSellHistory({ broker, days } = {}) {
const qs = new URLSearchParams();
if (broker && broker !== 'ALL') qs.set('broker', broker);
if (days) qs.set('days', String(days));
const q = qs.toString();
return apiGet(`/api/portfolio/sell-history${q ? '?' + q : ''}`);
}
export function addSellHistory(record) {
return apiPost('/api/portfolio/sell-history', record);
}
export function updateSellHistory(id, record) {
return apiPut(`/api/portfolio/sell-history/${id}`, record);
}
export function deleteSellHistory(id) {
return apiDelete(`/api/portfolio/sell-history/${id}`);
}
// ── 블로그 API ────────────────────────────────────────────────────────────────
// GET /api/blog/posts → { posts: [{id, title, tags, body, date, excerpt}] }
// POST /api/blog/posts → 새 글 생성