bitfinex-rb 1.0.2 → 1.0.7

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
- SHA1:
3
- metadata.gz: 9605e8f52f53439ff725d62a59282486c12a8825
4
- data.tar.gz: c71ab0c15ab935b66d1f681bf4c160f12435d082
2
+ SHA256:
3
+ metadata.gz: aae43b19cd5b14ec09f9c24c1c1fb2f569e144189e614298715498d906c5536b
4
+ data.tar.gz: f0df02719dc6aa0f9bbeea16f10f9df1dc24cd2ae0b708128f761642b0f19c8f
5
5
  SHA512:
6
- metadata.gz: 0fa4f96b629e26df7fea6df6b15c998d48199384268197f5a68a6044cd432546a22010bf9c362ef7683dd55ac080ebbbe8558b90bb0c20510565783b0c5da3fa
7
- data.tar.gz: df5280443e46887745368b785b093f847f720c25273acaa067277416f5935ee27f62da95d180bb2cfd95123ba6d4405ea8a18ea2a826d7321434d364ece6cefd
6
+ metadata.gz: 401d3de4b62ffafa75c7c59b1f0f82658fd34a7bede699abda7bb34b979d3149c5c2871e13252624b3cdad8107ac8315b8ef3d0f11d771603f9357ce78c5644e
7
+ data.tar.gz: 79d46fa771c9917958d014e4fc421d95ba270cbf1c76bbb12ae22f00c837be64a42f15e3a6bf690cfae6fca511ca9d06c49e79927def2144039ffffb0db5c4ea
@@ -33,6 +33,20 @@ module Bitfinex
33
33
  def self.unserialize (data)
34
34
  return Model.unserialize(data, FIELDS, BOOL_FIELDS)
35
35
  end
36
+
37
+ def to_new_order_packet
38
+ data = {
39
+ :type => @type,
40
+ :symbol => @symbol,
41
+ :amount => BigDecimal.new(@amount, 8).to_s,
42
+ :rate => BigDecimal.new(@rate, 8).to_s,
43
+ :period => 2
44
+ }
45
+ if !@flags.nil?
46
+ data[:flags] = @flags
47
+ end
48
+ data
49
+ end
36
50
  end
37
51
  end
38
52
  end
@@ -3,48 +3,36 @@ require_relative './model'
3
3
  module Bitfinex
4
4
  module Models
5
5
  class FundingTicker < Model
6
- attr_accessor :symbol, :frr, :bid, :bid_period, :bid_size, :ask
7
- attr_accessor :ask_period, :ask_size, :daily_change, :daily_change_perc
8
- attr_accessor :last_price, :volume, :high, :low
6
+ BOOL_FIELDS = []
7
+ FIELDS = {
8
+ symbol: 0,
9
+ frr: 1,
10
+ bid: 2,
11
+ bid_size: 3,
12
+ bid_period: 4,
13
+ ask: 5,
14
+ ask_size: 6,
15
+ ask_period: 7,
16
+ daily_change: 8,
17
+ daily_change_perc: 9,
18
+ last_price: 10,
19
+ volume: 11,
20
+ high: 12,
21
+ low: 13
22
+ }
9
23
 
10
- def initialize (data)
11
- super(data, {}, [])
24
+ FIELDS.each do |key, index|
25
+ attr_accessor key
12
26
  end
13
27
 
14
- def serialize ()
15
- [
16
- self.symbol,
17
- [
18
- self.frr, self.bid, self.bid_period, self.bid_size, self.ask,
19
- self.ask_period, self.ask_size, self.daily_change,
20
- self.daily_change_perc, self.last_price, self.volume, self.high,
21
- self.low
22
- ]
23
- ]
28
+ def initialize (data)
29
+ super(data, FIELDS, BOOL_FIELDS)
24
30
  end
25
31
 
26
- def self.unserialize (arr)
27
- symbol = arr[0]
28
- payload = arr[1]
29
- data = payload.kind_of?(Array) ? payload : arr.dup[1..-1]
30
-
31
- {
32
- :symbol => symbol,
33
- :frr => data[0],
34
- :bid => data[1],
35
- :bid_period => data[2],
36
- :bid_size => data[3],
37
- :ask => data[4],
38
- :ask_period => data[5],
39
- :ask_size => data[6],
40
- :daily_change => data[7],
41
- :daily_change_perc => data[8],
42
- :last_price => data[9],
43
- :volume => data[10],
44
- :high => data[11],
45
- :low => data[12]
46
- }
32
+ def self.unserialize (data)
33
+ return Model.unserialize(data, FIELDS, BOOL_FIELDS)
47
34
  end
