mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Security resolver and health checker (#2281)
* Setup health check * Security health checker cron * Use resolver throughout codebase * Use resolver for trade builder * Add security health checks to schedule * Handle no provider * Lint fixes
This commit is contained in:
parent
857436d894
commit
e4ee06c9f6
19 changed files with 599 additions and 78 deletions
|
@ -9,6 +9,8 @@ class Security < ApplicationRecord
|
|||
validates :ticker, presence: true
|
||||
validates :ticker, uniqueness: { scope: :exchange_operating_mic, case_sensitive: false }
|
||||
|
||||
scope :online, -> { where(offline: false) }
|
||||
|
||||
def current_price
|
||||
@current_price ||= find_or_fetch_price
|
||||
return nil if @current_price.nil?
|
||||
|
@ -25,10 +27,6 @@ class Security < ApplicationRecord
|
|||
)
|
||||
end
|
||||
|
||||
def has_prices?
|
||||
exchange_operating_mic.present?
|
||||
end
|
||||
|
||||
private
|
||||
def upcase_symbols
|
||||
self.ticker = ticker.upcase
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue