mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-18 20:59:39 +02:00
* add kind to transaction model * Basic transfer creator * Fix method naming conflict * Creator form pattern * Remove stale methods * Tweak migration * Remove BaseQuery, write entire query in each class for clarity * Query optimizations * Remove unused exchange rate query lines * Remove temporary cache-warming strategy * Fix test * Update transaction search * Decouple transactions endpoint from IncomeStatement * Clean up transactions controller * Update cursor rules * Cleanup comments, logic in search * Fix totals logic on transactions view * Fix pagination * Optimize search totals query * Default to last 30 days on transactions page if no filters * Decouple transactions list from transfer details * Revert transfer route * Migration reset * Bundle update * Fix matching logic, tests * Remove unused code
22 lines
932 B
Ruby
22 lines
932 B
Ruby
# This job runs daily at market close. See config/schedule.yml for details.
|
|
#
|
|
# The primary purpose of this job is to:
|
|
# 1. Determine what exchange rate pairs, security prices, and other market data all of our users need to view historical account balance data
|
|
# 2. For each needed rate/price, fetch from our data provider and upsert to our database
|
|
#
|
|
# Each individual account sync will still fetch any missing market data that isn't yet synced, but by running
|
|
# this job daily, we significantly reduce overlapping account syncs that both need the same market data (e.g. common security like `AAPL`)
|
|
#
|
|
class ImportMarketDataJob < ApplicationJob
|
|
queue_as :scheduled
|
|
|
|
def perform(opts)
|
|
return if Rails.env.development?
|
|
|
|
opts = opts.symbolize_keys
|
|
mode = opts.fetch(:mode, :full)
|
|
clear_cache = opts.fetch(:clear_cache, false)
|
|
|
|
MarketDataImporter.new(mode: mode, clear_cache: clear_cache).import_all
|
|
end
|
|
end
|