mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Groundwork for security info (#1396)
* Groundwork for security info * Lint
This commit is contained in:
parent
5e2b932648
commit
e7f09e6f71
4 changed files with 44 additions and 1 deletions
20
app/jobs/fetch_security_info_job.rb
Normal file
20
app/jobs/fetch_security_info_job.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class FetchSecurityInfoJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(security_id)
|
||||
return unless Security.security_info_provider.present?
|
||||
|
||||
security = Security.find(security_id)
|
||||
|
||||
security_info_response = Security.security_info_provider.fetch_security_info(
|
||||
ticker: security.ticker,
|
||||
mic_code: security.exchange_mic
|
||||
)
|
||||
|
||||
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")
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue