Method: Bitmex::Order#create

Defined in:
lib/bitmex/order.rb

#create(symbol, attributes) ⇒ Bitmex::Mash

Place new order

Options Hash (attributes):

  • :side (Buy, Sell)

    Order side. Defaults to ‘Buy’ unless orderQty is negative

  • :orderQty (Integer)

    Order quantity in units of the instrument (i.e. contracts)

  • :price (Double)

    Optional limit price for ‘Limit’, ‘StopLimit’, and ‘LimitIfTouched’ orders

  • :displayQty (Double)

    Optional quantity to display in the book. Use 0 for a fully hidden order.

  • :stopPx (Double)

    Optional trigger price for ‘Stop’, ‘StopLimit’, ‘MarketIfTouched’, and ‘LimitIfTouched’ orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. Use execInst of ‘MarkPrice’ or ‘LastPrice’ to define the current price used for triggering.

  • :clOrdID (String)

    Optional Client Order ID. This clOrdID will come back on the order and any related executions.

  • :pegOffsetValue (Double)

    Optional trailing offset from the current price for ‘Stop’, ‘StopLimit’, ‘MarketIfTouched’, and ‘LimitIfTouched’ orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for ‘Pegged’ orders.

  • :pegPriceType (LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg)

    Optional peg price type.

  • :ordType (Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, Pegged)

    Order type. Defaults to ‘Limit’ when price is specified. Defaults to ‘Stop’ when stopPx is specified. Defaults to ‘StopLimit’ when price and stopPx are specified.

  • :timeInForce (Day, GoodTillCancel, ImmediateOrCancel, FillOrKill)

    Time in force. Defaults to ‘GoodTillCancel’ for ‘Limit’, ‘StopLimit’, ‘LimitIfTouched’, and ‘MarketWithLeftOverAsLimit’ orders.

  • :execInst (ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed)

    Optional execution instructions. AllOrNone’ instruction requires displayQty to be 0. ‘MarkPrice’, ‘IndexPrice’ or ‘LastPrice’ instruction valid for ‘Stop’, ‘StopLimit’, ‘MarketIfTouched’, and ‘LimitIfTouched’ orders.

  • :text (String)

    Optional amend annotation. e.g. ‘Take profit’



55
56
57
58
# File 'lib/bitmex/order.rb', line 55

def create(symbol, attributes)
  params = attributes.merge symbol: symbol
  rest.post order_path, params: params
end