From 6bef192d463bf20ce7c2f7f3b6159279391625cf Mon Sep 17 00:00:00 2001 From: alplabin <122352306+alplabin@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:11:33 +0200 Subject: [PATCH] Release v1.5.2 --- CHANGELOG.md | 6 ++++++ Gemfile.lock | 18 ++++++++--------- examples/spot/market/exchange_info.rb | 3 ++- lib/binance/spot/market.rb | 13 ++++++------ lib/binance/version.rb | 2 +- spec/binance/spot/market/exchangeinfo_spec.rb | 20 +++++++++++++++++++ 6 files changed, 45 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f349200..d55c3cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.5.2 - 2024-07-23 + +### Changed +- Updated dependencies and resolve github security issue +- Added `permissions` parameter to `GET /api/v3/exchangeInfo` + ## 1.5.1 - 2024-06-18 ### Changed diff --git a/Gemfile.lock b/Gemfile.lock index 30f5163..db6262c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - binance-connector-ruby (1.5.1) + binance-connector-ruby (1.5.2) faraday (~> 1.8) websocket-eventmachine-client (~> 1.3) @@ -12,8 +12,8 @@ GEM adamantium (0.2.0) ice_nine (~> 0.11.0) memoizable (~> 0.4.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) anima (0.3.2) abstract_type (~> 0.0.7) adamantium (~> 0.2) @@ -72,7 +72,7 @@ GEM procto (~> 0.0.2) multipart-post (2.4.1) parallel (1.25.1) - parser (3.3.3.0) + parser (3.3.4.0) ast (~> 2.4.1) racc proc_to_ast (0.2.0) @@ -80,12 +80,12 @@ GEM rouge unparser procto (0.0.3) - public_suffix (5.1.0) + public_suffix (6.0.0) racc (1.8.0) rainbow (3.1.1) rake (13.2.1) regexp_parser (2.9.2) - rexml (3.3.0) + rexml (3.3.2) strscan rouge (4.3.0) rspec (3.13.0) @@ -112,13 +112,13 @@ GEM binding_of_caller rspec-parameterized-core (< 2) rspec-support (3.13.1) - rubocop (1.64.1) + rubocop (1.65.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) + regexp_parser (>= 2.4, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) @@ -150,7 +150,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket (1.2.10) + websocket (1.2.11) websocket-eventmachine-base (1.2.0) eventmachine (~> 1.0) websocket (~> 1.0) diff --git a/examples/spot/market/exchange_info.rb b/examples/spot/market/exchange_info.rb index f25d6ed..44d4db6 100755 --- a/examples/spot/market/exchange_info.rb +++ b/examples/spot/market/exchange_info.rb @@ -9,5 +9,6 @@ logger = Common.setup_logger client = Binance::Spot.new(base_url: 'https://testnet.binance.vision') -logger.info(client.exchange_info(symbols: %w[BTCUSDT BNBBUSD])) +logger.info(client.exchange_info(symbols: %w[BTCUSDT])) logger.info(client.exchange_info(symbol: 'BTCUSDT')) +logger.info(client.exchange_info(permissions: 'SPOT')) diff --git a/lib/binance/spot/market.rb b/lib/binance/spot/market.rb index dd65432..5c4f631 100644 --- a/lib/binance/spot/market.rb +++ b/lib/binance/spot/market.rb @@ -35,19 +35,20 @@ def time # # @option kwargs [string] :symbol # @option kwargs [string] :symbols + # @option kwargs [string] :permissions # @see https://binance-docs.github.io/apidocs/spot/en/#exchange-information - def exchange_info(symbol: nil, symbols: nil) + def exchange_info(symbol: nil, symbols: nil, permissions: nil) if symbols.is_a?(Array) symbols = symbols.map { |v| "%22#{v}%22" }.join(',') symbols = "%5B#{symbols}%5D" end + if permissions.is_a?(Array) + permissions = permissions.map { |v| "%22#{v}%22" }.join(',') + permissions = "%5B#{permissions}%5D" + end @session.public_request( path: '/api/v3/exchangeInfo', - params: - { - symbol: symbol, - symbols: symbols - } + params: { symbol: symbol, symbols: symbols, permissions: permissions } ) end diff --git a/lib/binance/version.rb b/lib/binance/version.rb index a40b5bf..3f04952 100644 --- a/lib/binance/version.rb +++ b/lib/binance/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Binance - VERSION = '1.5.1' + VERSION = '1.5.2' end diff --git a/spec/binance/spot/market/exchangeinfo_spec.rb b/spec/binance/spot/market/exchangeinfo_spec.rb index 9f64e24..b61415d 100644 --- a/spec/binance/spot/market/exchangeinfo_spec.rb +++ b/spec/binance/spot/market/exchangeinfo_spec.rb @@ -44,4 +44,24 @@ end end end + + context 'with param permissions' do + context 'one permission' do + let(:permissions) { 'SPOT' } + let(:path) { '/api/v3/exchangeInfo?permissions=SPOT' } + it 'should return specific permission exchange Info' do + spot_client.exchange_info(permissions: permissions) + expect(send_a_request(:get, path)).to have_been_made + end + end + + context 'two permission' do + let(:permissions) { %w[MARGIN LEVERAGED] } + let(:path) { '/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22,%22LEVERAGED%22%5D' } + it 'should return specific permission exchange Info' do + spot_client.exchange_info(permissions: permissions) + expect(send_a_request(:get, path)).to have_been_made + end + end + end end