mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Add security prices provider (Synth integration) (#1039)
* User tickers as primary lookup symbol instead of isin * Add security price provider * Fetch security prices in bulk to improve sync performance * Fetch prices in bulk, better mocking for tests
This commit is contained in:
parent
c70c8b6d86
commit
453a54e5e6
33 changed files with 584 additions and 118 deletions
|
@ -8,8 +8,8 @@ module ExchangeRateProviderInterfaceTest
|
|||
end
|
||||
|
||||
test "exchange rate provider response contract" do
|
||||
accounting_for_http_calls do
|
||||
response = @subject.fetch_exchange_rate from: "USD", to: "MXN", date: Date.current
|
||||
VCR.use_cassette "synth/exchange_rate" do
|
||||
response = @subject.fetch_exchange_rate from: "USD", to: "MXN", date: Date.iso8601("2024-08-01")
|
||||
|
||||
assert_respond_to response, :rate
|
||||
assert_respond_to response, :success?
|
||||
|
@ -17,11 +17,4 @@ module ExchangeRateProviderInterfaceTest
|
|||
assert_respond_to response, :raw_response
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def accounting_for_http_calls
|
||||
VCR.use_cassette "synth_exchange_rate" do
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
20
test/interfaces/security_price_provider_interface_test.rb
Normal file
20
test/interfaces/security_price_provider_interface_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require "test_helper"
|
||||
|
||||
module SecurityPriceProviderInterfaceTest
|
||||
extend ActiveSupport::Testing::Declarative
|
||||
|
||||
test "security price provider interface" do
|
||||
assert_respond_to @subject, :fetch_security_prices
|
||||
end
|
||||
|
||||
test "security price provider response contract" do
|
||||
VCR.use_cassette "synth/security_prices" do
|
||||
response = @subject.fetch_security_prices ticker: "AAPL", start_date: Date.iso8601("2024-01-01"), end_date: Date.iso8601("2024-08-01")
|
||||
|
||||
assert_respond_to response, :prices
|
||||
assert_respond_to response, :success?
|
||||
assert_respond_to response, :error
|
||||
assert_respond_to response, :raw_response
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue