diff --git a/CHANGELOG.md b/CHANGELOG.md index d55c3cc..b386f02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,57 @@ # Changelog +## 1.6.0 - 2024-10-02 + +### Changed +- Updated endpoint `/sapi/v1/sub-account/subAccountApi/ipRestriction` to `/sapi/v2/sub-account/subAccountApi/ipRestriction` +- Update dependencies + +### Removed +- Deprecated margin endpoints: + - `POST /sapi/v1/margin/transfer` + - `POST /sapi/v1/margin/isolated/transfer` + - `POST /sapi/v1/margin/loan` + - `POST /sapi/v1/margin/repay` + - `GET /sapi/v1/margin/isolated/transfer` + - `GET /sapi/v1/margin/asset` + - `GET /sapi/v1/margin/pair` + - `GET /sapi/v1/margin/isolated/pair` + - `GET /sapi/v1/margin/loan` + - `GET /sapi/v1/margin/repay` + - `GET /sapi/v1/margin/dribblet` + - `GET /sapi/v1/margin/dust` + - `POST /sapi/v1/margin/dust` + +- Deprecated SubAccount endpoint: `POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList` + +- Deprecated Futures endpoints: + - `GET /sapi/v1/futures/loan/interestHistory` + - `GET /sapi/v1/futures/loan/collateralRepayResult` + - `POST /sapi/v1/futures/loan/collateralRepay` + - `GET /sapi/v1/futures/loan/collateralRepay` + - `GET /sapi/v1/futures/loan/collateralRepayLimit` + - `GET /sapi/v1/futures/loan/liquidationHistory` + - `GET /sapi/v1/futures/loan/adjustCollateral/history` + - `POST /sapi/v2/futures/loan/adjustCollateral` + - `GET /sapi/v2/futures/loan/calcMaxAdjustAmount` + - `GET /sapi/v2/futures/loan/calcAdjustLevel` + - `GET /sapi/v2/futures/loan/configs` + - `GET /sapi/v2/futures/loan/wallet` + - `GET /sapi/v1/futures/loan/repay/history` + - `POST /sapi/v1/futures/loan/repay` + - `GET /sapi/v1/futures/loan/borrow/history` + - `POST /sapi/v1/futures/loan/borrow` + - `GET /sapi/v1/futures/transfer` + - `POST /sapi/v1/futures/transfer` + +- BLVT endpoints: + - `GET /sapi/v1/blvt/tokenInfo` + - `POST /sapi/v1/blvt/subscribe` + - `GET /sapi/v1/blvt/subscribe/record` + - `POST /sapi/v1/blvt/redeem` + - `GET /sapi/v1/blvt/redeem/record` + - `GET /sapi/v1/blvt/userLimit` + ## 1.5.2 - 2024-07-23 ### Changed diff --git a/Gemfile.lock b/Gemfile.lock index db6262c..0d633be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - binance-connector-ruby (1.5.2) + binance-connector-ruby (1.6.0) faraday (~> 1.8) websocket-eventmachine-client (~> 1.3) @@ -30,10 +30,10 @@ GEM rexml debug_inspector (1.2.0) diff-lcs (1.5.1) - docile (1.4.0) + docile (1.4.1) equalizer (0.0.11) eventmachine (1.2.7) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -51,13 +51,13 @@ GEM faraday-httpclient (1.0.1) faraday-multipart (1.0.4) multipart-post (~> 2) - faraday-net_http (1.0.1) + faraday-net_http (1.0.2) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) gem-release (2.2.2) - hashdiff (1.1.0) + hashdiff (1.1.1) ice_nine (0.11.2) json (2.7.2) language_server-protocol (3.17.0.3) @@ -71,8 +71,8 @@ GEM ice_nine (~> 0.11.1) procto (~> 0.0.2) multipart-post (2.4.1) - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc proc_to_ast (0.2.0) @@ -80,21 +80,20 @@ GEM rouge unparser procto (0.0.3) - public_suffix (6.0.0) - racc (1.8.0) + public_suffix (6.0.1) + racc (1.8.1) rainbow (3.1.1) rake (13.2.1) regexp_parser (2.9.2) - rexml (3.3.2) - strscan - rouge (4.3.0) + rexml (3.3.8) + rouge (4.4.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.1) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.1) @@ -112,18 +111,17 @@ GEM binding_of_caller rspec-parameterized-core (< 2) rspec-support (3.13.1) - rubocop (1.65.0) + rubocop (1.66.1) 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 (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) @@ -131,11 +129,10 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - strscan (3.1.0) thread_safe (0.3.6) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) unparser (0.5.7) abstract_type (~> 0.0.7) adamantium (~> 0.2.0) @@ -146,7 +143,7 @@ GEM mprelude (~> 0.1.0) parser (>= 3.0.0) procto (~> 0.0.2) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -158,7 +155,7 @@ GEM websocket-eventmachine-client (1.3.0) websocket-eventmachine-base (~> 1.0) websocket-native (1.0.0) - yard (0.9.36) + yard (0.9.37) PLATFORMS ruby diff --git a/binance-connector-ruby.gemspec b/binance-connector-ruby.gemspec index 04489f7..1b14112 100644 --- a/binance-connector-ruby.gemspec +++ b/binance-connector-ruby.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.license = 'MIT' spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['documentation_uri'] = 'https://binance-docs.github.io/apidocs/spot/en/' + spec.metadata['documentation_uri'] = 'https://developers.binance.com/en' spec.metadata['source_code_uri'] = 'https://github.com/binance/binance-connector-ruby' # Specify which files should be added to the gem when it is released. diff --git a/examples/spot/blvt/get_redeem_record.rb b/examples/spot/blvt/get_redeem_record.rb deleted file mode 100755 index edf79a0..0000000 --- a/examples/spot/blvt/get_redeem_record.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.get_redeem_record(tokenName: 'BTCDOWN', id: 10, limit: 10)) diff --git a/examples/spot/blvt/get_subscribe_record.rb b/examples/spot/blvt/get_subscribe_record.rb deleted file mode 100755 index 3f52884..0000000 --- a/examples/spot/blvt/get_subscribe_record.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.get_subscribe_record(tokenName: 'BTCDOWN', id: 10, limit: 10)) diff --git a/examples/spot/blvt/redeem.rb b/examples/spot/blvt/redeem.rb deleted file mode 100755 index 8639527..0000000 --- a/examples/spot/blvt/redeem.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.redeem(tokenName: 'BTCDOWN', amount: 1)) diff --git a/examples/spot/blvt/subscribe.rb b/examples/spot/blvt/subscribe.rb deleted file mode 100755 index 9e4eb1b..0000000 --- a/examples/spot/blvt/subscribe.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.subscribe(tokenName: 'BTCDOWN', cost: 10)) diff --git a/examples/spot/blvt/token_info.rb b/examples/spot/blvt/token_info.rb deleted file mode 100755 index 7cfe850..0000000 --- a/examples/spot/blvt/token_info.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '') - -logger.info(client.token_info(tokenName: 'BTCDOWN')) diff --git a/examples/spot/blvt/user_limit.rb b/examples/spot/blvt/user_limit.rb deleted file mode 100755 index 314a07c..0000000 --- a/examples/spot/blvt/user_limit.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.user_limit(tokenName: 'BTCDOWN')) diff --git a/examples/spot/futures/adjust_cross_collateral.rb b/examples/spot/futures/adjust_cross_collateral.rb deleted file mode 100755 index 20d08fb..0000000 --- a/examples/spot/futures/adjust_cross_collateral.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.adjust_cross_collateral(loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL')) diff --git a/examples/spot/futures/adjust_cross_collateral_history.rb b/examples/spot/futures/adjust_cross_collateral_history.rb deleted file mode 100755 index 8073235..0000000 --- a/examples/spot/futures/adjust_cross_collateral_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.adjust_cross_collateral_history(loanCoin: 'BUSD', collateralCoin: 'BTC')) diff --git a/examples/spot/futures/calculate_adjust_max_amount.rb b/examples/spot/futures/calculate_adjust_max_amount.rb deleted file mode 100755 index aeb3f52..0000000 --- a/examples/spot/futures/calculate_adjust_max_amount.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.calculate_adjust_max_amount(loanCoin: 'BUSD', collateralCoin: 'BTC')) diff --git a/examples/spot/futures/calculate_adjust_rate.rb b/examples/spot/futures/calculate_adjust_rate.rb deleted file mode 100755 index f03464c..0000000 --- a/examples/spot/futures/calculate_adjust_rate.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.calculate_adjust_rate(loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL')) diff --git a/examples/spot/futures/collateral_repay_limit.rb b/examples/spot/futures/collateral_repay_limit.rb deleted file mode 100755 index d511155..0000000 --- a/examples/spot/futures/collateral_repay_limit.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.collateral_repay_limit(coin: 'BUSD', collateralCoin: 'BTC')) diff --git a/examples/spot/futures/collateral_repay_quote.rb b/examples/spot/futures/collateral_repay_quote.rb deleted file mode 100755 index 1b531af..0000000 --- a/examples/spot/futures/collateral_repay_quote.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.collateral_repay_quote(coin: 'BUSD', collateralCoin: 'BTC', amount: 1)) diff --git a/examples/spot/futures/cross_collateral_borrow.rb b/examples/spot/futures/cross_collateral_borrow.rb deleted file mode 100755 index 1a6a924..0000000 --- a/examples/spot/futures/cross_collateral_borrow.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_borrow(coin: 'BUSD', collateralCoin: 'BTC', amount: 1)) diff --git a/examples/spot/futures/cross_collateral_borrow_history.rb b/examples/spot/futures/cross_collateral_borrow_history.rb deleted file mode 100755 index 77e6b9c..0000000 --- a/examples/spot/futures/cross_collateral_borrow_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_borrow_history(coin: 'BUSD')) diff --git a/examples/spot/futures/cross_collateral_info.rb b/examples/spot/futures/cross_collateral_info.rb deleted file mode 100755 index 1fa2361..0000000 --- a/examples/spot/futures/cross_collateral_info.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_info(loanCoin: 'BUSD')) diff --git a/examples/spot/futures/cross_collateral_interest_history.rb b/examples/spot/futures/cross_collateral_interest_history.rb deleted file mode 100755 index fdf7943..0000000 --- a/examples/spot/futures/cross_collateral_interest_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_interest_history) diff --git a/examples/spot/futures/cross_collateral_liquidation_history.rb b/examples/spot/futures/cross_collateral_liquidation_history.rb deleted file mode 100755 index 4e71885..0000000 --- a/examples/spot/futures/cross_collateral_liquidation_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_liquidation_history) diff --git a/examples/spot/futures/cross_collateral_repay.rb b/examples/spot/futures/cross_collateral_repay.rb deleted file mode 100755 index 92f453b..0000000 --- a/examples/spot/futures/cross_collateral_repay.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_repay(coin: 'BUSD', collateralCoin: 'BTC', amount: 1)) diff --git a/examples/spot/futures/cross_collateral_repay_history.rb b/examples/spot/futures/cross_collateral_repay_history.rb deleted file mode 100755 index c306c7c..0000000 --- a/examples/spot/futures/cross_collateral_repay_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_repay_history(coin: 'BUSD')) diff --git a/examples/spot/futures/cross_collateral_wallet.rb b/examples/spot/futures/cross_collateral_wallet.rb deleted file mode 100755 index be5e0c8..0000000 --- a/examples/spot/futures/cross_collateral_wallet.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.cross_collateral_wallet) diff --git a/examples/spot/futures/futures_account_transfer.rb b/examples/spot/futures/futures_account_transfer.rb deleted file mode 100755 index 78758db..0000000 --- a/examples/spot/futures/futures_account_transfer.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.futures_account_transfer(asset: 'BUSD', amount: 1, type: 1)) diff --git a/examples/spot/futures/futures_account_transfer_history.rb b/examples/spot/futures/futures_account_transfer_history.rb deleted file mode 100755 index 78ef6a1..0000000 --- a/examples/spot/futures/futures_account_transfer_history.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.futures_account_transfer_history(asset: 'BUSD', startTime: 1_555_056_425_000)) diff --git a/examples/spot/futures/repay_with_collateral.rb b/examples/spot/futures/repay_with_collateral.rb deleted file mode 100755 index 08ad7f6..0000000 --- a/examples/spot/futures/repay_with_collateral.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.repay_with_collateral(quoteId: '3eece81ca2734042b2f538ea0d9cbdd3')) diff --git a/examples/spot/futures/repayment_result.rb b/examples/spot/futures/repayment_result.rb deleted file mode 100755 index 5030784..0000000 --- a/examples/spot/futures/repayment_result.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.repayment_result(quoteId: '3eece81ca2734042b2f538ea0d9cbdd3')) diff --git a/examples/spot/margin/get_isolated_margin_pair.rb b/examples/spot/margin/get_isolated_margin_pair.rb deleted file mode 100755 index f4bc887..0000000 --- a/examples/spot/margin/get_isolated_margin_pair.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.get_isolated_margin_pair(symbol: 'BNBUSDT')) diff --git a/examples/spot/margin/get_isolated_margin_transfer.rb b/examples/spot/margin/get_isolated_margin_transfer.rb deleted file mode 100755 index 6a9882d..0000000 --- a/examples/spot/margin/get_isolated_margin_transfer.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.get_isolated_margin_transfer(symbol: 'BNBUSDT')) diff --git a/examples/spot/margin/get_margin_dust_log.rb b/examples/spot/margin/get_margin_dust_log.rb deleted file mode 100755 index feff29e..0000000 --- a/examples/spot/margin/get_margin_dust_log.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.get_margin_dust_log) diff --git a/examples/spot/margin/isolated_margin_transfer.rb b/examples/spot/margin/isolated_margin_transfer.rb deleted file mode 100755 index a7a9cb3..0000000 --- a/examples/spot/margin/isolated_margin_transfer.rb +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '', secret: '') - -logger.info(client.isolated_margin_transfer(asset: 'USDT', symbol: 'BNBUSDT', transFrom: 'SPOT', transTo: 'ISOLATED_MARGIN', amount: 0.001)) diff --git a/examples/spot/margin/margin_asset.rb b/examples/spot/margin/margin_asset.rb deleted file mode 100755 index 2b5dde0..0000000 --- a/examples/spot/margin/margin_asset.rb +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '') -logger.info(client.margin_asset(asset: 'BNB')) diff --git a/examples/spot/margin/margin_borrow.rb b/examples/spot/margin/margin_borrow.rb deleted file mode 100755 index 05f653d..0000000 --- a/examples/spot/margin/margin_borrow.rb +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -client = Binance::Spot.new(key: '', secret: '') - -params = { - asset: 'BNB', - amount: 0.01, - recvWindow: 1_000 -} - -logger.info(client.margin_borrow(**params)) diff --git a/examples/spot/margin/margin_load_record.rb b/examples/spot/margin/margin_load_record.rb deleted file mode 100755 index 438c116..0000000 --- a/examples/spot/margin/margin_load_record.rb +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '') -logger.info(client.margin_load_record(asset: 'BNB', startTime: '1581783387615')) diff --git a/examples/spot/margin/margin_pair.rb b/examples/spot/margin/margin_pair.rb deleted file mode 100755 index 40cbe83..0000000 --- a/examples/spot/margin/margin_pair.rb +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -# set key here -# or BINANCE_PUBLIC_API_KEY in env -client = Binance::Spot.new(key: '') -logger.info(client.margin_pair(symbol: 'BNBUSDT')) diff --git a/examples/spot/margin/margin_repay.rb b/examples/spot/margin/margin_repay.rb deleted file mode 100755 index 6683d03..0000000 --- a/examples/spot/margin/margin_repay.rb +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -client = Binance::Spot.new(key: '', secret: '') - -params = { - asset: 'BNB', - amount: 0.01, - recvWindow: 1_000 -} - -logger.info(client.margin_repay(**params)) diff --git a/examples/spot/margin/margin_transfer.rb b/examples/spot/margin/margin_transfer.rb deleted file mode 100755 index 29fb533..0000000 --- a/examples/spot/margin/margin_transfer.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -client = Binance::Spot.new(key: '', secret: '') - -params = { - asset: 'BNB', - amount: 0.01, - type: 1, - recvWindow: 1_000 -} - -logger.info(client.margin_transfer(**params)) diff --git a/examples/spot/subaccount/sub_account_add_ip_list.rb b/examples/spot/subaccount/sub_account_add_ip_list.rb deleted file mode 100755 index a16b989..0000000 --- a/examples/spot/subaccount/sub_account_add_ip_list.rb +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -$LOAD_PATH.unshift('./lib') - -require 'binance' -require_relative '../../common' - -logger = Common.setup_logger - -client = Binance::Spot.new(key: '', secret: '') -logger.info(client.sub_account_add_ip_list(email: 'alice@test.com', subAccountApiKey: 'xxxxxx', ipAddress: '1.2.3.4')) diff --git a/examples/spot/subaccount/sub_account_toggle_ip_restriction.rb b/examples/spot/subaccount/sub_account_toggle_ip_restriction.rb index 62647c9..95ad1f8 100755 --- a/examples/spot/subaccount/sub_account_toggle_ip_restriction.rb +++ b/examples/spot/subaccount/sub_account_toggle_ip_restriction.rb @@ -9,4 +9,4 @@ logger = Common.setup_logger client = Binance::Spot.new(key: '', secret: '') -logger.info(client.sub_account_toggle_ip_restriction(email: 'alice@test.com', subAccountApiKey: 'xxxxxx', ipRestrict: true)) +logger.info(client.sub_account_toggle_ip_restriction(email: 'alice@test.com', subAccountApiKey: 'xxxxxx', status: '1')) diff --git a/lib/binance/spot.rb b/lib/binance/spot.rb index f926e8b..618c5c4 100644 --- a/lib/binance/spot.rb +++ b/lib/binance/spot.rb @@ -5,11 +5,9 @@ require 'binance/utils/validation' require 'binance/utils/url' require 'binance/error' -require 'binance/spot/blvt' require 'binance/spot/c2c' require 'binance/spot/convert' require 'binance/spot/fiat' -require 'binance/spot/futures' require 'binance/spot/loan' require 'binance/spot/margin' require 'binance/spot/market' @@ -37,13 +35,11 @@ module Binance # - Subaccount # - Trade # - Wallet - # @see https://binance-docs.github.io/apidocs/spot/en/ + # @see https://developers.binance.com/en class Spot - include Binance::Spot::Blvt include Binance::Spot::C2C include Binance::Spot::Convert include Binance::Spot::Fiat - include Binance::Spot::Futures include Binance::Spot::Loan include Binance::Spot::Margin include Binance::Spot::Market diff --git a/lib/binance/spot/blvt.rb b/lib/binance/spot/blvt.rb deleted file mode 100644 index b1b00fd..0000000 --- a/lib/binance/spot/blvt.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module Binance - class Spot - # BLVT endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#blvt-endpoints - module Blvt - # Get BLVT Info (MARKET_DATA) - # - # GET /sapi/v1/blvt/tokenInfo - # - # @param tokenName [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#get-blvt-info-market_data - def token_info(tokenName: nil) - @session.public_request( - path: '/sapi/v1/blvt/tokenInfo', - params: { tokenName: tokenName } - ) - end - - # Subscribe BLVT (USER_DATA) - # - # POST /sapi/v1/blvt/subscribe - # - # @param tokenName [String] - # @param cost [Float] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-blvt-user_data - def subscribe(tokenName:, cost:, **kwargs) - Binance::Utils::Validation.require_param('tokenName', tokenName) - Binance::Utils::Validation.require_param('cost', cost) - - @session.sign_request(:post, '/sapi/v1/blvt/subscribe', params: kwargs.merge( - tokenName: tokenName, - cost: cost - )) - end - - # Query Subscription Record (USER_DATA) - # - # GET /sapi/v1/blvt/subscribe/record - # - # @param kwargs [Hash] - # @option kwargs [String] :tokenName - # @option kwargs [Integer] :id - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-subscription-record-user_data - def get_subscribe_record(**kwargs) - @session.sign_request(:get, '/sapi/v1/blvt/subscribe/record', params: kwargs) - end - - # Redeem BLVT (USER_DATA) - # - # POST /sapi/v1/blvt/redeem - # - # @param tokenName [String] - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-blvt-user_data - def redeem(tokenName:, amount:, **kwargs) - Binance::Utils::Validation.require_param('tokenName', tokenName) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:post, '/sapi/v1/blvt/redeem', params: kwargs.merge( - tokenName: tokenName, - amount: amount - )) - end - - # Query Redemption Record (USER_DATA) - # - # GET /sapi/v1/blvt/redeem/record - # - # @param kwargs [Hash] - # @option kwargs [String] :tokenName - # @option kwargs [Integer] :id - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-redemption-record-user_data - def get_redeem_record(**kwargs) - @session.sign_request(:get, '/sapi/v1/blvt/redeem/record', params: kwargs) - end - - # Get BLVT User Limit Info (USER_DATA) - # - # GET /sapi/v1/blvt/userLimit - # - # @param kwargs [Hash] - # @option kwargs [String] :tokenName - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-blvt-user-limit-info-user_data - def user_limit(**kwargs) - @session.sign_request(:get, '/sapi/v1/blvt/userLimit', params: kwargs) - end - end - end -end diff --git a/lib/binance/spot/c2c.rb b/lib/binance/spot/c2c.rb index 0716346..fe82fa5 100644 --- a/lib/binance/spot/c2c.rb +++ b/lib/binance/spot/c2c.rb @@ -3,7 +3,7 @@ module Binance class Spot # C2C endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#c2c-endpoints + # @see https://developers.binance.com/docs/c2c/Introduction module C2C # Get C2C Trade History (USER_DATA) # @@ -16,7 +16,7 @@ module C2C # @option kwargs [Integer] :rows # @option kwargs [Integer] :recvWindow # @option kwargs [Integer] :timestamp - # @see https://binance-docs.github.io/apidocs/spot/en/#get-c2c-trade-history-user_data + # @see https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History def c2c_trade_history(tradeType:, **kwargs) Binance::Utils::Validation.require_param('tradeType', tradeType) diff --git a/lib/binance/spot/convert.rb b/lib/binance/spot/convert.rb index 4d58ef7..4652cc0 100644 --- a/lib/binance/spot/convert.rb +++ b/lib/binance/spot/convert.rb @@ -3,7 +3,7 @@ module Binance class Spot # Convert endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#convert-endpoints + # @see https://developers.binance.com/docs/convert/Introduction module Convert # Get Convert Trade History (USER_DATA) # @@ -14,7 +14,7 @@ module Convert # @param kwargs [Hash] # @option kwargs [Integer] :limit default 100, max 1000 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#convert-endpoints + # @see https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History#http-request def convert_trade_flow(startTime:, endTime:, **kwargs) Binance::Utils::Validation.require_param('startTime', startTime) Binance::Utils::Validation.require_param('endTime', endTime) diff --git a/lib/binance/spot/fiat.rb b/lib/binance/spot/fiat.rb index 2dc4e23..102c906 100644 --- a/lib/binance/spot/fiat.rb +++ b/lib/binance/spot/fiat.rb @@ -3,7 +3,7 @@ module Binance class Spot # Fiat endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#fiat-endpoints + # @see https://developers.binance.com/docs/fiat/Introduction module Fiat # Get Fiat Deposit/Withdraw History (USER_DATA) # @@ -16,7 +16,7 @@ module Fiat # @option kwargs [Integer] :page default 1 # @option kwargs [Integer] :rows default 100, max 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data + # @see https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History def fiat_deposit_withdraw_history(transactionType:, **kwargs) Binance::Utils::Validation.require_param('transactionType', transactionType) @@ -36,7 +36,7 @@ def fiat_deposit_withdraw_history(transactionType:, **kwargs) # @option kwargs [Integer] :page default 1 # @option kwargs [Integer] :rows default 100, max 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-fiat-payments-history-user_data + # @see https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History def fiat_payment_history(transactionType:, **kwargs) Binance::Utils::Validation.require_param('transactionType', transactionType) diff --git a/lib/binance/spot/futures.rb b/lib/binance/spot/futures.rb deleted file mode 100644 index 1706b44..0000000 --- a/lib/binance/spot/futures.rb +++ /dev/null @@ -1,357 +0,0 @@ -# frozen_string_literal: true - -module Binance - class Spot - # Futures endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#futures - module Futures - # New Future Account Transfer (USER_DATA) - # - # POST /sapi/v1/futures/transfer - # - # Execute transfer between spot account and futures account. - # - # @param asset [String] - # @param amount [Float] - # @param type [Integer] 1: transfer from spot account to USDT-M futures account.
- # 2: transfer from USDT-M futures account to spot account.
- # 3: transfer from spot account to COIN-M futures account.
- # 4: transfer from COIN-M futures account to spot account.
- # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data - def futures_account_transfer(asset:, amount:, type:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('amount', amount) - Binance::Utils::Validation.require_param('type', type) - - @session.sign_request(:post, '/sapi/v1/futures/transfer', params: kwargs.merge( - asset: asset, - amount: amount, - type: type - )) - end - - # Get Future Account Transaction History List (USER_DATA) - # - # GET /sapi/v1/futures/transfer - # - # @param asset [String] - # @param startTime [Integer] - # @param kwargs [Hash] - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 - # @option kwargs [Integer] :size Default:10 Max:100 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-future-account-transaction-history-list-user_data - def futures_account_transfer_history(asset:, startTime:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('startTime', startTime) - - @session.sign_request(:get, '/sapi/v1/futures/transfer', params: kwargs.merge( - asset: asset, - startTime: startTime - )) - end - - # Borrow For Cross-Collateral (TRADE) - # - # POST /sapi/v1/futures/loan/borrow - # - # @param coin [String] - # @param collateralCoin [String] - # @param kwargs [Hash] - # @option kwargs [Float] :amount Mandatory when collateralAmount is empty. - # @option kwargs [Float] :collateralAmount Mandatory when amount is empty. - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#borrow-for-cross-collateral-trade - def cross_collateral_borrow(coin:, collateralCoin:, **kwargs) - Binance::Utils::Validation.require_param('coin', coin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - - @session.sign_request(:post, '/sapi/v1/futures/loan/borrow', params: kwargs.merge( - coin: coin, - collateralCoin: collateralCoin - )) - end - - # Cross-Collateral Borrow History (USER_DATA) - # - # GET /sapi/v1/futures/loan/borrow/history - # - # @param kwargs [Hash] - # @option kwargs [String] :coin - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit default 500, max 1000 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data - def cross_collateral_borrow_history(**kwargs) - @session.sign_request(:get, '/sapi/v1/futures/loan/borrow/history', params: kwargs) - end - - # Repay For Cross-Collateral (TRADE) - # - # POST /sapi/v1/futures/loan/repay - # - # @param coin [String] - # @param collateralCoin [String] - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#repay-for-cross-collateral-trade - def cross_collateral_repay(coin:, collateralCoin:, amount:, **kwargs) - Binance::Utils::Validation.require_param('coin', coin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:post, '/sapi/v1/futures/loan/repay', params: kwargs.merge( - coin: coin, - collateralCoin: collateralCoin, - amount: amount - )) - end - - # Cross-Collateral Repayment History (USER_DATA) - # - # GET /sapi/v1/futures/loan/repay/history - # - # @param kwargs [Hash] - # @option kwargs [String] :coin - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit default 500, max 1000 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data - def cross_collateral_repay_history(**kwargs) - @session.sign_request(:get, '/sapi/v1/futures/loan/repay/history', params: kwargs) - end - - # Cross-Collateral Wallet (USER_DATA) - # - # GET /sapi/v2/futures/loan/wallet - # - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-v2-user_data - def cross_collateral_wallet(**kwargs) - @session.sign_request(:get, '/sapi/v2/futures/loan/wallet', params: kwargs) - end - - # Cross-Collateral Information (USER_DATA) - # - # GET /sapi/v2/futures/loan/configs - # - # @param kwargs [Hash] - # @option kwargs [String] :loanCoin - # @option kwargs [String] :collateralCoin - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-information-v2-user_data - def cross_collateral_info(**kwargs) - @session.sign_request(:get, '/sapi/v2/futures/loan/configs', params: kwargs) - end - - # Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA) - # - # GET /sapi/v2/futures/loan/calcAdjustLevel - # - # @param loanCoin [String] - # @param collateralCoin [String] - # @param amount [Float] - # @param direction [String] "ADDITIONAL", "REDUCED" - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#calculate-rate-after-adjust-cross-collateral-ltv-v2-user_data - def calculate_adjust_rate(loanCoin:, collateralCoin:, amount:, direction:, **kwargs) - Binance::Utils::Validation.require_param('loanCoin', loanCoin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - Binance::Utils::Validation.require_param('amount', amount) - Binance::Utils::Validation.require_param('direction', direction) - - @session.sign_request(:get, '/sapi/v2/futures/loan/calcAdjustLevel', params: kwargs.merge( - loanCoin: loanCoin, - collateralCoin: collateralCoin, - amount: amount, - direction: direction - )) - end - - # Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA) - # - # GET /sapi/v2/futures/loan/calcMaxAdjustAmount - # - # @param loanCoin [String] - # @param collateralCoin [String] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-max-amount-for-adjust-cross-collateral-ltv-v2-user_data - def calculate_adjust_max_amount(loanCoin:, collateralCoin:, **kwargs) - Binance::Utils::Validation.require_param('loanCoin', loanCoin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - - @session.sign_request(:get, '/sapi/v2/futures/loan/calcMaxAdjustAmount', params: kwargs.merge( - loanCoin: loanCoin, - collateralCoin: collateralCoin - )) - end - - # Adjust Cross-Collateral LTV (TRADE) - # - # POST /sapi/v2/futures/loan/adjustCollateral - # - # @param loanCoin [String] - # @param collateralCoin [String] - # @param amount [Float] - # @param direction [String] "ADDITIONAL", "REDUCED" - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-v2-trade - def adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs) - Binance::Utils::Validation.require_param('loanCoin', loanCoin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - Binance::Utils::Validation.require_param('amount', amount) - Binance::Utils::Validation.require_param('direction', direction) - - @session.sign_request(:post, '/sapi/v2/futures/loan/adjustCollateral', params: kwargs.merge( - loanCoin: loanCoin, - collateralCoin: collateralCoin, - amount: amount, - direction: direction - )) - end - - # Adjust Cross-Collateral LTV History (USER_DATA) - # - # GET /sapi/v1/futures/loan/adjustCollateral/history - # - # All data will be returned if loanCoin or collateralCoin is not sent - # - # @param kwargs [Hash] - # @option kwargs [String] :loanCoin - # @option kwargs [String] :collateralCoin - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit default 500, max 1000 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data - def adjust_cross_collateral_history(**kwargs) - @session.sign_request(:get, '/sapi/v1/futures/loan/adjustCollateral/history', params: kwargs) - end - - # Cross-Collateral Liquidation History (USER_DATA) - # - # GET /sapi/v1/futures/loan/liquidationHistory - # - # All data will be returned if loanCoin or collateralCoin is not sent - # - # @param kwargs [Hash] - # @option kwargs [String] :loanCoin - # @option kwargs [String] :collateralCoin - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :limit default 500, max 1000 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data - def cross_collateral_liquidation_history(**kwargs) - @session.sign_request(:get, '/sapi/v1/futures/loan/liquidationHistory', params: kwargs) - end - - # Check Collateral Repay Limit (USER_DATA) - # - # GET /sapi/v1/futures/loan/collateralRepayLimit - # - # Check the maximum and minimum limit when repay with collateral. - # - # @param coin [String] - # @param collateralCoin [String] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#check-collateral-repay-limit-user_data - def collateral_repay_limit(coin:, collateralCoin:, **kwargs) - Binance::Utils::Validation.require_param('coin', coin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - - @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayLimit', params: kwargs.merge( - coin: coin, - collateralCoin: collateralCoin - )) - end - - # Get Collateral Repay Quote (USER_DATA) - # - # GET /sapi/v1/futures/loan/collateralRepay - # - # Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds. - # - # @param coin [String] - # @param collateralCoin [String] - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-collateral-repay-quote-user_data - def collateral_repay_quote(coin:, collateralCoin:, amount:, **kwargs) - Binance::Utils::Validation.require_param('coin', coin) - Binance::Utils::Validation.require_param('collateralCoin', collateralCoin) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge( - coin: coin, - collateralCoin: collateralCoin, - amount: amount - )) - end - - # Repay with Collateral (USER_DATA) - # - # POST /sapi/v1/futures/loan/collateralRepay - # - # Repay with collateral. Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds. - # - # @param quoteId [String] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#repay-with-collateral-user_data - def repay_with_collateral(quoteId:, **kwargs) - Binance::Utils::Validation.require_param('quoteId', quoteId) - - @session.sign_request(:post, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge( - quoteId: quoteId - )) - end - - # Collateral Repayment Result (USER_DATA) - # - # GET /sapi/v1/futures/loan/collateralRepayResult - # - # Check collateral repayment result. - # - # @param quoteId [String] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#collateral-repayment-result-user_data - def repayment_result(quoteId:, **kwargs) - Binance::Utils::Validation.require_param('quoteId', quoteId) - - @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayResult', params: kwargs.merge( - quoteId: quoteId - )) - end - - # Cross-Collateral Interest History (USER_DATA) - # - # GET /sapi/v1/futures/loan/interestHistory - # - # @param kwargs [Hash] - # @option kwargs [String] :collateralCoin - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 - # @option kwargs [Integer] :limit default 500, max 1000 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data - def cross_collateral_interest_history(**kwargs) - @session.sign_request(:get, '/sapi/v1/futures/loan/interestHistory', params: kwargs) - end - end - end -end diff --git a/lib/binance/spot/loan.rb b/lib/binance/spot/loan.rb index 46ffd7a..8036216 100644 --- a/lib/binance/spot/loan.rb +++ b/lib/binance/spot/loan.rb @@ -3,7 +3,7 @@ module Binance class Spot # all loan endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#crypto-loans-endpoints + # @see https://developers.binance.com/docs/crypto_loan/Introduction module Loan # Get Crypto Loans Income History (USER_DATA) # @@ -15,7 +15,7 @@ module Loan # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit default 20, max 100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-crypto-loans-income-history-user_data + # @see https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Crypto-Loans-Income-History def get_loan_history(asset:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) diff --git a/lib/binance/spot/margin.rb b/lib/binance/spot/margin.rb index 3868485..6a709d2 100644 --- a/lib/binance/spot/margin.rb +++ b/lib/binance/spot/margin.rb @@ -3,107 +3,13 @@ module Binance class Spot # Margin endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-trade + # @see https://developers.binance.com/docs/margin_trading/Introduction module Margin - # Cross Margin Account Transfer (MARGIN) - # - # POST /sapi/v1/margin/transfer - # - # Execute transfer between spot account and cross margin account. - # - # @param asset [String] - # @param amount [Float] - # @param type [Integer] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cross-margin-account-transfer-margin - def margin_transfer(asset:, amount:, type:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('amount', amount) - Binance::Utils::Validation.require_param('type', type) - - @session.sign_request(:post, '/sapi/v1/margin/transfer', params: kwargs.merge( - asset: asset, - amount: amount, - type: type - )) - end - - # Margin Account Borrow (MARGIN) - # - # POST /sapi/v1/margin/loan - # - # Apply for a loan. - # - # @param asset [String] - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [String] :isIsolated for isolated margin or not, "TRUE", "FALSE"; default "FALSE" - # @option kwargs [String] :symbol isolated symbol - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin - def margin_borrow(asset:, amount:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:post, '/sapi/v1/margin/loan', params: kwargs.merge( - asset: asset, - amount: amount - )) - end - - # Margin Account Repay (MARGIN) - # - # POST /sapi/v1/margin/repay - # - # Repay loan for margin account. - # - # @param asset [String] - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [String] :isIsolated for isolated margin or not, "TRUE", "FALSE"; default "FALSE" - # @option kwargs [String] :symbol isolated symbol - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin - def margin_repay(asset:, amount:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:post, '/sapi/v1/margin/repay', params: kwargs.merge( - asset: asset, - amount: amount - )) - end - - # Query Margin Asset (MARKET_DATA) - # - # GET /sapi/v1/margin/asset - # - # @param asset [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-asset-market_data - def margin_asset(asset:) - Binance::Utils::Validation.require_param('asset', asset) - - @session.limit_request(path: '/sapi/v1/margin/asset', params: { asset: asset }) - end - - # Query Margin Pair (MARKET_DATA) - # - # GET /sapi/v1/margin/pair - # - # @param symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-pair-market_data - def margin_pair(symbol:) - Binance::Utils::Validation.require_param('symbol', symbol) - - @session.limit_request(path: '/sapi/v1/margin/pair', params: { symbol: symbol }) - end - # Get All Margin Assets (MARKET_DATA) # # GET /sapi/v1/margin/allAssets # - # @see https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-assets-market_data + # @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets def margin_all_assets @session.limit_request(path: '/sapi/v1/margin/allAssets') end @@ -112,7 +18,7 @@ def margin_all_assets # # GET /sapi/v1/margin/allPairs # - # @see https://binance-docs.github.io/apidocs/spot/en/#get-all-margin-pairs-market_data + # @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs def margin_all_pairs @session.limit_request(path: '/sapi/v1/margin/allPairs') end @@ -121,7 +27,7 @@ def margin_all_pairs # # GET /sapi/v1/margin/priceIndex # - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-priceindex-market_data + # @see https://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex def margin_price_index(symbol:) Binance::Utils::Validation.require_param('symbol', symbol) @session.limit_request(path: '/sapi/v1/margin/priceIndex', params: { symbol: symbol }) @@ -146,7 +52,7 @@ def margin_price_index(symbol:) # @option kwargs [String] :sideEffectType NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT. # @option kwargs [String] :timeInForce GTC,IOC,FOK # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade + # @see https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order def margin_new_order(symbol:, side:, type:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) @@ -170,7 +76,7 @@ def margin_new_order(symbol:, side:, type:, **kwargs) # @option kwargs [String] :origClientOrderId # @option kwargs [String] :newClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-order-trade + # @see https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order def margin_cancel_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -187,7 +93,7 @@ def margin_cancel_order(symbol:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :isIsolated for isolated margin or not, "TRUE", "FALSE", default "FALSE" # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-all-open-orders-on-a-symbol-trade + # @see https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders def margin_cancel_all_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -209,53 +115,11 @@ def margin_cancel_all_order(symbol:, **kwargs) # @option kwargs [Integer] :size Default:10 Max:100 # @option kwargs [String] :archived Default: false. Set to true for archived data from 6 months ago # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-cross-margin-transfer-history-user_data + # @see https://developers.binance.com/docs/margin_trading/transfer/Get-Cross-Margin-Transfer-History def margin_transfer_history(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/transfer', params: kwargs) end - # Query Loan Record (USER_DATA) - # - # GET /sapi/v1/margin/loan - # - # @param asset [String] - # @param kwargs [Hash] - # @option kwargs [String] :isolatedSymbol - # @option kwargs [String] :txId - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 - # @option kwargs [Integer] :size Default:10 Max:100 - # @option kwargs [String] :archived Default: false. Set to true for archived data from 6 months ago - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data - def margin_load_record(asset:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - - @session.sign_request(:get, '/sapi/v1/margin/loan', params: kwargs.merge(asset: asset)) - end - - # Query Repay Record (USER_DATA) - # - # GET /sapi/v1/margin/repay - # - # @param asset [String] - # @param kwargs [Hash] - # @option kwargs [String] :isolatedSymbol - # @option kwargs [String] :txId - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 - # @option kwargs [Integer] :size Default:10 Max:100 - # @option kwargs [String] :archived Default: false. Set to true for archived data from 6 months ago - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-repay-record-user_data - def margin_repay_record(asset:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - - @session.sign_request(:get, '/sapi/v1/margin/repay', params: kwargs.merge(asset: asset)) - end - # Get Interest History (USER_DATA) # # GET /sapi/v1/margin/interestHistory @@ -269,7 +133,7 @@ def margin_repay_record(asset:, **kwargs) # @option kwargs [Integer] :size Default:10 Max:100 # @option kwargs [String] :archived Default: false. Set to true for archived data from 6 months ago # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data + # @see https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History def margin_interest_history(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/interestHistory', params: kwargs) end @@ -285,7 +149,7 @@ def margin_interest_history(**kwargs) # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10 Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Get-Force-Liquidation-Record def margin_force_liquidation_record(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/forceLiquidationRec', params: kwargs) end @@ -296,7 +160,7 @@ def margin_force_liquidation_record(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-account-details-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details def margin_account(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/account', params: kwargs) end @@ -311,7 +175,7 @@ def margin_account(**kwargs) # @option kwargs [Integer] :orderId # @option kwargs [String] :origClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-order-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order def margin_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -326,7 +190,7 @@ def margin_order(symbol:, **kwargs) # @option kwargs [String] :symbol # @option kwargs [String] :isIsolated for isolated margin or not, "TRUE", "FALSE", default "FALSE" # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders def margin_open_orders(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/openOrders', params: kwargs) end @@ -343,7 +207,7 @@ def margin_open_orders(**kwargs) # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit Default 500; max 1000. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders def margin_all_orders(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -371,7 +235,7 @@ def margin_all_orders(symbol:, **kwargs) # @option kwargs [String] :newOrderRespType # @option kwargs [String] :sideEffectType NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-oco-trade + # @see https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO def margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) @@ -401,7 +265,7 @@ def margin_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) # @option kwargs [String] :listClientOrderId Either orderListId or listClientOrderId must be provided # @option kwargs [String] :newClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-oco-trade + # @see https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO def margin_cancel_oco(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -420,7 +284,7 @@ def margin_cancel_oco(symbol:, **kwargs) # @option kwargs [Integer] :orderListId Either orderListId or origClientOrderId must be provided # @option kwargs [String] :origClientOrderId Either orderListId or origClientOrderId must be provided # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-oco-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO def margin_get_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/orderList', params: kwargs) end @@ -437,7 +301,7 @@ def margin_get_oco(**kwargs) # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-oco-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-OCO def margin_get_all_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/allOrderList', params: kwargs) end @@ -450,7 +314,7 @@ def margin_get_all_oco(**kwargs) # @option kwargs [String] :symbol # @option kwargs [String] :isIsolated # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-oco-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO def margin_get_open_oco(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/openOrderList', params: kwargs) end @@ -466,7 +330,7 @@ def margin_get_open_oco(**kwargs) # @option kwargs [String] :orderfromIdId # @option kwargs [Integer] :limit Default 500; max 1000. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data + # @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List def margin_my_trades(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -481,7 +345,7 @@ def margin_my_trades(symbol:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :isolatedSymbol # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-max-borrow-user_data + # @see https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow def margin_max_borrowable(asset:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) @@ -496,62 +360,13 @@ def margin_max_borrowable(asset:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :isolatedSymbol # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-max-transfer-out-amount-user_data + # @see https://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount def margin_max_transferable(asset:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) @session.sign_request(:get, '/sapi/v1/margin/maxTransferable', params: kwargs.merge(asset: asset)) end - # Isolated Margin Account Transfer (MARGIN) - # - # POST /sapi/v1/margin/isolated/transfer - # - # @param asset [String] - # @param symbol [String] - # @param transFrom [String] "SPOT", "ISOLATED_MARGIN" - # @param transTo [String] "SPOT", "ISOLATED_MARGIN" - # @param amount [Float] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin - def isolated_margin_transfer(asset:, symbol:, transFrom:, transTo:, amount:, **kwargs) - Binance::Utils::Validation.require_param('asset', asset) - Binance::Utils::Validation.require_param('symbol', symbol) - Binance::Utils::Validation.require_param('transFrom', transFrom) - Binance::Utils::Validation.require_param('transTo', transTo) - Binance::Utils::Validation.require_param('amount', amount) - - @session.sign_request(:post, '/sapi/v1/margin/isolated/transfer', params: kwargs.merge( - asset: asset, - symbol: symbol, - transFrom: transFrom, - transTo: transTo, - amount: amount - )) - end - - # Get Isolated Margin Transfer History (USER_DATA) - # - # GET /sapi/v1/margin/isolated/transfer - # - # @param symbol [String] - # @param kwargs [Hash] - # @option kwargs [String] :asset - # @option kwargs [String] :transFrom "SPOT", "ISOLATED_MARGIN" - # @option kwargs [String] :transTo "SPOT", "ISOLATED_MARGIN" - # @option kwargs [Integer] :startTime - # @option kwargs [Integer] :endTime - # @option kwargs [Integer] :current Current page, default 1 - # @option kwargs [Integer] :size Default 10, max 100 - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-isolated-margin-transfer-history-user_data - def get_isolated_margin_transfer(symbol:, **kwargs) - Binance::Utils::Validation.require_param('symbol', symbol) - - @session.sign_request(:get, '/sapi/v1/margin/isolated/transfer', params: kwargs.merge(symbol: symbol)) - end - # Query Isolated Margin Account Info (USER_DATA) # # GET /sapi/v1/margin/isolated/account @@ -559,7 +374,7 @@ def get_isolated_margin_transfer(symbol:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :symbols Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT" # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info def get_isolated_margin_account(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/account', params: kwargs) end @@ -571,7 +386,7 @@ def get_isolated_margin_account(**kwargs) # @param symbol [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#disable-isolated-margin-account-trade + # @see https://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account def disable_isolated_margin_account(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -585,7 +400,7 @@ def disable_isolated_margin_account(symbol:, **kwargs) # @param symbol [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#enable-isolated-margin-account-trade + # @see https://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account def enable_isolated_margin_account(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -598,32 +413,18 @@ def enable_isolated_margin_account(symbol:, **kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-enabled-isolated-margin-account-limit-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Enabled-Isolated-Margin-Account-Limit def get_isolated_margin_account_limit(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/accountLimit', params: kwargs) end - # Query Isolated Margin Symbol (USER_DATA) - # - # GET /sapi/v1/margin/isolated/pair - # - # @param symbol [String] - # @param kwargs [Hash] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-symbol-user_data - def get_isolated_margin_pair(symbol:, **kwargs) - Binance::Utils::Validation.require_param('symbol', symbol) - - @session.sign_request(:get, '/sapi/v1/margin/isolated/pair', params: kwargs.merge(symbol: symbol)) - end - # Get All Isolated Margin Symbol(USER_DATA) # # GET /sapi/v1/margin/isolated/allPairs # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-all-isolated-margin-symbol-user_data + # @see https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol def get_all_isolated_margin_pairs(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolated/allPairs', params: kwargs) end @@ -638,7 +439,7 @@ def get_all_isolated_margin_pairs(**kwargs) # @option kwargs [String] :spotBNBBurn "true" or "false"; Determines whether to use BNB to pay for trading fees on SPOT # @option kwargs [String] :interestBNBBurn "true" or "false"; Determines whether to use BNB to pay for margin loan's interest # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#toggle-bnb-burn-on-spot-trade-and-margin-interest-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Toggle-BNB-Burn-On-Spot-Trade-And-Margin-Interest def toggle_bnb_burn(**kwargs) @session.sign_request(:post, '/sapi/v1/bnbBurn', params: kwargs) end @@ -649,7 +450,7 @@ def toggle_bnb_burn(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-bnb-burn-status-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status def get_bnb_burn(**kwargs) @session.sign_request(:get, '/sapi/v1/bnbBurn', params: kwargs) end @@ -665,7 +466,7 @@ def get_bnb_burn(**kwargs) # @option endTime [Integer] Default: present. Maximum range: 3 months. # @option limit [Integer] Default: 20. Maximum: 100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data + # @see https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History def get_margin_interest_rate_history(asset:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) @@ -680,7 +481,7 @@ def get_margin_interest_rate_history(asset:, **kwargs) # @option vipLevel [Integer] Default: user's vip level # @option coin [String] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-fee-data-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-Data def get_cross_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/crossMarginData', params: kwargs) end @@ -693,7 +494,7 @@ def get_cross_margin_data(**kwargs) # @option vipLevel [Integer] Default: user's vip level # @option symbol [String] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data def get_isolated_margin_data(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/isolatedMarginData', params: kwargs) end @@ -706,7 +507,7 @@ def get_isolated_margin_data(**kwargs) # @param kwargs [Hash] # @option tier [Integer] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-tier-data-user_data + # @see https://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-Data def get_isolated_margin_tier(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -721,23 +522,10 @@ def get_isolated_margin_tier(symbol:, **kwargs) # @option isIsolated [String] # @option symbol [String] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + # @see https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data def get_margin_order_usage(**kwargs) @session.sign_request(:get, '/sapi/v1/margin/rateLimit/order', params: kwargs) end - - # Margin Dustlog (USER_DATA) - # - # GET /sapi/v1/margin/dribblet - # - # @param kwargs [Hash] - # @option kwargs [String] :startTime - # @option kwargs [String] :endTime - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-dustlog-user_data - def get_margin_dust_log(**kwargs) - @session.sign_request(:get, '/sapi/v1/margin/dribblet', params: kwargs) - end end end end diff --git a/lib/binance/spot/market.rb b/lib/binance/spot/market.rb index 5c4f631..e23099f 100644 --- a/lib/binance/spot/market.rb +++ b/lib/binance/spot/market.rb @@ -9,13 +9,13 @@ class Spot # - trades # - orderbook # - etc - # @see https://binance-docs.github.io/apidocs/spot/en/#market-data-endpoints + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#market-data-endpoints module Market # Test Connectivity # # GET /api/v3/ping # - # @see https://binance-docs.github.io/apidocs/spot/en/#test-connectivity + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#test-connectivity def ping @session.public_request(path: '/api/v3/ping') end @@ -24,7 +24,7 @@ def ping # # GET /api/v3/time # - # @see https://binance-docs.github.io/apidocs/spot/en/#check-server-time + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#check-server-time def time @session.public_request(path: '/api/v3/time') end @@ -36,7 +36,7 @@ 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 + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#exchange-information def exchange_info(symbol: nil, symbols: nil, permissions: nil) if symbols.is_a?(Array) symbols = symbols.map { |v| "%22#{v}%22" }.join(',') @@ -59,7 +59,7 @@ def exchange_info(symbol: nil, symbols: nil, permissions: nil) # @param symbol [String] the symbol # @param kwargs [Hash] # @option kwargs [Integer] :limit Default 100; max 1000. Valid limits:[5, 10, 20, 50, 100, 500, 1000, 5000] - # @see https://binance-docs.github.io/apidocs/spot/en/#order-book + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#order-book def depth(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -76,7 +76,7 @@ def depth(symbol:, **kwargs) # @param symbol [String] the symbol # @param kwargs [Hash] # @option kwargs [Integer] :limit Default 500; max 1000. - # @see https://binance-docs.github.io/apidocs/spot/en/#recent-trades-list + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#recent-trades-list def trades(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -96,7 +96,7 @@ def trades(symbol:, **kwargs) # @param kwargs [Hash] # @option kwargs [Integer] :limit Default 500; max 1000. # @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades. - # @see https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup-market_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#old-trade-lookup def historical_trades(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -118,7 +118,7 @@ def historical_trades(symbol:, **kwargs) # @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE. # @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades. # @option kwargs [Integer] :limit Default 500; max 1000. - # @see https://binance-docs.github.io/apidocs/spot/en/#compressed-aggregate-trades-list + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#compressedaggregate-trades-list def agg_trades(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -141,7 +141,7 @@ def agg_trades(symbol:, **kwargs) # @option kwargs [Integer] :startTime Timestamp in ms to get aggregate trades from INCLUSIVE. # @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE. # @option kwargs [Integer] :limit Default 500; max 1000. - # @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#klinecandlestick-data def klines(symbol:, interval:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('interval', interval) @@ -162,7 +162,7 @@ def klines(symbol:, interval:, **kwargs) # GET /api/v3/avgPrice # # @param symbol [String] the symbol - # @see https://binance-docs.github.io/apidocs/spot/en/#current-average-price + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#current-average-price def avg_price(symbol:) Binance::Utils::Validation.require_param('symbol', symbol) @@ -179,7 +179,7 @@ def avg_price(symbol:) # GET /api/v3/ticker/24hr # # @param symbol [String] the symbol - # @see https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#24hr-ticker-price-change-statistics def ticker_24hr(symbol: nil) @session.public_request( path: '/api/v3/ticker/24hr', @@ -194,7 +194,7 @@ def ticker_24hr(symbol: nil) # GET /api/v3/ticker/price # # @param symbol [String] the symbol - # @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#symbol-price-ticker def ticker_price(symbol: nil) @session.public_request( path: '/api/v3/ticker/price', @@ -209,7 +209,7 @@ def ticker_price(symbol: nil) # GET /api/v3/ticker/bookTicker # # @param symbol [String] the symbol - # @see https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#symbol-order-book-ticker def book_ticker(symbol: nil) @session.public_request( path: '/api/v3/ticker/bookTicker', @@ -224,7 +224,7 @@ def book_ticker(symbol: nil) # GET /api/v3/ticker/bookTicker # # @param symbol [String] the symbol - # @see https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#symbol-order-book-ticker def ticker(symbol: nil, symbols: nil, windowSize: '1d') raise Binance::DuplicatedParametersError.new('symbol', 'symbols') unless symbols.nil? || symbol.nil? diff --git a/lib/binance/spot/mining.rb b/lib/binance/spot/mining.rb index 55766b4..b7beeca 100644 --- a/lib/binance/spot/mining.rb +++ b/lib/binance/spot/mining.rb @@ -4,13 +4,13 @@ module Binance class Spot # Mining endpoints # The endpoints below allow to interact with Binance Pool. - # @see https://binance-docs.github.io/apidocs/spot/en/#mining-endpoints + # @see https://developers.binance.com/docs/mining/Introduction module Mining # Acquiring Algorithm (MARKET_DATA) # # GET /sapi/v1/mining/pub/algoList # - # @see https://binance-docs.github.io/apidocs/spot/en/#acquiring-algorithm-market_data + # @see https://developers.binance.com/docs/mining/rest-api/Acquiring-Algorithm def mining_algo_list @session.limit_request(path: '/sapi/v1/mining/pub/algoList') end @@ -19,7 +19,7 @@ def mining_algo_list # # GET /sapi/v1/mining/pub/coinList # - # @see https://binance-docs.github.io/apidocs/spot/en/#acquiring-coinname-market_data + # @see https://developers.binance.com/docs/mining/rest-api/Acquiring-CoinName def mining_coin_list @session.limit_request(path: '/sapi/v1/mining/pub/coinList') end @@ -33,7 +33,7 @@ def mining_coin_list # @param workerName [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#request-for-detail-miner-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Request-for-Detail-Miner-List def mining_worker(algo:, userName:, workerName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -58,7 +58,7 @@ def mining_worker(algo:, userName:, workerName:, **kwargs) # @option kwargs [String] :sortColumn # @option kwargs [String] :workerStatus # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#request-for-miner-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Request-for-Miner-List def mining_worker_list(algo:, userName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -82,7 +82,7 @@ def mining_worker_list(algo:, userName:, **kwargs) # @option kwargs [Integer] :pageIndex # @option kwargs [Integer] :pageSize # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#earnings-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Earnings-List def mining_revenue_list(algo:, userName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -101,7 +101,7 @@ def mining_revenue_list(algo:, userName:, **kwargs) # @param userName [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#statistic-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Statistic-List def mining_statistics_list(algo:, userName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -120,7 +120,7 @@ def mining_statistics_list(algo:, userName:, **kwargs) # @param userName [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#account-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Account-List def mining_account_list(algo:, userName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -144,7 +144,7 @@ def mining_account_list(algo:, userName:, **kwargs) # @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1 # @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#extra-bonus-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Extra-Bonus-List def mining_extra_bonus(algo:, userName:, **kwargs) Binance::Utils::Validation.require_param('algo', algo) Binance::Utils::Validation.require_param('userName', userName) @@ -163,7 +163,7 @@ def mining_extra_bonus(algo:, userName:, **kwargs) # @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1 # @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-list-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-List def mining_resale_list(**kwargs) @session.sign_request(:get, '/sapi/v1/mining/hash-transfer/config/details/list', params: kwargs) end @@ -178,7 +178,7 @@ def mining_resale_list(**kwargs) # @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1 # @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-detail-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Detail def mining_resale_detail(configId:, userName:, **kwargs) Binance::Utils::Validation.require_param('configId', configId) Binance::Utils::Validation.require_param('userName', userName) @@ -201,7 +201,7 @@ def mining_resale_detail(configId:, userName:, **kwargs) # @param hashRate [Integer] Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000) # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#hashrate-resale-request-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Request def mining_resale_request(userName:, algo:, startDate:, endDate:, toPoolUser:, hashRate:, **kwargs) Binance::Utils::Validation.require_param('userName', userName) Binance::Utils::Validation.require_param('algo', algo) @@ -228,7 +228,7 @@ def mining_resale_request(userName:, algo:, startDate:, endDate:, toPoolUser:, h # @param userName [String] Mining Account # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-hashrate-resale-configuration-user_data + # @see https://developers.binance.com/docs/mining/rest-api/Cancel-hashrate-resale-configuration def mining_resale_cancel(configId:, userName:, **kwargs) Binance::Utils::Validation.require_param('userName', userName) Binance::Utils::Validation.require_param('configId', configId) diff --git a/lib/binance/spot/simple_earn.rb b/lib/binance/spot/simple_earn.rb index 9312f02..710be7c 100644 --- a/lib/binance/spot/simple_earn.rb +++ b/lib/binance/spot/simple_earn.rb @@ -3,7 +3,7 @@ module Binance class Spot # all wallet endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#wallet-endpoints + # @see https://developers.binance.com/docs/simple_earn/Introduction module SimpleEarn # Get Simple Earn Flexible Product List (USER_DATA) # @@ -14,7 +14,7 @@ module SimpleEarn # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-flexible-product-list-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Flexible-Product-List def flexible_product_list(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/list', params: kwargs) end @@ -28,7 +28,7 @@ def flexible_product_list(**kwargs) # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-locked-product-list-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Locked-Product-List def locked_product_list(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/locked/list', params: kwargs) end @@ -43,7 +43,7 @@ def locked_product_list(**kwargs) # @option kwargs [Boolean] :autoSubscribe true or false, default true # @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-flexible-product-trade + # @see https://developers.binance.com/docs/simple_earn/earn/Subscribe-Flexible-Product def flexible_subscribe(productId:, amount:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) Binance::Utils::Validation.require_param('amount', amount) @@ -64,7 +64,7 @@ def flexible_subscribe(productId:, amount:, **kwargs) # @option kwargs [Boolean] :autoSubscribe true or false, default true # @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade + # @see https://developers.binance.com/docs/simple_earn/earn/Subscribe-Locked-Product def locked_subscribe(projectId:, amount:, **kwargs) Binance::Utils::Validation.require_param('projectId', projectId) Binance::Utils::Validation.require_param('amount', amount) @@ -85,7 +85,7 @@ def locked_subscribe(projectId:, amount:, **kwargs) # @option kwargs [Float] :amount if redeemAll is false, amount is mandatory # @option kwargs [String] :destAccount SPOT,FUND,ALL, default SPOT # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-trade + # @see https://developers.binance.com/docs/simple_earn/earn/Redeem-Flexible-Product def flexible_redeem_product(productId:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) @@ -101,7 +101,7 @@ def flexible_redeem_product(productId:, **kwargs) # @param positionId [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-locked-product-trade + # @see https://developers.binance.com/docs/simple_earn/earn/Redeem-Locked-Product def locked_redeem_product(positionId:, **kwargs) Binance::Utils::Validation.require_param('positionId', positionId) @@ -120,7 +120,7 @@ def locked_redeem_product(positionId:, **kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Product-Position def flexible_product_position(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/position', params: kwargs) end @@ -136,7 +136,7 @@ def flexible_product_position(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-product-position-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Locked-Product-Position def locked_product_position(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/locked/position', params: kwargs) end @@ -147,7 +147,7 @@ def locked_product_position(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#simple-account-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Simple-Account def simple_earn_account(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/account', params: kwargs) end @@ -165,7 +165,7 @@ def simple_earn_account(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-subscription-record-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Subscription-Record def flexible_subscription_record(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/subscriptionRecord', params: kwargs) end @@ -182,7 +182,7 @@ def flexible_subscription_record(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-record-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Subscription-Record def locked_subscription_record(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/subscriptionRecord', params: kwargs) end @@ -200,7 +200,7 @@ def locked_subscription_record(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-redemption-record-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Redemption-Record def flexible_redemption_record(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/redemptionRecord', params: kwargs) end @@ -218,7 +218,7 @@ def flexible_redemption_record(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-redemption-record-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Redemption-Record def locked_redemption_record(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/redemptionRecord', params: kwargs) end @@ -236,7 +236,7 @@ def locked_redemption_record(**kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-rewards-history-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Rewards-History def flexible_rewards_history(type:, **kwargs) Binance::Utils::Validation.require_param('type', type) @@ -255,7 +255,7 @@ def flexible_rewards_history(type:, **kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-rewards-history-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Rewards-History def locked_rewards_history(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/rewardsRecord', params: kwargs) end @@ -268,7 +268,7 @@ def locked_rewards_history(**kwargs) # @param autoSubscribe [Boolean] true or false # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#set-flexible-auto-subscribe-user_data + # @see https://developers.binance.com/docs/simple_earn/earn/Set-Flexible-Auto-Subscribe def flexible_auto_subscribe(productId:, autoSubscribe:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe) @@ -287,7 +287,7 @@ def flexible_auto_subscribe(productId:, autoSubscribe:, **kwargs) # @param autoSubscribe [Boolean] true or false # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#set-locked-auto-subscribe-user_data + # @see https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Auto-Subscribe def locked_auto_subscribe(positionId:, autoSubscribe:, **kwargs) Binance::Utils::Validation.require_param('positionId', positionId) Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe) @@ -305,7 +305,7 @@ def locked_auto_subscribe(positionId:, autoSubscribe:, **kwargs) # @param productId [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-personal-left-quota-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Personal-Left-Quota def flexible_personal_left_quota(productId:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) @@ -319,7 +319,7 @@ def flexible_personal_left_quota(productId:, **kwargs) # @param projectId [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-personal-left-quota-user_data + # @see https://developers.binance.com/docs/simple_earn/account/Get-Locked-Personal-Left-Quota def locked_personal_left_quota(projectId:, **kwargs) Binance::Utils::Validation.require_param('projectId', projectId) @@ -334,7 +334,7 @@ def locked_personal_left_quota(projectId:, **kwargs) # @param amount [Float] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-subscription-preview-user_data + # @see https://developers.binance.com/docs/simple_earn/earn/Get-Flexible-Subscription-Preview def flexible_subscription_preview(productId:, amount:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) Binance::Utils::Validation.require_param('amount', amount) @@ -354,7 +354,7 @@ def flexible_subscription_preview(productId:, amount:, **kwargs) # @param kwargs [Hash] # @option kwargs [Boolean] :autoSubscribe true or false, default true # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-preview-user_data + # @see https://developers.binance.com/docs/simple_earn/earn/Get-Locked-Subscription-Preview def locked_subscription_preview(projectId:, amount:, **kwargs) Binance::Utils::Validation.require_param('projectId', projectId) Binance::Utils::Validation.require_param('amount', amount) @@ -376,7 +376,7 @@ def locked_subscription_preview(projectId:, amount:, **kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-rate-history-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Rate-History def rate_history(productId:, **kwargs) Binance::Utils::Validation.require_param('productId', productId) @@ -394,7 +394,7 @@ def rate_history(productId:, **kwargs) # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1 # @option kwargs [Integer] :size Default:10, Max:100 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-collateral-record-user_data + # @see https://developers.binance.com/docs/simple_earn/history/Get-Collateral-Record def collateral_record(**kwargs) @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/collateralRecord', params: kwargs) end diff --git a/lib/binance/spot/stream.rb b/lib/binance/spot/stream.rb index 671a0e1..74a4ac5 100644 --- a/lib/binance/spot/stream.rb +++ b/lib/binance/spot/stream.rb @@ -3,7 +3,7 @@ module Binance class Spot # User data stream endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#user-data-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/user-data-stream module Stream # Create a ListenKey (USER_STREAM) # diff --git a/lib/binance/spot/subaccount.rb b/lib/binance/spot/subaccount.rb index 77491fb..7341ed1 100644 --- a/lib/binance/spot/subaccount.rb +++ b/lib/binance/spot/subaccount.rb @@ -3,7 +3,7 @@ module Binance class Spot # all sub-account endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#sub-account-endpoints + # @see https://developers.binance.com/docs/sub_account/Introduction module Subaccount # Create a Virtual Sub-account(For Master Account) # @@ -15,7 +15,7 @@ module Subaccount # @param subAccountString [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#create-a-virtual-sub-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Create-a-Virtual-Sub-account def create_virtual_sub_account(subAccountString:, **kwargs) Binance::Utils::Validation.require_param('subAccountString', subAccountString) @@ -34,7 +34,7 @@ def create_virtual_sub_account(subAccountString:, **kwargs) # @option kwargs [Integer] :page # @option kwargs [Integer] :limit # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-list-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Query-Sub-account-List def get_sub_account_list(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/list', params: kwargs) end @@ -54,7 +54,7 @@ def get_sub_account_list(**kwargs) # @option kwargs [Integer] :page Default value: 1 # @option kwargs [Integer] :limit Default value: 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-spot-asset-transfer-history-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Asset-Transfer-History def get_sub_account_spot_transfer_history(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/sub/transfer/history', params: kwargs) end @@ -71,7 +71,7 @@ def get_sub_account_spot_transfer_history(**kwargs) # @option kwargs [Integer] :page Default value: 1 # @option kwargs [Integer] :limit Default value: 50, Max value: 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-futures-asset-transfer-history-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Futures-Asset-Transfer-History def get_sub_account_futures_transfer_history(email:, futuresType:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('futuresType', futuresType) @@ -93,7 +93,7 @@ def get_sub_account_futures_transfer_history(email:, futuresType:, **kwargs) # @param amount [Float] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#sub-account-futures-asset-transfer-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Futures-Asset-Transfer def sub_account_futures_internal_transfer(fromEmail:, toEmail:, futuresType:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('fromEmail', fromEmail) Binance::Utils::Validation.require_param('toEmail', toEmail) @@ -117,7 +117,7 @@ def sub_account_futures_internal_transfer(fromEmail:, toEmail:, futuresType:, as # @param email [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-assets-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Assets-V3 def get_sub_account_assets(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -135,7 +135,7 @@ def get_sub_account_assets(email:, **kwargs) # @option kwargs [Integer] :page Default value: 1 # @option kwargs [Integer] :size default 10, max 20 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-sub-account-spot-assets-summary-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Assets-Summary def get_sub_account_spot_summary(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/spotSummary', params: kwargs) end @@ -151,7 +151,7 @@ def get_sub_account_spot_summary(**kwargs) # @param kwargs [Hash] # @option kwargs [String] :network # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-address-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-Address def sub_account_deposit_address(email:, coin:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('coin', coin) @@ -177,7 +177,7 @@ def sub_account_deposit_address(email:, coin:, **kwargs) # @option kwargs [String] :limit # @option kwargs [String] :offset # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-deposit-history-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-History def sub_account_deposit_history(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -193,7 +193,7 @@ def sub_account_deposit_history(email:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :email # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-39-s-status-on-margin-futures-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Get-Sub-accounts-Status-on-Margin-Or-Futures def sub_account_status(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/status', params: kwargs) end @@ -205,7 +205,7 @@ def sub_account_status(**kwargs) # @param kwargs [Hash] # @option kwargs [String] :email # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-sub-account-39-s-status-on-margin-futures-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Enable-Margin-for-Sub-account def sub_account_enable_margin(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -221,7 +221,7 @@ def sub_account_enable_margin(email:, **kwargs) # @param email [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-detail-on-sub-account-39-s-margin-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Margin-Account def sub_account_margin_account(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -236,7 +236,7 @@ def sub_account_margin_account(email:, **kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-summary-of-sub-account-39-s-margin-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Margin-Account def sub_account_margin_account_summary(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/margin/accountSummary', params: kwargs) end @@ -248,7 +248,7 @@ def sub_account_margin_account_summary(**kwargs) # @param email [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#enable-futures-for-sub-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Enable-Futures-for-Sub-account def sub_account_enable_futures(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -265,7 +265,7 @@ def sub_account_enable_futures(email:, **kwargs) # @param futuresType [Integer] 1:USDT Margined Futures, 2:COIN Margined Futures # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-detail-on-sub-account-39-s-futures-account-v2-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Futures-Account-V2 def sub_account_futures_account(email:, futuresType:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('futuresType', futuresType) @@ -285,7 +285,7 @@ def sub_account_futures_account(email:, futuresType:, **kwargs) # @option kwargs [Integer] :page default:1 # @option kwargs [Integer] :limit default:10, max:20 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-summary-of-sub-account-39-s-futures-account-v2-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Futures-Account-V2 def sub_account_futures_account_summary(futuresType:, **kwargs) Binance::Utils::Validation.require_param('futuresType', futuresType) @@ -302,7 +302,7 @@ def sub_account_futures_account_summary(futuresType:, **kwargs) # @param futuresType [Integer] 1:USDT Margined Futures, 2:COIN Margined Futures # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-futures-position-risk-of-sub-account-v2-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Get-Futures-Position-Risk-of-Sub-account-V2 def sub_account_futures_position_risk(email:, futuresType:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('futuresType', futuresType) @@ -326,7 +326,7 @@ def sub_account_futures_position_risk(email:, futuresType:, **kwargs) # 4:transfer from subaccount's COIN-margined futures account to its spot account # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#futures-transfer-for-sub-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Futures-Transfer-for-Sub-account def sub_account_futures_transfer(email:, asset:, amount:, type:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('asset', asset) @@ -352,7 +352,7 @@ def sub_account_futures_transfer(email:, asset:, amount:, type:, **kwargs) # 2: transfer from subaccount's margin account to its spot account # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#margin-transfer-for-sub-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Margin-Transfer-for-Sub-account def sub_account_margin_transfer(email:, asset:, amount:, type:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('asset', asset) @@ -376,7 +376,7 @@ def sub_account_margin_transfer(email:, asset:, amount:, type:, **kwargs) # @param amount [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#transfer-to-sub-account-of-same-master-for-sub-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Sub-account-of-Same-Master def sub_account_transfer_to_sub(toEmail:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('toEmail', toEmail) Binance::Utils::Validation.require_param('asset', asset) @@ -397,7 +397,7 @@ def sub_account_transfer_to_sub(toEmail:, asset:, amount:, **kwargs) # @param amount [Float] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#transfer-to-master-for-sub-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Master def sub_account_transfer_to_master(asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) Binance::Utils::Validation.require_param('amount', amount) @@ -419,7 +419,7 @@ def sub_account_transfer_to_master(asset:, amount:, **kwargs) # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#sub-account-transfer-history-for-sub-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Transfer-History def sub_account_transfer_sub_account_history(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/transfer/subUserHistory', params: kwargs) end @@ -439,7 +439,7 @@ def sub_account_transfer_sub_account_history(**kwargs) # @option kwargs [String] :fromEmail Transfer from master account by default if fromEmail is not sent. # @option kwargs [String] :toEmail Transfer to master account by default if toEmail is not sent. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#universal-transfer-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Universal-Transfer def universal_transfer(fromAccountType:, toAccountType:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('fromAccountType', fromAccountType) Binance::Utils::Validation.require_param('toAccountType', toAccountType) @@ -466,7 +466,7 @@ def universal_transfer(fromAccountType:, toAccountType:, asset:, amount:, **kwar # @option kwargs [Integer] :page # @option kwargs [Integer] :limit Default 500, Max 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-universal-transfer-history-for-master-account + # @see https://developers.binance.com/docs/sub_account/asset-management/Query-Universal-Transfer-History def universal_transfer_history(**kwargs) @session.sign_request(:get, '/sapi/v1/sub-account/universalTransfer', params: kwargs) end @@ -479,7 +479,7 @@ def universal_transfer_history(**kwargs) # @param enableBlvt [Boolean] Only true for now # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#enable-leverage-token-for-sub-account-for-master-account + # @see https://developers.binance.com/docs/sub_account/account-management/Enable-Leverage-Token-for-Sub-account def sub_account_enable_blvt(email:, enableBlvt:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('enableBlvt', enableBlvt) @@ -499,7 +499,7 @@ def sub_account_enable_blvt(email:, enableBlvt:, **kwargs) # @param amount [Float] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#deposit-assets-into-the-managed-sub-account-for-investor-master-account + # @see https://developers.binance.com/docs/sub_account/managed-sub-account/Deposit-Assets-Into-The-Managed-Sub-account def deposit_to_sub_account(toEmail:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('toEmail', toEmail) Binance::Utils::Validation.require_param('asset', asset) @@ -519,7 +519,7 @@ def deposit_to_sub_account(toEmail:, asset:, amount:, **kwargs) # @param email [String] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-managed-sub-account-asset-details-for-investor-master-account + # @see https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-Asset-Details def sub_account_asset_details(email:, **kwargs) Binance::Utils::Validation.require_param('email', email) @@ -536,7 +536,7 @@ def sub_account_asset_details(email:, **kwargs) # @param kwargs [Hash] # @option kwargs [Integer] :transferDate # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#withdrawl-assets-from-the-managed-sub-account-for-investor-master-account + # @see https://developers.binance.com/docs/sub_account/managed-sub-account/Withdrawl-Assets-From-The-Managed-Sub-account def withdraw_from_sub_account(fromEmail:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('fromEmail', fromEmail) Binance::Utils::Validation.require_param('asset', asset) @@ -551,43 +551,23 @@ def withdraw_from_sub_account(fromEmail:, asset:, amount:, **kwargs) # Enable or Disable IP Restriction for a Sub-account API Key (For Master Account) # - # POST /sapi/v1/sub-account/subAccountApi/ipRestriction + # POST /sapi/v2/sub-account/subAccountApi/ipRestriction # # @param email [String] # @param subAccountApiKey [String] - # @param ipRestrict [Boolean] + # @param status [String] + # @option kwargs [String] :ipAddress Insert static IP in batch, separated by commas. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#enable-or-disable-ip-restriction-for-a-sub-account-api-key-for-master-account - def sub_account_toggle_ip_restriction(email:, subAccountApiKey:, ipRestrict:, **kwargs) + # @see https://developers.binance.com/docs/sub_account/api-management/Add-IP-Restriction-for-Sub-Account-API-key + def sub_account_toggle_ip_restriction(email:, subAccountApiKey:, status:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey) - Binance::Utils::Validation.require_param('ipRestrict', ipRestrict) + Binance::Utils::Validation.require_param('status', status) - @session.sign_request(:post, '/sapi/v1/sub-account/subAccountApi/ipRestriction', params: kwargs.merge( + @session.sign_request(:post, '/sapi/v2/sub-account/subAccountApi/ipRestriction', params: kwargs.merge( email: email, subAccountApiKey: subAccountApiKey, - ipRestrict: ipRestrict - )) - end - - # Add IP List for a Sub-account API Key (For Master Account) - # - # POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList - # - # @param email [String] - # @param subAccountApiKey [String] - # @param ipAddress [String] - # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#add-ip-list-for-a-sub-account-api-key-for-master-account - def sub_account_add_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs) - Binance::Utils::Validation.require_param('email', email) - Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey) - Binance::Utils::Validation.require_param('ipAddress', ipAddress) - - @session.sign_request(:post, '/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList', params: kwargs.merge( - email: email, - subAccountApiKey: subAccountApiKey, - ipAddress: ipAddress + status: status )) end @@ -598,7 +578,7 @@ def sub_account_add_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs) # @param email [String] # @param subAccountApiKey [String] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-ip-restriction-for-a-sub-account-api-key-for-master-account + # @see https://developers.binance.com/docs/sub_account/api-management/Get-IP-Restriction-for-a-Sub-account-API-Key def sub_account_ip_list(email:, subAccountApiKey:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey) @@ -617,7 +597,7 @@ def sub_account_ip_list(email:, subAccountApiKey:, **kwargs) # @param subAccountApiKey [String] # @param ipAddress [String] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-ip-restriction-for-a-sub-account-api-key-for-master-account + # @see https://developers.binance.com/docs/sub_account/api-management/Get-IP-Restriction-for-a-Sub-account-API-Key def sub_account_delete_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs) Binance::Utils::Validation.require_param('email', email) Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey) diff --git a/lib/binance/spot/trade.rb b/lib/binance/spot/trade.rb index c4f325e..64fff67 100644 --- a/lib/binance/spot/trade.rb +++ b/lib/binance/spot/trade.rb @@ -8,7 +8,7 @@ class Spot # - cancel orders (spot and oco) # - account information # - my trades - # @see https://binance-docs.github.io/apidocs/spot/en/#spot-account-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api module Trade # TestNew Order # @@ -29,7 +29,7 @@ module Trade # @option kwargs [Float] :icebergeQty # @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#test-new-order-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#test-new-order-trade def new_order_test(symbol:, side:, type:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) @@ -61,7 +61,7 @@ def new_order_test(symbol:, side:, type:, **kwargs) # @option kwargs [Float] :icebergeQty # @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade def new_order(symbol:, side:, type:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) @@ -84,7 +84,7 @@ def new_order(symbol:, side:, type:, **kwargs) # @option kwargs [String] :origClientOrderId # @option kwargs [String] :newClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-trade def cancel_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -98,7 +98,7 @@ def cancel_order(symbol:, **kwargs) # @param symbol [String] the symbol # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-all-open-orders-on-a-symbol-trade def cancel_open_orders(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -114,7 +114,7 @@ def cancel_open_orders(symbol:, **kwargs) # @option kwargs [Integer] :orderId # @option kwargs [String] :origClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order-user_data def get_order(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -128,7 +128,7 @@ def get_order(symbol:, **kwargs) # @param kwargs [Hash] # @option kwargs [String] :symbol the symbol # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#current-open-orders-user_data def open_orders(**kwargs) @session.sign_request(:get, '/api/v3/openOrders', params: kwargs) end @@ -146,7 +146,7 @@ def open_orders(**kwargs) # @option kwargs [String] :endTime # @option kwargs [String] :limit Default 500; max 1000. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data def all_orders(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -174,7 +174,7 @@ def all_orders(symbol:, **kwargs) # @option kwargs [Float] :stopLimitTimeInForce GTC/ FOK/ IOC # @option kwargs [String] :newOrderRespType # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#new-oco-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-oco---deprecated-trade def new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) @@ -201,7 +201,7 @@ def new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs) # @option kwargs [String] :listClientOrderId # @option kwargs [String] :newClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-oco-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-list-trade def cancel_order_list(symbol:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) @@ -218,7 +218,7 @@ def cancel_order_list(symbol:, **kwargs) # @option kwargs [Integer] :orderListId # @option kwargs [String] :orgClientOrderId # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-oco-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order-lists-user_data def order_list(**kwargs) @session.sign_request(:get, '/api/v3/orderList', params: kwargs) end @@ -235,7 +235,7 @@ def order_list(**kwargs) # @option kwargs [String] :endTime # @option kwargs [String] :limit Default 500; max 1000. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-all-oco-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-all-order-lists-user_data def all_order_list(**kwargs) @session.sign_request(:get, '/api/v3/allOrderList', params: kwargs) end @@ -246,7 +246,7 @@ def all_order_list(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-open-oco-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-open-order-lists-user_data def open_order_list(**kwargs) @session.sign_request(:get, '/api/v3/openOrderList', params: kwargs) end @@ -257,7 +257,7 @@ def open_order_list(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-information-user_data def account(**kwargs) @session.sign_request(:get, '/api/v3/account', params: kwargs) end @@ -274,7 +274,7 @@ def account(**kwargs) # @option kwargs [Integer] :fromId TradeId to fetch from. Default gets most recent trades. # @option kwargs [Integer] :limit Default 500; max 1000. # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-trade-list-user_data def my_trades(symbol:, **kwargs) @session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol)) end @@ -285,7 +285,7 @@ def my_trades(symbol:, **kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-current-order-count-usage-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-current-order-count-usage-trade def get_order_rate_limit(**kwargs) @session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs) end @@ -312,7 +312,7 @@ def get_order_rate_limit(**kwargs) # @option kwargs [Float] :icebergQty # @option kwargs [String] :newOrderRespType # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade + # @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-an-existing-order-and-send-a-new-order-trade def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs) Binance::Utils::Validation.require_param('symbol', symbol) Binance::Utils::Validation.require_param('side', side) diff --git a/lib/binance/spot/wallet.rb b/lib/binance/spot/wallet.rb index f933b52..b9877dc 100644 --- a/lib/binance/spot/wallet.rb +++ b/lib/binance/spot/wallet.rb @@ -3,7 +3,7 @@ module Binance class Spot # all wallet endpoints - # @see https://binance-docs.github.io/apidocs/spot/en/#wallet-endpoints + # @see https://developers.binance.com/docs/wallet/introduction module Wallet # System Status (System) # @@ -11,7 +11,7 @@ module Wallet # # Fetch system status. # - # @see https://binance-docs.github.io/apidocs/spot/en/#system-status-system + # @see https://developers.binance.com/docs/wallet/others/system-status def system_status @session.public_request(path: '/sapi/v1/system/status') end @@ -24,7 +24,7 @@ def system_status # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data + # @see https://developers.binance.com/docs/wallet/capital/all-coins-info def coin_info(**kwargs) @session.sign_request(:get, '/sapi/v1/capital/config/getall', params: kwargs) end @@ -39,7 +39,7 @@ def coin_info(**kwargs) # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit min 5, max 30, default 5 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#daily-account-snapshot-user_data + # @see https://developers.binance.com/docs/wallet/account/daily-account-snapshoot def account_snapshot(type:, **kwargs) Binance::Utils::Validation.require_param('type', type) @@ -54,7 +54,7 @@ def account_snapshot(type:, **kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data + # @see https://developers.binance.com/docs/wallet/account/disable-fast-withdraw-switch def disable_fast_withdraw(**kwargs) @session.sign_request(:post, '/sapi/v1/account/disableFastWithdrawSwitch', params: kwargs) end @@ -65,7 +65,7 @@ def disable_fast_withdraw(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data + # @see https://developers.binance.com/docs/wallet/account/enable-fast-withdraw-switch def enable_fast_withdraw(**kwargs) @session.sign_request(:post, '/sapi/v1/account/enableFastWithdrawSwitch', params: kwargs) end @@ -84,7 +84,7 @@ def enable_fast_withdraw(**kwargs) # @option kwargs [Boolean] :transactionFeeFlag # @option kwargs [String] :name # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi + # @see https://developers.binance.com/docs/wallet/capital/withdraw def withdraw(coin:, address:, amount:, **kwargs) Binance::Utils::Validation.require_param('coin', coin) Binance::Utils::Validation.require_param('address', address) @@ -109,7 +109,7 @@ def withdraw(coin:, address:, amount:, **kwargs) # @option kwargs [Integer] :offest Default:0 # @option kwargs [Integer] :limit Default:1000, Max:1000 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data + # @see https://developers.binance.com/docs/wallet/capital/deposite-history def deposit_history(**kwargs) @session.sign_request(:get, '/sapi/v1/capital/deposit/hisrec', params: kwargs) end @@ -127,7 +127,7 @@ def deposit_history(**kwargs) # @option kwargs [Integer] :offest # @option kwargs [Integer] :limit # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data + # @see https://developers.binance.com/docs/wallet/capital/withdraw-history def withdraw_history(**kwargs) @session.sign_request(:get, '/sapi/v1/capital/withdraw/history', params: kwargs) end @@ -140,7 +140,7 @@ def withdraw_history(**kwargs) # @param kwargs [Hash] # @option kwargs [String] :network # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data + # @see https://developers.binance.com/docs/wallet/capital/withdraw-history def deposit_address(coin:, **kwargs) Binance::Utils::Validation.require_param('coin', coin) @@ -157,7 +157,7 @@ def deposit_address(coin:, **kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#account-status-user_data + # @see https://developers.binance.com/docs/wallet/account/account-status def account_status(**kwargs) @session.sign_request(:get, '/sapi/v1/account/status', params: kwargs) end @@ -170,7 +170,7 @@ def account_status(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#account-api-trading-status-user_data + # @see https://developers.binance.com/docs/wallet/account/account-api-trading-status def api_trading_status(**kwargs) @session.sign_request(:get, '/sapi/v1/account/apiTradingStatus', params: kwargs) end @@ -183,7 +183,7 @@ def api_trading_status(**kwargs) # @option kwargs [Integer] :startTime # @option kwargs [Integer] :endTime # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data + # @see https://developers.binance.com/docs/wallet/asset/dust-log def dust_log(**kwargs) @session.sign_request(:get, '/sapi/v1/asset/dribblet', params: kwargs) end @@ -197,7 +197,7 @@ def dust_log(**kwargs) # @param asset [Array] # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-user_data + # @see https://developers.binance.com/docs/wallet/asset/dust-transfer def dust_transfer(asset:, **kwargs) Binance::Utils::Validation.require_param('asset', asset) @@ -216,7 +216,7 @@ def dust_transfer(asset:, **kwargs) # @option kwargs [Integer] :endTime # @option kwargs [Integer] :limit Default 20, max 500 # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#asset-dividend-record-user_data + # @see https://developers.binance.com/docs/wallet/asset/assets-divided-record def asset_devidend_record(**kwargs) @session.sign_request(:get, '/sapi/v1/asset/assetDividend', params: kwargs) end @@ -228,7 +228,7 @@ def asset_devidend_record(**kwargs) # @param kwargs [Hash] # @option kwargs [String] :asset # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#asset-detail-user_data + # @see https://developers.binance.com/docs/wallet/asset/asset-detail def asset_detail(**kwargs) @session.sign_request(:get, '/sapi/v1/asset/assetDetail', params: kwargs) end @@ -240,7 +240,7 @@ def asset_detail(**kwargs) # @param kwargs [Hash] # @option kwargs [String] :symbol # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data + # @see https://developers.binance.com/docs/wallet/asset/trade-fee def trade_fee(**kwargs) @session.sign_request(:get, '/sapi/v1/asset/tradeFee', params: kwargs) end @@ -256,7 +256,7 @@ def trade_fee(**kwargs) # @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN # @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data + # @see https://developers.binance.com/docs/wallet/asset/user-universal-transfer def user_universal_transfer(type:, asset:, amount:, **kwargs) Binance::Utils::Validation.require_param('type', type) Binance::Utils::Validation.require_param('asset', asset) @@ -282,7 +282,7 @@ def user_universal_transfer(type:, asset:, amount:, **kwargs) # @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN # @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data + # @see https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer def user_universal_transfer_history(type:, **kwargs) Binance::Utils::Validation.require_param('type', type) @session.sign_request(:get, '/sapi/v1/asset/transfer', params: kwargs.merge(type: type)) @@ -296,7 +296,7 @@ def user_universal_transfer_history(type:, **kwargs) # @option kwargs [String] :asset # @option kwargs [String] :needBtcValuation true or false # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data + # @see https://developers.binance.com/docs/wallet/asset/funding-wallet def funding_wallet(**kwargs) @session.sign_request(:post, '/sapi/v1/asset/get-funding-asset', params: kwargs) end @@ -307,7 +307,7 @@ def funding_wallet(**kwargs) # # @param kwargs [Hash] # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#get-api-key-permission-user_data + # @see https://developers.binance.com/docs/wallet/account/api-key-permission def api_key_permission(**kwargs) @session.sign_request(:get, '/sapi/v1/account/apiRestrictions', params: kwargs) end @@ -320,7 +320,7 @@ def api_key_permission(**kwargs) # @option kwargs [String] :asset If asset is blank, then query all positive assets user have. # @option kwargs [Boolean] :needBtcValuation # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000 - # @see https://binance-docs.github.io/apidocs/spot/en/#user-asset-user_data + # @see https://developers.binance.com/docs/wallet/asset/user-assets def get_user_asset(**kwargs) @session.sign_request(:post, '/sapi/v3/asset/getUserAsset', params: kwargs) end diff --git a/lib/binance/spot/websocket.rb b/lib/binance/spot/websocket.rb index e16ad02..aa3861e 100644 --- a/lib/binance/spot/websocket.rb +++ b/lib/binance/spot/websocket.rb @@ -20,7 +20,7 @@ def initialize(options = {}) # Update Speed: Real-time # # @param symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#aggregate-trade-streams def agg_trade(symbol:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@aggTrade" create_connection(url, callbacks) @@ -32,20 +32,20 @@ def agg_trade(symbol:, callbacks:) # Update Speed: Real-time # # @param symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#trade-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams def trade(symbol:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@trade" create_connection(url, callbacks) end - # Kline/Candlestick Streams + # Kline/Candlestick Streams for UTC # The Kline/Candlestick Stream push updates to the current klines/candlestick every second. # Stream Name: @kline_ # Update Speed: 2000ms # # @param symbol [String] # @param interval [String] 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M - # @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#klinecandlestick-streams-for-utc def kline(symbol:, interval:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@kline_#{interval}" create_connection(url, callbacks) @@ -57,7 +57,7 @@ def kline(symbol:, interval:, callbacks:) # Update Speed: 1000ms # # @option symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-mini-ticker-stream def mini_ticker(callbacks:, symbol: nil) url = if symbol.nil? "#{@base_url}/ws/!miniTicker@arr" @@ -73,7 +73,7 @@ def mini_ticker(callbacks:, symbol: nil) # Update Speed: 1000ms # # @option symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-ticker-streams def symbol_ticker(callbacks:, symbol: nil) url = if symbol.nil? "#{@base_url}/ws/!ticker@arr" @@ -89,7 +89,7 @@ def symbol_ticker(callbacks:, symbol: nil) # Update Speed: Real-time # # @option symbol [String] - # @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-book-ticker-streams def book_ticker(callbacks:, symbol: nil) url = if symbol.nil? "#{@base_url}/ws/!bookTicker" @@ -107,7 +107,7 @@ def book_ticker(callbacks:, symbol: nil) # @param symbol [String] # @param levels [Integer] 5, 10, or 20. # @param speed [String] 1000ms or 100ms - # @see https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#partial-book-depth-streams def partial_book_depth(symbol:, levels:, speed:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@depth#{levels}@#{speed}" create_connection(url, callbacks) @@ -120,7 +120,7 @@ def partial_book_depth(symbol:, levels:, speed:, callbacks:) # # @param symbol [String] # @param speed [String] 1000ms or 100ms - # @see https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream def diff_book_depth(symbol:, speed:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@depth@#{speed}" create_connection(url, callbacks) @@ -132,7 +132,7 @@ def diff_book_depth(symbol:, speed:, callbacks:) # Window Sizes: 1h,4h # Update Speed: 1000ms # - # @see https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-rolling-window-statistics-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-rolling-window-statistics-streams def rolling_window_ticker(symbol:, windowSize:, callbacks:) url = "#{@base_url}/ws/#{symbol.downcase}@ticker_#{windowSize}" create_connection(url, callbacks) @@ -144,7 +144,7 @@ def rolling_window_ticker(symbol:, windowSize:, callbacks:) # Window Sizes: 1h, 4h # Update Speed: 1000ms # - # @see https://binance-docs.github.io/apidocs/spot/en/#all-market-rolling-window-statistics-streams + # @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-rolling-window-statistics-streams def rolling_window_ticker_all_symbols(windowSize:, callbacks:) url = "#{@base_url}/ws/!ticker_#{windowSize}@arr" create_connection(url, callbacks) diff --git a/lib/binance/version.rb b/lib/binance/version.rb index 3f04952..eb48978 100644 --- a/lib/binance/version.rb +++ b/lib/binance/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Binance - VERSION = '1.5.2' + VERSION = '1.6.0' end diff --git a/spec/binance/spot/blvt/get_redeem_record_spec.rb b/spec/binance/spot/blvt/get_redeem_record_spec.rb deleted file mode 100644 index 74de714..0000000 --- a/spec/binance/spot/blvt/get_redeem_record_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#get_redeem_record' do - let(:tokenName) { 'BTCDOWN' } - let(:path) { '/sapi/v1/blvt/redeem/record' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - tokenName: 'BTCDOWN', - id: 12_345, - startTime: 1_631_688_673_000, - endTime: 1_631_688_673_001, - limit: 100 - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'with parameters' do - it 'should get redeem records' do - spot_client_signed.get_redeem_record(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/blvt/get_subscribe_record_spec.rb b/spec/binance/spot/blvt/get_subscribe_record_spec.rb deleted file mode 100644 index c455b68..0000000 --- a/spec/binance/spot/blvt/get_subscribe_record_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#get_subscribe_record' do - let(:tokenName) { 'BTCDOWN' } - let(:path) { '/sapi/v1/blvt/subscribe/record' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - tokenName: 'BTCDOWN', - id: 12_345, - startTime: 1_631_688_673_000, - endTime: 1_631_688_673_001, - limit: 100 - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'with parameters' do - it 'should get subscribe records' do - spot_client_signed.get_subscribe_record(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/blvt/redeem_spec.rb b/spec/binance/spot/blvt/redeem_spec.rb deleted file mode 100644 index 64e5551..0000000 --- a/spec/binance/spot/blvt/redeem_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#redeem' do - let(:tokenName) { 'BTCDOWN' } - let(:amount) { 100.11 } - let(:path) { '/sapi/v1/blvt/redeem' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - tokenName: tokenName, - amount: amount - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation tokenName' do - let(:params) { { tokenName: '', amount: amount } } - it 'should raise validation error without tokenName' do - expect { spot_client_signed.redeem(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation amount' do - let(:params) { { tokenName: tokenName, amount: '' } } - it 'should raise validation error without amount' do - expect { spot_client_signed.redeem(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - it 'should redeem blvt' do - spot_client_signed.redeem(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/blvt/subscribe_spec.rb b/spec/binance/spot/blvt/subscribe_spec.rb deleted file mode 100644 index d3eb3a2..0000000 --- a/spec/binance/spot/blvt/subscribe_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#subscribe' do - let(:tokenName) { 'BTCDOWN' } - let(:cost) { 100.11 } - let(:path) { '/sapi/v1/blvt/subscribe' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - tokenName: tokenName, - cost: cost - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation tokenName' do - let(:params) { { tokenName: '', cost: cost } } - it 'should raise validation error without tokenName' do - expect { spot_client_signed.subscribe(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation cost' do - let(:params) { { tokenName: tokenName, cost: '' } } - it 'should raise validation error without cost' do - expect { spot_client_signed.subscribe(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - it 'should subscribe to blvt' do - spot_client_signed.subscribe(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/blvt/token_info_spec.rb b/spec/binance/spot/blvt/token_info_spec.rb deleted file mode 100644 index 9e40740..0000000 --- a/spec/binance/spot/blvt/token_info_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#token_info' do - let(:tokenName) { 'BTCUP' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - stub_binance_request(:get, path, status, body) - end - - context 'with params' do - let(:path) { "/sapi/v1/blvt/tokenInfo?tokenName=#{tokenName}" } - it 'should return token info' do - spot_client_signed.token_info(tokenName: tokenName) - expect(send_a_request(:get, path)).to have_been_made - end - end -end diff --git a/spec/binance/spot/blvt/user_limit_spec.rb b/spec/binance/spot/blvt/user_limit_spec.rb deleted file mode 100644 index 21b0b3e..0000000 --- a/spec/binance/spot/blvt/user_limit_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Blvt, '#user_limit' do - let(:tokenName) { 'BTCDOWN' } - let(:path) { '/sapi/v1/blvt/userLimit' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - tokenName: 'BTCDOWN' - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'with parameters' do - it 'should get redeem limit' do - spot_client_signed.user_limit(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/adjust_cross_collateral_history_spec.rb b/spec/binance/spot/futures/adjust_cross_collateral_history_spec.rb deleted file mode 100644 index e1a41ee..0000000 --- a/spec/binance/spot/futures/adjust_cross_collateral_history_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#adjust_cross_collateral_history' do - let(:path) { '/sapi/v1/futures/loan/adjustCollateral/history' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return adjust cross collateral history' do - spot_client_signed.adjust_cross_collateral_history - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return adjust cross collateral history' do - spot_client_signed.adjust_cross_collateral_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/adjust_cross_collateral_spec.rb b/spec/binance/spot/futures/adjust_cross_collateral_spec.rb deleted file mode 100644 index 6128b1c..0000000 --- a/spec/binance/spot/futures/adjust_cross_collateral_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#adjust_cross_collateral' do - let(:path) { '/sapi/v2/futures/loan/adjustCollateral' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { loanCoin: '', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: '', amount: 1, direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: '', direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.adjust_cross_collateral(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL' } } - it 'should adjust cross collateral' do - spot_client_signed.adjust_cross_collateral(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/calculate_adjust_max_amount_spec.rb b/spec/binance/spot/futures/calculate_adjust_max_amount_spec.rb deleted file mode 100644 index 4c1bd53..0000000 --- a/spec/binance/spot/futures/calculate_adjust_max_amount_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#calculate_adjust_max_amount' do - let(:path) { '/sapi/v2/futures/loan/calcMaxAdjustAmount' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { loanCoin: '', collateralCoin: 'BTC' }, - { loanCoin: 'BUSD', collateralCoin: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.calculate_adjust_max_amount(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { loanCoin: 'BUSD', collateralCoin: 'BTC' } } - it 'should calculate adjust max amount' do - spot_client_signed.calculate_adjust_max_amount(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/calculate_adjust_rate_spec.rb b/spec/binance/spot/futures/calculate_adjust_rate_spec.rb deleted file mode 100644 index ee6ba57..0000000 --- a/spec/binance/spot/futures/calculate_adjust_rate_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#calculate_adjust_rate' do - let(:path) { '/sapi/v2/futures/loan/calcAdjustLevel' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { loanCoin: '', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: '', amount: 1, direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: '', direction: 'ADDITIONAL' }, - { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.calculate_adjust_rate(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { loanCoin: 'BUSD', collateralCoin: 'BTC', amount: 1, direction: 'ADDITIONAL' } } - it 'should calculate adjust rate' do - spot_client_signed.calculate_adjust_rate(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/collateral_repay_limit_spec.rb b/spec/binance/spot/futures/collateral_repay_limit_spec.rb deleted file mode 100644 index 01d29e2..0000000 --- a/spec/binance/spot/futures/collateral_repay_limit_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#collateral_repay_limit' do - let(:path) { '/sapi/v1/futures/loan/collateralRepayLimit' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { coin: '', collateralCoin: 'BTC' }, - { coin: 'BUSD', collateralCoin: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.collateral_repay_limit(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { coin: 'BUSD', collateralCoin: 'BTC' } } - it 'should collateral repay limit' do - spot_client_signed.collateral_repay_limit(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/collateral_repay_quote_spec.rb b/spec/binance/spot/futures/collateral_repay_quote_spec.rb deleted file mode 100644 index d7c5568..0000000 --- a/spec/binance/spot/futures/collateral_repay_quote_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#collateral_repay_quote' do - let(:path) { '/sapi/v1/futures/loan/collateralRepay' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { coin: '', collateralCoin: 'BTC', amount: 1 }, - { coin: 'BUSD', collateralCoin: '', amount: 1 }, - { coin: 'BUSD', collateralCoin: 'BTC', amount: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.collateral_repay_quote(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { coin: 'BUSD', collateralCoin: 'BTC', amount: 1 } } - it 'should quote' do - spot_client_signed.collateral_repay_quote(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_borrow_history_spec.rb b/spec/binance/spot/futures/cross_collateral_borrow_history_spec.rb deleted file mode 100644 index bc53780..0000000 --- a/spec/binance/spot/futures/cross_collateral_borrow_history_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_borrow_history' do - let(:path) { '/sapi/v1/futures/loan/borrow/history' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return borrow history' do - spot_client_signed.cross_collateral_borrow_history - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return borrow history' do - spot_client_signed.cross_collateral_borrow_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_borrow_spec.rb b/spec/binance/spot/futures/cross_collateral_borrow_spec.rb deleted file mode 100644 index b601554..0000000 --- a/spec/binance/spot/futures/cross_collateral_borrow_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_borrow' do - let(:path) { '/sapi/v1/futures/loan/borrow' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { coin: '', collateralCoin: 'BTC' }, - { coin: 'BUSD', collateralCoin: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.cross_collateral_borrow(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { coin: 'BUSD', collateralCoin: 'BTC', amount: 1 } } - it 'should do borrow' do - spot_client_signed.cross_collateral_borrow(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_info_spec.rb b/spec/binance/spot/futures/cross_collateral_info_spec.rb deleted file mode 100644 index 17f40fd..0000000 --- a/spec/binance/spot/futures/cross_collateral_info_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_info' do - let(:path) { '/sapi/v2/futures/loan/configs' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return cross-collateral info' do - spot_client_signed.cross_collateral_info - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return cross-collateral info' do - spot_client_signed.cross_collateral_info(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_interest_history_spec.rb b/spec/binance/spot/futures/cross_collateral_interest_history_spec.rb deleted file mode 100644 index a384849..0000000 --- a/spec/binance/spot/futures/cross_collateral_interest_history_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_interest_history' do - let(:path) { '/sapi/v1/futures/loan/interestHistory' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return cross-collateral interest history' do - spot_client_signed.cross_collateral_interest_history - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return cross-collateral interest history' do - spot_client_signed.cross_collateral_interest_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_liquidation_history_spec.rb b/spec/binance/spot/futures/cross_collateral_liquidation_history_spec.rb deleted file mode 100644 index 202686f..0000000 --- a/spec/binance/spot/futures/cross_collateral_liquidation_history_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_liquidation_history' do - let(:path) { '/sapi/v1/futures/loan/liquidationHistory' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return cross-collateral liquidation history' do - spot_client_signed.cross_collateral_liquidation_history - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return cross-collateral liquidation history' do - spot_client_signed.cross_collateral_liquidation_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_repay_history_spec.rb b/spec/binance/spot/futures/cross_collateral_repay_history_spec.rb deleted file mode 100644 index 4ad07c4..0000000 --- a/spec/binance/spot/futures/cross_collateral_repay_history_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_repay_history' do - let(:path) { '/sapi/v1/futures/loan/repay/history' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return repay history' do - spot_client_signed.cross_collateral_repay_history - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return repay history' do - spot_client_signed.cross_collateral_repay_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_repay_spec.rb b/spec/binance/spot/futures/cross_collateral_repay_spec.rb deleted file mode 100644 index e480603..0000000 --- a/spec/binance/spot/futures/cross_collateral_repay_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_repay' do - let(:path) { '/sapi/v1/futures/loan/repay' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { coin: '', collateralCoin: 'BTC', amount: 1 }, - { coin: 'BUSD', collateralCoin: '', amount: 1 }, - { coin: 'BUSD', collateralCoin: '', amount: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.cross_collateral_repay(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { coin: 'BUSD', collateralCoin: 'BTC', amount: 1 } } - it 'should do repay' do - spot_client_signed.cross_collateral_repay(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/cross_collateral_wallet_spec.rb b/spec/binance/spot/futures/cross_collateral_wallet_spec.rb deleted file mode 100644 index 60358c9..0000000 --- a/spec/binance/spot/futures/cross_collateral_wallet_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#cross_collateral_wallet' do - let(:path) { '/sapi/v2/futures/loan/wallet' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) { {} } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - it 'should return cross-collateral wallet data' do - spot_client_signed.cross_collateral_wallet - expect(send_a_request_with_signature(:get, path)).to have_been_made - end - - context 'with params' do - let(:params) { { recvWindow: 10_000 } } - - it 'should return cross-collateral wallet data' do - spot_client_signed.cross_collateral_wallet(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/futures_account_transfer_history_spec.rb b/spec/binance/spot/futures/futures_account_transfer_history_spec.rb deleted file mode 100644 index dca7c8a..0000000 --- a/spec/binance/spot/futures/futures_account_transfer_history_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#futures_account_transfer_history' do - let(:path) { '/sapi/v1/futures/transfer' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { asset: '', startTime: 1_555_056_425_000 }, - { asset: 'BUSD', startTime: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.futures_account_transfer_history(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { asset: 'BUSD', startTime: 1_555_056_425_000 } } - it 'should return transfer history' do - spot_client_signed.futures_account_transfer_history(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/futures_account_transfer_spec.rb b/spec/binance/spot/futures/futures_account_transfer_spec.rb deleted file mode 100644 index dd78085..0000000 --- a/spec/binance/spot/futures/futures_account_transfer_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#futures_account_transfer' do - let(:path) { '/sapi/v1/futures/transfer' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { asset: '', amount: 1, type: 1 }, - { asset: 'BUSD', amount: '', type: 1 }, - { asset: 'BUSD', amount: 1, type: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.futures_account_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { asset: 'BUSD', amount: 1, type: 1 } } - it 'should do transfer' do - spot_client_signed.futures_account_transfer(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/repay_with_collateral_spec.rb b/spec/binance/spot/futures/repay_with_collateral_spec.rb deleted file mode 100644 index af3e812..0000000 --- a/spec/binance/spot/futures/repay_with_collateral_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#repay_with_collateral' do - let(:path) { '/sapi/v1/futures/loan/collateralRepay' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - let(:params) { { quoteId: '' } } - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.repay_with_collateral(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with params' do - let(:params) { { quoteId: 'quote_id' } } - it 'should repay' do - spot_client_signed.repay_with_collateral(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/futures/repayment_result_spec.rb b/spec/binance/spot/futures/repayment_result_spec.rb deleted file mode 100644 index 389eac6..0000000 --- a/spec/binance/spot/futures/repayment_result_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Futures, '#repayment_result' do - let(:path) { '/sapi/v1/futures/loan/collateralRepayResult' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation' do - let(:params) { { quoteId: '' } } - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.repayment_result(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with params' do - let(:params) { { quoteId: 'quote_id' } } - it 'should get repay result' do - spot_client_signed.repayment_result(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/get_isolated_margin_pair_spec.rb b/spec/binance/spot/margin/get_isolated_margin_pair_spec.rb deleted file mode 100644 index 11c02cc..0000000 --- a/spec/binance/spot/margin/get_isolated_margin_pair_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#get_isolated_margin_pair' do - let(:path) { '/sapi/v1/margin/isolated/pair' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation symbol' do - let(:params) { { symbol: '' } } - it 'should raise validation error without symbol' do - expect { spot_client_signed.get_isolated_margin_pair(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with symbol' do - let(:params) { { symbol: 'BNBUSDT' } } - it 'should return isolated margin pair' do - spot_client_signed.get_isolated_margin_pair(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/get_isolated_margin_transfer_spec.rb b/spec/binance/spot/margin/get_isolated_margin_transfer_spec.rb deleted file mode 100644 index 9d45437..0000000 --- a/spec/binance/spot/margin/get_isolated_margin_transfer_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#get_isolated_margin_transfer' do - let(:path) { '/sapi/v1/margin/isolated/transfer' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation symbol' do - let(:params) { { symbol: '' } } - it 'should raise validation error without symbol' do - expect { spot_client_signed.get_isolated_margin_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with symbol' do - let(:params) { { symbol: 'BNBUSDT' } } - it 'should return isolated margin transfer history' do - spot_client_signed.get_isolated_margin_transfer(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/get_margin_dust_log_spec.rb b/spec/binance/spot/margin/get_margin_dust_log_spec.rb deleted file mode 100644 index 5570957..0000000 --- a/spec/binance/spot/margin/get_margin_dust_log_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#get_margin_dust_log' do - let(:path) { '/sapi/v1/margin/dribblet' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:params) do - { - startTime: 1_631_688_673_000, - endTime: 1_631_688_673_001 - } - end - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'with symbol' do - it 'should return margin dust convert history' do - spot_client_signed.get_margin_dust_log(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/isolated_margin_transfer_spec.rb b/spec/binance/spot/margin/isolated_margin_transfer_spec.rb deleted file mode 100644 index d5cfe2c..0000000 --- a/spec/binance/spot/margin/isolated_margin_transfer_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#isolated_margin_transfer' do - let(:path) { '/sapi/v1/margin/isolated/transfer' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { asset: '', symbol: 'BNBUSDT', transFrom: 'SPOT', transTo: 'ISOLATED_MARGIN', amount: 10 }, - { asset: 'USDT', symbol: '', transFrom: 'SPOT', transTo: 'ISOLATED_MARGIN', amount: 10 }, - { asset: 'USDT', symbol: 'BNBUSDT', transFrom: '', transTo: 'ISOLATED_MARGIN', amount: 10 }, - { asset: 'USDT', symbol: 'BNBUSDT', transFrom: 'SPOT', transTo: '', amount: 10 }, - { asset: 'USDT', symbol: 'BNBUSDT', transFrom: 'SPOT', transTo: 'ISOLATED_MARGIN', amount: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.isolated_margin_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with complete params' do - let(:params) { { asset: 'USDT', symbol: 'BNBUSDT', transFrom: 'SPOT', transTo: 'ISOLATED_MARGIN', amount: 10 } } - it 'should transfer to isolated margin account' do - spot_client_signed.isolated_margin_transfer(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_asset_spec.rb b/spec/binance/spot/margin/margin_asset_spec.rb deleted file mode 100644 index 620c6e8..0000000 --- a/spec/binance/spot/margin/margin_asset_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_asset' do - let(:path) { '/sapi/v1/margin/asset' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:asset) { 'BNB' } - - before do - stub_binance_request(:get, path, status, body) - end - - context 'validation asset' do - let(:params) { { asset: '' } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_asset(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:path) { "/sapi/v1/margin/asset?asset=#{asset}" } - it 'should query margin asset' do - spot_client_signed.margin_asset(asset: asset) - expect(send_a_request(:get, path)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_borrow_spec.rb b/spec/binance/spot/margin/margin_borrow_spec.rb deleted file mode 100644 index 52fe56f..0000000 --- a/spec/binance/spot/margin/margin_borrow_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_transfer' do - let(:path) { '/sapi/v1/margin/loan' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation asset' do - let(:params) { { asset: '', amount: 1, type: 1, recvWindow: 1_000 } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_borrow(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation amount' do - let(:params) { { asset: 'BNB', amount: '', type: 1, recvWindow: 1_000 } } - it 'should raise validation error without amount' do - expect { spot_client_signed.margin_borrow(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - # it should add parameters together to place an order, but we are testing if the parameters can be add to url - let(:params) do - { - asset: 'BNB', - amount: 1, - recvWindow: 1_000 - } - end - - it 'should make a transfer' do - spot_client_signed.margin_borrow(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_load_record_spec.rb b/spec/binance/spot/margin/margin_load_record_spec.rb deleted file mode 100644 index 3c9c7b2..0000000 --- a/spec/binance/spot/margin/margin_load_record_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_load_record' do - let(:path) { '/sapi/v1/margin/loan' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation asset' do - let(:params) { { asset: '', recvWindow: 1_000 } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_load_record(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:params) do - { - asset: 'BNB', - txId: 'tx_id' - } - end - it 'should query load record' do - spot_client_signed.margin_load_record(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_pair_spec.rb b/spec/binance/spot/margin/margin_pair_spec.rb deleted file mode 100644 index d3c9980..0000000 --- a/spec/binance/spot/margin/margin_pair_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_pair' do - let(:path) { '/sapi/v1/margin/pair' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:symbol) { 'BNB' } - - before do - stub_binance_request(:get, path, status, body) - end - - context 'validation symbol' do - let(:params) { { symbol: '' } } - it 'should raise validation error without symbol' do - expect { spot_client_signed.margin_pair(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:path) { "/sapi/v1/margin/pair?symbol=#{symbol}" } - it 'should query margin symbol' do - spot_client_signed.margin_pair(symbol: symbol) - expect(send_a_request(:get, path)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_repay_record_spec.rb b/spec/binance/spot/margin/margin_repay_record_spec.rb deleted file mode 100644 index 43d98b3..0000000 --- a/spec/binance/spot/margin/margin_repay_record_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_repay_record' do - let(:path) { '/sapi/v1/margin/repay' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:get, path, status, body, params) - end - - context 'validation asset' do - let(:params) { { asset: '', recvWindow: 1_000 } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_repay_record(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:params) do - { - asset: 'BNB', - txId: 'tx_id' - } - end - it 'should query load record' do - spot_client_signed.margin_repay_record(**params) - expect(send_a_request_with_signature(:get, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_repay_spec.rb b/spec/binance/spot/margin/margin_repay_spec.rb deleted file mode 100644 index 522dd0c..0000000 --- a/spec/binance/spot/margin/margin_repay_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_repay' do - let(:path) { '/sapi/v1/margin/repay' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation asset' do - let(:params) { { asset: '', amount: 1, type: 1, recvWindow: 1_000 } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_repay(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation amount' do - let(:params) { { asset: 'BNB', amount: '', type: 1, recvWindow: 1_000 } } - it 'should raise validation error without amount' do - expect { spot_client_signed.margin_repay(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:params) do - { - asset: 'BNB', - amount: 1, - recvWindow: 1_000 - } - end - - it 'should make a transfer' do - spot_client_signed.margin_repay(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/margin/margin_transfer_spec.rb b/spec/binance/spot/margin/margin_transfer_spec.rb deleted file mode 100644 index 2cfb6bc..0000000 --- a/spec/binance/spot/margin/margin_transfer_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Margin, '#margin_transfer' do - let(:path) { '/sapi/v1/margin/transfer' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation asset' do - let(:params) { { asset: '', amount: 1, type: 1, recvWindow: 1_000 } } - it 'should raise validation error without asset' do - expect { spot_client_signed.margin_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation amount' do - let(:params) { { asset: 'BNB', amount: '', type: 1, recvWindow: 1_000 } } - it 'should raise validation error without amount' do - expect { spot_client_signed.margin_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'validation type' do - let(:params) { { asset: 'BNB', amount: '1', type: '', recvWindow: 1_000 } } - it 'should raise validation error without type' do - expect { spot_client_signed.margin_transfer(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - - context 'with parameters' do - let(:params) do - { - asset: 'BNB', - amount: 1, - type: 1, - recvWindow: 1_000 - } - end - - it 'should make a transfer' do - spot_client_signed.margin_transfer(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/subaccount/sub_account_add_ip_list_spec.rb b/spec/binance/spot/subaccount/sub_account_add_ip_list_spec.rb deleted file mode 100644 index d8a5852..0000000 --- a/spec/binance/spot/subaccount/sub_account_add_ip_list_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Binance::Spot::Subaccount, '#sub_account_add_ip_list' do - let(:path) { '/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList' } - let(:body) { fixture('response.json') } - let(:status) { 200 } - let(:sub_acct_api_key) { 'the_api_key' } - let(:email) { 'alice@test.com' } - let(:ip) { '1.2.3.4' } - - before do - mocking_signature_and_ts(**params) - stub_binance_sign_request(:post, path, status, body, params) - end - - context 'validation' do - where(:params) do - [ - { email: '', subAccountApiKey: sub_acct_api_key, ipAddress: ip }, - { email: email, subAccountApiKey: '', ipAddress: ip }, - { email: email, subAccountApiKey: sub_acct_api_key, ipAddress: '' } - ] - end - with_them do - it 'should raise validation error without mandatory params' do - expect { spot_client_signed.sub_account_add_ip_list(**params) }.to raise_error(Binance::RequiredParameterError) - end - end - end - - context 'with params' do - let(:params) { { email: email, subAccountApiKey: sub_acct_api_key, ipAddress: ip } } - it 'should add ip list' do - spot_client_signed.sub_account_add_ip_list(**params) - expect(send_a_request_with_signature(:post, path, params)).to have_been_made - end - end -end diff --git a/spec/binance/spot/subaccount/sub_account_toggle_ip_restriction_spec.rb b/spec/binance/spot/subaccount/sub_account_toggle_ip_restriction_spec.rb index 05ac759..9d603e5 100644 --- a/spec/binance/spot/subaccount/sub_account_toggle_ip_restriction_spec.rb +++ b/spec/binance/spot/subaccount/sub_account_toggle_ip_restriction_spec.rb @@ -3,11 +3,12 @@ require 'spec_helper' RSpec.describe Binance::Spot::Subaccount, '#sub_account_toggle_ip_restriction' do - let(:path) { '/sapi/v1/sub-account/subAccountApi/ipRestriction' } + let(:path) { '/sapi/v2/sub-account/subAccountApi/ipRestriction' } let(:body) { fixture('response.json') } let(:status) { 200 } let(:sub_acct_api_key) { 'the_api_key' } let(:email) { 'alice@test.com' } + let(:status) { '1' } before do mocking_signature_and_ts(**params) @@ -17,9 +18,9 @@ context 'validation' do where(:params) do [ - { email: '', subAccountApiKey: sub_acct_api_key, ipRestrict: true }, - { email: email, subAccountApiKey: '', ipRestrict: true }, - { email: email, subAccountApiKey: sub_acct_api_key, ipRestrict: '' } + { email: '', subAccountApiKey: sub_acct_api_key, status: status }, + { email: email, subAccountApiKey: '', status: status }, + { email: email, subAccountApiKey: sub_acct_api_key, status: '' } ] end with_them do @@ -30,7 +31,7 @@ end context 'with params' do - let(:params) { { email: email, subAccountApiKey: sub_acct_api_key, ipRestrict: true } } + let(:params) { { email: email, subAccountApiKey: sub_acct_api_key, status: status } } it 'should toggle the ip ipRestriction on sub account' do spot_client_signed.sub_account_toggle_ip_restriction(**params) expect(send_a_request_with_signature(:post, path, params)).to have_been_made