Module: Binance::Spot::Trade

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

Overview

This module includes all spot trading methods, including:

  • place orders (spot and oco)

  • query orders (spot and oco)

  • cancel orders (spot and oco)

  • account information

  • my trades

Instance Method Summary collapse

Instance Method Details

#account(**kwargs) ⇒ Object

Account Information (USER_DATA)

GET /api/v3/account

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



290
291
292
# File 'lib/binance/spot/trade.rb', line 290

def (**kwargs)
  @session.sign_request(:get, '/api/v3/account', params: kwargs)
end

#all_order_list(**kwargs) ⇒ Object

Query all OCO (USER_DATA)

GET /api/v3/allOrderList

Retrieves all OCO based on provided optional parameters

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

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

    Default 500; max 1000.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



267
268
269
# File 'lib/binance/spot/trade.rb', line 267

def all_order_list(**kwargs)
  @session.sign_request(:get, '/api/v3/allOrderList', params: kwargs)
end

#all_orders(symbol:, **kwargs) ⇒ Object

All Orders (USER_DATA)

GET /api/v3/allOrders

Get all account orders; active, canceled, or filled.

Parameters:

  • symbol (String)

    the symbol

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (String)
  • :startTime (String)
  • :endTime (String)
  • :limit (String)

    Default 500; max 1000.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



164
165
166
167
168
# File 'lib/binance/spot/trade.rb', line 164

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

  @session.sign_request(:get, '/api/v3/allOrders', params: kwargs.merge(symbol: symbol))
end

#amend_keep_priority(symbol:, newQty:, **kwargs) ⇒ Object

Order Amend Keep Priority (TRADE)

PUT /api/v3/order/amend/keepPriority