35
+
48
36
  end
49
37
  end
50
38
  end
@@ -16,14 +16,28 @@ module Bitfinex
16
16
  :amount_orig => 7,
17
17
  :type => 8,
18
18
  :type_prev => 9,
19
+ :mts_tif => 10,
20
+ # placeholder
19
21
  :flags => 12,
20
22
  :status => 13,
23
+ # placeholder
24
+ # placeholder
21
25
  :price => 16,
22
26
  :price_avg => 17,
23
27
  :price_trailing => 18,
24
28
  :price_aux_limit => 19,
29
+ # placeholder
30
+ # placeholder
31
+ # placeholder
25
32
  :notify => 23,
26
- :placed_id => 25
33
+ :hidden => 24,
34
+ :placed_id => 25,
35
+ # placeholder
36
+ # placeholder
37
+ :routing => 28,
38
+ # placeholder
39
+ # placeholder
40
+ :meta => 31
27
41
  }
28
42
 
29
43
  FLAG_OCO = 2 ** 14 # 16384
@@ -39,7 +53,7 @@ module Bitfinex
39
53
  attr_accessor key
40
54
  end
41
55
 
42
- attr_accessor :last_amount, :meta
56
+ attr_accessor :last_amount, :lev
43
57
 
44
58
  def self.gen_cid
45
59
  @@last_cid += 1
@@ -57,6 +71,9 @@ module Bitfinex
57
71
  set_oco(data[:oco]) if data.has_key?(:oco)
58
72
  set_hidden(data[:hidden]) if data.has_key?(:hidden)
59
73
  set_post_only(data[:post_only]) if data.has_key?(:post_only)
74
+ if data.has_key?(:lev)
75
+ @lev = data[:lev]
76
+ end
60
77
  end
61
78
  end
62
79
 
@@ -153,7 +170,6 @@ module Bitfinex
153
170
  end
154
171
 
155
172
  data = {
156
- :gid => @gid,
157
173
  :cid => cid,
158
174
  :symbol => @symbol,
159
175
  :type => @type,
@@ -161,6 +177,12 @@ module Bitfinex
161
177
  :flags => @flags || 0,
162
178
  :meta => @meta
163
179
  }
180
+ if !@gid.nil?
181
+ data[:gid] = @gid
182
+ end
183
+ if !@lev.nil?
184
+ data[:lev] = @lev
185
+ end
164
186
 
165
187
  data[:price] = BigDecimal.new(@price, 5).to_s if !@price.nil?
166
188
  data[:price_trailing] = BigDecimal.new(@price_trailing, 5).to_s if !@price_trailing.nil?
@@ -14,7 +14,17 @@ module Bitfinex
14
14
  :pl => 6,
15
15
  :pl_perc => 7,
16
16
  :liquidation_price => 8,
17
- :leverage => 9
17
+ :leverage => 9,
18
+ # placeholder
19
+ :id => 11,
20
+ :mts_create => 12,
21
+ :mts_update => 13,
22
+ # placeholder
23
+ :type => 15,
24
+ # placeholder
25
+ :collateral => 17,
26
+ :callateral_min => 18,
27
+ :meta => 19
18
28
  }
19
29
 
20
30
  FIELDS.each do |key, index|
@@ -5,16 +5,17 @@ module Bitfinex
5
5
  class TradingTicker < Model
6
6
  BOOL_FIELDS = []
7
7
  FIELDS = {
8
- bid: 0,
9
- bid_size: 1,
10
- ask: 2,
11
- ask_size: 3,
12
- daily_change: 4,
13
- daily_change_perc: 5,
14
- last_price: 6,
15
- volume: 7,
16
- high: 8,
17
- low: 9
8
+ symbol: 0,
9
+ bid: 1,
10
+ bid_size: 2,
11
+ ask: 3,
12
+ ask_size: 4,
13
+ daily_change: 5,
14
+ daily_change_perc: 6,
15
+ last_price: 7,
16
+ volume: 8,
17
+ high: 9,
18
+ low: 10
18
19
  }
19
20
 
20
21
  FIELDS.each do |key, index|
@@ -100,4 +100,4 @@ module Bitfinex
100
100
  !! (config[:api_key] && config[:api_secret])
