From 87dd655f08e7e89d20f83497208fa2c6d81f191e Mon Sep 17 00:00:00 2001 From: zwitschi Date: Wed, 3 Jun 2026 18:43:36 +0200 Subject: [PATCH] feat: add pair fees configuration panel and related functionality - Introduced a new HTML template for configuring pair fees, allowing users to add, edit, and delete fees for trading pairs. - Implemented a responsive fee table displaying existing fees with options for editing and deleting. - Added a form for adding new fees, including fields for base asset, quote asset, market type, and fee rates. - Removed outdated templates related to backtesting, dashboard, health, and various partials to streamline the codebase. - Ensured the new fee configuration panel integrates seamlessly with existing endpoints and uses htmx for dynamic updates. --- src/arbitrade/web/templates/config.html | 37 ++ src/arbitrade/web/templates/dashboard.html | 1 + .../web/templates/partials/config.html | 614 ++++++++++++++++++ .../web/templates/partials/config_fees.html | 214 ++++++ web/templates/backtesting.html | 24 - web/templates/base.html | 148 ----- web/templates/dashboard.html | 180 ----- web/templates/health.html | 14 - web/templates/partials/audit.html | 37 -- web/templates/partials/backtesting_panel.html | 142 ---- web/templates/partials/charts.html | 37 -- web/templates/partials/controls.html | 171 ----- web/templates/partials/metrics.html | 31 - web/templates/partials/overview.html | 67 -- 14 files changed, 866 insertions(+), 851 deletions(-) create mode 100644 src/arbitrade/web/templates/config.html create mode 100644 src/arbitrade/web/templates/partials/config.html create mode 100644 src/arbitrade/web/templates/partials/config_fees.html delete mode 100644 web/templates/backtesting.html delete mode 100644 web/templates/base.html delete mode 100644 web/templates/dashboard.html delete mode 100644 web/templates/health.html delete mode 100644 web/templates/partials/audit.html delete mode 100644 web/templates/partials/backtesting_panel.html delete mode 100644 web/templates/partials/charts.html delete mode 100644 web/templates/partials/controls.html delete mode 100644 web/templates/partials/metrics.html delete mode 100644 web/templates/partials/overview.html diff --git a/src/arbitrade/web/templates/config.html b/src/arbitrade/web/templates/config.html new file mode 100644 index 0000000..fa56b43 --- /dev/null +++ b/src/arbitrade/web/templates/config.html @@ -0,0 +1,37 @@ +{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block +main_class %}shell{% endblock %} {% block content %} +
+
+

Configuration

+

+ Runtime settings, alerts, exchange, risk, and strategy. +

+
+ +
+ +
+ {% include "partials/config_fees.html" %} +
+ +
+ {% include "partials/config.html" %} +
+ +{% endblock %} diff --git a/src/arbitrade/web/templates/dashboard.html b/src/arbitrade/web/templates/dashboard.html index b6be1fa..4751afe 100644 --- a/src/arbitrade/web/templates/dashboard.html +++ b/src/arbitrade/web/templates/dashboard.html @@ -18,6 +18,7 @@ head_scripts %} >Refresh metrics Health + Config Backtesting diff --git a/src/arbitrade/web/templates/partials/config.html b/src/arbitrade/web/templates/partials/config.html new file mode 100644 index 0000000..e3e46d7 --- /dev/null +++ b/src/arbitrade/web/templates/partials/config.html @@ -0,0 +1,614 @@ +
+
+ +
+
Runtime
+ + + + + + + + + + + + + + + + +
+ + +
+
Alerting
+ + + + + + + +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
Kraken Exchange
+ + + + + + + + + + + +
+ + +
+
Risk Limits
+ + + + + + +
+ + +
+
Stat-Arb Strategy
+ + {% if strategy_stat_arb_enabled %} + + + + + {% endif %} +
+ + +
+ +
+
+
diff --git a/src/arbitrade/web/templates/partials/config_fees.html b/src/arbitrade/web/templates/partials/config_fees.html new file mode 100644 index 0000000..8d6b403 --- /dev/null +++ b/src/arbitrade/web/templates/partials/config_fees.html @@ -0,0 +1,214 @@ +
+
+

Pair Fees

