GithubHelp home page GithubHelp logo

binance-ruby's Introduction

Returning Soon

binance-ruby's People

Contributors

0xjmp avatar 2pd avatar aronyu127 avatar cigano avatar cmer avatar cristianogregnanin avatar fdocr avatar fossabot avatar kozinski avatar lexrikkers avatar pgorgita avatar rodrigoalvesvieira avatar seanwooj avatar semsaksoy avatar wilkosz avatar zeropointenergy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

binance-ruby's Issues

Error when using TESTNET

With BINANCE_TEST_NET_ENABLE=true

On this test code

require 'rubygems'
require 'bundler/setup'
require 'binance-ruby'

Binance::Api.all_coins_info!

My Gemfile

source 'https://rubygems.org'
gem 'binance-ruby'

I am getting the following errors:

Traceback (most recent call last):
        5: from test.rb:10:in `<main>'
        4: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api.rb:7:in `all_coins_info!'
        3: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api/request.rb:31:in `send!'
        2: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api/request.rb:45:in `process!'
        1: from /Users/roman/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/roman/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0/json/common.rb:156:in `parse': 783: unexpected token at '' (JSON::ParserError)
        4: from test.rb:10:in `<main>'
        3: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api.rb:7:in `all_coins_info!'
        2: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api/request.rb:31:in `send!'
        1: from /Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api/request.rb:44:in `process!'
/Users/roman/Projects/binance/ruby/vendor/gems/ruby/2.7.0/gems/binance-ruby-1.3.6/lib/binance/api/request.rb:48:in `rescue in process!': @783: unexpected token at '' 783: unexpected token at '' (Binance::Api::Error)

It happens on exactly this method (all_coins_info!). Other methods I tested was working fine.

How to quick buy a specific coin?

I would like to buy a coin with my all current btc as fast as possible, I would like to know if we can do it with only 1 API call. The approach I'm using it we request to get the current price first, then calculate the quantity, then create an order based on that. Btw it will takes 2 API calls.

How can I achieve it by using only 1 API call, (the API to get current price will take about > 1sec).

readme.md error

BCH: Bcash. LOL

Bitcoin Cash is what still keeps me in crypto. We already saw all the BS/core lies showing up for what they were. BTC 1 MB block is the most stupid thing ever. Please do your own diligence and if you remove that stupid statement, I will use and contribute to your project.

timeInForce

Hi there, i'm stuck at the beginning of things, need a bit of a help.

new_order = Binance::Api::Order::create!(symbol: pair, side: 'BUY' , type: 'LIMIT', price: buyPrice,  quantity: amount)

results

/usr/local/lib64/ruby/gems/2.3.0/gems/binance-ruby-0.1.9/lib/binance/api/request.rb:42:in `process!': (-1102) Mandatory parameter 'timeInForce' was not sent, was empty/null, or malformed. (Binance::Api::Error)

but

new_order = Binance::Api::Order::create!(symbol: pair, side: 'BUY' , type: 'LIMIT', price: buyPrice,  quantity: amount, timeInForce: 'GTC')

results

/usr/local/lib64/ruby/gems/2.3.0/gems/binance-ruby-0.1.9/lib/binance/api/order.rb:35:in `create!': unknown keyword: timeInForce (ArgumentError)

API-key format invalid

Hitting an API format error when trying to grab balance information off an .info! call. Will go poke at the code now to see if I can understand what's going on but wanted to raise it up here as well.

	 2: from /Users/jproudman/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/binance-ruby-0.2/lib/binance/api.rb:39:in `info!'
	 1: from /Users/jproudman/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/binance-ruby-0.2/lib/binance/api/request.rb:28:in `send!'
