feat(birikim): otomatik ve manuel kurlar, portföy değerlemesi

- TCMB (döviz alış kuru) ve xaus.com (altın) saatlik arka planda çekilir, gün başına saklanır
- Kaynak erişilemezse son kur geçerli; altın için son USD kuru kullanılır
- Elle kur girişi/silme; aynı gün elle girilen kur önceliklidir
- GET /portfolio: güncel değer, kâr/zarar, toplamlar, son kur çekimi
- RATES_REFRESH_MINUTES ayarı

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 00:59:01 +03:00
parent 267d292a90
commit 3f60efdc33
25 changed files with 1424 additions and 9 deletions
+24
View File
@@ -0,0 +1,24 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PortfolioItem } from "./PortfolioItem";
export type Portfolio = { items: Array<PortfolioItem>,
/**
* Eldeki maliyet toplamı (kuruş)
*/
cost_total: number,
/**
* Kuru olanların güncel değeri (kuruş)
*/
value_total: number,
/**
* Kuru olanlarda değer − maliyet
*/
unrealized_pl_total: number, realized_pl_total: number,
/**
* Elde olup kuru bulunmayan varlık sayısı (toplama girmedi)
*/
unpriced: number,
/**
* Son otomatik kur çekimi (ISO); hiç yoksa `null`
*/
last_fetch: string | null, };
+17
View File
@@ -0,0 +1,17 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Asset } from "./Asset";
import type { Rate } from "./Rate";
export type PortfolioItem = { asset: Asset,
/**
* TL'de ve kur yoksa `null`
*/
rate: Rate | null,
/**
* Güncel değer (kuruş); kur yoksa `null`
*/
value: number | null,
/**
* Değer − eldeki maliyet (kuruş)
*/
unrealized_pl: number | null, };
+15
View File
@@ -0,0 +1,15 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type Rate = { id: string, code: string,
/**
* TL × 1e6, birim başına
*/
rate_e6: number,
/**
* `tcmb` · `xaus` · `manual`
*/
source: "tcmb" | "xaus" | "manual", rate_date: string,
/**
* ISO 8601
*/
fetched_at: string, is_manual: boolean, };
+15
View File
@@ -0,0 +1,15 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RateCreateRequest = {
/**
* Varlık kodu (`XAU_CEYREK`, `USD`…)
*/
code: string,
/**
* TL × 1e6, birim başına
*/
rate_e6: number,
/**
* Boşsa bugün
*/
rate_date?: string, };