Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmh committed May 2, 2011
1 parent 0bd7791 commit 1653efa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/btc_trader/trader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def execute!(rec)
end

def buy(amount)
raise "Order exceeds balance" if amount > @cash_balance
raise "Buy order exceeds balance" if amount > @cash_balance
@cash_balance -= amount
btc = amount / @price
@btc_balance += btc * TRADE_FEE_MULTIPLIER
Expand All @@ -36,6 +36,7 @@ def buy(amount)
end

def sell(amount)
raise "Sell order exceeds balance" if amount > @btc_balance
@btc_balance -= amount
cash = amount * @price
@cash_balance += cash * TRADE_FEE_MULTIPLIER
Expand All @@ -56,7 +57,7 @@ def ror_no_fee
end
end

# A trivial example that buys at the outset and hold until the end
# A trivial example that buys at the outset and holds until the end
module Strategies
class BuyAndHoldTrader < Trader
def execute_strategy!
Expand Down

0 comments on commit 1653efa

Please sign in to comment.