mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
Plaid sync tests and multi-currency investment support (#1531)
* Plaid sync tests and multi-currency investment support * Fix system test * Cleanup * Remove data migration
This commit is contained in:
parent
b2a56aefc1
commit
800eb4c146
21 changed files with 406 additions and 165 deletions
|
@ -43,18 +43,23 @@ class Provider::Synth
|
|||
)
|
||||
end
|
||||
|
||||
def fetch_security_prices(ticker:, mic_code:, start_date:, end_date:)
|
||||
prices = paginate(
|
||||
"#{base_url}/tickers/#{ticker}/open-close",
|
||||
mic_code: mic_code,
|
||||
def fetch_security_prices(ticker:, start_date:, end_date:, mic_code: nil)
|
||||
params = {
|
||||
start_date: start_date,
|
||||
end_date: end_date
|
||||
}
|
||||
|
||||
params[:mic_code] = mic_code if mic_code.present?
|
||||
|
||||
prices = paginate(
|
||||
"#{base_url}/tickers/#{ticker}/open-close",
|
||||
params
|
||||
) do |body|
|
||||
body.dig("prices").map do |price|
|
||||
{
|
||||
date: price.dig("date"),
|
||||
price: price.dig("close")&.to_f || price.dig("open")&.to_f,
|
||||
currency: "USD"
|
||||
currency: price.dig("currency") || "USD"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue