feat: Add Twelve Data provider for exchange rates and securities (#2)

* feat: Add Twelve Data provider for exchange rates and securities

* test: fix hosting controller test, linting

* fix: add countries gem to handle country codes in Twelve Data provider

* fix: allow security search combobox to have no logo

* refactor: update Twelve Data provider use time series endpoint

* fix: set twelve data as default provider
This commit is contained in:
Vincent Teo
2025-08-01 07:31:37 +10:00
committed by GitHub
parent 2458fa90c8
commit 5bdefe6e63
19 changed files with 301 additions and 9 deletions

View File

@@ -8,6 +8,9 @@ class Settings::HostingsController < ApplicationController
def show
synth_provider = Provider::Registry.get_provider(:synth)
@synth_usage = synth_provider&.usage
twelve_data_provider = Provider::Registry.get_provider(:twelve_data)
@twelve_data_usage = twelve_data_provider&.usage
end
def update
@@ -23,6 +26,10 @@ class Settings::HostingsController < ApplicationController
Setting.synth_api_key = hosting_params[:synth_api_key]
end
if hosting_params.key?(:twelve_data_api_key)
Setting.twelve_data_api_key = hosting_params[:twelve_data_api_key]
end
redirect_to settings_hosting_path, notice: t(".success")
rescue ActiveRecord::RecordInvalid => error
flash.now[:alert] = t(".failure")
@@ -36,7 +43,7 @@ class Settings::HostingsController < ApplicationController
private
def hosting_params
params.require(:setting).permit(:require_invite_for_signup, :require_email_confirmation, :synth_api_key)
params.require(:setting).permit(:require_invite_for_signup, :require_email_confirmation, :synth_api_key, :twelve_data_api_key)
end
def ensure_admin