diff --git a/app/jobs/fetch_security_info_job.rb b/app/jobs/fetch_security_info_job.rb index 2612f633..7dff6d0f 100644 --- a/app/jobs/fetch_security_info_job.rb +++ b/app/jobs/fetch_security_info_job.rb @@ -12,9 +12,7 @@ class FetchSecurityInfoJob < ApplicationJob ) security.update( - name: security_info_response.info.dig("name"), - exchange_acronym: security_info_response.info.dig("exchange", "acronym"), - country_code: security_info_response.info.dig("exchange", "country_code") + name: security_info_response.info.dig("name") ) end end diff --git a/app/models/account/trade_builder.rb b/app/models/account/trade_builder.rb index eefdac29..ec252897 100644 --- a/app/models/account/trade_builder.rb +++ b/app/models/account/trade_builder.rb @@ -31,9 +31,10 @@ class Account::TradeBuilder < Account::EntryBuilder end def security - ticker_symbol, exchange_mic = ticker.split("|") + ticker_symbol, exchange_mic, exchange_acronym, exchange_country_code = ticker.split("|") - security = Security.find_or_create_by(ticker: ticker_symbol, exchange_mic: exchange_mic) + security = Security.find_or_create_by(ticker: ticker_symbol, exchange_mic: exchange_mic, country_code: exchange_country_code) + security.update(exchange_acronym: exchange_acronym) FetchSecurityInfoJob.perform_later(security.id) diff --git a/app/models/provider/synth.rb b/app/models/provider/synth.rb index 764d670f..0e367f1e 100644 --- a/app/models/provider/synth.rb +++ b/app/models/provider/synth.rb @@ -138,7 +138,8 @@ class Provider::Synth name: security.dig("name"), logo_url: security.dig("logo_url"), exchange_acronym: security.dig("exchange", "acronym"), - exchange_mic: security.dig("exchange", "mic_code") + exchange_mic: security.dig("exchange", "mic_code"), + exchange_country_code: security.dig("exchange", "country_code") } end diff --git a/app/models/security/synth_combobox_option.rb b/app/models/security/synth_combobox_option.rb index 6b2f9dc4..efd81db6 100644 --- a/app/models/security/synth_combobox_option.rb +++ b/app/models/security/synth_combobox_option.rb @@ -2,7 +2,7 @@ class Security::SynthComboboxOption include ActiveModel::Model include Providable - attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_mic + attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_mic, :exchange_country_code class << self def find_in_synth(query) @@ -18,7 +18,7 @@ class Security::SynthComboboxOption end def id - "#{symbol}|#{exchange_mic}" # submitted by combobox as value + "#{symbol}|#{exchange_mic}|#{exchange_acronym}|#{exchange_country_code}" # submitted by combobox as value end def to_combobox_display