mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +02:00
Security price syncer
This commit is contained in:
parent
4a50c09c24
commit
dbae195923
23 changed files with 503 additions and 347 deletions
|
@ -11,6 +11,7 @@ module Account::Convertible
|
||||||
from: currency,
|
from: currency,
|
||||||
to: target_currency,
|
to: target_currency,
|
||||||
start_date: start_date,
|
start_date: start_date,
|
||||||
|
end_date: Date.current
|
||||||
)
|
)
|
||||||
|
|
||||||
Rails.logger.info("Synced #{affected_row_count} exchange rates for account #{id}")
|
Rails.logger.info("Synced #{affected_row_count} exchange rates for account #{id}")
|
||||||
|
|
|
@ -27,6 +27,7 @@ module ExchangeRate::Provided
|
||||||
rate
|
rate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [Integer] The number of exchange rates synced
|
||||||
def sync_provider_rates(from:, to:, start_date:, end_date:, clear_cache: false)
|
def sync_provider_rates(from:, to:, start_date:, end_date:, clear_cache: false)
|
||||||
unless provider.present?
|
unless provider.present?
|
||||||
Rails.logger.warn("No provider configured for ExchangeRate.sync_provider_rates")
|
Rails.logger.warn("No provider configured for ExchangeRate.sync_provider_rates")
|
||||||
|
|
|
@ -66,13 +66,19 @@ class ExchangeRate::Syncer
|
||||||
def upsert_rows(rows)
|
def upsert_rows(rows)
|
||||||
batch_size = 200
|
batch_size = 200
|
||||||
|
|
||||||
|
total_upsert_count = 0
|
||||||
|
|
||||||
rows.each_slice(batch_size) do |batch|
|
rows.each_slice(batch_size) do |batch|
|
||||||
ExchangeRate.upsert_all(
|
upserted_ids = ExchangeRate.upsert_all(
|
||||||
batch,
|
batch,
|
||||||
unique_by: %i[from_currency to_currency date],
|
unique_by: %i[from_currency to_currency date],
|
||||||
returning: false
|
returning: [ "id" ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
total_upsert_count += upserted_ids.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
total_upsert_count
|
||||||
end
|
end
|
||||||
|
|
||||||
# Since provider may not return values on weekends and holidays, we grab the first rate from the provider that is on or before the start date
|
# Since provider may not return values on weekends and holidays, we grab the first rate from the provider that is on or before the start date
|
||||||
|
|
|
@ -3,11 +3,6 @@ class MarketDataSyncer
|
||||||
RATE_PROVIDER_NAME = :synth
|
RATE_PROVIDER_NAME = :synth
|
||||||
PRICE_PROVIDER_NAME = :synth
|
PRICE_PROVIDER_NAME = :synth
|
||||||
|
|
||||||
MissingExchangeRateError = Class.new(StandardError)
|
|
||||||
InvalidExchangeRateDataError = Class.new(StandardError)
|
|
||||||
MissingSecurityPriceError = Class.new(StandardError)
|
|
||||||
InvalidSecurityPriceDataError = Class.new(StandardError)
|
|
||||||
|
|
||||||
# Syncer can optionally be scoped. Otherwise, it syncs all user data
|
# Syncer can optionally be scoped. Otherwise, it syncs all user data
|
||||||
def initialize(family: nil, account: nil)
|
def initialize(family: nil, account: nil)
|
||||||
@family = family
|
@family = family
|
||||||
|
@ -40,7 +35,15 @@ class MarketDataSyncer
|
||||||
pairs = (entry_pairs + account_pairs).uniq
|
pairs = (entry_pairs + account_pairs).uniq
|
||||||
|
|
||||||
pairs.each do |pair|
|
pairs.each do |pair|
|
||||||
sync_exchange_rate(from: pair.source, to: pair.target, full_history: full_history)
|
start_date = full_history ? find_oldest_required_rate(from_currency: pair.source) : default_start_date
|
||||||
|
|
||||||
|
ExchangeRate.sync_provider_rates(
|
||||||
|
from: pair.source,
|
||||||
|
to: pair.target,
|
||||||
|
start_date: start_date,
|
||||||
|
end_date: end_date,
|
||||||
|
clear_cache: clear_cache
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,99 +54,13 @@ class MarketDataSyncer
|
||||||
end
|
end
|
||||||
|
|
||||||
securities_scope.each do |security|
|
securities_scope.each do |security|
|
||||||
sync_security_price(security: security, full_history: full_history)
|
start_date = full_history ? find_oldest_required_price(security: security) : default_start_date
|
||||||
|
|
||||||
|
security.sync_provider_prices(start_date: start_date, end_date: end_date, clear_cache: clear_cache)
|
||||||
|
security.sync_provider_details(clear_cache: clear_cache)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def sync_security_price(security:, full_history:, clear_cache:)
|
|
||||||
start_date = full_history ? find_oldest_required_price(security: security) : default_start_date
|
|
||||||
|
|
||||||
Rails.logger.info("Syncing security price for: #{security.ticker}, start_date: #{start_date}, end_date: #{end_date}")
|
|
||||||
|
|
||||||
fetched_prices = price_provider.fetch_security_prices(
|
|
||||||
security,
|
|
||||||
start_date: start_date,
|
|
||||||
end_date: end_date
|
|
||||||
)
|
|
||||||
|
|
||||||
unless fetched_prices.success?
|
|
||||||
error = MissingSecurityPriceError.new(
|
|
||||||
"#{PRICE_PROVIDER_NAME} could not fetch security price for: #{security.ticker} between: #{start_date} and: #{Date.current}. Provider error: #{fetched_prices.error.message}"
|
|
||||||
)
|
|
||||||
|
|
||||||
Rails.logger.warn(error.message)
|
|
||||||
Sentry.capture_exception(error, level: :warning)
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
prices_for_upsert = fetched_prices.data.map do |price|
|
|
||||||
if price.security.nil? || price.date.nil? || price.price.nil? || price.currency.nil?
|
|
||||||
error = InvalidSecurityPriceDataError.new(
|
|
||||||
"#{PRICE_PROVIDER_NAME} returned invalid price data for security: #{security.ticker} on: #{price.date}. Price data: #{price.inspect}"
|
|
||||||
)
|
|
||||||
|
|
||||||
Rails.logger.warn(error.message)
|
|
||||||
Sentry.capture_exception(error, level: :warning)
|
|
||||||
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
{
|
|
||||||
security_id: price.security.id,
|
|
||||||
date: price.date,
|
|
||||||
price: price.price,
|
|
||||||
currency: price.currency
|
|
||||||
}
|
|
||||||
end.compact
|
|
||||||
|
|
||||||
Security::Price.upsert_all(
|
|
||||||
prices_for_upsert,
|
|
||||||
unique_by: %i[security_id date currency]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def sync_exchange_rate(from:, to:, full_history:, clear_cache:)
|
|
||||||
start_date = full_history ? find_oldest_required_rate(from_currency: from) : default_start_date
|
|
||||||
|
|
||||||
Rails.logger.info("Syncing exchange rate from: #{from}, to: #{to}, start_date: #{start_date}, end_date: #{end_date}")
|
|
||||||
|
|
||||||
fetched_rates = rate_provider.fetch_exchange_rates(
|
|
||||||
from: from,
|
|
||||||
to: to,
|
|
||||||
start_date: start_date,
|
|
||||||
end_date: end_date
|
|
||||||
)
|
|
||||||
|
|
||||||
unless fetched_rates.success?
|
|
||||||
message = "#{RATE_PROVIDER_NAME} could not fetch exchange rate pair from: #{from} to: #{to} between: #{start_date} and: #{Date.current}. Provider error: #{fetched_rates.error.message}"
|
|
||||||
Rails.logger.warn(message)
|
|
||||||
Sentry.capture_exception(MissingExchangeRateError.new(message))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
rates_for_upsert = fetched_rates.data.map do |rate|
|
|
||||||
if rate.from.nil? || rate.to.nil? || rate.date.nil? || rate.rate.nil?
|
|
||||||
message = "#{RATE_PROVIDER_NAME} returned invalid rate data for pair from: #{from} to: #{to} on: #{rate.date}. Rate data: #{rate.inspect}"
|
|
||||||
Rails.logger.warn(message)
|
|
||||||
Sentry.capture_exception(InvalidExchangeRateDataError.new(message))
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
{
|
|
||||||
from_currency: rate.from,
|
|
||||||
to_currency: rate.to,
|
|
||||||
date: rate.date,
|
|
||||||
rate: rate.rate
|
|
||||||
}
|
|
||||||
end.compact
|
|
||||||
|
|
||||||
ExchangeRate.upsert_all(
|
|
||||||
rates_for_upsert,
|
|
||||||
unique_by: %i[from_currency to_currency date]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
attr_reader :family, :account
|
attr_reader :family, :account
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,22 @@ module Provider::SecurityConcept
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
Security = Data.define(:symbol, :name, :logo_url, :exchange_operating_mic)
|
Security = Data.define(:symbol, :name, :logo_url, :exchange_operating_mic)
|
||||||
SecurityInfo = Data.define(:symbol, :name, :links, :logo_url, :description, :kind)
|
SecurityInfo = Data.define(:symbol, :name, :links, :logo_url, :description, :kind, :exchange_operating_mic)
|
||||||
Price = Data.define(:security, :date, :price, :currency)
|
Price = Data.define(:symbol, :date, :price, :currency, :exchange_operating_mic)
|
||||||
|
|
||||||
def search_securities(symbol, country_code: nil, exchange_operating_mic: nil)
|
def search_securities(symbol, country_code: nil, exchange_operating_mic: nil)
|
||||||
raise NotImplementedError, "Subclasses must implement #search_securities"
|
raise NotImplementedError, "Subclasses must implement #search_securities"
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_info(security)
|
def fetch_security_info(symbol:, exchange_operating_mic:)
|
||||||
raise NotImplementedError, "Subclasses must implement #fetch_security_info"
|
raise NotImplementedError, "Subclasses must implement #fetch_security_info"
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_price(security, date:)
|
def fetch_security_price(symbol:, exchange_operating_mic:, date:)
|
||||||
raise NotImplementedError, "Subclasses must implement #fetch_security_price"
|
raise NotImplementedError, "Subclasses must implement #fetch_security_price"
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_prices(security, start_date:, end_date:)
|
def fetch_security_prices(symbol:, exchange_operating_mic:, start_date:, end_date:)
|
||||||
raise NotImplementedError, "Subclasses must implement #fetch_security_prices"
|
raise NotImplementedError, "Subclasses must implement #fetch_security_prices"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,55 +109,52 @@ class Provider::Synth < Provider
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_info(security)
|
def fetch_security_info(symbol:, exchange_operating_mic:)
|
||||||
with_provider_response do
|
with_provider_response do
|
||||||
response = client.get("#{base_url}/tickers/#{security.ticker}") do |req|
|
response = client.get("#{base_url}/tickers/#{symbol}") do |req|
|
||||||
req.params["mic_code"] = security.exchange_mic if security.exchange_mic.present?
|
req.params["operating_mic"] = exchange_operating_mic
|
||||||
req.params["operating_mic"] = security.exchange_operating_mic if security.exchange_operating_mic.present?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
data = JSON.parse(response.body).dig("data")
|
data = JSON.parse(response.body).dig("data")
|
||||||
|
|
||||||
SecurityInfo.new(
|
SecurityInfo.new(
|
||||||
symbol: data.dig("ticker"),
|
symbol: symbol,
|
||||||
name: data.dig("name"),
|
name: data.dig("name"),
|
||||||
links: data.dig("links"),
|
links: data.dig("links"),
|
||||||
logo_url: data.dig("logo_url"),
|
logo_url: data.dig("logo_url"),
|
||||||
description: data.dig("description"),
|
description: data.dig("description"),
|
||||||
kind: data.dig("kind")
|
kind: data.dig("kind"),
|
||||||
|
exchange_operating_mic: exchange_operating_mic
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_price(security, date:)
|
def fetch_security_price(symbol:, exchange_operating_mic:, date:)
|
||||||
with_provider_response do
|
with_provider_response do
|
||||||
historical_data = fetch_security_prices(security, start_date: date, end_date: date)
|
historical_data = fetch_security_prices(symbol:, exchange_operating_mic:, start_date: date, end_date: date)
|
||||||
|
|
||||||
raise ProviderError, "No prices found for security #{security.ticker} on date #{date}" if historical_data.data.empty?
|
raise ProviderError, "No prices found for security #{symbol} on date #{date}" if historical_data.data.empty?
|
||||||
|
|
||||||
historical_data.data.first
|
historical_data.data.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_security_prices(security, start_date:, end_date:)
|
def fetch_security_prices(symbol:, exchange_operating_mic:, start_date:, end_date:)
|
||||||
with_provider_response do
|
with_provider_response do
|
||||||
params = {
|
params = {
|
||||||
start_date: start_date,
|
start_date: start_date,
|
||||||
end_date: end_date
|
end_date: end_date,
|
||||||
|
operating_mic_code: exchange_operating_mic
|
||||||
}
|
}
|
||||||
|
|
||||||
params[:operating_mic_code] = security.exchange_operating_mic if security.exchange_operating_mic.present?
|
|
||||||
|
|
||||||
data = paginate(
|
data = paginate(
|
||||||
"#{base_url}/tickers/#{security.ticker}/open-close",
|
"#{base_url}/tickers/#{symbol}/open-close",
|
||||||
params
|
params
|
||||||
) do |body|
|
) do |body|
|
||||||
body.dig("prices")
|
body.dig("prices")
|
||||||
end
|
end
|
||||||
|
|
||||||
currency = data.first_page.dig("currency")
|
currency = data.first_page.dig("currency")
|
||||||
country_code = data.first_page.dig("exchange", "country_code")
|
|
||||||
exchange_mic = data.first_page.dig("exchange", "mic_code")
|
|
||||||
exchange_operating_mic = data.first_page.dig("exchange", "operating_mic_code")
|
exchange_operating_mic = data.first_page.dig("exchange", "operating_mic_code")
|
||||||
|
|
||||||
data.paginated.map do |price|
|
data.paginated.map do |price|
|
||||||
|
@ -165,17 +162,18 @@ class Provider::Synth < Provider
|
||||||
price = price.dig("close") || price.dig("open")
|
price = price.dig("close") || price.dig("open")
|
||||||
|
|
||||||
if date.nil? || price.nil?
|
if date.nil? || price.nil?
|
||||||
message = "#{self.class.name} returned invalid price data for security #{security.ticker} on: #{date}. Price data: #{price.inspect}"
|
message = "#{self.class.name} returned invalid price data for security #{symbol} on: #{date}. Price data: #{price.inspect}"
|
||||||
Rails.logger.warn(message)
|
Rails.logger.warn(message)
|
||||||
Sentry.capture_exception(InvalidSecurityPriceError.new(message), level: :warning)
|
Sentry.capture_exception(InvalidSecurityPriceError.new(message), level: :warning)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
Price.new(
|
Price.new(
|
||||||
security: security,
|
symbol: symbol,
|
||||||
date: date,
|
date: date,
|
||||||
price: price,
|
price: price,
|
||||||
currency: currency
|
currency: currency,
|
||||||
|
exchange_operating_mic: exchange_operating_mic
|
||||||
)
|
)
|
||||||
end.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
|
144
app/models/security/price/syncer.rb
Normal file
144
app/models/security/price/syncer.rb
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
class Security::Price::Syncer
|
||||||
|
MissingSecurityPriceError = Class.new(StandardError)
|
||||||
|
MissingStartPriceError = Class.new(StandardError)
|
||||||
|
|
||||||
|
def initialize(security:, security_provider:, start_date:, end_date:, clear_cache: false)
|
||||||
|
@security = security
|
||||||
|
@security_provider = security_provider
|
||||||
|
@start_date = start_date
|
||||||
|
@end_date = normalize_end_date(end_date)
|
||||||
|
@clear_cache = clear_cache
|
||||||
|
end
|
||||||
|
|
||||||
|
# Constructs a daily series of prices for a single security over the date range.
|
||||||
|
# Returns the number of rows upserted.
|
||||||
|
def sync_provider_prices
|
||||||
|
if !clear_cache && all_prices_exist?
|
||||||
|
Rails.logger.info("No new prices to sync for #{security.ticker} between #{start_date} and #{end_date}, skipping")
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if clear_cache && provider_prices.empty?
|
||||||
|
Rails.logger.warn("Could not clear cache for #{security.ticker} between #{start_date} and #{end_date} because provider returned no prices")
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
prev_price_value = start_price_value
|
||||||
|
|
||||||
|
unless prev_price_value.present?
|
||||||
|
error = MissingStartPriceError.new("Could not find a start price for #{security.ticker} on or before #{start_date}")
|
||||||
|
Rails.logger.error(error.message)
|
||||||
|
Sentry.capture_exception(error)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
gapfilled_prices = effective_start_date.upto(end_date).map do |date|
|
||||||
|
db_price_value = db_prices[date]&.price
|
||||||
|
provider_price_value = provider_prices[date]&.price
|
||||||
|
provider_currency = provider_prices[date]&.currency
|
||||||
|
|
||||||
|
chosen_price = if clear_cache
|
||||||
|
provider_price_value || db_price_value # overwrite when possible
|
||||||
|
else
|
||||||
|
db_price_value || provider_price_value # fill gaps
|
||||||
|
end
|
||||||
|
|
||||||
|
# Gap-fill using LOCF (last observation carried forward)
|
||||||
|
chosen_price ||= prev_price_value
|
||||||
|
prev_price_value = chosen_price
|
||||||
|
|
||||||
|
{
|
||||||
|
security_id: security.id,
|
||||||
|
date: date,
|
||||||
|
price: chosen_price,
|
||||||
|
currency: provider_currency || prev_price_currency || db_price_currency || "USD"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
upsert_rows(gapfilled_prices)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
attr_reader :security, :security_provider, :start_date, :end_date, :clear_cache
|
||||||
|
|
||||||
|
def provider_prices
|
||||||
|
@provider_prices ||= begin
|
||||||
|
provider_fetch_start_date = effective_start_date - 5.days
|
||||||
|
|
||||||
|
response = security_provider.fetch_security_prices(
|
||||||
|
security,
|
||||||
|
start_date: provider_fetch_start_date,
|
||||||
|
end_date: end_date
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.success?
|
||||||
|
response.data.index_by(&:date)
|
||||||
|
else
|
||||||
|
msg = "#{security_provider.class.name} could not fetch prices for #{security.ticker} between #{provider_fetch_start_date} and #{end_date}. Provider error: #{response.error.message}"
|
||||||
|
Rails.logger.warn(msg)
|
||||||
|
Sentry.capture_exception(MissingSecurityPriceError.new(msg))
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def db_prices
|
||||||
|
@db_prices ||= Security::Price.where(security_id: security.id, date: start_date..end_date)
|
||||||
|
.order(:date)
|
||||||
|
.to_a
|
||||||
|
.index_by(&:date)
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_prices_exist?
|
||||||
|
db_prices.count == expected_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def expected_count
|
||||||
|
(start_date..end_date).count
|
||||||
|
end
|
||||||
|
|
||||||
|
# Skip over ranges that already exist unless clearing cache
|
||||||
|
def effective_start_date
|
||||||
|
return start_date if clear_cache
|
||||||
|
|
||||||
|
(start_date..end_date).detect { |d| !db_prices.key?(d) } || end_date
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_price_value
|
||||||
|
provider_price_value = provider_prices.select { |date, _| date <= start_date }
|
||||||
|
.max_by { |date, _| date }
|
||||||
|
&.last&.price
|
||||||
|
db_price_value = db_prices[start_date]&.price
|
||||||
|
provider_price_value || db_price_value
|
||||||
|
end
|
||||||
|
|
||||||
|
def upsert_rows(rows)
|
||||||
|
batch_size = 200
|
||||||
|
total_upsert_count = 0
|
||||||
|
|
||||||
|
rows.each_slice(batch_size) do |batch|
|
||||||
|
ids = Security::Price.upsert_all(
|
||||||
|
batch,
|
||||||
|
unique_by: %i[security_id date currency],
|
||||||
|
returning: [ "id" ]
|
||||||
|
)
|
||||||
|
total_upsert_count += ids.count
|
||||||
|
end
|
||||||
|
|
||||||
|
total_upsert_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def db_price_currency
|
||||||
|
db_prices.values.first&.currency
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev_price_currency
|
||||||
|
@prev_price_currency ||= provider_prices.values.first&.currency
|
||||||
|
end
|
||||||
|
|
||||||
|
# Clamp to today (EST) so we never call our price API for a future date (our API is in EST/EDT timezone)
|
||||||
|
def normalize_end_date(requested_end_date)
|
||||||
|
today_est = Date.current.in_time_zone("America/New_York").to_date
|
||||||
|
[ requested_end_date, today_est ].min
|
||||||
|
end
|
||||||
|
end
|
|
@ -49,6 +49,42 @@ module Security::Provided
|
||||||
price
|
price
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sync_provider_details(clear_cache: false)
|
||||||
|
unless provider.present?
|
||||||
|
Rails.logger.warn("No provider configured for Security.sync_provider_details")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.name.present? && self.logo_url.present? && !clear_cache
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
details = provider.fetch_security_info(
|
||||||
|
symbol: ticker,
|
||||||
|
exchange_operating_mic: exchange_operating_mic
|
||||||
|
)
|
||||||
|
|
||||||
|
update(
|
||||||
|
name: details.name,
|
||||||
|
logo_url: details.logo_url,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sync_provider_prices(start_date:, end_date:, clear_cache: false)
|
||||||
|
unless provider.present?
|
||||||
|
Rails.logger.warn("No provider configured for Security.sync_provider_prices")
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: self,
|
||||||
|
security_provider: provider,
|
||||||
|
start_date: start_date,
|
||||||
|
end_date: end_date,
|
||||||
|
clear_cache: clear_cache
|
||||||
|
).sync_provider_prices
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def provider
|
def provider
|
||||||
self.class.provider
|
self.class.provider
|
||||||
|
|
|
@ -129,13 +129,9 @@ class TradeBuilder
|
||||||
def security
|
def security
|
||||||
ticker_symbol, exchange_operating_mic = ticker.present? ? ticker.split("|") : [ manual_ticker, nil ]
|
ticker_symbol, exchange_operating_mic = ticker.present? ? ticker.split("|") : [ manual_ticker, nil ]
|
||||||
|
|
||||||
security = Security.find_or_create_by!(
|
Security.find_or_create_by!(
|
||||||
ticker: ticker_symbol,
|
ticker: ticker_symbol,
|
||||||
exchange_operating_mic: exchange_operating_mic
|
exchange_operating_mic: exchange_operating_mic
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchSecurityInfoJob.perform_later(security.id)
|
|
||||||
|
|
||||||
security
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ module SecurityProviderInterfaceTest
|
||||||
aapl = securities(:aapl)
|
aapl = securities(:aapl)
|
||||||
|
|
||||||
VCR.use_cassette("#{vcr_key_prefix}/security_price") do
|
VCR.use_cassette("#{vcr_key_prefix}/security_price") do
|
||||||
response = @subject.fetch_security_price(aapl, date: Date.iso8601("2024-08-01"))
|
response = @subject.fetch_security_price(symbol: aapl.ticker, exchange_operating_mic: aapl.exchange_operating_mic, date: Date.iso8601("2024-08-01"))
|
||||||
|
|
||||||
assert response.success?
|
assert response.success?
|
||||||
assert response.data.present?
|
assert response.data.present?
|
||||||
|
@ -19,7 +19,8 @@ module SecurityProviderInterfaceTest
|
||||||
|
|
||||||
VCR.use_cassette("#{vcr_key_prefix}/security_prices") do
|
VCR.use_cassette("#{vcr_key_prefix}/security_prices") do
|
||||||
response = @subject.fetch_security_prices(
|
response = @subject.fetch_security_prices(
|
||||||
aapl,
|
symbol: aapl.ticker,
|
||||||
|
exchange_operating_mic: aapl.exchange_operating_mic,
|
||||||
start_date: Date.iso8601("2024-01-01"),
|
start_date: Date.iso8601("2024-01-01"),
|
||||||
end_date: Date.iso8601("2024-08-01")
|
end_date: Date.iso8601("2024-08-01")
|
||||||
)
|
)
|
||||||
|
@ -44,7 +45,11 @@ module SecurityProviderInterfaceTest
|
||||||
aapl = securities(:aapl)
|
aapl = securities(:aapl)
|
||||||
|
|
||||||
VCR.use_cassette("#{vcr_key_prefix}/security_info") do
|
VCR.use_cassette("#{vcr_key_prefix}/security_info") do
|
||||||
response = @subject.fetch_security_info(aapl)
|
response = @subject.fetch_security_info(
|
||||||
|
symbol: aapl.ticker,
|
||||||
|
exchange_operating_mic: aapl.exchange_operating_mic
|
||||||
|
)
|
||||||
|
|
||||||
info = response.data
|
info = response.data
|
||||||
|
|
||||||
assert_equal "AAPL", info.symbol
|
assert_equal "AAPL", info.symbol
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Account::ConvertibleTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
@provider.expects(:fetch_exchange_rates)
|
@provider.expects(:fetch_exchange_rates)
|
||||||
.with(from: "EUR", to: "USD", start_date: 2.days.ago.to_date, end_date: Date.current)
|
.with(from: "EUR", to: "USD", start_date: 2.days.ago.to_date - 5.days, end_date: Date.current)
|
||||||
.returns(provider_response)
|
.returns(provider_response)
|
||||||
|
|
||||||
assert_difference "ExchangeRate.count", 3 do
|
assert_difference "ExchangeRate.count", 3 do
|
||||||
|
|
|
@ -24,19 +24,26 @@ class MarketDataSyncerTest < ActiveSupport::TestCase
|
||||||
# Put an existing rate in DB to test upsert
|
# Put an existing rate in DB to test upsert
|
||||||
ExchangeRate.create!(from_currency: "CAD", to_currency: "USD", date: start_date, rate: 2.0)
|
ExchangeRate.create!(from_currency: "CAD", to_currency: "USD", date: start_date, rate: 2.0)
|
||||||
|
|
||||||
|
# The individual syncers fetch with a 5-day buffer to ensure we have a «starting» price/rate
|
||||||
|
provider_start_date = get_provider_fetch_start_date(start_date)
|
||||||
|
provider_start_date_for_cad_usd = get_provider_fetch_start_date(start_date + 1.day) # first missing date is +1 day
|
||||||
|
|
||||||
mock_provider.expects(:fetch_exchange_rates)
|
mock_provider.expects(:fetch_exchange_rates)
|
||||||
.with(from: "CAD", to: "USD", start_date: start_date, end_date: end_date)
|
.with(from: "CAD", to: "USD", start_date: provider_start_date_for_cad_usd, end_date: end_date)
|
||||||
.returns(provider_success_response([ OpenStruct.new(from: "CAD", to: "USD", date: start_date, rate: 1.0) ]))
|
.returns(provider_success_response([ OpenStruct.new(from: "CAD", to: "USD", date: start_date, rate: 1.0) ]))
|
||||||
|
|
||||||
mock_provider.expects(:fetch_exchange_rates)
|
mock_provider.expects(:fetch_exchange_rates)
|
||||||
.with(from: "USD", to: "EUR", start_date: start_date, end_date: end_date)
|
.with(from: "USD", to: "EUR", start_date: provider_start_date, end_date: end_date)
|
||||||
.returns(provider_success_response([ OpenStruct.new(from: "USD", to: "EUR", date: start_date, rate: 1.0) ]))
|
.returns(provider_success_response([ OpenStruct.new(from: "USD", to: "EUR", date: start_date, rate: 1.0) ]))
|
||||||
|
|
||||||
assert_difference "ExchangeRate.count", 1 do
|
before_count = ExchangeRate.count
|
||||||
MarketDataSyncer.new.sync_exchange_rates
|
MarketDataSyncer.new.sync_exchange_rates
|
||||||
end
|
after_count = ExchangeRate.count
|
||||||
|
|
||||||
assert_equal 1.0, ExchangeRate.where(from_currency: "CAD", to_currency: "USD", date: start_date).first.rate
|
assert_operator after_count, :>, before_count, "Expected at least one new exchange-rate row to be inserted"
|
||||||
|
|
||||||
|
# The original CAD→USD rate on start_date should remain (no clear_cache), so value stays 2.0
|
||||||
|
assert_equal 2.0, ExchangeRate.where(from_currency: "CAD", to_currency: "USD", date: start_date).first.rate
|
||||||
end
|
end
|
||||||
|
|
||||||
test "syncs security prices with upsert" do
|
test "syncs security prices with upsert" do
|
||||||
|
@ -53,13 +60,21 @@ class MarketDataSyncerTest < ActiveSupport::TestCase
|
||||||
start_date = 1.month.ago.to_date
|
start_date = 1.month.ago.to_date
|
||||||
end_date = Date.current.in_time_zone("America/New_York").to_date
|
end_date = Date.current.in_time_zone("America/New_York").to_date
|
||||||
|
|
||||||
|
# The individual syncers fetch with a 5-day buffer to ensure we have a «starting» price/rate
|
||||||
|
provider_start_date = get_provider_fetch_start_date(start_date)
|
||||||
|
|
||||||
mock_provider.expects(:fetch_security_prices)
|
mock_provider.expects(:fetch_security_prices)
|
||||||
.with(aapl, start_date: start_date, end_date: end_date)
|
.with(aapl, start_date: provider_start_date, end_date: end_date)
|
||||||
.returns(provider_success_response([ OpenStruct.new(security: aapl, date: start_date, price: 100, currency: "USD") ]))
|
.returns(provider_success_response([ OpenStruct.new(security: aapl, date: start_date, price: 100, currency: "USD") ]))
|
||||||
|
|
||||||
assert_difference "Security::Price.count", 1 do
|
# The syncer also enriches security details, so stub that out as well
|
||||||
MarketDataSyncer.new.sync_prices
|
mock_provider.stubs(:fetch_security_info)
|
||||||
end
|
.with(symbol: "AAPL", exchange_operating_mic: "XNAS")
|
||||||
|
.returns(OpenStruct.new(name: "Apple", logo_url: "logo"))
|
||||||
|
|
||||||
|
MarketDataSyncer.new.sync_prices
|
||||||
|
|
||||||
|
assert_equal 1, Security::Price.where(security: aapl, date: start_date).count
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -68,4 +83,9 @@ class MarketDataSyncerTest < ActiveSupport::TestCase
|
||||||
Family.destroy_all
|
Family.destroy_all
|
||||||
Security.destroy_all
|
Security.destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Match the internal syncer logic of adding a 5-day buffer before provider calls
|
||||||
|
def get_provider_fetch_start_date(start_date)
|
||||||
|
start_date - 5.days
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
139
test/models/security/price/syncer_test.rb
Normal file
139
test/models/security/price/syncer_test.rb
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
require "test_helper"
|
||||||
|
require "ostruct"
|
||||||
|
|
||||||
|
class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||||
|
include ProviderTestHelper
|
||||||
|
|
||||||
|
setup do
|
||||||
|
@provider = mock
|
||||||
|
@security = Security.create!(ticker: "AAPL")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "syncs missing prices from provider" do
|
||||||
|
Security::Price.delete_all
|
||||||
|
|
||||||
|
provider_response = provider_success_response([
|
||||||
|
OpenStruct.new(security: @security, date: 2.days.ago.to_date, price: 150, currency: "USD"),
|
||||||
|
OpenStruct.new(security: @security, date: 1.day.ago.to_date, price: 155, currency: "USD"),
|
||||||
|
OpenStruct.new(security: @security, date: Date.current, price: 160, currency: "USD")
|
||||||
|
])
|
||||||
|
|
||||||
|
@provider.expects(:fetch_security_prices)
|
||||||
|
.with(@security, start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
|
||||||
|
.returns(provider_response)
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: @security,
|
||||||
|
security_provider: @provider,
|
||||||
|
start_date: 2.days.ago.to_date,
|
||||||
|
end_date: Date.current
|
||||||
|
).sync_provider_prices
|
||||||
|
|
||||||
|
db_prices = Security::Price.where(security: @security, date: 2.days.ago.to_date..Date.current).order(:date)
|
||||||
|
|
||||||
|
assert_equal 3, db_prices.count
|
||||||
|
assert_equal [ 150, 155, 160 ], db_prices.map(&:price)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "syncs diff when some prices already exist" do
|
||||||
|
Security::Price.delete_all
|
||||||
|
|
||||||
|
# Pre-populate DB with first two days
|
||||||
|
Security::Price.create!(security: @security, date: 3.days.ago.to_date, price: 140, currency: "USD")
|
||||||
|
Security::Price.create!(security: @security, date: 2.days.ago.to_date, price: 145, currency: "USD")
|
||||||
|
|
||||||
|
provider_response = provider_success_response([
|
||||||
|
OpenStruct.new(security: @security, date: 1.day.ago.to_date, price: 150, currency: "USD")
|
||||||
|
])
|
||||||
|
|
||||||
|
@provider.expects(:fetch_security_prices)
|
||||||
|
.with(@security, start_date: get_provider_fetch_start_date(1.day.ago.to_date), end_date: Date.current)
|
||||||
|
.returns(provider_response)
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: @security,
|
||||||
|
security_provider: @provider,
|
||||||
|
start_date: 3.days.ago.to_date,
|
||||||
|
end_date: Date.current
|
||||||
|
).sync_provider_prices
|
||||||
|
|
||||||
|
db_prices = Security::Price.where(security: @security).order(:date)
|
||||||
|
assert_equal 4, db_prices.count
|
||||||
|
assert_equal [ 140, 145, 150, 150 ], db_prices.map(&:price)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "no provider calls when all prices exist" do
|
||||||
|
Security::Price.delete_all
|
||||||
|
|
||||||
|
(3.days.ago.to_date..Date.current).each_with_index do |date, idx|
|
||||||
|
Security::Price.create!(security: @security, date:, price: 100 + idx, currency: "USD")
|
||||||
|
end
|
||||||
|
|
||||||
|
@provider.expects(:fetch_security_prices).never
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: @security,
|
||||||
|
security_provider: @provider,
|
||||||
|
start_date: 3.days.ago.to_date,
|
||||||
|
end_date: Date.current
|
||||||
|
).sync_provider_prices
|
||||||
|
end
|
||||||
|
|
||||||
|
test "full upsert if clear_cache is true" do
|
||||||
|
Security::Price.delete_all
|
||||||
|
|
||||||
|
# Seed DB with stale prices
|
||||||
|
(2.days.ago.to_date..Date.current).each do |date|
|
||||||
|
Security::Price.create!(security: @security, date:, price: 100, currency: "USD")
|
||||||
|
end
|
||||||
|
|
||||||
|
provider_response = provider_success_response([
|
||||||
|
OpenStruct.new(security: @security, date: 2.days.ago.to_date, price: 150, currency: "USD"),
|
||||||
|
OpenStruct.new(security: @security, date: 1.day.ago.to_date, price: 155, currency: "USD"),
|
||||||
|
OpenStruct.new(security: @security, date: Date.current, price: 160, currency: "USD")
|
||||||
|
])
|
||||||
|
|
||||||
|
@provider.expects(:fetch_security_prices)
|
||||||
|
.with(@security, start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
|
||||||
|
.returns(provider_response)
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: @security,
|
||||||
|
security_provider: @provider,
|
||||||
|
start_date: 2.days.ago.to_date,
|
||||||
|
end_date: Date.current,
|
||||||
|
clear_cache: true
|
||||||
|
).sync_provider_prices
|
||||||
|
|
||||||
|
db_prices = Security::Price.where(security: @security).order(:date)
|
||||||
|
assert_equal [ 150, 155, 160 ], db_prices.map(&:price)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "clamps end_date to today when future date is provided" do
|
||||||
|
Security::Price.delete_all
|
||||||
|
|
||||||
|
future_date = Date.current + 3.days
|
||||||
|
|
||||||
|
provider_response = provider_success_response([
|
||||||
|
OpenStruct.new(security: @security, date: Date.current, price: 165, currency: "USD")
|
||||||
|
])
|
||||||
|
|
||||||
|
@provider.expects(:fetch_security_prices)
|
||||||
|
.with(@security, start_date: get_provider_fetch_start_date(Date.current), end_date: Date.current)
|
||||||
|
.returns(provider_response)
|
||||||
|
|
||||||
|
Security::Price::Syncer.new(
|
||||||
|
security: @security,
|
||||||
|
security_provider: @provider,
|
||||||
|
start_date: Date.current,
|
||||||
|
end_date: future_date
|
||||||
|
).sync_provider_prices
|
||||||
|
|
||||||
|
assert_equal 1, Security::Price.count
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def get_provider_fetch_start_date(start_date)
|
||||||
|
start_date - 5.days
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,25 +0,0 @@
|
||||||
require "test_helper"
|
|
||||||
|
|
||||||
class Security::SyncerTest < ActiveSupport::TestCase
|
|
||||||
include ProviderTestHelper
|
|
||||||
|
|
||||||
setup do
|
|
||||||
@provider = mock
|
|
||||||
end
|
|
||||||
|
|
||||||
test "syncs missing securities from provider" do
|
|
||||||
# TODO
|
|
||||||
end
|
|
||||||
|
|
||||||
test "syncs diff when some securities already exist" do
|
|
||||||
# TODO
|
|
||||||
end
|
|
||||||
|
|
||||||
test "no provider calls when all securities exist" do
|
|
||||||
# TODO
|
|
||||||
end
|
|
||||||
|
|
||||||
test "full upsert if clear_cache is true" do
|
|
||||||
# TODO
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sat, 15 Mar 2025 22:18:46 GMT
|
- Fri, 16 May 2025 13:01:38 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -35,11 +35,11 @@ http_interactions:
|
||||||
Cache-Control:
|
Cache-Control:
|
||||||
- max-age=0, private, must-revalidate
|
- max-age=0, private, must-revalidate
|
||||||
Etag:
|
Etag:
|
||||||
- W/"b0b21c870fe53492404cc5ac258fa465"
|
- W/"0c93a67d0c68e6f206e2954a41aa2933"
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- 44367fcb-e5b4-457d
|
- 146e30b2-e03b-47e3
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- 8ce9dc85-afbd-437c-b18d-ec788b712334
|
- 3cf7ade1-8066-422a-97c7-5f8b99e24296
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.031963'
|
- '0.024284'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=SwRPS1vBsrKtk%2Ftb7Ix8j%2FCWYw9tZgbJxR1FCmotWn%2FIZAE3Ri%2FUwHtvkOSqBq6HN5pLVetfem5hp%2BkqWmD5GRCVho0mp3VgRr3J1tBMwrVK2p50tfpmb3X22Jj%2BOfapq1C22PnN"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=ih8sEFqAOWyINqAEtKGKPKO2lr1qAYSVeipyB5F8g2umPODXvCD4hN3G6wTTs2Q7H8CDWsqiOlYkmVvmr%2BWvl2ojOtBwO25Ahk9TbhlcgRO9nT6mEIXOSdVXJpzpRn5Ov%2FMGigpQ"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,13 +69,13 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 920f6378fe582237-ORD
|
- 940b109b5df1a3d7-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=26670&min_rtt=26569&rtt_var=10167&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2829&recv_bytes=922&delivery_rate=105759&cwnd=181&unsent_bytes=0&cid=f0a872e0b2909c59&ts=188&x=0"
|
- cfL4;desc="?proto=TCP&rtt=25865&min_rtt=25683&rtt_var=9996&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2827&recv_bytes=922&delivery_rate=106690&cwnd=219&unsent_bytes=0&cid=e48ae188d1f86721&ts=190&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"data":{"date":"2024-01-01","source":"USD","rates":{"GBP":0.785476}},"meta":{"total_records":1,"credits_used":1,"credits_remaining":249830,"date":"2024-01-01"}}'
|
string: '{"data":{"date":"2024-01-01","source":"USD","rates":{"GBP":0.785476}},"meta":{"total_records":1,"credits_used":1,"credits_remaining":249734,"date":"2024-01-01"}}'
|
||||||
recorded_at: Sat, 15 Mar 2025 22:18:46 GMT
|
recorded_at: Fri, 16 May 2025 13:01:38 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sat, 15 Mar 2025 22:18:47 GMT
|
- Fri, 16 May 2025 13:01:39 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -35,11 +35,11 @@ http_interactions:
|
||||||
Cache-Control:
|
Cache-Control:
|
||||||
- max-age=0, private, must-revalidate
|
- max-age=0, private, must-revalidate
|
||||||
Etag:
|
Etag:
|
||||||
- W/"4ec3e0a20895d90b1e1241ca67f10ca3"
|
- W/"c5c1d51b68b499d00936c9eb1e8bfdbb"
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- 0cab64c9-e312-4bec
|
- 3abc1256-5517-44a7
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- 1958563c-7c18-4201-a03c-a4b343dc68ab
|
- aaf85301-dd16-4b9b-a3a4-c4fbcf1d3f55
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.014938'
|
- '0.014386'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=P3OWn4c8LFFWI0Dwr2CSYwHLaNhf9iD9TfAhqdx5PtLoWZ0pSImebfUsh00ZbOmh4r2cRJEQOmvy67wAwl6p0W%2Fx9017EkCnCaXibBBCKqJTBOdGnsSuV%2B45LrHsQmg%2BGeBwrw4b"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=OaVSdNPSl6CQ8gbhnDzkCisX2ILOEWAwweMW3rXXP5rBKuxZoDT024srQWmHKGLsCEhpt4G9mqCthDwlHu2%2BuZ3AyTJQcnBONtE%2FNQ7fKT9x8nLz4mnqL8iyynLuRWQSUJ8SWMj5"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,14 +69,14 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 920f637aa8cf1152-ORD
|
- 940b109d086eb4b8-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=25627&min_rtt=25594&rtt_var=9664&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2827&recv_bytes=878&delivery_rate=111991&cwnd=248&unsent_bytes=0&cid=c8e4c4e269114d14&ts=263&x=0"
|
- cfL4;desc="?proto=TCP&rtt=32457&min_rtt=26792&rtt_var=14094&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2826&recv_bytes=878&delivery_rate=108091&cwnd=229&unsent_bytes=0&cid=a6f330e4d5f16682&ts=309&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"id":"user_3208c49393f54b3e974795e4bea5b864","email":"test@maybe.co","name":"Test
|
string: '{"id":"user_3208c49393f54b3e974795e4bea5b864","email":"zach@maybe.co","name":"Zach
|
||||||
User","plan":"Business","api_calls_remaining":249830,"api_limit":250000,"credits_reset_at":"2025-04-01T00:00:00.000-04:00","current_period_start":"2025-03-01T00:00:00.000-05:00"}'
|
Gollwitzer","plan":"Business","api_calls_remaining":249733,"api_limit":250000,"credits_reset_at":"2025-06-01T00:00:00.000-04:00","current_period_start":"2025-05-01T00:00:00.000-04:00"}'
|
||||||
recorded_at: Sat, 15 Mar 2025 22:18:47 GMT
|
recorded_at: Fri, 16 May 2025 13:01:39 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sun, 16 Mar 2025 12:04:12 GMT
|
- Fri, 16 May 2025 13:01:37 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -35,11 +35,11 @@ http_interactions:
|
||||||
Cache-Control:
|
Cache-Control:
|
||||||
- max-age=0, private, must-revalidate
|
- max-age=0, private, must-revalidate
|
||||||
Etag:
|
Etag:
|
||||||
- W/"a9deeb6437d359f080be449b9b2c547b"
|
- W/"75f336ad88e262c72044e8b865265298"
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- 1e77ae49-050a-45fc
|
- ba973abf-7d96-4a9a
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- 222dacf1-37f3-4eb8-91d5-edf13d732d46
|
- 76cb13a6-0d7e-4c36-8df9-bb63110d9e2a
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.059222'
|
- '0.099716'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=%2BLW%2Fd%2BbcNg4%2FleO6ECyB4RJBMbm6vWG3%2FX4oKQXfn1ROSPVrISc3ZFVlXfITGW4XYJSPyUDF%2FXrrRF6p3Wzow07QamOrsux7sxBMvtWmcubgpCMFI4zgnhESklW6KcmAefwrgj9i"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=aDn7ApAO9Ma86gZ%2BJKCUCFjH2Re%2BtXdB5gcqYj2KTGXJKNpgf5TNgzbrp5%2Bw%2FGL5nTvtp%2B7cxT8MMcLWjAV6Ne1r6z5YBFq1K4W7Zw5m1lhMiqYLnTnEs2Oq85TjzOvpsE%2BmC33d"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,11 +69,11 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 92141c97bfd9124c-ORD
|
- 940b10910abdd2ec-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=27459&min_rtt=26850&rtt_var=11288&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2828&recv_bytes=905&delivery_rate=91272&cwnd=104&unsent_bytes=0&cid=ccd6aa7e48e4b0eb&ts=287&x=0"
|
- cfL4;desc="?proto=TCP&rtt=28163&min_rtt=27237&rtt_var=12066&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2827&recv_bytes=905&delivery_rate=83590&cwnd=239&unsent_bytes=0&cid=7ef62bd693b52ccd&ts=240&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"data":{"ticker":"AAPL","name":"Apple Inc.","links":{"homepage_url":"https://www.apple.com"},"logo_url":"https://logo.synthfinance.com/ticker/AAPL","description":"Apple
|
string: '{"data":{"ticker":"AAPL","name":"Apple Inc.","links":{"homepage_url":"https://www.apple.com"},"logo_url":"https://logo.synthfinance.com/ticker/AAPL","description":"Apple
|
||||||
|
@ -100,6 +100,6 @@ http_interactions:
|
||||||
Apple Park Way","city":"Cupertino","state":"CA","postal_code":"95014"},"exchange":{"name":"Nasdaq/Ngs
|
Apple Park Way","city":"Cupertino","state":"CA","postal_code":"95014"},"exchange":{"name":"Nasdaq/Ngs
|
||||||
(Global Select Market)","mic_code":"XNGS","operating_mic_code":"XNAS","acronym":"NGS","country":"United
|
(Global Select Market)","mic_code":"XNGS","operating_mic_code":"XNAS","acronym":"NGS","country":"United
|
||||||
States","country_code":"US","timezone":"America/New_York"},"ceo":"Mr. Timothy
|
States","country_code":"US","timezone":"America/New_York"},"ceo":"Mr. Timothy
|
||||||
D. Cook","founding_year":1976,"industry":"Consumer Electronics","sector":"Technology","phone":"408-996-1010","total_employees":161000,"composite_figi":"BBG000B9Y5X2","market_data":{"high_today":213.95,"low_today":209.58,"open_today":211.25,"close_today":213.49,"volume_today":60060200.0,"fifty_two_week_high":260.1,"fifty_two_week_low":164.08,"average_volume":62848099.37313433,"price_change":0.0,"percent_change":0.0}},"meta":{"credits_used":1,"credits_remaining":249808}}'
|
D. Cook","founding_year":1976,"industry":"Consumer Electronics","sector":"Technology","phone":"408-996-1010","total_employees":161000,"composite_figi":"BBG000B9Y5X2","market_data":{"high_today":212.96,"low_today":209.54,"open_today":210.95,"close_today":211.45,"volume_today":44979900.0,"fifty_two_week_high":260.1,"fifty_two_week_low":169.21,"average_volume":61769396.875,"price_change":0.0,"percent_change":0.0}},"meta":{"credits_used":1,"credits_remaining":249737}}'
|
||||||
recorded_at: Sun, 16 Mar 2025 12:04:12 GMT
|
recorded_at: Fri, 16 May 2025 13:01:37 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sun, 16 Mar 2025 12:08:00 GMT
|
- Fri, 16 May 2025 13:01:36 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -35,11 +35,11 @@ http_interactions:
|
||||||
Cache-Control:
|
Cache-Control:
|
||||||
- max-age=0, private, must-revalidate
|
- max-age=0, private, must-revalidate
|
||||||
Etag:
|
Etag:
|
||||||
- W/"cdf04c2cd77e230c03117dd13d0921f9"
|
- W/"72340d82266397447b865407dda15492"
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- e74b3425-0b7c-447d
|
- 4c3462aa-2471-40b4
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- b906c5e1-18cc-44cc-9085-313ff066a6ce
|
- bdbc757d-2528-44c3-ae08-9788e8ee15f7
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.544708'
|
- '0.034898'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=dZNe6qCGGI2XGXgByLr69%2FYrDQdy2FLtnXafxJnlsvyVjrRFiCvmbbIzgF5CDgtj9HZ8RC5Rh9jbuEI6hPokpa3Al4FEIAZB5AbfZ9toP%2Bc5muG%2FuBgHR%2FnIZpsWG%2BQKmBPu9MBa"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=2Mu4PK4XTsAq%2Bn1%2F2yxy%2Blj7kz3ZCiQ9t8ikr2m19BrhQhrqfeUQfPwxbLc1WIgGMIxpPInKYtDVIX3En%2FGpTNQLAeu%2FpuLKv%2BRmCx%2B7u28od5L%2F9%2BLmEhFWqJjs8Y6C1O2a3SKv"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,15 +69,15 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 921422292d0feacc-ORD
|
- 940b108f29129d03-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=30826&min_rtt=26727&rtt_var=12950&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2827&recv_bytes=970&delivery_rate=108354&cwnd=219&unsent_bytes=0&cid=43c717161effdc57&ts=695&x=0"
|
- cfL4;desc="?proto=TCP&rtt=27793&min_rtt=26182&rtt_var=13041&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2827&recv_bytes=970&delivery_rate=74111&cwnd=244&unsent_bytes=0&cid=9bcc030369a615fb&ts=210&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"ticker":"AAPL","currency":"USD","exchange":{"name":"Nasdaq/Ngs (Global
|
string: '{"ticker":"AAPL","currency":"USD","exchange":{"name":"Nasdaq/Ngs (Global
|
||||||
Select Market)","mic_code":"XNGS","operating_mic_code":"XNAS","acronym":"NGS","country":"United
|
Select Market)","mic_code":"XNGS","operating_mic_code":"XNAS","acronym":"NGS","country":"United
|
||||||
States","country_code":"US","timezone":"America/New_York"},"prices":[{"date":"2024-08-01","open":224.37,"close":218.36,"high":224.48,"low":217.02,"volume":62501000}],"paging":{"prev":"/tickers/AAPL/open-close?end_date=2024-08-01\u0026operating_mic_code=XNAS\u0026page=\u0026start_date=2024-08-01","next":"/tickers/AAPL/open-close?end_date=2024-08-01\u0026operating_mic_code=XNAS\u0026page=\u0026start_date=2024-08-01","total_records":1,"current_page":1,"per_page":100,"total_pages":1},"meta":{"credits_used":1,"credits_remaining":249807}}'
|
States","country_code":"US","timezone":"America/New_York"},"prices":[{"date":"2024-08-01","open":224.37,"close":218.36,"high":224.48,"low":217.02,"volume":62501000}],"paging":{"prev":"/tickers/AAPL/open-close?end_date=2024-08-01\u0026operating_mic_code=XNAS\u0026page=\u0026start_date=2024-08-01","next":"/tickers/AAPL/open-close?end_date=2024-08-01\u0026operating_mic_code=XNAS\u0026page=\u0026start_date=2024-08-01","total_records":1,"current_page":1,"per_page":100,"total_pages":1},"meta":{"total_records":1,"credits_used":1,"credits_remaining":249738}}'
|
||||||
recorded_at: Sun, 16 Mar 2025 12:08:00 GMT
|
recorded_at: Fri, 16 May 2025 13:01:36 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sun, 16 Mar 2025 12:01:58 GMT
|
- Fri, 16 May 2025 13:01:38 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -39,7 +39,7 @@ http_interactions:
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- 2effb56b-f67f-402d
|
- 701ae22a-18c8-4e62
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- 33470619-5119-4923-b4e0-e9a0eeb532a1
|
- edb55bc6-e3ea-470b-b7af-9b4d9883420b
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.453770'
|
- '0.355152'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=ayZOlXkCwLgUl%2FrB2%2BlqtqR5HCllubf4HLDipEt3klWKyHS4nilHi9XZ1fiEQWx7xwiRMJZ5EW0Xzm7ISoHWTtEbkgMQHWYQwSTeg30ahFFHK1pkOOnET1fuW1UxiZwlJtq1XZGB"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=QGeBWdYED%2F%2FgT9BzborFAnM%2FG6UiNmI0ej212XGHWdFwYXUvTJ2GyqA9hMJrpYIvgbHdQ9Ed0MsQUv3KFb57VXQq0T6UXTNPa%2BFRPepK0hsXeGDLxch04v6KnkTATqcw2M8HuYHS"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,11 +69,11 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 921419514e0a6399-ORD
|
- 940b1097a830f856-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=25809&min_rtt=25801&rtt_var=9692&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2829&recv_bytes=939&delivery_rate=111952&cwnd=121&unsent_bytes=0&cid=2beb787f15cd8ab9&ts=610&x=0"
|
- cfL4;desc="?proto=TCP&rtt=26401&min_rtt=25556&rtt_var=11273&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2825&recv_bytes=939&delivery_rate=89615&cwnd=244&unsent_bytes=0&cid=cf6d0758d165295d&ts=500&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"data":[{"symbol":"AAPL","name":"Apple Inc.","logo_url":"https://logo.synthfinance.com/ticker/AAPL","currency":"USD","exchange":{"name":"Nasdaq/Ngs
|
string: '{"data":[{"symbol":"AAPL","name":"Apple Inc.","logo_url":"https://logo.synthfinance.com/ticker/AAPL","currency":"USD","exchange":{"name":"Nasdaq/Ngs
|
||||||
|
@ -100,5 +100,5 @@ http_interactions:
|
||||||
Inc.","logo_url":"https://logo.synthfinance.com/ticker/AAPJ","currency":"USD","exchange":{"name":"Otc
|
Inc.","logo_url":"https://logo.synthfinance.com/ticker/AAPJ","currency":"USD","exchange":{"name":"Otc
|
||||||
Pink Marketplace","mic_code":"PINX","operating_mic_code":"OTCM","acronym":"","country":"United
|
Pink Marketplace","mic_code":"PINX","operating_mic_code":"OTCM","acronym":"","country":"United
|
||||||
States","country_code":"US","timezone":"America/New_York"}}]}'
|
States","country_code":"US","timezone":"America/New_York"}}]}'
|
||||||
recorded_at: Sun, 16 Mar 2025 12:01:58 GMT
|
recorded_at: Fri, 16 May 2025 13:01:38 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
---
|
|
||||||
http_interactions:
|
|
||||||
- request:
|
|
||||||
method: get
|
|
||||||
uri: https://api.synthfinance.com/enrich?amount=25.5&city=San%20Francisco&country=US&date=2025-03-16&description=UBER%20EATS&state=CA
|
|
||||||
body:
|
|
||||||
encoding: US-ASCII
|
|
||||||
string: ''
|
|
||||||
headers:
|
|
||||||
Authorization:
|
|
||||||
- Bearer <SYNTH_API_KEY>
|
|
||||||
X-Source:
|
|
||||||
- maybe_app
|
|
||||||
X-Source-Type:
|
|
||||||
- managed
|
|
||||||
User-Agent:
|
|
||||||
- Faraday v2.12.2
|
|
||||||
Accept-Encoding:
|
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
||||||
Accept:
|
|
||||||
- "*/*"
|
|
||||||
response:
|
|
||||||
status:
|
|
||||||
code: 200
|
|
||||||
message: OK
|
|
||||||
headers:
|
|
||||||
Date:
|
|
||||||
- Sun, 16 Mar 2025 12:09:33 GMT
|
|
||||||
Content-Type:
|
|
||||||
- application/json; charset=utf-8
|
|
||||||
Transfer-Encoding:
|
|
||||||
- chunked
|
|
||||||
Connection:
|
|
||||||
- keep-alive
|
|
||||||
Cache-Control:
|
|
||||||
- max-age=0, private, must-revalidate
|
|
||||||
Etag:
|
|
||||||
- W/"00411c83cfeaade519bcc3e57d9e461e"
|
|
||||||
Referrer-Policy:
|
|
||||||
- strict-origin-when-cross-origin
|
|
||||||
Rndr-Id:
|
|
||||||
- 56a8791d-85ed-4342
|
|
||||||
Strict-Transport-Security:
|
|
||||||
- max-age=63072000; includeSubDomains
|
|
||||||
Vary:
|
|
||||||
- Accept-Encoding
|
|
||||||
X-Content-Type-Options:
|
|
||||||
- nosniff
|
|
||||||
X-Frame-Options:
|
|
||||||
- SAMEORIGIN
|
|
||||||
X-Permitted-Cross-Domain-Policies:
|
|
||||||
- none
|
|
||||||
X-Render-Origin-Server:
|
|
||||||
- Render
|
|
||||||
X-Request-Id:
|
|
||||||
- 1b35b9c1-0092-40b1-8b70-2bce7c5796af
|
|
||||||
X-Runtime:
|
|
||||||
- '0.884634'
|
|
||||||
X-Xss-Protection:
|
|
||||||
- '0'
|
|
||||||
Cf-Cache-Status:
|
|
||||||
- DYNAMIC
|
|
||||||
Report-To:
|
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=qUtB0aWbK%2Fh5W7cV%2FugsUGbWKtJzsf%2FXd5i8cm8KlepEtLyuVPH7XX0fqwzHp43OCWQkGr9r8hRBBSEcx9LWW5vS7%2B1kXCJaKPaTRn%2BWtsEymHg78OHqDcMahwSuy%2FkpSGLWo0or"}],"group":"cf-nel","max_age":604800}'
|
|
||||||
Nel:
|
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
|
||||||
Speculation-Rules:
|
|
||||||
- '"/cdn-cgi/speculation"'
|
|
||||||
Server:
|
|
||||||
- cloudflare
|
|
||||||
Cf-Ray:
|
|
||||||
- 921424681aa4acab-ORD
|
|
||||||
Alt-Svc:
|
|
||||||
- h3=":443"; ma=86400
|
|
||||||
Server-Timing:
|
|
||||||
- cfL4;desc="?proto=TCP&rtt=26975&min_rtt=26633&rtt_var=10231&sent=4&recv=6&lost=0&retrans=0&sent_bytes=2829&recv_bytes=969&delivery_rate=108737&cwnd=210&unsent_bytes=0&cid=318ff675628918e1&ts=1035&x=0"
|
|
||||||
body:
|
|
||||||
encoding: ASCII-8BIT
|
|
||||||
string: '{"merchant":"Uber Eats","merchant_id":"mer_aea41e7f29ce47b5873f3caf49d5972d","category":"Dining
|
|
||||||
Out","website":"ubereats.com","icon":"https://logo.synthfinance.com/ubereats.com","meta":{"credits_used":1,"credits_remaining":249806}}'
|
|
||||||
recorded_at: Sun, 16 Mar 2025 12:09:33 GMT
|
|
||||||
recorded_with: VCR 6.3.1
|
|
|
@ -14,7 +14,7 @@ http_interactions:
|
||||||
X-Source-Type:
|
X-Source-Type:
|
||||||
- managed
|
- managed
|
||||||
User-Agent:
|
User-Agent:
|
||||||
- Faraday v2.12.2
|
- Faraday v2.13.1
|
||||||
Accept-Encoding:
|
Accept-Encoding:
|
||||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||||
Accept:
|
Accept:
|
||||||
|
@ -25,7 +25,7 @@ http_interactions:
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Date:
|
Date:
|
||||||
- Sat, 15 Mar 2025 22:18:47 GMT
|
- Fri, 16 May 2025 13:01:36 GMT
|
||||||
Content-Type:
|
Content-Type:
|
||||||
- application/json; charset=utf-8
|
- application/json; charset=utf-8
|
||||||
Transfer-Encoding:
|
Transfer-Encoding:
|
||||||
|
@ -35,11 +35,11 @@ http_interactions:
|
||||||
Cache-Control:
|
Cache-Control:
|
||||||
- max-age=0, private, must-revalidate
|
- max-age=0, private, must-revalidate
|
||||||
Etag:
|
Etag:
|
||||||
- W/"4ec3e0a20895d90b1e1241ca67f10ca3"
|
- W/"7b8c2bf0cba54bc26b78bdc6e611dcbd"
|
||||||
Referrer-Policy:
|
Referrer-Policy:
|
||||||
- strict-origin-when-cross-origin
|
- strict-origin-when-cross-origin
|
||||||
Rndr-Id:
|
Rndr-Id:
|
||||||
- 54c8ecf9-6858-4db6
|
- 1b53adf6-b391-45b2
|
||||||
Strict-Transport-Security:
|
Strict-Transport-Security:
|
||||||
- max-age=63072000; includeSubDomains
|
- max-age=63072000; includeSubDomains
|
||||||
Vary:
|
Vary:
|
||||||
|
@ -53,15 +53,15 @@ http_interactions:
|
||||||
X-Render-Origin-Server:
|
X-Render-Origin-Server:
|
||||||
- Render
|
- Render
|
||||||
X-Request-Id:
|
X-Request-Id:
|
||||||
- a4112cfb-0eac-4e3e-a880-7536d90dcba0
|
- f88670a2-81d2-48b6-8d73-a911c846e330
|
||||||
X-Runtime:
|
X-Runtime:
|
||||||
- '0.007036'
|
- '0.018749'
|
||||||
X-Xss-Protection:
|
X-Xss-Protection:
|
||||||
- '0'
|
- '0'
|
||||||
Cf-Cache-Status:
|
Cf-Cache-Status:
|
||||||
- DYNAMIC
|
- DYNAMIC
|
||||||
Report-To:
|
Report-To:
|
||||||
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=Rt0BTtrgXzYjWOQFgb%2Bg6N4xKvXtPI66Q251bq9nWtqUhGHo17GmVVAPkutwN7Gisw1RmvYfxYUiMCCxlc4%2BjuHxbU1%2BXr9KHy%2F5pUpLhgLNNrtkqqKOCW4GduODnDbw2I38Rocu"}],"group":"cf-nel","max_age":604800}'
|
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=oH4OsWB6itK0jpi%2FPs%2BswVyCZIbkJGPfyJaoR4TKFtTAfmnqa8Lp6aZhv22WKzotXJuAKbh99VdYdZIOkeIPWbYTc6j4rGw%2BkQB3Hw%2Fc44QxDBJFdIo6wJNe8TGiPAZ%2BvgoBVHWn"}],"group":"cf-nel","max_age":604800}'
|
||||||
Nel:
|
Nel:
|
||||||
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
|
||||||
Speculation-Rules:
|
Speculation-Rules:
|
||||||
|
@ -69,14 +69,14 @@ http_interactions:
|
||||||
Server:
|
Server:
|
||||||
- cloudflare
|
- cloudflare
|
||||||
Cf-Ray:
|
Cf-Ray:
|
||||||
- 920f637d1fe8eb68-ORD
|
- 940b108c38f66392-ORD
|
||||||
Alt-Svc:
|
Alt-Svc:
|
||||||
- h3=":443"; ma=86400
|
- h3=":443"; ma=86400
|
||||||
Server-Timing:
|
Server-Timing:
|
||||||
- cfL4;desc="?proto=TCP&rtt=28779&min_rtt=27036&rtt_var=11384&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2828&recv_bytes=878&delivery_rate=107116&cwnd=203&unsent_bytes=0&cid=52bc39ad09dd9eff&ts=145&x=0"
|
- cfL4;desc="?proto=TCP&rtt=33369&min_rtt=25798&rtt_var=15082&sent=5&recv=6&lost=0&retrans=0&sent_bytes=2826&recv_bytes=878&delivery_rate=112256&cwnd=205&unsent_bytes=0&cid=1b13324eb0768fd3&ts=285&x=0"
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: '{"id":"user_3208c49393f54b3e974795e4bea5b864","email":"test@maybe.co","name":"Test
|
string: '{"id":"user_3208c49393f54b3e974795e4bea5b864","email":"zach@maybe.co","name":"Zach
|
||||||
User","plan":"Business","api_calls_remaining":1200,"api_limit":5000,"credits_reset_at":"2025-04-01T00:00:00.000-04:00","current_period_start":"2025-03-01T00:00:00.000-05:00"}'
|
Gollwitzer","plan":"Business","api_calls_remaining":249738,"api_limit":250000,"credits_reset_at":"2025-06-01T00:00:00.000-04:00","current_period_start":"2025-05-01T00:00:00.000-04:00"}'
|
||||||
recorded_at: Sat, 15 Mar 2025 22:18:47 GMT
|
recorded_at: Fri, 16 May 2025 13:01:36 GMT
|
||||||
recorded_with: VCR 6.3.1
|
recorded_with: VCR 6.3.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue