Skip to content

3. Order Examples

ArjunVachhani-CCM edited this page Jun 30, 2023 · 1 revision

Order Examples

Limit

Order limitBuyOrder = new Order { IsBuy = true, OrderId = 1, OpenQuantity = 1000, Price = 10 };
Order limitSellOrder = new Order { IsBuy = false, OrderId = 2, OpenQuantity = 1000, Price = 10 };

Above orders are willing to buy/sell 1000 shares at price of 10.

Stop Limit

Order stopLimitBuy = new Order { IsBuy = true, OpenQuantity = 1000, Price = 11, OrderId = 1, StopPrice = 10 };

Above order are willing to buy 1000 share after price goes above $10.00 and he is willing to pay $11.00 per share

Order stopLimitSell = new Order { IsBuy = false, OpenQuantity = 1000, Price = 8, OrderId = 1, StopPrice = 9 };

Above order are willing to sell 1000 share after price goes below $9.00 and he is willing to accept $8.00 per share.

Market

Order marketSell  = new Order { IsBuy = false, OpenQuantity = 500, Price = 0, OrderId = 2 };

Above order is willing to sell 500 share at any price at the moment.

Order marketBuy = new Order { IsBuy = true, OpenQuantity = 500, Price = 0, OrderId = 2 };

Above order is willing to buy 500 share at any price at the moment.

Order marketBuy = new Order { IsBuy = true, Price = 0, OrderId = 5, OrderAmount = 5000 };

Above order is willing to any quantity of shares at any price but amount should be less than 5000.

Stop Market/Stop Loss

Order stopMarketSell = new Order { IsBuy = false, OpenQuantity = 500, Price = 0, OrderId = 3, StopPrice = 9 };

Above order will triggered when price goes below $9.00 and will sell 500 shares at any price.

Order stopMarketBuy = new Order { IsBuy = true, OpenQuantity = 500, Price = 0, OrderId = 3, StopPrice = 10 };

Above order will triggered when price goes above $10.00 and will buy 500 shares at any price.

Order stopMarketBuy = new Order { IsBuy = true, Price = 0, OrderId = 3, StopPrice = 11, OrderAmount = 5500 };

Above order will triggered when price goes above $11.00 and will buy shares of worth $5500.

Iceberg Order

Order order = new Order { IsBuy = false, OpenQuantity = 500, Price = 10, OrderId = 1, TipQuantity = 500, TotalQuantity = 5000 };

above order is willing to sell 5000 share at price $10.00 but order will add tip of 500 share only. only 500 share will be visible on order book.

Good till Date

Order gtdOrder = new Order { IsBuy = true, OpenQuantity = 500, Price = 10, OrderId = 1, CancelOn = 1 };

Above order will be automatically cancelled on 1 Jan 1970 UTC. Orders can be cancelled manually before CancelOn time.

Immediate or cancel

Order iocOrder = new Order { IsBuy = true, OpenQuantity = 1500, Price = 10, OrderId = 2, OrderCondition = OrderCondition.ImmediateOrCancel };

MatchingEngine will match what ever possible and cancel remaining quantity.

Book or cancel

Order bocOrder = new Order { IsBuy = true, OpenQuantity = 500, Price = 10, OrderId = 2, OrderCondition = OrderCondition.BookOrCancel };