101
101
  end
102
102
  end
103
- end
103
+ end
@@ -10,11 +10,12 @@ module Bitfinex
10
10
  # @param params :is_postonly [bool] (optional) true if the order should be post only. Default is false. Only relevant for limit orders
11
11
  # @param params :ocoorder [bool] Set an additional STOP OCO order that will be linked with the current order
12
12
  # @param params :buy_price_oco [decimal] If ocoorder is true, this field represent the price of the OCO stop order to place
13
+ # @param params :sell_price_oco [decimal] If ocoorder is true, this field represent the price of the OCO stop order to place
13
14
  # @return [Hash]
14
15
  # @example:
15
16
  # client.new_order("usdbtc", 100, "market", "sell", 0)
16
17
  def new_order(symbol, amount, type, side, price = nil, params = {})
17
- check_params(params, %i{is_hidden is_postonly ocoorder buy_price_oco use_all_available})
18
+ check_params(params, %i{is_hidden is_postonly ocoorder buy_price_oco use_all_available sell_price_oco})
18
19
 
19
20
  # for 'market' order, we need to pass a random positive price, not nil
20
21
  price ||= 0.001 if type == "market" || type == "exchange market"
@@ -5,12 +5,16 @@ require_relative './v2/stats'
5
5
  require_relative './v2/ticker'
6
6
  require_relative './v2/trading'
7
7
  require_relative './v2/utils'
8
+ require_relative './v2/orders'
9
+ require_relative './v2/wallet'
10
+ require_relative './v2/funding'
11
+ require_relative './v2/positions'
8
12
 
9
13
  module Bitfinex
10
14
  class RESTv2
11
15
  attr_accessor :api_endpoint, :debug, :debug_connection, :api_version
12
16
  attr_accessor :rest_timeout, :rest_open_timeout, :proxy
13
- attr_accessor :api_key, :api_secret
17
+ attr_accessor :api_key, :api_secret, :aff_code
14
18
 
15
19
  include Bitfinex::RESTClient
16
20
  include Bitfinex::RESTv2Margin
@@ -19,6 +23,10 @@ module Bitfinex
19
23
  include Bitfinex::RESTv2Ticker
20
24
  include Bitfinex::RESTv2Trading
21
25
  include Bitfinex::RESTv2Utils
26
+ include Bitfinex::RESTv2Orders
27
+ include Bitfinex::RESTv2Wallet
28
+ include Bitfinex::RESTv2Funding
29
+ include Bitfinex::RESTv2Positions
22
30
 
23
31
  def initialize(args = {})
24
32
  self.api_endpoint = args[:url] ? "#{args[:url]}/v2/" : "https://api.bitfinex.com/v2/"
@@ -29,6 +37,7 @@ module Bitfinex
29
37
  self.rest_open_timeout = 30
30
38
  self.api_key = args[:api_key]
31
39
  self.api_secret = args[:api_secret]
40
+ self.aff_code = args[:aff_code]
32
41
  end
33
42
 
34
43
  def config
@@ -40,8 +49,9 @@ module Bitfinex
40
49
  :rest_open_timeout => self.rest_open_timeout,
41
50
  :proxy => self.proxy,
42
51
  :api_key => self.api_key,
43
- :api_secret => self.api_secret
52
+ :api_secret => self.api_secret,
53
+ :aff_code => self.aff_code
44
54
  }
45
55
  end
46
56
  end
47
- end
57
+ end
@@ -0,0 +1,86 @@
1
+ module Bitfinex
2
+ module RESTv2Funding
3
+ ###
4
+ # Submit a new funding offer
5
+ #
6
+ # @param [Hash|FundingOffer] offer
7
+ #
8
+ # @return [Array] Raw notification
9
+ ###
10
+ def submit_funding_offer(offer)
11
+ if offer.instance_of?(Models::FundingOffer)
12
+ packet = offer.to_new_order_packet
13
+ elsif offer.kind_of?(Hash)
14
+ packet = Models::FundingOffer.new(offer).to_new_order_packet
15
+ else
16
+ raise Exception, 'tried to submit offer of unkown type'
17
+ end
18
+ authenticated_post("auth/w/funding/offer/submit", params: packet).body
19
+ end
20
+
21
+ ###
22
+ # Cancel an active funding offer
23
+ #
24
+ # @param [Hash|Array|FundingOffer|number] offer - must contain or be ID
25
+ #
26
+ # @return [Array] Raw notification
27
+ ###
28
+ def cancel_funding_offer(offer)
29
+ if offer.is_a?(Numeric)
30
+ id = offer
31
+ elsif offer.is_a?(Array)
32
+ id = offer[0]
33
+ elsif offer.instance_of?(Models::FundingOffer)
34
+ id = offer.id
35
+ elsif offer.kind_of?(Hash)
36
+ id = offer[:id] || order['id']
37
+ else
38
+ raise Exception, 'tried to cancel offer with invalid ID'
39
+ end
40
+ authenticated_post("auth/w/funding/offer/cancel", params: { :id => id }).body
41
+ end
42
+
43
+ ###
44
+ # Close a funding loan/credit
45
+ #
46
+ # @param [Hash|Array|FundingOffer|FundingLoan|FundingCredit|number] funding - must contain or be ID
47
+ #
48
+ # @return [Array] Raw notification
49
+ ###
50
+ def close_funding(funding)
51
+ if funding.is_a?(Numeric)
52
+ id = funding
53
+ elsif funding.is_a?(Array)
54
+ id = funding[0]
55
+ elsif funding.instance_of?(Models::FundingOffer)
56
+ id = funding.id
57
+ elsif funding.instance_of?(Models::FundingLoan)
58
+ id = funding.id
59
+ elsif funding.instance_of?(Models::FundingCredit)
60
+ id = funding.id
61
+ elsif funding.kind_of?(Hash)
62
+ id = funding[:id] || order['id']
63
+ else
64
+ raise Exception, 'tried to close funding with invalid ID'
65
+ end
66
+ authenticated_post("auth/w/funding/close", params: { :id => id }).body
67
+ end
68
+
69
+ ###
70
+ # Submit a new auto funding request
71
+ #
72
+ # @param [string] currency - urrency for which to enable auto-renew
73
+ # @param [number] amount - amount to be auto-renewed (Minimum 50 USD equivalent)
74
+ # @param [string] rate - percentage rate at which to auto-renew. (rate == 0 to renew at FRR)
75
+ # @param [integer] period - period in days
76
+ # @param [integer] status - 1 for activate and 0 for deactivate
77
+ #
78
+ # @return [Array] Raw notification
79
+ ###
80
+ def submit_funding_auto(currency, amount, period, rate='0', status=1)
81
+ dec_amount = BigDecimal.new(amount, 8).to_s
82
+ payload = { :status => status, :currency => currency, :amount => dec_amount, :period => period, :rate => rate }
83
+ authenticated_post("auth/w/funding/auto", params: payload).body
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,95 @@
1
+ module Bitfinex
2
+ module RESTv2Orders
3
+ # Get active orders
4
+ #
5
+ # example:
6
+ # client.orders
7
+ def orders
8
+ authenticated_post("auth/r/orders").body
9
+ end
10
+
11
+ # Get Trades generated by an Order
12
+ #
13
+ # @param order_id [int32] Id of the order
14
+ # @param symbol [string] symbol used for the order
15
+ #
16
+ # @return [Array]
17
+ #
18
+ # @example:
19
+ # client.order_trades 10010, "tBTCUSD"
20
+ #
21
+ def order_trades(order_id, symbol="tBTCUSD")
22
+ authenticated_post("auth/r/order/#{symbol}:#{order_id}/trades").body
23
+ end
24
+
25
+ ###
26
+ # Submit a new order
27
+ #
28
+ # @param [Hash|Order] order
29
+ #
30
+ # @return [Array] Raw notification
31
+ ###
32
+ def submit_order(order)
33
+ if order.instance_of?(Models::Order)
34
+ packet = order.to_new_order_packet
35
+ elsif order.kind_of?(Hash)
36
+ packet = Models::Order.new(order).to_new_order_packet
37
+ else
38
+ raise Exception, 'tried to submit order of unkown type'
39
+ end
40
+
41
+ if !@aff_code.nil?
42
+ unless packet[:meta]
43
+ packet[:meta] = {}
44
+ end
45
+
46
+ packet[:meta][:aff_code] = @aff_code
47
+ end
48
+
49
+ authenticated_post("auth/w/order/submit", params: packet).body
50
+ end
51
+
52
+ ###
53
+ # Update an order with a changeset by ID
54
+ #
55
+ # @param [Hash] changes - must contain ID
56
+ #
57
+ # @return [Array] Raw notification
58
+ ###
59
+ def update_order (changes)
60
+ authenticated_post("auth/w/order/update", params: changes).body
61
+ end
62
+
63
+ ###
64
+ # Cancel an order by ID
65
+ #
66
+ # @param [Hash|Array|Order|number] order - must contain or be ID
67
+ #
68
+ # @return [Array] Raw notification
69
+ ###
70
+ def cancel_order (order)
71
+ if order.is_a?(Numeric)
72
+ id = order
73
+ elsif order.is_a?(Array)
74
+ id = order[0]
75
+ elsif order.instance_of?(Models::Order)
76
+ id = order.id
77
+ elsif order.kind_of?(Hash)
78
+ id = order[:id] || order['id']
79
+ else
80
+ raise Exception, 'tried to cancel order with invalid ID'
81
+ end
82
+ authenticated_post("auth/w/order/cancel", params: { :id => id }).body
83
+ end
84
+
85
+ # TODO - requires websocket implementation as well
86
+ def cancel_multi ()
87
+ raise Exception, 'not implemented'
88
+ end
89
+
90
+ # TODO - requires websocket implementation as well
91
+ def order_multi ()
92
+ raise Exception, 'not implemented'
93
+ end
94
+ end
95
+ end
@@ -1,14 +1,5 @@
1
1
  module Bitfinex
