feat: add paper trading capital controls — API endpoint + UI with presets, fix status/metrics to read real state, fix migration duplicates
This commit is contained in:
@@ -320,6 +320,7 @@ CREATE INDEX idx_notifications_event ON notifications(event_type, created_at DES
|
||||
-- ============================================================
|
||||
|
||||
-- Insert default trading engine configuration (moderate tier defaults)
|
||||
-- Use a singleton pattern: only insert if no rows exist
|
||||
INSERT INTO trading_engine_config (
|
||||
enabled, paused, risk_tier, reserve_siphon_pct,
|
||||
polling_interval_seconds, gradual_entry_tranches,
|
||||
@@ -339,7 +340,8 @@ INSERT INTO trading_engine_config (
|
||||
notification_sms_enabled, notification_email_enabled,
|
||||
notification_rate_limit_sms_per_hour, notification_rate_limit_email_per_hour,
|
||||
notification_daily_summary_time
|
||||
) VALUES (
|
||||
)
|
||||
SELECT
|
||||
FALSE, FALSE, 'moderate', 0.20,
|
||||
60, 3,
|
||||
30.0, 15,
|
||||
@@ -358,8 +360,9 @@ INSERT INTO trading_engine_config (
|
||||
FALSE, FALSE,
|
||||
10, 20,
|
||||
'16:30'
|
||||
);
|
||||
WHERE NOT EXISTS (SELECT 1 FROM trading_engine_config);
|
||||
|
||||
-- Insert initial reserve pool ledger entry with zero balance
|
||||
-- Insert initial reserve pool ledger entry with zero balance (only if empty)
|
||||
INSERT INTO reserve_pool_ledger (amount, balance_after, trigger_type, notes)
|
||||
VALUES (0.0, 0.0, 'initial', 'Initial reserve pool entry');
|
||||
SELECT 0.0, 0.0, 'initial', 'Initial reserve pool entry'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM reserve_pool_ledger);
|
||||
|
||||
Reference in New Issue
Block a user