Class: Binance::Api::Margin::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/binance/api/margin/order.rb

Class Method Summary collapse

Class Method Details

.cancel!(symbol: nil, isIsolated: false, orderId: nil, origClientOrderId: nil, newClientOrderId: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/binance/api/margin/order.rb', line 6

def cancel!(symbol: nil, isIsolated: false, orderId: nil, origClientOrderId: nil,
            newClientOrderId: nil, recvWindow: nil, api_key: nil, api_secret_key: nil)
  timestamp = Configuration.timestamp
  params = {
    symbol: symbol, isIsolated: isIsolated, orderId: orderId, origClientOrderId: origClientOrderId,
    newClientOrderId: newClientOrderId, recvWindow: recvWindow, timestamp: timestamp,
  }.delete_if { |_, value| value.nil? }
  ensure_required_cancel_keys!(params: params)
  path = "/sapi/v1/margin/order"
  Request.send!(api_key_type: :trading, method: :delete, path: path,
                params: params, security_type: :margin, tld: Configuration.tld,
                api_key: api_key, api_secret_key: api_secret_key)
end

.create!(symbol: nil, isIsolated: false, side: nil, type: nil, quantity: nil, quoteOrderQty: nil, price: nil, stopPrice: nil, newClientOrderId: nil, icebergQty: nil, newOrderRespType: nil, sideEffectType: nil, timeInForce: nil, recvWindow: nil, api_key: nil, api_secret_key: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/binance/api/margin/order.rb', line 20

def create!(symbol: nil, isIsolated: false, side: nil, type: nil, quantity: nil,
            quoteOrderQty: nil, price: nil, stopPrice: nil, newClientOrderId: nil,
            icebergQty: nil, newOrderRespType: nil, sideEffectType: nil, timeInForce: nil,
            recvWindow: nil, api_key: nil, api_secret_key: nil)
  timestamp = Configuration.timestamp
  params = {
    symbol: symbol, isIsolated: isIsolated, side: side, type: type,
    quantity: quantity, quoteOrderQty: quoteOrderQty, price: price,
    stopPrice: stopPrice, newClientOrderId: newClientOrderId, icebergQty: icebergQty,
    newOrderRespType: newOrderRespType, sideEffectType: sideEffectType,
    timeInForce: timeInForce, recvWindow: recvWindow, timestamp: timestamp,
  }.delete_if { |_, value| value.nil? }
  ensure_required_create_keys!(params: params)
  path = "/sapi/v1/margin/order"
  Request.send!(api_key_type: :trading, method: :post, path: path,
                params: params, security_type: :margin, tld: Configuration.tld,
                api_key: api_key, api_secret_key: api_secret_key)
end