Module: Binance::Spot::Wallet

Included in:
Binance::Spot
Defined in:
lib/binance/spot/wallet.rb

Overview

all wallet endpoints

Instance Method Summary collapse

Instance Method Details

#account_info(**kwargs) ⇒ Object

Account info (USER_DATA)

GET /sapi/v1/account/info

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



418
419
420
# File 'lib/binance/spot/wallet.rb', line 418

def (**kwargs)
  @session.sign_request(:get, '/sapi/v1/account/info', params: kwargs)
end

#account_snapshot(type:, **kwargs) ⇒ Object

Daily Account Snapshot (USER_DATA)

GET /sapi/v1/accountSnapshot

Parameters:

  • type (String)

    “SPOT”, “MARGIN”, “FUTURES”

  • kwargs (Hash)

Options Hash (**kwargs):

  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)

    min 5, max 30, default 5

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



54
55
56
57
58
59
60
# File 'lib/binance/spot/wallet.rb', line 54

def (type:, **kwargs)
  Binance::Utils::Validation.require_param('type', type)

  @session.sign_request(:get, '/sapi/v1/accountSnapshot', params: kwargs.merge(
    type: type
  ))
end

#account_status(**kwargs) ⇒ Object

Account Status (USER_DATA)

GET /sapi/v1/account/status

Fetch account status detail.

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



202
203
204
# File 'lib/binance/spot/wallet.rb', line 202

def (**kwargs)
  @session.sign_request(:get, '/sapi/v1/account/status', params: kwargs)
end

#api_key_permission(**kwargs) ⇒ Object

Get API Key Permission (USER_DATA)

GET /sapi/v1/account/apiRestrictions

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



429
430
431
# File 'lib/binance/spot/wallet.rb', line 429

def api_key_permission(**kwargs)
  @session.sign_request(:get, '/sapi/v1/account/apiRestrictions', params: kwargs)
end

#api_trading_status(**kwargs) ⇒ Object

Account API Trading Status (USER_DATA)

GET /sapi/v1/account/apiTradingStatus

Fetch account api trading status detail.

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



215
216
217
# File 'lib/binance/spot/wallet.rb', line 215

def api_trading_status(**kwargs)
  @session.sign_request(:get, '/sapi/v1/account/apiTradingStatus', params: kwargs)
end

#asset_detail(**kwargs) ⇒ Object

Asset Detail (USER_DATA)

GET /sapi/v1/asset/assetDetail

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



273
274
275
# File 'lib/binance/spot/wallet.rb', line 273

