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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83b15f4ee0948a7bfa5d093d22db01a31d5b950f
4
- data.tar.gz: c5ba58927b2ce63f008e2d7ff3b2be183b30777b
3
+ metadata.gz: 685070e19c5fd5d873dfdbf4e913af07afca0dd2
4
+ data.tar.gz: 025b79fb12c285d334a4a78a1bb6f88815f187a5
5
5
  SHA512:
6
- metadata.gz: 9814f5265c77c6cdd01392324ef796cea7ab1b2ab33041d9c8e9ba8f79070a8b1a28e18ac7b1d1611dc7844cf544d6d4fffe7ce5ba2fe18e9b97cb74cd43a777
7
- data.tar.gz: e3224dc050ea43d595f4f25aa7b7c803bc2101c749355e3311eb4726d6ace17c643d50dbf95dc38716c63d6b6e0338772c4b3274cdfb9c50006c8f6ded03546a
6
+ metadata.gz: 0b739604627de5dffc0210404db6dfa51c28ce37aaaa0c6355ee4c1e58ac72f163272c01eda225e664e5d825c7225755eb5677a9c4f084c1480a39a926438b7d
7
+ data.tar.gz: c67934b085c0c5d157e7a541510f03c5d1c04e37e16d52e5f400d6cc936cbe12defe79102ebf53bc44b3feb59f234cfdceff7b1d54f9053bdd017e192bcfdbfa
@@ -16,7 +16,7 @@ module Bitfinex
16
16
  renew: renew
17
17
  }
18
18
 
19
- authenticated_post("deposit/new", params).body
19
+ authenticated_post("deposit/new", params: params).body
20
20
  end
21
21
  end
22
22
  end
@@ -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
@@ -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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bitfinex
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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-16 00:00:00.000000000 Z
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday