Skip to content

Commit 6fe217c

Browse files
committed
Merge pull request #11 from arvicco/master
Fixed all instances of calls silently dropping params
2 parents 3477c0e + 7412f6b commit 6fe217c

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

lib/bitfinex/deposit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def deposit method, wallet_name, renew=0
1616
renew: renew
1717
}
1818

19-
authenticated_post("deposit/new", params).body
19+
authenticated_post("deposit/new", params: params).body
2020
end
2121
end
2222
end

lib/bitfinex/margin_funding.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def new_offer(currency, amount, rate, period, direction)
2929
# @example:
3030
# client.cancel_offer(1000)
3131
def cancel_offer(offer_id)
32-
authenticated_post("offer/cancel", {offer_id: offer_id}).body
32+
authenticated_post("offer/cancel", params: {offer_id: offer_id.to_i}).body
3333
end
3434

3535
# Get the status of an offer. Is it active? Was it cancelled? To what extent has it been executed? etc.
@@ -39,7 +39,7 @@ def cancel_offer(offer_id)
3939
# @example:
4040
# client.offer_status(1000)
4141
def offer_status(offer_id)
42-
authenticated_post("offer/status", {offer_id: offer_id}).body
42+
authenticated_post("offer/status", params: {offer_id: offer_id.to_i}).body
4343
end
4444

4545
# View your funds currently taken (active credits)
@@ -94,7 +94,7 @@ def total_taken_funds
9494
# @example:
9595
# client.close_funding(1000)
9696
def close_funding(swap_id)
97-
authenticated_post("funding/close", {swap_id: swap_id}).body
97+
authenticated_post("funding/close", params: {swap_id: swap_id.to_i}).body
9898
end
9999
end
100100
end

lib/bitfinex/orders.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module OrdersClient
1818
def new_order(symbol, amount, type, side, price = nil, params = {})
1919
check_params(params, %i{is_hidden is_postonly ocoorder buy_price_oco})
2020

21+
# for 'market' order, we need to pass a random positive price, not nil
22+
price ||= 0.00001 if type == "market" || type == "exchange market"
23+
2124
params.merge!({
2225
symbol: symbol,
2326
amount: amount.to_s,
@@ -58,9 +61,9 @@ def multiple_orders(orders)
5861
def cancel_orders(ids=nil)
5962
case ids
6063
when Array
61-
authenticated_post("order/cancel/multi", {order_ids: ids}).body
62-
when Numeric
63-
authenticated_post("order/cancel", {order_id: ids}).body
64+
authenticated_post("order/cancel/multi", params: {order_ids: ids.map(&:to_i)}).body
65+
when Numeric, String
66+
authenticated_post("order/cancel", params: {order_id: ids.to_i}).body
6467
when NilClass
6568
authenticated_post("order/cancel/all").body
6669
else
@@ -91,7 +94,7 @@ def replace_order(id, symbol, amount, type, side, price, is_hidden=false)
9194
is_hidden: is_hidden,
9295
price: price.to_s
9396
}
94-
authenticated_post("order/cancel/replace", params).body
97+
authenticated_post("order/cancel/replace", params: params).body
9598
end
9699

97100
# Get the status of an order. Is it active? Was it cancelled? To what extent has it been executed? etc.
@@ -101,7 +104,7 @@ def replace_order(id, symbol, amount, type, side, price, is_hidden=false)
101104
# @exmaple:
102105
# client.order_status(100)
103106
def order_status(id)
104-
authenticated_post("order/status", order_id: id).body
107+
authenticated_post("order/status", params: {order_id: id.to_i}).body
105108
end
106109

107110

lib/bitfinex/positions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ def positions
1515
# It is a long position: The amount in the last unit of the position pair that you have in your trading wallet AND/OR the realized profit of the position is greater or equal to the purchase amount of the position (base price * position amount) and the funds which need to be returned. For example, for a long BTCUSD position, you can claim the position if the amount of USD you have in the trading wallet is greater than the base price * the position amount and the funds used.
1616
#
1717
# It is a short position: The amount in the first unit of the position pair that you have in your trading wallet is greater or equal to the amount of the position and the margin funding used.
18-
# @param position_id [int] The position ID given by `/positions`
18+
# @param position_id [int] The position ID given by `/positions`
1919
# @param amount [decimal] The partial amount you wish to claim
2020
# @return [Hash]
2121
# @example:
2222
# client.claim_position(100,10)
2323
def claim_position(position_id, amount)
24-
authenticated_post("position/claim", {position_id: position_id, amount: amount}).body
24+
authenticated_post("position/claim", params: {position_id: position_id, amount: amount}).body
2525
end
2626
end
2727
end

lib/bitfinex/wallet.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ module Bitfinex
22
module WalletClient
33

44
# See your balances.
5-
#
5+
#
66
# @param params :type [string] “trading”, “deposit” or “exchange”.
77
# @param params :currency [string] currency
88
# @param params :amount [decimal] How much balance of this currency in this wallet
99
# @param params :available [decimal] How much X there is in this wallet that is available to trade
10-
# @return [Array]
11-
# @example:
10+
# @return [Array]
11+
# @example:
1212
# client.balances
1313
def balances(params = {})
1414
check_params(params, %i{type currency amount available})
15-
authenticated_post("balances", params).body
15+
authenticated_post("balances", params: params).body
1616
end
1717

1818
# See your trading wallet information for margin trading.
19-
#
19+
#
2020
# @return [Array]
21-
# @example:
21+
# @example:
2222
# client.margin_infos
2323
def margin_infos
2424
authenticated_post("margin_infos").body
2525
end
2626

2727
# Allow you to move available balances between your wallets.
28-
#
28+
#
2929
# @param amount [decimal] Amount to transfer
3030
# @param currency [string] Currency of funds to transfer
3131
# @param wallet_from [string] Wallet to transfer from
@@ -40,7 +40,7 @@ def transfer(amount, currency, wallet_from, wallet_to)
4040
wallet_from: wallet_from,
4141
wallet_to: wallet_to
4242
}
43-
authenticated_post("transfer", params).body
43+
authenticated_post("transfer", params: params).body
4444
end
4545

4646
# Allow you to request a withdrawal from one of your wallet.
@@ -74,7 +74,7 @@ def withdraw(withdraw_type, walletselected, amount, params={})
7474
walletselected: walletselected,
7575
amount: amount})
7676

77-
authenticated_post("withdraw", params).body
77+
authenticated_post("withdraw", params: params).body
7878
end
7979

8080
# Check the permissions of the key being used to generate this request

0 commit comments

Comments
 (0)