2
2
  module RESTv2Personal
3
-
4
- # Get account wallets
5
- #
6
- # @example:
7
- # client.wallets
8
- def wallets
9
- authenticated_post("auth/r/wallets").body
10
- end
11
-
12
3
  # Get account historical daily performance
13
4
  #
14
5
  # @example:
@@ -0,0 +1,25 @@
1
+ module Bitfinex
2
+ module RESTv2Positions
3
+ ###
4
+ # Claim an active position
5
+ #
6
+ # @param [Hash|Array|Position|number] position - must contain or be ID
7
+ #
8
+ # @return [Array] Raw notification
9
+ ###
10
+ def claim_position(position)
11
+ if position.is_a?(Numeric)
12
+ id = position
13
+ elsif position.is_a?(Array)
14
+ id = position[0]
15
+ elsif position.instance_of?(Models::Position)
16
+ id = position.id
17
+ elsif position.kind_of?(Hash)
18
+ id = position[:id] || position['id']
19
+ else
20
+ raise Exception, 'tried to claim position with invalid ID'
21
+ end
22
+ authenticated_post("auth/w/position/claim", params: { :id => id }).body
23
+ end
24
+ end
25
+ end
@@ -65,28 +65,6 @@ module Bitfinex
65
65
  get("trades/#{symbol}", params).body
66
66
  end
67
67
 
68
- # Get active orders
69
- #
70
- # example:
71
- # client.orders
72
- def orders
73
- authenticated_post("auth/r/orders").body
74
- end
75
-
76
- # Get Trades generated by an Order
77
- #
78
- # @param order_id [int32] Id of the order
79
- # @param symbol [string] symbol used for the order
80
- #
81
- # @return [Array]
82
- #
83
- # @example:
84
- # client.order_trades 10010, "tBTCUSD"
85
- #
86
- def order_trades(order_id, symbol="tBTCUSD")
87
- authenticated_post("auth/r/order/#{symbol}:#{order_id}/trades").body
88
- end
89
-
90
68
  # Get active positions
91
69
  #
92
70
  # return [Array]
