Comments (8)
Hi @arvicco, you should use the listen_account
method passing a block, this is a full working example :
require 'bitfinex'
Bitfinex::Client.configure do |conf|
conf.api_key = ENV["BFX_KEY"]
conf.secret = ENV["BFX_SECRET"]
end
client = Bitfinex::Client.new
client.listen_account do |c|
puts "account: #{c.inspect}"
end
client.listen_ticker do |t|
puts "tick: #{t.inspect}"
end
client.listen_book do |b|
puts "book: #{b.inspect}"
end
client.listen_trades do |b|
puts "trades: #{b.inspect}"
end
client.listen!
from bitfinex-api-rb.
Ah, sorry - it works now, I wasn't using the module API correctly - you need to call it's methods on Bitfinex::Client.
from bitfinex-api-rb.
We are working on the websocket feed, should be ready soon.
from bitfinex-api-rb.
Great! I messed around with it a bit and got public channels working with code like:
bws = Bitfinex::Websocket::EMClient.new
bws.on ('open') { |_| bws.send( event: 'subscribe', channel: 'trades', pair: 'BTCUSD') }
bws.on ('message') { | json | pp JSON.parse(json) }
bws.run!
I'm still not sure how to handle auth though, in order to receive account-specific channels. Maybe you happen have a Ruby snippet handy that you could share? I'm a bit obtuse with Javascript.
from bitfinex-api-rb.
from bitfinex-api-rb.
Thanks! I tried to use new WebsocketConnection module to do ws auth, but no luck so far: 'websocket_connection.rb:27:in ws_auth': undefined method
sign' for main:Object (NoMethodError)'
from bitfinex-api-rb.
Great job, guys! It does all I need atm.
from bitfinex-api-rb.
Do I understand correctly that this websocket API is for live feed only? And it's not suited to place/cancel orders etc?
from bitfinex-api-rb.
Related Issues (20)
- ws v1 ticker API not working anymore? HOT 1
- This is maybe wrong about funding offers
- Implementation of Ledgers endpoint in Ruby?
- WS2 - Order book management code fails checksum audit
- JSON version for Ruby 2.4.1 HOT 1
- Orderbook() turning max of 25 asks and bids HOT 2
- Missing docs for /tickers
- Adding/deleting pair(s)
- Bitfinex::NotFoundError on api v2 trades HOT 1
- Not Indexed response
- api_v2.rb ex : ample
- api_v2.rb example bug HOT 1
- Facing issue with the Bitfinex API Key ans Secret Key. HOT 5
- Facing This pair cannot be traded on margin - Bitfinex HOT 1
- Ruby API library dead? HOT 1
- Facing issue with uninitialized constant Bitfinex::Client (NameError). HOT 3
- Unable to activate bitfinex-rb-1.0.2, because json-2.2.0 conflicts with json (>= 2.1.0, ~> 2.1.0) (Gem::ConflictError)
- Bitfinex::BadRequestError: Nonce is too small HOT 3
- FundingTicker not working HOT 4
- Release Github versions to Rubygems HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitfinex-api-rb.