def asset_detail(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/assetDetail', params: kwargs)
end

#asset_devidend_record(**kwargs) ⇒ Object

Asset Dividend Record (USER_DATA)

GET /sapi/v1/asset/assetDividend

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :startTime (Integer)
  • :endTime (Integer)
  • :limit (Integer)

    Default 20, max 500

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



261
262
263
# File 'lib/binance/spot/wallet.rb', line 261

def asset_devidend_record(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/assetDividend', params: kwargs)
end

#cloud_mining_payment_and_refund_history(**kwargs) ⇒ Object

Get Cloud-Mining payment and refund history (USER_DATA)

GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :tranId (Integer)
  • :clientTranId (String)

    The unique flag

  • :asset (String)

    If it is blank, we will query all assets

  • :startTime (Integer)

    inclusive, unit: ms

  • :endTime (Integer)

    exclusive, unit: ms

  • :current (Integer)

    current page, default 1, the min value is 1

  • :size (Integer)

    page size, default 10, the max value is 100

See Also:



381
382
383
# File 'lib/binance/spot/wallet.rb', line 381

def cloud_mining_payment_and_refund_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage', params: kwargs)
end

#coin_info(**kwargs) ⇒ Object

All Coins’ Information (USER_DATA)

GET /sapi/v1/capital/config/getall

Get information of coins (available for deposit and withdraw) for user.

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



39
40
41
# File 'lib/binance/spot/wallet.rb', line 39

def coin_info(**kwargs)
  @session.sign_request(:get, '/sapi/v1/capital/config/getall', params: kwargs)
end

#delist_schedule(**kwargs) ⇒ Object

Get symbols delist schedule for spot (MARKET_DATA)

GET /sapi/v1/spot/delist-schedule

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



26
27
28
# File 'lib/binance/spot/wallet.rb', line 26

def delist_schedule(**kwargs)
  @session.public_request(path: '/sapi/v1/spot/delist-schedule', params: kwargs)
end

#deposit_address(coin:, **kwargs) ⇒ Object

Deposit Address (supporting network) (USER_DATA)

GET /sapi/v1/capital/deposit/address

Parameters:

  • coin (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :network (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



155
156
157
158
159
160
161
# File 'lib/binance/spot/wallet.rb', line 155

def deposit_address(coin:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)

  @session.sign_request(:get, '/sapi/v1/capital/deposit/address', params: kwargs.merge(
    coin: coin
  ))
end

#deposit_address_list(coin:, **kwargs) ⇒ Object

Fetch deposit address list with network (USER_DATA)

GET /sapi/v1/capital/deposit/address/list

Parameters:

  • coin (String)

    coin refers to the parent network address format that the address is using

  • kwargs (Hash)

Options Hash (**kwargs):

  • :network (String)

See Also:



171
172
173
174
175
176
177
# File 'lib/binance/spot/wallet.rb', line 171

def deposit_address_list(coin:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)

  @session.sign_request(:get, '/sapi/v1/capital/deposit/address/list', params: kwargs.merge(
    coin: coin
  ))
end

#deposit_history(**kwargs) ⇒ Object

Deposit History (supporting network) (USER_DATA)

GET /sapi/v1/capital/deposit/hisrec

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :coin (String)
  • :status (Integer)

    0(0:pending,6: credited but cannot withdraw, 1:success)

  • :startTime (Integer)
  • :endTime (Integer)
  • :offest (Integer)

    Default:0

  • :limit (Integer)

    Default:1000, Max:1000

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



124
125
126
# File 'lib/binance/spot/wallet.rb', line 124

def deposit_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/capital/deposit/hisrec', params: kwargs)
end

#disable_fast_withdraw(**kwargs) ⇒ Object

Disable Fast Withdraw Switch (USER_DATA)

POST /sapi/v1/account/disableFastWithdrawSwitch

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



69
70
71
# File 'lib/binance/spot/wallet.rb', line 69

def disable_fast_withdraw(**kwargs)
  @session.sign_request(:post, '/sapi/v1/account/disableFastWithdrawSwitch', params: kwargs)
end

#dust_log(**kwargs) ⇒ Object

DustLog (USER_DATA)

GET /sapi/v1/asset/dribblet

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :startTime (Integer)
  • :endTime (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



228
229
230
# File 'lib/binance/spot/wallet.rb', line 228

def dust_log(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/dribblet', params: kwargs)
end

#dust_transfer(asset:, **kwargs) ⇒ Object

Dust Transfer (USER_DATA)

POST /sapi/v1/asset/dust

Convert dust assets to BNB.

Parameters:

  • asset (Array)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



242
243
244
245
246
247
248
# File 'lib/binance/spot/wallet.rb', line 242

def dust_transfer(asset:, **kwargs)
  Binance::Utils::Validation.require_param('asset', asset)

  @session.sign_request(:post, '/sapi/v1/asset/dust', params: kwargs.merge(
    asset: asset
  ))
end

#enable_fast_withdraw(**kwargs) ⇒ Object

Enable Fast Withdraw Switch (USER_DATA)

POST /sapi/v1/account/enableFastWithdrawSwitch

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



80
81
82
# File 'lib/binance/spot/wallet.rb', line 80

def enable_fast_withdraw(**kwargs)
  @session.sign_request(:post, '/sapi/v1/account/enableFastWithdrawSwitch', params: kwargs)
end

#funding_wallet(**kwargs) ⇒ Object

Funding Wallet (USER_DATA)

POST /sapi/v1/asset/get-funding-asset

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)
  • :needBtcValuation (String)

    true or false

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



364
365
366
# File 'lib/binance/spot/wallet.rb', line 364

def funding_wallet(**kwargs)
  @session.sign_request(:post, '/sapi/v1/asset/get-funding-asset', params: kwargs)
end

#get_assets_converted_into_bnb(**kwargs) ⇒ Object

Get Assets That Can Be Converted Into BNB (USER_DATA)

POST /sapi/v1/asset/dust-btc

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :accountType (String)

    SPOT or MARGIN,default SPOT

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



351
352
353
# File 'lib/binance/spot/wallet.rb', line 351

def get_assets_converted_into_bnb(**kwargs)
  @session.sign_request(:post, '/sapi/v1/asset/dust-btc', params: kwargs)
end

#get_user_asset(**kwargs) ⇒ Object

User Asset (USER_DATA)

POST /sapi/v3/asset/getUserAsset

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :asset (String)

    If asset is blank, then query all positive assets user have.

  • :needBtcValuation (Boolean)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



442
443
444
# File 'lib/binance/spot/wallet.rb', line 442

def get_user_asset(**kwargs)
  @session.sign_request(:post, '/sapi/v3/asset/getUserAsset', params: kwargs)
end

#one_click_arrival_deposit_apply(**kwargs) ⇒ Object

One click arrival deposit apply (for expired address deposit) (USER_DATA)

POST /sapi/v1/capital/deposit/credit-apply

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :depositId (String)

    Deposit record Id, priority use

  • :txId (String)

    Deposit txId, used when depositId is not specified

  • :subAccountId (String)

    Sub-accountId of Cloud user

  • :subUserId (String)

    Sub-userId of parent user

See Also:



189
190
191
# File 'lib/binance/spot/wallet.rb', line 189

def one_click_arrival_deposit_apply(**kwargs)
  @session.sign_request(:post, '/sapi/v1/capital/deposit/credit-apply', params: kwargs)
end

#system_statusObject

System Status (System)

GET /sapi/v1/system/status

Fetch system status.



15
16
17
# File 'lib/binance/spot/wallet.rb', line 15

def system_status
  @session.public_request(path: '/sapi/v1/system/status')
end

#trade_fee(**kwargs) ⇒ Object

Trade Fee (USER_DATA)

GET /sapi/v1/asset/tradeFee

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



296
297
298
# File 'lib/binance/spot/wallet.rb', line 296

def trade_fee(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/tradeFee', params: kwargs)
end

#user_delegation_history(email:, startTime:, endTime:, **kwargs) ⇒ Object

Query User Delegation History (For Master Account)(USER_DATA)

GET /sapi/v1/asset/custody/transfer-history

Parameters:

  • email (String)
  • startTime (Integer)
  • endTime (Integer)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :type (String)

    Delegate/Undelegate

  • :asset (String)
  • :current (Integer)

    Default 1

  • :size (Integer)

    default 10, max 100

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



399
400
401
402
403
404
405
406
407
408
409
# File 'lib/binance/spot/wallet.rb', line 399

def user_delegation_history(email:, startTime:, endTime:, **kwargs)
  Binance::Utils::Validation.require_param('email', email)
  Binance::Utils::Validation.require_param('startTime', startTime)
  Binance::Utils::Validation.require_param('endTime', endTime)

  @session.sign_request(:get, '/sapi/v1/asset/custody/transfer-history', params: kwargs.merge(
    email: email,
    startTime: startTime,
    endTime: endTime
  ))
end

#user_universal_transfer(type:, asset:, amount:, **kwargs) ⇒ Object

User Universal Transfer (USER_DATA)

POST /sapi/v1/asset/transfer

Parameters:

  • type (String)
  • asset (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :fromSymbol (String)

    must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN

  • :toSymbol (String)

    must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



312
313
314
315
316
317
318
319
320
321
322
# File 'lib/binance/spot/wallet.rb', line 312

def user_universal_transfer(type:, asset:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('type', type)
  Binance::Utils::Validation.require_param('asset', asset)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/asset/transfer', params: kwargs.merge(
    type: type,
    asset: asset,
    amount: amount
  ))
end

#user_universal_transfer_history(type:, **kwargs) ⇒ Object

Query User Universal Transfer History (USER_DATA)

GET /sapi/v1/asset/transfer

Parameters:

  • type (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :startTime (Integer)
  • :endTime (Integer)
  • :current (Integer)

    Default 1

  • :size (Integer)

    Default 10, Max 100

  • :fromSymbol (String)

    must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN

  • :toSymbol (String)

    must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



338
339
340
341
# File 'lib/binance/spot/wallet.rb', line 338

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))
end

#wallet_balance(**kwargs) ⇒ Object

Query User Wallet Balance (USER_DATA)

GET /sapi/v1/asset/wallet/balance

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



284
285
286
# File 'lib/binance/spot/wallet.rb', line 284

def wallet_balance(**kwargs)
  @session.sign_request(:get, '/sapi/v1/asset/wallet/balance', params: kwargs)
end

#withdraw(coin:, address:, amount:, **kwargs) ⇒ Object

Withdraw [SAPI]

POST /sapi/v1/capital/withdraw/apply

Parameters:

  • coin (String)
  • address (String)
  • amount (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :withdrawOrderId (String)
  • :network (String)

    If network not send, return with default network of the coin.

  • :addressTag (String)
  • :transactionFeeFlag (Boolean)
  • :name (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/binance/spot/wallet.rb', line 99

def withdraw(coin:, address:, amount:, **kwargs)
  Binance::Utils::Validation.require_param('coin', coin)
  Binance::Utils::Validation.require_param('address', address)
  Binance::Utils::Validation.require_param('amount', amount)

  @session.sign_request(:post, '/sapi/v1/capital/withdraw/apply', params: kwargs.merge(
    coin: coin,
    address: address,
    amount: amount
  ))
end

#withdraw_history(**kwargs) ⇒ Object

Withdraw History (supporting network) (USER_DATA)

GET /sapi/v1/capital/withdraw/history

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :coin (String)
  • :withdrawOrderId (String)
  • :status (Integer)

    0(0:pending,6: credited but cannot withdraw, 1:success)

  • :startTime (Integer)
  • :endTime (Integer)
  • :offest (Integer)
  • :limit (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



142
143
144
# File 'lib/binance/spot/wallet.rb', line 142

def withdraw_history(**kwargs)
  @session.sign_request(:get, '/sapi/v1/capital/withdraw/history', params: kwargs)
end