Parameters:

  • symbol (String)
  • newQty (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (Integer)
  • :origClientOrderId (String)
  • :newClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



461
462
463
464
465
466
467
468
469
470
# File 'lib/binance/spot/trade.rb', line 461

def amend_keep_priority(symbol:, newQty:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('newQty', newQty)

  @session.sign_request(:put, '/api/v3/order/amend/keepPriority',
                        params: kwargs.merge(
                          symbol: symbol,
                          newQty: newQty
                        ))
end

#cancel_open_orders(symbol:, **kwargs) ⇒ Object

Cancel all Open Orders on a Symbol (TRADE)

DELETE /api/v3/openOrders



113
114
115
116
117
# File 'lib/binance/spot/trade.rb', line 113

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

  @session.sign_request(:delete, '/api/v3/openOrders', params: kwargs.merge(symbol: symbol))
end

#cancel_order(symbol:, **kwargs) ⇒ Object

Cancel Order (TRADE)

DELETE /api/v3/order

Parameters:

  • symbol (String)

    the symbol

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (Integer)
  • :origClientOrderId (String)
  • :newClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



98
99
100
101
102
# File 'lib/binance/spot/trade.rb', line 98

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

  @session.sign_request(:delete, '/api/v3/order', params: kwargs.merge(symbol: symbol))
end

#cancel_order_list(symbol:, **kwargs) ⇒ Object

Cancel OCO (TRADE)

DELETE /api/v3/orderList

Parameters:

  • symbol (String)

    the symbol

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderListId (Integer)
  • :listClientOrderId (String)
  • :newClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



231
232
233
234
235
# File 'lib/binance/spot/trade.rb', line 231

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

  @session.sign_request(:delete, '/api/v3/orderList', params: kwargs.merge(symbol: symbol))
end

#cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs) ⇒ Object

Cancel an Existing Order and Send a New Order (TRADE)

POST /api/v3/order/cancelReplace

Parameters:

  • symbol (String)

    the symbol

  • side (String)
  • type (String)
  • cancelReplaceMode (String)

    STOP_ON_FAILURE or ALLOW_FAILURE

  • kwargs (Hash)

Options Hash (**kwargs):

  • :timeInForce (String)
  • :quantity (Float)
  • :quoteOrderQty (Float)
  • :price (Float)
  • :cancelNewClientOrderId (String)
  • :cancelOrigClientOrderId (String)
  • :cancelOrderId (Integer)
  • :newClientOrderId (String)
  • :strategyId (Integer)
  • :strategyType (Integer)

    The value cannot be less than 1000000

  • :stopPrice (Float)
  • :trailingDelta (Integer)
  • :icebergQty (Float)
  • :newOrderRespType (String)
  • :selfTradePreventionMode (String)

    The allowed enums is dependent on what is configured on the symbo

  • :cancelRestrictions (String)

    ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED

  • :orderRateLimitExceededMode (String)

    DO_NOTHING (default)- will only attempt to cancel the order if account has not exceeded the unfilled order rate limit CANCEL_ONLY - will always cancel the order

  • :pegPriceType (String)

    PRIMARY_PEG or MARKET_PEG.

  • :pegOffsetValue (Integer)
  • :pegOffsetType (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/binance/spot/trade.rb', line 434

def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('side', side)
  Binance::Utils::Validation.require_param('type', type)
  Binance::Utils::Validation.require_param('cancelReplaceMode', cancelReplaceMode)

  @session.sign_request(:post, '/api/v3/order/cancelReplace',
                        params: kwargs.merge(
                          symbol: symbol,
                          side: side,
                          type: type,
                          cancelReplaceMode: cancelReplaceMode
                        ))
end

#commission_rate(symbol:) ⇒ Object

Query Commission Rates (USER_DATA)

GET /api/v3/account/commission



364
365
366
367
368
# File 'lib/binance/spot/trade.rb', line 364

def commission_rate(symbol:)
  Binance::Utils::Validation.require_param('symbol', symbol)

  @session.sign_request(:get, '/api/v3/account/commission', params: { symbol: symbol })
end

#get_order(symbol:, **kwargs) ⇒ Object

Query Order (USER_DATA)

GET /api/v3/order

Parameters:

  • symbol (String)

    the symbol

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (Integer)
  • :origClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



130
131
132
133
134
# File 'lib/binance/spot/trade.rb', line 130

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

  @session.sign_request(:get, '/api/v3/order', params: kwargs.merge(symbol: symbol))
end

#get_order_rate_limit(**kwargs) ⇒ Object

Query Current Order Count Usage (TRADE)

GET /api/v3/rateLimit/order

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



318
319
320
# File 'lib/binance/spot/trade.rb', line 318

def get_order_rate_limit(**kwargs)
  @session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
end

#my_allocations(symbol:, **kwargs) ⇒ Object

Query Allocations (USER_DATA)

GET /api/v3/myAllocations

Parameters:

  • symbol (String)
  • kwargs (Hash)
  • kwargs (Integer)

    :startTime

  • kwargs (Integer)

    :endTime

  • kwargs (Integer)

    :fromAllocationId

  • kwargs (Integer)

    :limit Default 500;Max 1000

  • kwargs (Integer)

    :orderId

See Also:



352
353
354
355
356
# File 'lib/binance/spot/trade.rb', line 352

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

  @session.sign_request(:get, '/api/v3/myAllocations', params: kwargs.merge(symbol: symbol))
end

#my_filters(symbol:, **kwargs) ⇒ Object

Query relevant filters (USER_DATA)

GET /api/v3/myFilters

Parameters:

  • symbol (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



396
397
398
399
400
# File 'lib/binance/spot/trade.rb', line 396

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

  @session.sign_request(:get, '/api/v3/myFilters', params: kwargs.merge(symbol: symbol))
end

#my_prevented_matches(symbol:, **kwargs) ⇒ Object

Query Prevented Matches (USER_DATA)

GET /api/v3/myPreventedMatches

Parameters:

  • symbol (String)
  • kwargs (Hash)
  • kwargs (Integer)

    :preventedMatchId

  • kwargs (Integer)

    :orderId

  • kwargs (Integer)

    :fromPreventedMatchId

  • kwargs (Integer)

    :limit Default: 500; Max: 1000

  • kwargs (Integer)

    :recvWindow The value cannot be greater than 60000

See Also:



334
335
336
337
338
# File 'lib/binance/spot/trade.rb', line 334

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

  @session.sign_request(:get, '/api/v3/myPreventedMatches', params: kwargs.merge(symbol: symbol))
end

#my_trades(symbol:, **kwargs) ⇒ Object

Account Trade List (USER_DATA)

GET /api/v3/myTrades

Parameters:

  • symbol (String)

    the symbol

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderId (Integer)
  • :startTime (Integer)
  • :endTime (Integer)
  • :fromId (Integer)

    TradeId to fetch from. Default gets most recent trades.

  • :limit (Integer)

    Default 500; max 1000.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



307
308
309
# File 'lib/binance/spot/trade.rb', line 307

def my_trades(symbol:, **kwargs)
  @session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol))
end

#new_oco_order(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs) ⇒ Object

New OCO (TRADE)

POST /api/v3/order/oco

Send in a new OCO

Parameters:

  • symbol (String)

    the symbol

  • side (String)
  • quantity (Float)
  • aboveType (String)
  • belowType (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :aboveClientOrderId (String)

    Arbitrary unique ID among open orders for the above order. Automatically generated if not sent

  • :aboveIcebergQty (Integer)

    Note that this can only be used if aboveTimeInForce is GTC

  • :abovePrice (Float)
  • :aboveStopPriceCan (Float)

    be used if aboveType is STOP_LOSS or STOP_LOSS_LIMIT. Either aboveStopPrice or aboveTrailingDelta or both, must be specified.

  • :aboveTrailingDelta (Integer)
  • :aboveTimeInForce (Float)

    Required if the aboveType is STOP_LOSS_LIMIT.

  • :aboveStrategyId (Integer)

    Arbitrary numeric value identifying the above order within an order strategy.

  • :aboveStrategyType (Integer)

    Arbitrary numeric value identifying the above order strategy. Values smaller than 1000000 are reserved and cannot be used.

  • :belowClientOrderId (String)

    Arbitrary unique ID among open orders for the below order. Automatically generated if not sent

  • :belowIcebergQty (Integer)

    Note that this can only be used if belowTimeInForce is GTC

  • :belowPrice (Float)

    Can be used if belowType is STOP_LOSS_LIMIT or LIMIT_MAKER to specify the limit price.

  • :belowStopPrice (Float)

    Can be used if belowType is STOP_LOSS or STOP_LOSS_LIMIT. Either belowStopPrice or belowTrailingDelta or both, must be specified.

  • :belowTrailingDelta (Integer)
  • :belowTimeInForce (String)

    Required if the belowType is STOP_LOSS_LIMIT

  • :belowStrategyId (Integer)

    Arbitrary numeric value identifying the below order within an order strategy

  • :belowStrategyType (String)

    Arbitrary numeric value identifying the below order strategy. Values smaller than 1000000 are reserved and cannot be used.

  • :newOrderRespType (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/binance/spot/trade.rb', line 203

def new_oco_order(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('side', side)
  Binance::Utils::Validation.require_param('quantity', quantity)
  Binance::Utils::Validation.require_param('aboveType', aboveType)
  Binance::Utils::Validation.require_param('belowType', belowType)

  @session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge(
    symbol: symbol,
    side: side,
    quantity: quantity,
    aboveType: aboveType,
    belowType: belowType
  ))
end

#new_oco_order_list(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs) ⇒ Object

New Order list - OCO (TRADE)

POST /api/v3/orderList/oco

Parameters:

  • symbol (String)
  • side (String)
  • quantity (Float)
  • aboveType (String)
  • belowType (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :aboveClientOrderId (String)
  • :aboveIcebergQty (Integer)
  • :abovePrice (Float)
  • :aboveStopPrice (Float)
  • :aboveTrailingDelta (Integer)
  • :aboveTimeInForce (Integer)
  • :aboveStrategyId (Integer)
  • :aboveStrategyType (Integer)
  • :abovePegPriceType (Integer)
  • :abovePegOffsetType (Integer)
  • :abovePegOffsetValue (Integer)
  • :belowClientOrderId (String)
  • :belowIcebergQty (Integer)
  • :belowPrice (Float)
  • :belowStopPrice (Float)
  • :belowTrailingDelta (Integer)
  • :belowTimeInForce (Integer)
  • :belowStrategyId (Integer)
  • :belowStrategyType (Integer)
  • :belowPegPriceType (Integer)
  • :belowPegOffsetType (Integer)
  • :belowPegOffsetValue (Integer)
  • :selfTradePreventionMode (Integer)
  • :newOrderRespType (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/binance/spot/trade.rb', line 509

def new_oco_order_list(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('side', side)
  Binance::Utils::Validation.require_param('quantity', quantity)
  Binance::Utils::Validation.require_param('aboveType', aboveType)
  Binance::Utils::Validation.require_param('belowType', belowType)

  @session.sign_request(:post, '/api/v3/orderList/oco',
                        params: kwargs.merge(
                          symbol: symbol,
                          side: side,
                          quantity: quantity,
                          aboveType: aboveType,
                          belowType: belowType
                        ))
end

#new_opo_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingType:, pendingSide:, **kwargs) ⇒ Object

New Order List - OPO (TRADE)

POST /api/v3/orderList/opo

Parameters:

  • symbol (String)
  • workingType (String)

    Supported values: LIMIT, LIMIT_MAKER

  • workingSide (String)
  • workingPrice (Float)
  • workingQuantity (Float)
  • pendingType (String)
  • pendingSide (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :newOrderRespType (String)
  • :selfTradePreventionMode (String)
  • :workingClientOrderId (String)
  • :workingIcebergQty (Float)
  • :workingTimeInForce (String)
  • :workingStrategyId (Integer)
  • :workingStrategyType (Integer)
  • :workingPegPriceType (String)
  • :workingPegOffsetType (String)
  • :workingPegOffsetValue (Integer)
  • :pendingClientOrderId (String)
  • :pendingPrice (Float)
  • :pendingStopPrice (Float)
  • :pendingTrailingDelta (Float)
  • :pendingIcebergQty (Float)
  • :pendingTimeInForce (String)
  • :pendingStrategyId (Integer)
  • :pendingStrategyType (Integer)
  • :pendingPegPriceType (String)
  • :pendingPegOffsetType (String)
  • :pendingPegOffsetValue (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
# File 'lib/binance/spot/trade.rb', line 698

def new_opo_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingType:, pendingSide:, **kwargs)
  params = {
    symbol: symbol,
    workingType: workingType,
    workingSide: workingSide,
    workingPrice: workingPrice,
    workingQuantity: workingQuantity,
    pendingType: pendingType,
    pendingSide: pendingSide
  }

  params.each do |name, value|
    Binance::Utils::Validation.require_param(name.to_s, value)
  end

  @session.sign_request(:post, '/api/v3/orderList/opo',
                        params: kwargs.merge(params))
end

#new_opoco_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingSide:, pendingAboveType:, **kwargs) ⇒ Object

New Order List - OPOCO (TRADE)

POST /api/v3/orderList/opoco

Parameters:

  • symbol (String)
  • workingType (String)

    Supported values: LIMIT, LIMIT_MAKER

  • workingSide (String)
  • workingPrice (Float)
  • workingQuantity (Float)
  • pendingSide (String)
  • pendingAboveType (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :newOrderRespType (String)
  • :selfTradePreventionMode (String)
  • :workingClientOrderId (String)
  • :workingIcebergQty (Float)
  • :workingTimeInForce (String)
  • :workingStrategyId (Integer)
  • :workingStrategyType (Integer)
  • :workingPegPriceType (String)
  • :workingPegOffsetType (String)
  • :workingPegOffsetValue (Integer)
  • :pendingAboveClientOrderId (String)
  • :pendingAbovePrice (Float)
  • :pendingAboveStopPrice (Float)
  • :pendingAboveTrailingDelta (Float)
  • :pendingAboveIcebergQty (Float)
  • :pendingAboveTimeInForce (String)
  • :pendingAboveStrategyId (Integer)
  • :pendingAboveStrategyType (Integer)
  • :pendingAbovePegPriceType (String)
  • :pendingAbovePegOffsetType (String)
  • :pendingAbovePegOffsetValue (Integer)
  • :pendingBelowType (String)
  • :pendingBelowClientOrderId (String)
  • :pendingBelowPrice (Float)
  • :pendingBelowStopPrice (Float)
  • :pendingBelowTrailingDelta (Float)
  • :pendingBelowIcebergQty (Float)
  • :pendingBelowTimeInForce (String)
  • :pendingBelowStrategyId (Integer)
  • :pendingBelowStrategyType (Integer)
  • :pendingBelowPegPriceType (String)
  • :pendingBelowPegOffsetType (String)
  • :pendingBelowPegOffsetValue (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
# File 'lib/binance/spot/trade.rb', line 765

def new_opoco_order_list(
  symbol:,
  workingType:,
  workingSide:,
  workingPrice:,
  workingQuantity:,
  pendingSide:,
  pendingAboveType:,
  **kwargs
)
  params = {
    symbol: symbol,
    workingType: workingType,
    workingSide: workingSide,
    workingPrice: workingPrice,
    workingQuantity: workingQuantity,
    pendingSide: pendingSide,
    pendingAboveType: pendingAboveType
  }

  params.each do |name, value|
    Binance::Utils::Validation.require_param(name.to_s, value)
  end

  @session.sign_request(:post, '/api/v3/orderList/opoco',
                        params: kwargs.merge(params))
end

#new_order(symbol:, side:, type:, **kwargs) ⇒ Object

New Order

POST /api/v3/order

send in a new order

Parameters:

  • symbol (String)

    the symbol

  • side (String)
  • type (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :timeInForce (String)
  • :quantity (Float)
  • :quoteOrderQty (Float)
  • :price (Float)
  • :newClientOrderId (String)
  • :strategyId (Integer)
  • :strategyType (Integer)
  • :stopPrice (Float)
  • :trailingDelta (Integer)
  • :icebergeQty (Float)
  • :newOrderRespType (String)

    Set the response JSON. ACK, RESULT, or FULL.

  • :selfTradePreventionMode (String)
  • :pegPriceType (String)

    PRIMARY_PEG or MARKET_PEG.

  • :pegOffsetValue (Integer)
  • :pegOffsetType (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/binance/spot/trade.rb', line 75

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

  @session.sign_request(:post, '/api/v3/order', params: kwargs.merge(
    symbol: symbol,
    side: side,
    type: type
  ))
end

#new_order_test(symbol:, side:, type:, **kwargs) ⇒ Object

TestNew Order

POST /api/v3/order/test

send in a new order to test the request, no order is really generated.

Parameters:

  • symbol (String)

    the symbol

  • side (String)
  • type (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :timeInForce (String)
  • :quantity (Float)
  • :quoteOrderQty (Float)
  • :price (Float)
  • :newClientOrderId (String)
  • :stopPrice (Float)
  • :icebergeQty (Float)
  • :newOrderRespType (String)

    Set the response JSON. ACK, RESULT, or FULL.

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/binance/spot/trade.rb', line 35

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

  @session.sign_request(:post, '/api/v3/order/test', params: kwargs.merge(
    symbol: symbol,
    side: side,
    type: type
  ))
end

#new_oto_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingType:, pendingSide:, pendingQuantity:, **kwargs) ⇒ Object

New Order list - OTO (TRADE)

POST /api/v3/orderList/oto

Parameters:

  • symbol (String)
  • workingType (String)

    Supported values: LIMIT, LIMIT_MAKER

  • workingSide (String)
  • workingPrice (Float)
  • workingQuantity (Float)
  • pendingType (String)
  • pendingSide (String)
  • pendingQuantity (Float)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :newOrderRespType (String)
  • :selfTradePreventionMode (String)
  • :workingClientOrderId (String)
  • :workingIcebergQty (Float)
  • :workingTimeInForce (String)
  • :workingStrategyId (Integer)
  • :workingStrategyType (Integer)
  • :workingPegPriceType (String)
  • :workingPegOffsetType (String)
  • :workingPegOffsetValue (Integer)
  • :pendingClientOrderId (String)
  • :pendingPrice (Float)
  • :pendingStopPrice (Float)
  • :pendingTrailingDelta (Float)
  • :pendingIcebergQty (Float)
  • :pendingTimeInForce (String)
  • :pendingStrategyId (Integer)
  • :pendingStrategyType (Integer)
  • :pendingPegPriceType (String)
  • :pendingPegOffsetType (String)
  • :pendingPegOffsetValue (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/binance/spot/trade.rb', line 563

def new_oto_order_list(
  symbol:,
  workingType:,
  workingSide:,
  workingPrice:,
  workingQuantity:,
  pendingType:,
  pendingSide:,
  pendingQuantity:,
  **kwargs
)
  params = {
    symbol: symbol,
    workingType: workingType,
    workingSide: workingSide,
    workingPrice: workingPrice,
    workingQuantity: workingQuantity,
    pendingType: pendingType,
    pendingSide: pendingSide,
    pendingQuantity: pendingQuantity
  }

  params.each do |name, value|
    Binance::Utils::Validation.require_param(name.to_s, value)
  end

  @session.sign_request(:post, '/api/v3/orderList/oto',
                        params: kwargs.merge(params))
end

#new_otoco_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingSide:, pendingQuantity:, pendingAboveType:, **kwargs) ⇒ Object

New Order list - OTOCO (TRADE)

POST /api/v3/orderList/otoco

Parameters:

  • symbol (String)
  • workingType (String)

    Supported values: LIMIT, LIMIT_MAKER

  • workingSide (String)
  • workingPrice (Float)
  • workingQuantity (Float)
  • pendingSide (String)
  • pendingQuantity (Float)
  • pendingAboveType (String)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :listClientOrderId (String)
  • :newOrderRespType (String)
  • :selfTradePreventionMode (String)
  • :workingClientOrderId (String)
  • :workingIcebergQty (Float)
  • :workingTimeInForce (String)
  • :workingStrategyId (Integer)
  • :workingStrategyType (Integer)
  • :workingPegPriceType (String)
  • :workingPegOffsetType (String)
  • :workingPegOffsetValue (Integer)
  • :pendingAboveClientOrderId (String)
  • :pendingAbovePrice (Float)
  • :pendingAboveStopPrice (Float)
  • :pendingAboveTrailingDelta (Float)
  • :pendingAboveIcebergQty (Float)
  • :pendingAboveTimeInForce (String)
  • :pendingAboveStrategyId (Integer)
  • :pendingAboveStrategyType (Integer)
  • :pendingAbovePegPriceType (String)
  • :pendingAbovePegOffsetType (String)
  • :pendingAbovePegOffsetValue (Integer)
  • :pendingBelowType (String)
  • :pendingBelowClientOrderId (String)
  • :pendingBelowPrice (Float)
  • :pendingBelowStopPrice (Float)
  • :pendingBelowTrailingDelta (Float)
  • :pendingBelowIcebergQty (Float)
  • :pendingBelowTimeInForce (String)
  • :pendingBelowStrategyId (Integer)
  • :pendingBelowStrategyType (Integer)
  • :pendingBelowPegPriceType (String)
  • :pendingBelowPegOffsetType (String)
  • :pendingBelowPegOffsetValue (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/binance/spot/trade.rb', line 642

def new_otoco_order_list(symbol:, workingType:, workingSide:, workingPrice:, workingQuantity:, pendingSide:, pendingQuantity:, pendingAboveType:, **kwargs)
  params = {
    symbol: symbol,
    workingType: workingType,
    workingSide: workingSide,
    workingPrice: workingPrice,
    workingQuantity: workingQuantity,
    pendingSide: pendingSide,
    pendingQuantity: pendingQuantity,
    pendingAboveType: pendingAboveType
  }

  params.each do |name, value|
    Binance::Utils::Validation.require_param(name.to_s, value)
  end

  @session.sign_request(:post, '/api/v3/orderList/otoco',
                        params: kwargs.merge(params))
end

#open_order_list(**kwargs) ⇒ Object

Query Open OCO (USER_DATA)

GET /api/v3/openOrderList



279
280
281
# File 'lib/binance/spot/trade.rb', line 279

def open_order_list(**kwargs)
  @session.sign_request(:get, '/api/v3/openOrderList', params: kwargs)
end

#open_orders(**kwargs) ⇒ Object

Current Open Orders (USER_DATA)

GET /api/v3/openOrders

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :symbol (String)

    the symbol

  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



145
146
147
# File 'lib/binance/spot/trade.rb', line 145

def open_orders(**kwargs)
  @session.sign_request(:get, '/api/v3/openOrders', params: kwargs)
end

#order_amendments(symbol:, orderId:, **kwargs) ⇒ Object

Query Order Amendments (USER_DATA)

GET /api/v3/order/amendments

Parameters:

  • symbol (String)
  • orderId (Integer)
  • kwargs (Hash)

Options Hash (**kwargs):

  • :fromExecutionId (Integer)
  • :limit (Integer)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



381
382
383
384
385
386
# File 'lib/binance/spot/trade.rb', line 381

def order_amendments(symbol:, orderId:, **kwargs)
  Binance::Utils::Validation.require_param('symbol', symbol)
  Binance::Utils::Validation.require_param('orderId', orderId)

  @session.sign_request(:get, '/api/v3/order/amendments', params: kwargs.merge(symbol: symbol, orderId: orderId))
end

#order_list(**kwargs) ⇒ Object

Query OCO (USER_DATA)

GET /api/v3/orderList

Retrieves a specific OCO based on provided optional parameters

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :orderListId (Integer)
  • :orgClientOrderId (String)
  • :recvWindow (Integer)

    The value cannot be greater than 60000

See Also:



249
250
251
# File 'lib/binance/spot/trade.rb', line 249

def order_list(**kwargs)
  @session.sign_request(:get, '/api/v3/orderList', params: kwargs)
end