- Buy by EUR amount (fractional shares, like Trade Republic): 200 EUR can now reach every large cap; risk engine sizes in whole euros - No-AI screener (pullback in uptrend) feeds training cards and AI candidates - Auto-update on app open via after(); "find ideas now" button (3/day) - New Actions tab: stock list, stock page with chart, news, AI opinion, sandbox buy by amount or shares - "Mon compte" tab: declare deposits, cash, holdings and PEA plan (no broker credentials, no PEA invented by default) - Yahoo data cached and deduplicated, pages stream per section - Tests: fractional sizing, screener, no-AI idea flow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
export function eur(n: number, digits = 2): string {
|
|
return n.toLocaleString("fr-FR", { style: "currency", currency: "EUR", minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
}
|
|
|
|
export function price(n: number, currency: string): string {
|
|
return n.toLocaleString("fr-FR", { style: "currency", currency, minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
}
|
|
|
|
export function pct(n: number, digits = 1): string {
|
|
return `${n >= 0 ? "+" : ""}${n.toLocaleString("fr-FR", { minimumFractionDigits: digits, maximumFractionDigits: digits })} %`;
|
|
}
|
|
|
|
/** Nombre d'actions, fractions comprises (« 0,4213 »). */
|
|
export function shares(n: number): string {
|
|
return n.toLocaleString("fr-FR", { maximumFractionDigits: 4 });
|
|
}
|
|
|
|
export function signedEur(n: number): string {
|
|
return `${n >= 0 ? "+" : ""}${eur(n)}`;
|
|
}
|
|
|
|
export function timeAgo(d: Date): string {
|
|
const min = Math.round((Date.now() - d.getTime()) / 60_000);
|
|
if (min < 60) return `il y a ${Math.max(1, min)} min`;
|
|
const h = Math.round(min / 60);
|
|
if (h < 24) return `il y a ${h} h`;
|
|
return `il y a ${Math.round(h / 24)} j`;
|
|
}
|
|
|
|
export const EXIT_REASONS: Record<string, string> = {
|
|
stop: "stop déclenché",
|
|
target: "objectif atteint",
|
|
time: "durée max. atteinte",
|
|
manual: "vente manuelle",
|
|
};
|