Skip to content

Commit

Permalink
Update open spot orders page
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-xiong committed Dec 1, 2023
1 parent e0a3846 commit a9373d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/open_spot_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ def current_price
end

def margin_rate
current_price.zero? ? 0 : ((price - current_price) / current_price) * 100
current_price.zero? ? 0 : ((current_price - price) / current_price) * 100
end
end
6 changes: 2 additions & 4 deletions app/views/page/open_spot_orders.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
<th>买卖类别</th>
<th>委托价</th>
<th>当前价</th>
<th>委托家和当前价的比例</th>
<th>委托价和当前价的比例</th>
<th>委托数量</th>
<th>成交数量</th>
<th>委托金额</th>
<th>订单类型</th>
</tr>
Expand All @@ -38,9 +37,8 @@
<td class="<%= trade_type_style(order.trade_type) %>"><%= I18n.t("views.trading.#{order.trade_type}") %></td>
<td><%= order.price.round(4) %></td>
<td><%= order.current_price.round(4) %></td>
<td><%= order.margin_rate.round(2) %>%</td>
<td class="<%= order.margin_rate > 0 ? 'pos-num' : 'neg-num' %>"><%= order.margin_rate.round(2) %>%</td>
<td><%= order.orig_qty.round(4) %></td>
<td><%= order.executed_qty.round(4) %></td>
<td><%= order.amount.round(4) %></td>
<td><%= order.order_type %></td>
</tr>
Expand Down

0 comments on commit a9373d6

Please sign in to comment.