API order types

There are two types of order available on our API:

  • Immediate orders
  • Resting orders

Immediate order types

There are two kinds of immediate order:

  • Market order
  • Limit fill or kill order

Note there is an additional order type "QUOTE" representing "IG-quoted" orders which is currently not supported.

Market order

A market order is an instruction to buy or sell at the best available price for the size of your order. When using this type of order you choose the size and direction of your order, but not the price.

You do not have any control over what price your order will be filled at; it will be filled at the then market price which may be worse than the indicative prices visible when placing the order.

This is because the full size of the order you request may not be available at the time you place your market order, and the price may change significantly between that time and when your order size becomes available. This is particularly true for markets that are not traded in high volumes, as well as orders submitted during fast-moving markets or outside the open hours of the underlying market.

Limit fill or kill

A limit fill or kill order is an instruction to buy or sell in a specified size within a specified price limit, which is either filled completely or rejected. Provided the market price is within the specified limit and there is sufficient volume available, the order will be filled at the prevailing market price.

The entire order will be rejected if:

  • The market price is outside your specified limit (higher for buy orders, lower for sell orders)
  • There is insufficient volume available to satisfy the full order size
Examples

Scenario: Placing a limit fill or kill order on Spot Gold

Spot Gold is currently priced at 1250 / 1250.5 and you send a limit fill or kill order to sell £2000 per point with a limit of 1248.

  • Example 1 - We receive your instruction and although the price is unmoved, there is insufficient liquidity at the current price. We work your order down to 1248, and there is sufficient liquidity to fill you at the average price of 1248
  • Example 2 - We receive your instruction and although the price is unmoved, there is insufficient liquidity at the current price. We work your order down to 1248, but there is also insufficient liquidity down to this level, so your order is cancelled
  • Example 3 - We receive your instruction but the price has moved to 1247 / 1247.5. Because this is outside the limit of 1248, your order is cancelled
  • Example 4 - We receive your instruction but the price has moved to 1251 / 1251.5. Your order would likely be filled at 1251

Scenario: Placing a limit fill or kill order on FTSE 100

The FTSE 100 is currently priced at 6800 / 6801 and you send a limit fill or kill order to buy 10 lots with a limit of 6805.

  • Example 1 - We receive your instruction and the price is unmoved. There is also sufficient liquidity to fill the order, so it’s filled at 6801
  • Example 2 - We receive your instruction, but the price has moved to 6803 / 6804. The order is filled at 6804
  • Example 3 - We receive your instruction, but the price has moved to 6807 / 6808, which is outside of the limit you requested, so the order is cancelled

Resting orders

There are two kinds of resting order:

  • Working orders (to open)
  • Attached or contingent orders (to close)

Both consist of limit and stop orders.

Working orders (to open)

  • Limit order - This is an order to open a position by buying when the market reaches a lower level than the current price, or selling short when the market hits a higher level than the current price. This is suitable if you think the market price will change direction when it hits a certain level
  • Stop order - This is an order to buy when the market hits a higher level than the current price, or sell when the market hits a lower level than the current price. This is suitable if you think the market will continue moving in the same direction once it hits a certain level

Attached or contingent orders (to close)

These orders can be attached to open positions or left as contingent orders attached to working orders to open.

  • Limit order - This is an order to close a long position when the market reaches a higher level than the current price, or close a short position when the market reaches a lower level. For example, let’s say you have a long position that’s currently in profit. If you have a target level at which you’d be happy to collect your gains, you can set a limit to close out your position when and if this level is met. You may then avoid the risk of a subsequent change in market direction wiping out your profit
  • Stop order - This is an order to close an open position by selling when the market reaches a lower level, or buying when the market reaches a higher level. This type of order is known as a stop-loss and is commonly used to close out a position at a predetermined level, effectively restricting the amount of money you could lose. Adding a stop order means your position will be closed if the market moves too far against you

Uncaught exception thrown in shutdown function.

PDOException: SQLSTATE[25006]: Read only sql transaction: 7 ERROR: cannot execute DELETE in a read-only transaction: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 16426613835e7f6111767e02.47505442 ) in lock_release_all() (line 269 of /var/ig/webcontent/drupal/includes/lock.inc).