@@ -0,0 +1,69 @@
1
+ module Bitfinex
2
+ module RESTv2Wallet
3
+ # Get account wallets
4
+ #
5
+ # @example:
6
+ # client.wallets
7
+ def wallets
8
+ authenticated_post("auth/r/wallets").body
9
+ end
10
+
11
+ ###
12
+ # Transfer between bitfinex wallets
13
+ #
14
+ # @param from [string] wallet to transfer funds from (exchange, margin ect...)
15
+ # @param to [string] wallet to transfer funds to (exchange, margin ect...)
16
+ # @param currency_from [string] original currency of funds
17
+ # @param currency_to [string] currency to convert funds to
18
+ # @param amount [number] amount of funds to convert
19
+ #
20
+ # @return [Array] Raw notification
21
+ ###
22
+ def transfer (from, to, currency_from, currency_to, amount)
23
+ payload = { :from => from, :to => to, :currency => currency, :currency_to => currency_to, :amount => amount }
24
+ authenticated_post("auth/w/transfer", params: payload).body
25
+ end
26
+
27
+ ###
28
+ # Get the deposit address for the given currency
29
+ #
30
+ # @param wallet [string] wallet to transfer funds from (exchange, margin ect...)
31
+ # @param method [string] funds transfer protocol (bitcoin, tetherus ect...)
32
+ #
33
+ # @return [Array] Raw notification
34
+ ###
35
+ def deposit_address (wallet, method)
36
+ payload = { :wallet => wallet, :method => method, :op_renew => 0 }
37
+ authenticated_post("auth/w/deposit/address", params: payload).body
38
+ end
39
+
40
+ ###
41
+ # Regenerate the deposit address for the given currency. All previous addresses
42
+ # are still active and can receive funds.
43
+ #
44
+ # @param wallet [string] wallet to transfer funds from (exchange, margin ect...)
45
+ # @param method [string] funds transfer protocol (bitcoin, tetherus ect...)
46
+ #
47
+ # @return [Array] Raw notification
48
+ ###
49
+ def create_deposit_address (wallet, method)
50
+ payload = { :wallet => wallet, :method => method, :op_renew => 1 }
51
+ authenticated_post("auth/w/deposit/address", params: payload).body
52
+ end
53
+
54
+ ###
55
+ # Withdraw from the given bitfinex wallet to the given cryptocurrency address
56
+ #
57
+ # @param wallet [string] wallet to transfer funds from (exchange, margin ect...)
58
+ # @param method [string] funds transfer protocol (bitcoin, tetherus ect...)
59
+ # @param amount [number] amount of funds to withdraw
60
+ # @param address [string] public key destination address
61
+ #
62
+ # @return [Array] Raw notification
63
+ ###
64
+ def withdraw (wallet, method, amount, address)
65
+ payload = { :wallet => wallet, :method => method, :amount => amount, :address => address }
66
+ authenticated_post("auth/w/withdraw", params: { :id => id }).body
67
+ end
68
+ end
69
+ end
@@ -52,6 +52,7 @@ module Bitfinex
52
52
  #
53
53
  # @param [Hash] params
54
54
  # @param [string] params.url - connection URL
55
+ # @param [string] params.aff_code - optional affiliate code to be applied to all orders
55
56
  # @param [string] params.api_key
56
57
  # @param [string] params.api_secret
57
58
  # @param [boolean] params.manage_order_books - if true, order books are persisted internally, allowing for automatic checksum verification
@@ -64,6 +65,7 @@ module Bitfinex
64
65
  @l.progname = 'ws2'
65
66
 
66
67
  @url = params[:url] || 'wss://api.bitfinex.com/ws/2'
68
+ @aff_code = params[:aff_code]
67
69
  @api_key = params[:api_key]
68
70
  @api_secret = params[:api_secret]
69
71
  @manage_obs = params[:manage_order_books]
@@ -229,11 +231,12 @@ module Bitfinex
229
231
 
230
232
  def handle_ticker_message (msg, chan) # :nodoc:
231
233
  payload = msg[1]
234
+ payload_with_sym = [chan['symbol']].concat(payload)
232
235
 
233
236
  if chan['symbol'][0] === 't'
234
- emit(:ticker, chan['symbol'], @transform ? Models::TradingTicker.new(payload) : payload)
237
+ emit(:ticker, chan['symbol'], @transform ? Models::TradingTicker.new(payload_with_sym) : payload)
235
238
  else
236
- emit(:ticker, chan['symbol'], @transform ? Models::FundingTicker.new(payload) : payload)
239
+ emit(:ticker, chan['symbol'], @transform ? Models::FundingTicker.new(payload_with_sym) : payload)
237
240
  end
238
241
  end
239
242
 
@@ -721,6 +724,14 @@ module Bitfinex
721
724
  raise Exception, 'tried to submit order of unkown type'
722
725
  end
723
726
 
727
+ if !@aff_code.nil?
728
+ unless packet[:meta]
729
+ packet[:meta] = {}
730
+ end
731
+
732
+ packet[:meta][:aff_code] = @aff_code
733
+ end
734
+
724
735
  @ws.send(JSON.generate([0, 'on', nil, packet]))
725
736
 
726
737
  if packet.has_key?(:cid) && !cb.nil?
