bitfinex-rb 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bitfinex/deposit.rb +1 -1
- data/lib/bitfinex/margin_funding.rb +3 -3
- data/lib/bitfinex/orders.rb +8 -5
- data/lib/bitfinex/positions.rb +2 -2
- data/lib/bitfinex/version.rb +1 -1
- data/lib/bitfinex/wallet.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685070e19c5fd5d873dfdbf4e913af07afca0dd2
|
4
|
+
data.tar.gz: 025b79fb12c285d334a4a78a1bb6f88815f187a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b739604627de5dffc0210404db6dfa51c28ce37aaaa0c6355ee4c1e58ac72f163272c01eda225e664e5d825c7225755eb5677a9c4f084c1480a39a926438b7d
|
7
|
+
data.tar.gz: c67934b085c0c5d157e7a541510f03c5d1c04e37e16d52e5f400d6cc936cbe12defe79102ebf53bc44b3feb59f234cfdceff7b1d54f9053bdd017e192bcfdbfa
|
data/lib/bitfinex/deposit.rb
CHANGED
@@ -29,7 +29,7 @@ module Bitfinex
|
|
29
29
|
# @example:
|
30
30
|
# client.cancel_offer(1000)
|
31
31
|
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
|
33
33
|
end
|
34
34
|
|
35
35
|
# Get the status of an offer. Is it active? Was it cancelled? To what extent has it been executed? etc.
|
@@ -39,7 +39,7 @@ module Bitfinex
|
|
39
39
|
# @example:
|
40
40
|
# client.offer_status(1000)
|
41
41
|
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
|
43
43
|
end
|
44
44
|
|
45
45
|
# View your funds currently taken (active credits)
|
@@ -94,7 +94,7 @@ module Bitfinex
|
|
94
94
|
# @example:
|
95
95
|
# client.close_funding(1000)
|
96
96
|
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
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
data/lib/bitfinex/orders.rb
CHANGED
@@ -18,6 +18,9 @@ module Bitfinex
|
|
18
18
|
def new_order(symbol, amount, type, side, price = nil, params = {})
|
19
19
|
check_params(params, %i{is_hidden is_postonly ocoorder buy_price_oco})
|
20
20
|
|
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
|
+
|
21
24
|
params.merge!({
|
22
25
|
symbol: symbol,
|
23
26
|
amount: amount.to_s,
|
@@ -58,9 +61,9 @@ module Bitfinex
|
|
58
61
|
def cancel_orders(ids=nil)
|
59
62
|
case ids
|
60
63
|
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
|
64
67
|
when NilClass
|
65
68
|
authenticated_post("order/cancel/all").body
|
66
69
|
else
|
@@ -91,7 +94,7 @@ module Bitfinex
|
|
91
94
|
is_hidden: is_hidden,
|
92
95
|
price: price.to_s
|
93
96
|
}
|
94
|
-
authenticated_post("order/cancel/replace", params).body
|
97
|
+
authenticated_post("order/cancel/replace", params: params).body
|
95
98
|
end
|
96
99
|
|
97
100
|
# Get the status of an order. Is it active? Was it cancelled? To what extent has it been executed? etc.
|
@@ -101,7 +104,7 @@ module Bitfinex
|
|
101
104
|
# @exmaple:
|
102
105
|
# client.order_status(100)
|
103
106
|
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
|
105
108
|
end
|
106
109
|
|
107
110
|
|
data/lib/bitfinex/positions.rb
CHANGED
@@ -15,13 +15,13 @@ module Bitfinex
|
|
15
15
|
# 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.
|
16
16
|
#
|
17
17
|
# 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`
|
19
19
|
# @param amount [decimal] The partial amount you wish to claim
|
20
20
|
# @return [Hash]
|
21
21
|
# @example:
|
22
22
|
# client.claim_position(100,10)
|
23
23
|
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
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/bitfinex/version.rb
CHANGED
data/lib/bitfinex/wallet.rb
CHANGED
@@ -2,30 +2,30 @@ module Bitfinex
|
|
2
2
|
module WalletClient
|
3
3
|
|
4
4
|
# See your balances.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# @param params :type [string] “trading”, “deposit” or “exchange”.
|
7
7
|
# @param params :currency [string] currency
|
8
8
|
# @param params :amount [decimal] How much balance of this currency in this wallet
|
9
9
|
# @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:
|
12
12
|
# client.balances
|
13
13
|
def balances(params = {})
|
14
14
|
check_params(params, %i{type currency amount available})
|
15
|
-
authenticated_post("balances", params).body
|
15
|
+
authenticated_post("balances", params: params).body
|
16
16
|
end
|
17
17
|
|
18
18
|
# See your trading wallet information for margin trading.
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# @return [Array]
|
21
|
-
# @example:
|
21
|
+
# @example:
|
22
22
|
# client.margin_infos
|
23
23
|
def margin_infos
|
24
24
|
authenticated_post("margin_infos").body
|
25
25
|
end
|
26
26
|
|
27
27
|
# Allow you to move available balances between your wallets.
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# @param amount [decimal] Amount to transfer
|
30
30
|
# @param currency [string] Currency of funds to transfer
|
31
31
|
# @param wallet_from [string] Wallet to transfer from
|
@@ -40,7 +40,7 @@ module Bitfinex
|
|
40
40
|
wallet_from: wallet_from,
|
41
41
|
wallet_to: wallet_to
|
42
42
|
}
|
43
|
-
authenticated_post("transfer", params).body
|
43
|
+
authenticated_post("transfer", params: params).body
|
44
44
|
end
|
45
45
|
|
46
46
|
# Allow you to request a withdrawal from one of your wallet.
|
@@ -74,7 +74,7 @@ module Bitfinex
|
|
74
74
|
walletselected: walletselected,
|
75
75
|
amount: amount})
|
76
76
|
|
77
|
-
authenticated_post("withdraw", params).body
|
77
|
+
authenticated_post("withdraw", params: params).body
|
78
78
|
end
|
79
79
|
|
80
80
|
# Check the permissions of the key being used to generate this request
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitfinex-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bitfinex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|