+ +
+ + {% if error %} +
+ {{ error }} +
+ {% endif %} + + + {% if pair_fees %} +
+ + + + + + + + + + + + + {% for fee in pair_fees %} + + + + + + + + + {% endfor %} + +
Pair + Market Type + + Maker Rate + + Taker Rate + + Updated + + Actions +
{{ fee.pair_display }}{{ fee.market_type }}{{ "%.4f"|format(fee.maker_fee_rate) }}{{ "%.4f"|format(fee.taker_fee_rate) }} + {{ fee.updated_at or "—" }} + +
+ + + + + + + +
+
+ + + + + +
+
+
+ {% else %} +
+ No pair fees configured. Click "Add / Edit Fee" to create one. +
+ {% endif %} + + + +
diff --git a/web/templates/backtesting.html b/web/templates/backtesting.html deleted file mode 100644 index 7519e75..0000000 --- a/web/templates/backtesting.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block -content %} -
-
-

Backtesting

-

- Replay controls, run status, and recent summary reports. -

-
-
- Dashboard -
-
- -
- {% include "partials/backtesting_panel.html" %} -
-{% endblock %} diff --git a/web/templates/base.html b/web/templates/base.html deleted file mode 100644 index 4155859..0000000 --- a/web/templates/base.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - {% block title %}{{ title or "Arbitrade" }}{% endblock %} - - {% block head_scripts %}{% endblock %} - - {% block extra_style %}{% endblock %} - - -
- {% block content %}{% endblock %} -
- {% block scripts %}{% endblock %} - - diff --git a/web/templates/dashboard.html b/web/templates/dashboard.html deleted file mode 100644 index b6be1fa..0000000 --- a/web/templates/dashboard.html +++ /dev/null @@ -1,180 +0,0 @@ -{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block -head_scripts %} - - -{% endblock %} {% block main_class %}shell{% endblock %} {% block content %} -
-
-

Arbitrade Dashboard

-

Live execution, P&L, and system state.

-
- -
- -
- {% include "partials/metrics.html" %} -
- -
- {% include "partials/overview.html" %} -
- -
- {% include "partials/controls.html" %} -
- -
- {% include "partials/charts.html" %} -
- -
- {% include "partials/audit.html" %} -
-{% endblock %} {% block scripts %} - -{% endblock %} diff --git a/web/templates/health.html b/web/templates/health.html deleted file mode 100644 index aa86fd0..0000000 --- a/web/templates/health.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -
-

Arbitrade Bootstrap Complete

-

Status: {{ status }}

-

UTC: {{ time }}

-

- Health JSON: - refresh -

-
{"status":"ok","service":"arbitrade"}
-
-{% endblock %} diff --git a/web/templates/partials/audit.html b/web/templates/partials/audit.html deleted file mode 100644 index 2aa55db..0000000 --- a/web/templates/partials/audit.html +++ /dev/null @@ -1,37 +0,0 @@ -
-
Audit Trail
-
Generated {{ generated_at }}
- -
- - - - - - - - - - - - - {% if entries %} - {% for entry in entries %} - - - - - - - - - {% endfor %} - {% else %} - - - - {% endif %} - -
TimeActorEventDecisionPayloadCorrelation
{{ entry.occurred_at }}{{ entry.actor }}{{ entry.event_type }}{{ entry.decision }}{{ entry.payload }}{{ entry.correlation_id }}
No audit entries yet.
-
-
diff --git a/web/templates/partials/backtesting_panel.html b/web/templates/partials/backtesting_panel.html deleted file mode 100644 index 15b665d..0000000 --- a/web/templates/partials/backtesting_panel.html +++ /dev/null @@ -1,142 +0,0 @@ -
-
-
-
Run Status
-
{{ status }}
-
{{ message }}
-
-
-
Latest Report
- {% if latest_report %} -
Run at {{ latest_report.run_at }}
-
Events: {{ latest_report.events_path }}
-
- Processed: {{ latest_report.report.processed_events }} -
-
- Opportunities: {{ latest_report.report.opportunities_seen }} -
-
Trades: {{ latest_report.report.trades_executed }}
-
- Realized P&L: {{ - '%.4f'|format(latest_report.report.realized_pnl_usd) }} USD -
-
- Max drawdown: {{ '%.4f'|format(latest_report.report.max_drawdown_usd) }} - USD -
- {% else %} -
No runs yet.
- {% endif %} -
-
- -
-
Run Backtest
-
- - - - - - - - - -
-
- -
-
Recent Runs
- {% if recent_reports %} {% for item in recent_reports %} -
- {{ item.run_at }} | {{ item.events_path }} | trades={{ - item.report.trades_executed }} | pnl={{ - '%.4f'|format(item.report.realized_pnl_usd) }} USD -
- {% endfor %} {% else %} -
No recent reports yet.
- {% endif %} -
-
diff --git a/web/templates/partials/charts.html b/web/templates/partials/charts.html deleted file mode 100644 index 91c51df..0000000 --- a/web/templates/partials/charts.html +++ /dev/null @@ -1,37 +0,0 @@ -
-
-
-
Opportunity Trend
-
Recent opportunities from DuckDB. Updated {{ generated_at }}
-
- -
- -
-
- {% if has_chart_data %} - - - {% else %} -
No opportunity data yet.
- {% endif %} -
-
-
\ No newline at end of file diff --git a/web/templates/partials/controls.html b/web/templates/partials/controls.html deleted file mode 100644 index a5f968b..0000000 --- a/web/templates/partials/controls.html +++ /dev/null @@ -1,171 +0,0 @@ -
-
-
-
Runtime Status
-
{{ execution_status }}
-
Updated {{ updated_at }}
-
-
-
Kill Switch
-
{{ kill_switch_status }}
-
Reason {{ kill_switch_reason }}
-
-
-
Config Snapshot
-
Paper trading: {{ paper_trading_mode }}
-
Trade capital: {{ trade_capital_usd }}
-
Max trade capital: {{ max_trade_capital_usd }}
-
Max concurrent trades: {{ max_concurrent_trades }}
-
Tradable pairs: {{ tradable_pairs_display }}
-
Strategy mode: {{ strategy_mode }}
-
Profit threshold: {{ strategy_profit_threshold }}
-
Max depth levels: {{ strategy_max_depth_levels }}
-
-
-
Alerting
-
Status: {{ alerts_enabled }}
-
Channels: {{ alerts_channels }}
-
Min severity: {{ alerts_min_severity }}
-
Dedup window: {{ alerts_dedup_seconds }}s
-
Last result: {{ alerts_last_result }}
-
Last attempted: {{ alerts_last_attempted_at }}
-
Last success: {{ alerts_last_success_at }}
-
Last event: {{ alerts_last_event_title }}
-
Last error: {{ alerts_last_error }}
- {% if alerts_last_channel_results %} {% for item in - alerts_last_channel_results %} -
{{ item }}
- {% endfor %} {% endif %} -
-
- -
-
-
Execution Controls
-
-
- -
-
- -
-
- - -
-
-
-
-
Edit Config
-
- - - - - - - - - -
-
-
-
diff --git a/web/templates/partials/metrics.html b/web/templates/partials/metrics.html deleted file mode 100644 index 1748e29..0000000 --- a/web/templates/partials/metrics.html +++ /dev/null @@ -1,31 +0,0 @@ -
-
-
-
Realized P&L
-
{{ realized_pnl }}
-
-
-
Win Rate
-
{{ win_rate }}
-
-
-
Avg Trade Duration
-
{{ avg_trade_duration }}
-
-
-
Opportunities / Min
-
{{ opportunities_per_minute }}
-
-
-
Fill Rate
-
{{ fill_rate }}
-
-
-
Latency p50 / p95 / p99
-
- {{ latency_p50 }} | {{ latency_p95 }} | {{ latency_p99 }} -
-
-
-
Updated {{ generated_at }}
-
diff --git a/web/templates/partials/overview.html b/web/templates/partials/overview.html deleted file mode 100644 index 6787b51..0000000 --- a/web/templates/partials/overview.html +++ /dev/null @@ -1,67 +0,0 @@ -
-
-
-
Status
-
{{ status }}
-
-
-
Balances
-
{{ balances }}
-
-
-
Open Trades
-
{{ open_trade_count }}
-
-
-
Realized P&L
-
{{ realized_pnl_total }}
-
-
- -
-
-
Open Trades
-
    - {% for trade in open_trades %} -
  • - {{ trade.trade_ref }} - {{ trade.status }} - {{ trade.cycle }} - {{ - trade.started_at }} -
  • - {% else %} -
  • No open trades.
  • - {% endfor %} -
-
-
-
Balances Snapshot
-
- {{ balances }} -
-
Total value {{ total_value }}
-
-
-
Opportunity Feed
-
    - {% for opp in opportunities %} -
  • - {{ opp.cycle }} - {{ opp.net_pct }} - {{ opp.est_profit }} - {{ - opp.detected_at }} -
  • - {% else %} -
  • No opportunities.
  • - {% endfor %} -
-
-
- -
Updated {{ generated_at }}
-