/Users/jproudman/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/binance-ruby-0.2/lib/binance/api/request.rb:42:in `process!': (-2014) API-key format invalid. (Binance::Api::Error)

binance signin requests issue

hello Jake,

I'm trying to use binance-ruby. Running : pp Binance::Api::Account.info! I get an issue about reqest signing :

/var/lib/gems/2.3.0/gems/binance-ruby-0.1.4/lib/binance/api/request.rb:47:in `process!': Binance::Api::Error (-1100): Illegal characters found in parameter 'signature'; legal range is '^[A-Fa-f0-9]{64}$'. (Binance::Api::Error)
	from /var/lib/gems/2.3.0/gems/binance-ruby-0.1.4/lib/binance/api/request.rb:33:in `send!'
	from /var/lib/gems/2.3.0/gems/binance-ruby-0.1.4/lib/binance/api/account.rb:8:in `info!'
	from binance-ruby.rb:19:in `<main>'
  • signature looks like this : "dQKOP8YFUgyCqoSH6ZYElBy4ZJe7bdZrpHjYZHTjTSo="
  • It is working fin with "binance" gem.
  • right now, I am using binance-ruby version "0.1.4".

best regards, Marc.

HTTParty @ -> %40 and break signature

module Binance
module Api
class Request
include HTTParty

  #need for sub-account with email params

  **query_string_normalizer proc { |query|
    query.map do |key, value|
      [value].flatten.map {|v| "#{key}=#{v}"}.join('&')
    end.join('&')
  }**

uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState

Issue

RSpec NameError with Rails 7.x.x

joshuawilkosz@joshua binance-ruby % bundle exec rspec spec/binance/websocket_spec.rb

An error occurred while loading ./spec/binance/websocket_spec.rb.
Failure/Error: require "active_support/core_ext/string"

NameError:
  uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/xml_mini.rb:184:in `current_thread_backend'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/xml_mini.rb:103:in `backend='
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/xml_mini.rb:201:in `<module:ActiveSupport>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/xml_mini.rb:11:in `<top (required)>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/array/conversions.rb:3:in `require'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/array/conversions.rb:3:in `<top (required)>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/duration.rb:3:in `require'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/duration.rb:3:in `<top (required)>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/time/calculations.rb:3:in `require'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/time/calculations.rb:3:in `<top (required)>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/string/conversions.rb:4:in `require'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/string/conversions.rb:4:in `<top (required)>'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/string.rb:3:in `require'
# /Users/joshuawilkosz/.rvm/gems/ruby-2.7.5/gems/activesupport-7.0.1/lib/active_support/core_ext/string.rb:3:in `<top (required)>'
# ./lib/binance-ruby.rb:1:in `require'
# ./lib/binance-ruby.rb:1:in `<top (required)>'
# ./spec/spec_helper.rb:19:in `require'
# ./spec/spec_helper.rb:19:in `<top (required)>'
# ./spec/binance/websocket_spec.rb:1:in `require'
# ./spec/binance/websocket_spec.rb:1:in `<top (required)>'
No examples found.

Finished in 0.00002 seconds (files took 0.17595 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

Instance api key not working

I keep getting:

lib/binance/api/request.rb:50:in `process!': (-2014) API-key format invalid. (Binance::Api::Error::BadAPIKeyFormat)

#25 solves the issue please merge it!

Current workaround for me is bundle open binance-ruby

And changing line 13 of:
lib/binance/api/configuration.rb

From:

instance_api_key(type: type) || ENV["BINANCE_#{type.to_s.humanize.upcase}_API_KEY"] || ENV["BINANCE_API_KEY"]

To:

instance_api_key(type: type) || ENV["BINANCE_#{type.to_s.humanize.upcase}_API_KEY"] || instance_api_key || ENV["BINANCE_API_KEY"]

Getting response headers

With the current approach, all requests return only the response body, that is, a JSON that is converted into a hash. That means it's not possible to know information about rate limiting, cache and more.

Here's an example: https://github.com/Jakenberg/binance-ruby/blob/master/lib/binance/api/account.rb#L26-L28

Would there be interest to instead return the HTTP object and let the client call response.body, instead of prohibiting the client from accessing anything other than the HTTP body?

Always getting error code -1104

Hi,

Thanks for providing a great gem to interact with the Binance API.
Do you guys have any idea why I might be getting the response "{"code":-1104,"msg":"Not all sent parameters were read; read '6' parameter(s) but was sent '7'."}" on all the user requests that I've beent trying to make?

Thank you for your help.

does this really work for US?

I couldnt get it to work with ruby, but the python bindings worked perfectly.
This code dies on ruby but same exact thing with same keys/ip works fine with python:
require 'binance-ruby'
BINANCE_TLD = "US"
puts Binance::Api.ping!
puts Binance::Api::Account.info!

error: (-2015) Invalid API-key, IP, or permissions for action. (Binance::Api::Error)

im fairly certain it is not working under US tld.

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.