Skip to content

Conversation

@f3rno
Copy link
Contributor

@f3rno f3rno commented Nov 14, 2018

This PR adds a cancel_order method to WSv2, and support for callbacks in both cancel_order and submit_order that resolve with received notifications. Also adds request_calc, and comments/doc headers to WSv2.

Example:

client = Bitfinex::WSv2.new({
  # ...
  :transform => true
})

client.on(:open) { client.auth! }
client.on(:auth) do
  p 'succesfully authenticated'

  o = Bitfinex::Models::Order.new({
    :type => 'EXCHANGE LIMIT',
    :price => 3.0152235,
    :amount => 2.0235235263262,
    :symbol => 'tEOSUSD'
  })

  client.submit_order(o) do |order_packet|
    p "recv order confirmation packet with ID #{order_packet.id}"

    client.update_order({
      :id => order_packet.id,
      :price => '3.0'
    }) do |update_packet|
      p "updated order #{update_packet.id} with price #{update_packet.price}"

      client.cancel_order(order_packet) do |canceled_order|
        p "canceled order with ID #{canceled_order[0]}"
      end
    end
  end
end

@prdn prdn merged commit 838534e into bitfinexcom:master Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants