Skip to content

Commit d3ef321

Browse files
author
David FRANCOIS
committed
Last checks before merge
1 parent 70d34d0 commit d3ef321

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

app/models/trade.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ def execute
106106
account_operations << AccountOperation.new do |fee|
107107
fee.currency = "BTC"
108108
fee.amount = btc_fee
109-
fee.account = Account.storage_account_for("btc_fees".to_sym)
109+
fee.account = Account.storage_account_for(:fees)
110110
end
111111

112112
account_operations << AccountOperation.new do |fee|
113113
fee.currency = currency
114114
fee.amount = currency_fee
115-
fee.account = Account.storage_account_for((currency.downcase + "_fees").to_sym)
115+
fee.account = Account.storage_account_for(:fees)
116116
end
117117

118118
save!

db/migrate/20111205110307_add_com_to_users.rb renamed to db/migrate/20111205110307_add_commission_rate_to_users.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class AddComToUsers < ActiveRecord::Migration
1+
class AddCommissionRateToUsers < ActiveRecord::Migration
22
def self.up
33
add_column :accounts, :commission_rate, :decimal,
44
:precision => 16,

test/unit/trade_order_test.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,10 @@ class TradeOrderTest < ActiveSupport::TestCase
745745
assert_equal BigDecimal("999250.0"), trader2.balance(:lrusd), "Delta #{trader2.balance(:lrusd) - BigDecimal("999250.0")}"
746746
end
747747

748-
test "a market order should remains active" do
748+
test "a market order should remain active" do
749749
t1 = Factory(:user)
750750

751-
add_money(t1, BigDecimal("1000.0"), :btc)
751+
add_money(t1, 1000.0, :btc)
752752

753753
market = Factory(:market_order,
754754
:category => "sell",
@@ -768,7 +768,7 @@ class TradeOrderTest < ActiveSupport::TestCase
768768
assert market.active?
769769
assert limit.active?
770770

771-
add_money(t1, BigDecimal("-1000.0"), :btc)
771+
add_money(t1, -1000.0, :btc)
772772

773773
assert !limit.reload.active?
774774
assert market.reload.active?
@@ -882,7 +882,7 @@ class TradeOrderTest < ActiveSupport::TestCase
882882
:commission_rate => BigDecimal("0.1"))
883883

884884
t2 = Factory(:user,
885-
:commission_rate => BigDecimal("0.1"))
885+
:commission_rate => BigDecimal("0.2"))
886886

887887
add_money(t1, 1000, :btc)
888888
add_money(t2, 1000, :eur)
@@ -905,7 +905,8 @@ class TradeOrderTest < ActiveSupport::TestCase
905905
t.execute!
906906

907907
assert_equal t1.balance(:eur), BigDecimal("900")
908-
assert_equal Account.storage_account_for(:BTC_fees).balance(:btc), 100
908+
assert_equal Account.storage_account_for(:fees).balance(:eur), 100
909+
assert_equal Account.storage_account_for(:fees).balance(:btc), 200
909910
end
910911

911912
test "should not be able to create a very small market order" do

0 commit comments

Comments
 (0)