mirror of
https://github.com/we-promise/sure.git
synced 2026-04-23 22:14:08 +00:00
FIX holdings and exchange rate (#345)
* FIX holdings and exchange rate - Fix holdings not showing total return instead showing day change % - Fix exchange rate saving 0 for holidays, use LOCF - Last Observation Carried Forward * Fix failing test
This commit is contained in:
@@ -74,7 +74,7 @@ class Provider::TwelveData < Provider
|
||||
data.map do |resp|
|
||||
rate = resp.dig("close")
|
||||
date = resp.dig("datetime")
|
||||
if rate.nil?
|
||||
if rate.nil? || rate.to_f <= 0
|
||||
Rails.logger.warn("#{self.class.name} returned invalid rate data for pair from: #{from} to: #{to} on: #{date}. Rate data: #{rate.inspect}")
|
||||
next
|
||||
end
|
||||
@@ -178,7 +178,7 @@ class Provider::TwelveData < Provider
|
||||
values.map do |resp|
|
||||
price = resp.dig("close")
|
||||
date = resp.dig("datetime")
|
||||
if price.nil?
|
||||
if price.nil? || price.to_f <= 0
|
||||
Rails.logger.warn("#{self.class.name} returned invalid price data for security #{symbol} on: #{date}. Price data: #{price.inspect}")
|
||||
next
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user