diff --git a/app/controllers/synced_transactions_controller.rb b/app/controllers/synced_transactions_controller.rb index 4181812..a888354 100644 --- a/app/controllers/synced_transactions_controller.rb +++ b/app/controllers/synced_transactions_controller.rb @@ -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 diff --git a/app/services/import_okx_transactions_csv_service.rb b/app/services/import_okx_transactions_csv_service.rb index 2a38f3c..04d2287 100644 --- a/app/services/import_okx_transactions_csv_service.rb +++ b/app/services/import_okx_transactions_csv_service.rb @@ -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' diff --git a/app/views/adding_positions_histories/_list.html.erb b/app/views/adding_positions_histories/_list.html.erb index e846e75..08ff981 100644 --- a/app/views/adding_positions_histories/_list.html.erb +++ b/app/views/adding_positions_histories/_list.html.erb @@ -30,7 +30,7 @@ <%= h.amount.round(4) %> <%= h.get_revenue.round(4) %> <%= "#{h.roi}%" %> - <%= "#{(h.trading_roi * 100).round(3)}%" %> + <%= "#{(h.trading_roi.to_f * 100).round(3)}%" %> <%= h.source %> <% end %>