Skip to content

Commit

Permalink
Update ranking snapshot filters
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-xiong committed Oct 10, 2023
1 parent ed9de9d commit 5fd97e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/jobs/get_users_spot_transactions_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def perform(user_id=nil)
get_binance_orders(user_id)
get_okx_orders(user_id)
end

get_okx_orders # 公共账户
end

ForceGcJob.perform_later
Expand All @@ -30,7 +32,7 @@ def get_binance_orders(user_id)
end
end

def get_okx_orders(user_id)
def get_okx_orders(user_id=nil)
result = OkxSpotsService.new(user_id: user_id).get_orders rescue nil
return if result.nil? || result['data'].nil?

Expand Down
1 change: 0 additions & 1 deletion app/models/ranking_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def self.get_rankings(duration: 12, rank: nil, data_type: nil, source: nil)
while price_ratio.nil? && retries < max_retries
price_ratio = get_price_ratio(fetch_symbol(key[0]), last_price, rank, duration)
retries += 1
sleep(1)
end

price_change = (last_price - open_price) / open_price rescue 0
Expand Down
4 changes: 2 additions & 2 deletions app/views/ranking_snapshots/long_selling_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</tr>
</thead>
<tbody>
<% @three_days_ranking.sort_by{|d| [d["priceChangePercent"].to_f, d["bottomPriceRatio"].to_f]}.first(10).each do |d| %>
<% @three_days_ranking.select{|d| d['bottomPriceRatio'].to_f != 0 }.sort_by{|d| [d["priceChangePercent"].to_f, d["bottomPriceRatio"].to_f]}.first(10).each do |d| %>
<tr>
<td><%= get_symbol_url d["symbol"], d["source"] %></td>
<td><%= d["priceChangePercent"] + " %" %></td>
Expand Down Expand Up @@ -95,7 +95,7 @@
</tr>
</thead>
<tbody>
<% @weekly_ranking.sort_by{|d| [d["priceChangePercent"].to_f, d["bottomPriceRatio"].to_f]}.first(10).each do |d| %>
<% @weekly_ranking.select{|d| d['bottomPriceRatio'].to_f != 0 }.sort_by{|d| [d["priceChangePercent"].to_f, d["bottomPriceRatio"].to_f]}.first(10).each do |d| %>
<tr>
<td><%= get_symbol_url d["symbol"], d["source"] %></td>
<td><%= d["priceChangePercent"] + " %" %></td>
Expand Down
6 changes: 3 additions & 3 deletions app/views/ranking_snapshots/short_selling_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@
</tr>
</thead>
<tbody>
<% @three_days_ranking.sort_by{|d| [d["priceChangePercent"].to_f, d["topPriceRatio"].to_f]}.reverse.first(10).each do |d| %>
<% @three_days_ranking.select{|d| d['topPriceRatio'].to_f != 0 }.sort_by{|d| [d["priceChangePercent"].to_f, d["topPriceRatio"].to_f]}.reverse.first(10).each do |d| %>
<tr>
<td><%= get_symbol_url d["symbol"], d["source"] %></td>
<td><%= d["priceChangePercent"] + " %" %></td>
<td><%= d["bottomPriceRatio"] + " %" %></td>
<td><%= d["topPriceRatio"] + " %" %></td>
<td><%= d["source"] %></td>
</tr>
<% end %>
Expand Down Expand Up @@ -183,7 +183,7 @@
</tr>
</thead>
<tbody>
<% @weekly_ranking.sort_by{|d| [d["priceChangePercent"].to_f, d["topPriceRatio"].to_f]}.reverse.first(10).each do |d| %>
<% @weekly_ranking.select{|d| d['topPriceRatio'].to_f != 0 }.sort_by{|d| [d["priceChangePercent"].to_f, d["topPriceRatio"].to_f]}.reverse.first(10).each do |d| %>
<tr>
<td><%= get_symbol_url d["symbol"], d["source"] %></td>
<td><%= d["priceChangePercent"] + " %" %></td>
Expand Down

0 comments on commit 5fd97e0

Please sign in to comment.