metadata CHANGED
@@ -1,73 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfinex-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitfinex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.15.3
20
- - - ">="
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.15.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.15.3
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.15.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: eventmachine
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 1.2.7
40
- - - ">="
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.2.7
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: 1.2.7
50
- - - ">="
50
+ - - "~>"
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.2.7
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: faraday-detailed_logger
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: 2.1.2
60
- - - ">="
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: 2.1.2
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: 2.1.2
70
- - - ">="
70
+ - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 2.1.2
73
73
  - !ruby/object:Gem::Dependency
@@ -88,120 +88,120 @@ dependencies:
88
88
  name: json
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - "~>"
92
- - !ruby/object:Gem::Version
93
- version: 2.1.0
94
91
  - - ">="
95
92
  - !ruby/object:Gem::Version
96
- version: 2.1.0
93
+ version: 2.2.0
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.2.0
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 2.1.0
104
101
  - - ">="
105
102
  - !ruby/object:Gem::Version
106
- version: 2.1.0
103
+ version: 2.2.0
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: 2.2.0
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: faraday_middleware
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - "~>"
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: 0.12.2
114
- - - ">="
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: 0.12.2
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: 0.12.2
124
- - - ">="
124
+ - - "~>"
125
125
  - !ruby/object:Gem::Version
126
126
  version: 0.12.2
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: emittr
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - "~>"
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: 0.1.0
134
- - - ">="
134
+ - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: 0.1.0
137
137
  type: :runtime
138
138
  prerelease: false
139
139
  version_requirements: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - "~>"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: 0.1.0
144
- - - ">="
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
146
  version: 0.1.0
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: dotenv
149
149
  requirement: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - "~>"
151
+ - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: 2.5.0
154
- - - ">="
154
+ - - "~>"
155
155
  - !ruby/object:Gem::Version
156
156
  version: 2.5.0
157
157
  type: :runtime
158
158
  prerelease: false
159
159
  version_requirements: !ruby/object:Gem::Requirement
160
160
  requirements:
161
- - - "~>"
161
+ - - ">="
162
162
  - !ruby/object:Gem::Version
163
163
  version: 2.5.0
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 2.5.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: faraday_adapter_socks
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.1.1
174
- - - ">="
174
+ - - "~>"
175
175
  - !ruby/object:Gem::Version
176
176
  version: 0.1.1
177
177
  type: :runtime
178
178
  prerelease: false
179
179
  version_requirements: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - "~>"
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
183
  version: 0.1.1
184
- - - ">="
184
+ - - "~>"
185
185
  - !ruby/object:Gem::Version
186
186
  version: 0.1.1
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: zlib
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - "~>"
191
+ - - ">="
192
192
  - !ruby/object:Gem::Version
193
193
  version: 1.0.0
194
- - - ">="
194
+ - - "~>"
195
195
  - !ruby/object:Gem::Version
196
196
  version: 1.0.0
197
197
  type: :runtime
198
198
  prerelease: false
199
199
  version_requirements: !ruby/object:Gem::Requirement
200
200
  requirements:
201
- - - "~>"
201
+ - - ">="
202
202
  - !ruby/object:Gem::Version
203
203
  version: 1.0.0
204
- - - ">="
204
+ - - "~>"
205
205
  - !ruby/object:Gem::Version
206
206
  version: 1.0.0
207
207
  description: Official Bitfinex API ruby wrapper
@@ -253,12 +253,16 @@ files:
253
253
  - lib/rest/v1/trades.rb
254
254
  - lib/rest/v1/wallet.rb
255
255
  - lib/rest/v2.rb
256
+ - lib/rest/v2/funding.rb
256
257
  - lib/rest/v2/margin.rb
258
+ - lib/rest/v2/orders.rb
257
259
  - lib/rest/v2/personal.rb
260
+ - lib/rest/v2/positions.rb
258
261
  - lib/rest/v2/stats.rb
259
262
  - lib/rest/v2/ticker.rb
260
263
  - lib/rest/v2/trading.rb
261
264
  - lib/rest/v2/utils.rb
265
+ - lib/rest/v2/wallet.rb
262
266
  - lib/ws/ws2.rb
263
267
  homepage: https://www.bitfinex.com/
264
268
  licenses:
@@ -279,8 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
283
  - !ruby/object:Gem::Version
280
284
  version: '0'
281
285
  requirements: []
282
- rubyforge_project:
283
- rubygems_version: 2.6.14
286
+ rubygems_version: 3.0.6
284
287
  signing_key:
285
288
  specification_version: 4
286
289
  summary: Bitfinex API Wrapper