Comments (4)
Hi @larry82,
Are you using the pub-api URL? The following works for me:
require 'rubygems'
require 'bitfinex'
client = Bitfinex::WSv2.new({
url: 'wss://api-pub.bitfinex.com/ws/2',
transform: true
})
client.on(:ticker) do |symbol, msg|
p "recv ticker message for symbol #{symbol}"
p msg.serialize.join('|')
end
client.on(:open) do
client.subscribe_ticker('fUSD')
end
client.open!
If you are still having issues, please share a code snippet that reproduces the issue.
Thanks
from bitfinex-api-rb.
I, [2019-07-07T20:26:54.711699 #37837] INFO -- ws2: recv [179343,[0.0007134986301369863,0.000645,30,5003639.261537059,0.00063735,2,196897.94456750999,-0.0000024,-0.0034,0.000699,130755027.60711361,0.00071253,0.00000191,null,null,184654802.74329743]] "recv ticker message for symbol fUSD" "|||||||||||||"
This is what I got after using your code
I'm using rails and this is my gem file
`source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.3'
gem 'john_hancock'
gem 'bitfinex-rb', :require => "bitfinex"
gem "chartkick"
gem 'rails', '~> 6.0.0.rc1'
gem 'pg'
gem 'puma', '~> 3.12'
gem 'sass-rails', '~> 5'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'redis', '~> 4.0'
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'pry-rails'
gem 'annotate'
gem 'brakeman'
gem 'bundler-audit'
gem 'letter_opener_web', '~> 1.3', '>= 1.3.4'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'webdrivers'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'jumpstart', path: 'lib/jumpstart'
gem 'administrate', github: 'excid3/administrate', branch: 'jumpstart' #'> 0.10.0'> 3.1'
gem 'attr_encrypted', '
gem 'devise', '> 4.6.0'> 2.0'
gem 'devise_invitable', '
gem 'devise_masquerade', '> 0.6.4'> 1.2'
gem 'image_processing', '
gem 'inline_svg', '> 1.3', '>= 1.3.1'> 2.1'
gem 'local_time', '
gem 'name_of_person', '> 1.0'> 3.0'
gem 'pagy', '
gem 'pay', '> 1.0.0.beta5'> 0.2.2'
gem 'receipts', '
gem 'turbolinks_render', '~> 0.9.12'
gem 'omniauth'
gem 'strong_migrations'
gem 'whenever', require: false
if File.exists?("config/jumpstart/Gemfile")
eval_gemfile "config/jumpstart/Gemfile"
end
`
from bitfinex-api-rb.
I set the "transform" option to false and then the msg can be shown normally
client = Bitfinex::WSv2.new({
url: 'wss://api-pub.bitfinex.com/ws/2',
transform: false
})
client.on(:ticker) do |symbol, msg|
p "recv ticker message for symbol #{symbol}"
p msg
end
client.on(:open) do
client.subscribe_ticker('fUSD')
end
client.open!
"recv ticker message for symbol fUSD"
[0.000713345205479452, 0.000645, 30, 6087698.5942001995, 0.00062886, 2, 429636.50682435, -0.00010726, -0.1527, 0.00059522, 132211775.44697618, 0.00071253, 1.91e-06, nil, nil, 186125929.93047523]
from bitfinex-api-rb.
Ok so it looks like it is working for you now. If I'm mistaken I will re-open the issue. Thank you.
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
- 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.