1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00
Maybe/app/jobs/securities_import_job.rb

14 lines
382 B
Ruby
Raw Normal View History

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