mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-27 09:09:41 +02:00
Fix for certain securities returning incorrect prices
This commit is contained in:
parent
154a1a971b
commit
31d9d926f7
4 changed files with 8 additions and 8 deletions
|
@ -12,9 +12,7 @@ class FetchSecurityInfoJob < ApplicationJob
|
||||||
)
|
)
|
||||||
|
|
||||||
security.update(
|
security.update(
|
||||||
name: security_info_response.info.dig("name"),
|
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")
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,9 +31,10 @@ class Account::TradeBuilder < Account::EntryBuilder
|
||||||
end
|
end
|
||||||
|
|
||||||
def security
|
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)
|
FetchSecurityInfoJob.perform_later(security.id)
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,8 @@ class Provider::Synth
|
||||||
name: security.dig("name"),
|
name: security.dig("name"),
|
||||||
logo_url: security.dig("logo_url"),
|
logo_url: security.dig("logo_url"),
|
||||||
exchange_acronym: security.dig("exchange", "acronym"),
|
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
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Security::SynthComboboxOption
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
include Providable
|
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
|
class << self
|
||||||
def find_in_synth(query)
|
def find_in_synth(query)
|
||||||
|
@ -18,7 +18,7 @@ class Security::SynthComboboxOption
|
||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
"#{symbol}|#{exchange_mic}" # submitted by combobox as value
|
"#{symbol}|#{exchange_mic}|#{exchange_acronym}|#{exchange_country_code}" # submitted by combobox as value
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_combobox_display
|
def to_combobox_display
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue