Giter Site home page Giter Site logo

Comments (4)

face avatar face commented on June 11, 2024

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.

larry82 avatar larry82 commented on June 11, 2024

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'
gem 'attr_encrypted', '
> 3.1'
gem 'devise', '> 4.6.0'
gem 'devise_invitable', '
> 2.0'
gem 'devise_masquerade', '> 0.6.4'
gem 'image_processing', '
> 1.2'
gem 'inline_svg', '> 1.3', '>= 1.3.1'
gem 'local_time', '
> 2.1'
gem 'name_of_person', '> 1.0'
gem 'pagy', '
> 3.0'
gem 'pay', '> 1.0.0.beta5'
gem 'receipts', '
> 0.2.2'
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.

larry82 avatar larry82 commented on June 11, 2024

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.

face avatar face commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.