Skip to content

Commit

Permalink
fix synced transactions job
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-xiong committed Sep 6, 2023
1 parent 0af232b commit b90900c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/synced_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def import_csv
user_id = current_user.id if source_type == 'private'
source = params[:source].presence || 'binance'
import_status = if source == 'binance'
ImportBinanceTransactionsCsvService.new(params[:files], source, user_id).call
ImportBinanceTransactionsCsvService.new(params[:files].first, source, user_id).call
else
ImportOkxTransactionsCsvService.new(params[:files], source, user_id).call
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/import_okx_transactions_csv_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def store_okx_model
price = symbol == 'ELON-USDT-SWAP' ? row[11].to_f : other_row[7].to_f
qty = amount / price
revenue = row[12].to_f
trade_type = ["卖", "SELL"].include?(row[5]) ? "sell" : "buy"
trade_type = ["卖", "SELL", "平空"].include?(row[5]) ? "sell" : "buy"
fee, fee_symbol = row[13].split(' ')
fee = fee.to_f.abs
position_side = if trade_type == 'sell'
Expand Down
2 changes: 1 addition & 1 deletion app/views/adding_positions_histories/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<td class="<%= h.amount.to_f > 0 ? 'pos-num' : 'neg-num' %>"><%= h.amount.round(4) %></td>
<td class="<%= h.get_revenue.to_f > 0 ? 'pos-num' : 'neg-num' %>"><%= h.get_revenue.round(4) %></td>
<td><%= "#{h.roi}%" %></td>
<td><%= "#{(h.trading_roi * 100).round(3)}%" %></td>
<td><%= "#{(h.trading_roi.to_f * 100).round(3)}%" %></td>
<td><%= h.source %></td>
</tr>
<% end %>
Expand Down

0 comments on commit b90900c

Please sign in to comment.