Files
maybe/app/jobs/securities_import_job.rb
Josh Pigford aa3342b0dc Stock imports (#1363)
* Initial pass

* Marketstack data provider

* Marketstack data provider

* Refactor a bit
2024-10-24 16:36:50 -05:00

14 lines
382 B
Ruby

class SecuritiesImportJob < ApplicationJob
queue_as :default
def perform(country_code = nil)
exchanges = StockExchange.in_country(country_code)
market_stack_client = Provider::Marketstack.new(ENV["MARKETSTACK_API_KEY"])
exchanges.each do |exchange|
importer = Security::Importer.new(market_stack_client, exchange.mic)
importer.import
end
end
end