<%= t(".exchange_rate_title") %>
<%= t(".exchange_rate_description") %>
<%= styled_form_with model: Setting.new,
url: settings_hosting_path,
method: :patch,
data: {
controller: "auto-submit-form",
"auto-submit-form-trigger-event-value": "change"
} do |form| %>
<%= form.select :exchange_rate_provider,
[
[t(".providers.twelve_data"), "twelve_data"],
[t(".providers.yahoo_finance"), "yahoo_finance"]
],
{ label: t(".exchange_rate_provider_label") },
{
value: ENV.fetch("EXCHANGE_RATE_PROVIDER", Setting.exchange_rate_provider),
disabled: ENV["EXCHANGE_RATE_PROVIDER"].present?,
data: { "auto-submit-form-target": "auto" }
} %>
<% end %>
<%# Securities Providers - multiple checkboxes %>
<%= t(".securities_title") %>
<%= t(".securities_description") %>
<%= styled_form_with model: Setting.new,
url: settings_hosting_path,
method: :patch,
data: {
controller: "auto-submit-form"
} do |form| %>
<% disabled = ENV["SECURITIES_PROVIDERS"].present? || ENV["SECURITIES_PROVIDER"].present? %>
<% enabled_providers = Setting.enabled_securities_providers %>
<%# Hidden field to ensure empty array is submitted when all unchecked %>
<% [
["twelve_data", t(".providers.twelve_data"), t(".twelve_data_hint")],
["yahoo_finance", t(".providers.yahoo_finance"), t(".yahoo_finance_hint")],
["tiingo", t(".providers.tiingo"), t(".requires_api_key")],
["eodhd", t(".providers.eodhd"), t(".requires_api_key_eodhd")],
["alpha_vantage", t(".providers.alpha_vantage"), t(".requires_api_key_alpha_vantage")],
["mfapi", t(".providers.mfapi"), t(".mfapi_hint")],
["binance_public", t(".providers.binance_public"), t(".binance_public_hint")],
].each do |value, label, hint| %>
<% end %>
<% end %>
<% if ENV["EXCHANGE_RATE_PROVIDER"].present? || ENV["SECURITIES_PROVIDERS"].present? || ENV["SECURITIES_PROVIDER"].present? %>
<%= render DS::Alert.new(message: t(".env_configured_message"), variant: :warning) %>
<% end %>