Skip to content

Commit

Permalink
Update cache keys for insider trades with version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpigford committed Nov 20, 2024
1 parent 4d50118 commit 4ea9c1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/presenters/tool/presenter/inside_trading_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def active_record
end

def insider_data
@insider_data ||= Rails.cache.fetch("insider_trades/#{symbol}/#{180.days.ago.to_date}/#{Date.today}/250", expires_in: 6.hours) do
@insider_data ||= Rails.cache.fetch("insider_trades/v2/#{symbol}/#{180.days.ago.to_date}/#{Date.today}/250", expires_in: 6.hours) do
response = Provider::Synth.new.insider_trades(
ticker: symbol,
start_date: 180.days.ago,
Expand Down Expand Up @@ -135,7 +135,7 @@ def format_trades(trades)
end

def fetch_filtered_trades(filters = {})
cache_key = "filtered_insider_trades/#{filters.to_json}/#{90.days.ago.to_date}/#{Date.today}"
cache_key = "filtered_insider_trades/v2/#{filters.to_json}/#{90.days.ago.to_date}/#{Date.today}"

Rails.cache.fetch(cache_key, expires_in: 30.minutes) do
Rails.logger.warn "Fetching filtered trades with filters: #{filters}"
Expand Down

0 comments on commit 4ea9c1f

Please sign in to comment.