mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-08 15:05:22 +02:00
Market data sync refinements (#2252)
* Exchange rate syncer implementation * Security price syncer * Fix issues with provider API * Add back prod schedule * Add back price and exchange rate syncs to account syncs * Remove unused stock_exchanges table
This commit is contained in:
parent
6917cecf33
commit
6dc1d22672
38 changed files with 1206 additions and 1615 deletions
|
@ -1,7 +1,20 @@
|
|||
# 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 SyncMarketDataJob < ApplicationJob
|
||||
queue_as :scheduled
|
||||
|
||||
def perform
|
||||
MarketDataSyncer.new.sync_all
|
||||
def perform(opts)
|
||||
opts = opts.symbolize_keys
|
||||
mode = opts.fetch(:mode, :full)
|
||||
clear_cache = opts.fetch(:clear_cache, false)
|
||||
|
||||
MarketDataSyncer.new(mode: mode, clear_cache: clear_cache).sync
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue