feat(settings): add settings route and API updates\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This commit is contained in:
2026-05-16 20:19:35 +02:00
parent 9b63d981b0
commit 0ee89cf052
38 changed files with 1426 additions and 562 deletions
@@ -0,0 +1,22 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { enrichExecutionPlan } from "../execution";
describe("enrichExecutionPlan with Alpaca account data", () => {
beforeEach(() => {
process.env.DEFAULT_ACCOUNT_EQUITY = "10000";
});
afterEach(() => {
delete process.env.DEFAULT_ACCOUNT_EQUITY;
});
it("uses input.account.cash for sizing when provided", () => {
const decision: any = { action: "buy" };
const input = { technicalData: { prices: [50, 52, 51] }, account: { cash: 5000 } };
const out = enrichExecutionPlan(decision, input);
// entryPrice = 51, ATR ~ 1.5 -> stopDistance = 1.5*1.5 = 2.25
// riskAmount = 5000 * 0.01 = 50 -> amount = floor(50 / 2.25) = 22
expect(out.executionPlan.amount).toBe(22);
});
});