/positions/otc

DELETE (version: 1)

Closes one or more OTC positions.
Request
Parameter Type Name Description
Body request (Object)
Close position request data
[Constraint: If epic is defined, then set expiry]
[Constraint: If orderType equals LIMIT, then DO NOT set quoteId]
[Constraint: If orderType equals LIMIT, then set level]
[Constraint: If orderType equals MARKET, then DO NOT set level,quoteId]
[Constraint: If orderType equals QUOTE, then set level,quoteId]
[Constraint: Set only one of {dealId,epic}]
dealId (String) Deal identifier
[Constraint: Pattern(regexp=".{1,30}")]
direction (Constant)
Deal direction
BUY Buy
SELL Sell
epic (String) Instrument epic identifier
[Constraint: Pattern(regexp="[A-Za-z0-9._]{6,30}")]
expiry (String) Instrument expiry
[Constraint: Pattern(regexp="(\\d{2}-)?[A-Z]{3}-\\d{2}|-|DFB")]
level (Number) Closing deal level
orderType (Constant)
Describes the order level model to be used for a position operation
LIMIT Limit orders get executed at the price seen by IG at the moment of booking a trade. A limit determines the level at which the order or the remainder of the order will be rejected.
MARKET Market orders get executed at the price seen by the IG at the time of booking the trade. A level cannot be specified. Not applicable to BINARY instruments
QUOTE Quote orders get executed at the specified level. The level has to be accompanied by a valid quote id. This type is only available subject to agreement with IG.
quoteId (String) Lightstreamer price quote identifier
size (Number) Deal size
[Constraint: NotNull][Constraint: Check precision is not more than 12 decimal places]
timeInForce (Constant)
The time in force determines the order fill strategy.
EXECUTE_AND_ELIMINATE Execute and eliminate
FILL_OR_KILL Fill or kill
Response
Close position response
dealReference (String) Deal reference
Exceptions
HTTP code Description
400
error.public-api.failure.encryption.required A login has been attempted to the login V1 service by a client from the IG Singapore company. They need to use the v2 version as they need to send their passwords encrypyted.
400
error.request.invalid.date-range Invalid date range
400
error.security.api-key-missing The api key was not provided
400
error.trading.otc.market-orders.not-supported Market Orders are not supported
400
invalid.input A generic input data error has occurred
401
error.public-api.failure.kyc.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.missing.credentials The user has not provided all required security credentials.
401
error.public-api.failure.pending.agreements.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.preferred.account.disabled The user's preferred account is disabled.
401
error.public-api.failure.preferred.account.not.set The user has not set a preferred account.
401
error.security.account-token-invalid The service requires an account token and the one provided was not valid
401
error.security.account-token-missing The service requires an account token and it was not provided
401
error.security.client-token-invalid The service requires a client token and the one provided was not valid
401
error.security.client-token-missing The service requires a client token and it was not provided
401
error.security.oauth-token-invalid Invalid OAuth access token
403
endpoint.unavailable.for.api-key The provided api key was not accepted
403
error.public-api.exceeded-account-allowance The account traffic allowance has been exceeded
403
error.public-api.exceeded-account-historical-data-allowance The account historical data traffic allowance has been exceeded
403
error.public-api.exceeded-account-trading-allowance The account trading traffic allowance has been exceeded
403
error.public-api.exceeded-api-key-allowance The api key traffic allowance has been exceeded
403
error.public-api.failure.stockbroking-not-supported Stockbroking not supported for Public API users.
403
error.security.api-key-disabled The provided api key was not accepted because it is not currently enabled
403
error.security.api-key-invalid The provided api key was not accepted
403
error.security.api-key-restricted The provided api key was not valid for the requesting account
403
error.security.api-key-revoked The provided api key was not accepted because it has been revoked
404
invalid.url
500
system.error

POST (version: 2)

Creates an OTC position.
Request
Parameter Type Name Description
Body request (Object)
Create position request
[Constraint: If a limitDistance is set, then forceOpen must be true]
[Constraint: If a limitLevel is set, then forceOpen must be true]
[Constraint: If a stopDistance is set, then forceOpen must be true]
[Constraint: If a stopLevel is set, then forceOpen must be true]
[Constraint: If guaranteedStop equals true, then set only one of stopLevel,stopDistance]
[Constraint: If orderType equals LIMIT, then DO NOT set quoteId]
[Constraint: If orderType equals LIMIT, then set level]
[Constraint: If orderType equals MARKET, then DO NOT set level,quoteId]
[Constraint: If orderType equals QUOTE, then set level,quoteId]
[Constraint: If trailingStop equals false, then DO NOT set trailingStopIncrement]
[Constraint: If trailingStop equals true, then DO NOT set stopLevel]
[Constraint: If trailingStop equals true, then guaranteedStop must be false]
[Constraint: If trailingStop equals true, then set stopDistance,trailingStopIncrement]
[Constraint: Set only one of {limitLevel,limitDistance}]
[Constraint: Set only one of {stopLevel,stopDistance}]
currencyCode (String) Currency. Restricted to available instrument currencies
[Constraint: NotNull]
[Constraint: Pattern(regexp="[A-Z]{3}")]
dealReference (String) A user-defined reference identifying the submission of the order
[Constraint: Pattern(regexp="[A-Za-z0-9_\\-]{1,30}")]
direction (Constant)
Deal direction
BUY Buy
SELL Sell
epic (String) Instrument epic identifier
[Constraint: NotNull]
[Constraint: Pattern(regexp="[A-Za-z0-9._]{6,30}")]
expiry (String) Instrument expiry
[Constraint: NotNull]
[Constraint: Pattern(regexp="(\\d{2}-)?[A-Z]{3}-\\d{2}|-|DFB")]
forceOpen (Boolean) True if force open is required
[Constraint: NotNull]
guaranteedStop (Boolean) True if a guaranteed stop is required
[Constraint: NotNull]
level (Number) Deal level
limitDistance (Number) Limit distance
limitLevel (Number) Limit level
orderType (Constant)
Describes the order level model to be used for a position operation
LIMIT Limit orders get executed at the price seen by IG at the moment of booking a trade. A limit determines the level at which the order or the remainder of the order will be rejected.
MARKET Market orders get executed at the price seen by the IG at the time of booking the trade. A level cannot be specified. Not applicable to BINARY instruments
QUOTE Quote orders get executed at the specified level. The level has to be accompanied by a valid quote id. This type is only available subject to agreement with IG.
quoteId (String) Lightstreamer price quote identifier
size (Number) Deal size
[Constraint: NotNull][Constraint: Check precision is not more than 12 decimal places]
stopDistance (Number) Stop distance
stopLevel (Number) Stop level
timeInForce (Constant)
The time in force determines the order fill strategy.
EXECUTE_AND_ELIMINATE Execute and eliminate
FILL_OR_KILL Fill or kill
trailingStop (Boolean) Whether the stop has to be moved towards the current level in case of a favourable trade
trailingStopIncrement (Number) increment step in pips for the trailing stop
Response
Create position response
dealReference (String) Deal reference of the transaction
Exceptions
HTTP code Description
400
error.public-api.failure.encryption.required A login has been attempted to the login V1 service by a client from the IG Singapore company. They need to use the v2 version as they need to send their passwords encrypyted.
400
error.request.invalid.date-range Invalid date range
400
error.security.api-key-missing The api key was not provided
400
error.trading.otc.market-orders.not-supported Market Orders are not supported
400
invalid.input A generic input data error has occurred
401
error.public-api.failure.kyc.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.missing.credentials The user has not provided all required security credentials.
401
error.public-api.failure.pending.agreements.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.preferred.account.disabled The user's preferred account is disabled.
401
error.public-api.failure.preferred.account.not.set The user has not set a preferred account.
401
error.security.account-token-invalid The service requires an account token and the one provided was not valid
401
error.security.account-token-missing The service requires an account token and it was not provided
401
error.security.client-token-invalid The service requires a client token and the one provided was not valid
401
error.security.client-token-missing The service requires a client token and it was not provided
401
error.security.oauth-token-invalid Invalid OAuth access token
403
endpoint.unavailable.for.api-key The provided api key was not accepted
403
error.public-api.exceeded-account-allowance The account traffic allowance has been exceeded
403
error.public-api.exceeded-account-historical-data-allowance The account historical data traffic allowance has been exceeded
403
error.public-api.exceeded-account-trading-allowance The account trading traffic allowance has been exceeded
403
error.public-api.exceeded-api-key-allowance The api key traffic allowance has been exceeded
403
error.public-api.failure.stockbroking-not-supported Stockbroking not supported for Public API users.
403
error.security.api-key-disabled The provided api key was not accepted because it is not currently enabled
403
error.security.api-key-invalid The provided api key was not accepted
403
error.security.api-key-restricted The provided api key was not valid for the requesting account
403
error.security.api-key-revoked The provided api key was not accepted because it has been revoked
404
error.trading.otc.instrument-not-found Instrument not found
404
invalid.url
500
system.error

POST (version: 1)

Creates an OTC position.
Request
Parameter Type Name Description
Body request (Object)
Create position request
[Constraint: If guaranteedStop equals true, then set only one of stopLevel,stopDistance]
[Constraint: If orderType equals LIMIT, then DO NOT set quoteId]
[Constraint: If orderType equals LIMIT, then set level]
[Constraint: If orderType equals MARKET, then DO NOT set level,quoteId]
[Constraint: If orderType equals QUOTE, then set level,quoteId]
[Constraint: Set only one of {limitLevel,limitDistance}]
[Constraint: Set only one of {stopLevel,stopDistance}]
currencyCode (String) Currency
[Constraint: NotNull]
[Constraint: Pattern(regexp="[A-Z]{3}")]
dealReference (String) A user-defined reference identifying the submission of the order
[Constraint: Pattern(regexp="[A-Za-z0-9_\\-]{1,30}")]
direction (Constant)
Deal direction
BUY Buy
SELL Sell
epic (String) Instrument epic identifier
[Constraint: NotNull]
[Constraint: Pattern(regexp="[A-Za-z0-9._]{6,30}")]
expiry (String) Instrument expiry
[Constraint: NotNull]
[Constraint: Pattern(regexp="(\\d{2}-)?[A-Z]{3}-\\d{2}|-|DFB")]
forceOpen (Boolean) True if force open is required
[Constraint: NotNull]
guaranteedStop (Boolean) True if a guaranteed stop is required
[Constraint: NotNull]
level (Number) Deal level
limitDistance (Number) Limit distance
limitLevel (Number) Limit level
orderType (Constant)
Describes the order level model to be used for a position operation
LIMIT Limit orders get executed at the price seen by IG at the moment of booking a trade. A limit determines the level at which the order or the remainder of the order will be rejected.
MARKET Market orders get executed at the price seen by the IG at the time of booking the trade. A level cannot be specified. Not applicable to BINARY instruments
QUOTE Quote orders get executed at the specified level. The level has to be accompanied by a valid quote id. This type is only available subject to agreement with IG.
quoteId (String) Lightstreamer price quote identifier
size (Number) Deal size
[Constraint: NotNull][Constraint: Check precision is not more than 12 decimal places]
stopDistance (Number) Stop distance
stopLevel (Number) Stop level
Response
Create position response
dealReference (String) Deal reference of the transaction
Exceptions
HTTP code Description
400
error.public-api.failure.encryption.required A login has been attempted to the login V1 service by a client from the IG Singapore company. They need to use the v2 version as they need to send their passwords encrypyted.
400
error.request.invalid.date-range Invalid date range
400
error.security.api-key-missing The api key was not provided
400
error.trading.otc.market-orders.not-supported Market Orders are not supported
400
invalid.input A generic input data error has occurred
401
error.public-api.failure.kyc.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.missing.credentials The user has not provided all required security credentials.
401
error.public-api.failure.pending.agreements.required The account is not allowed to log into public API. Please use the web platform.
401
error.public-api.failure.preferred.account.disabled The user's preferred account is disabled.
401
error.public-api.failure.preferred.account.not.set The user has not set a preferred account.
401
error.security.account-token-invalid The service requires an account token and the one provided was not valid
401
error.security.account-token-missing The service requires an account token and it was not provided
401
error.security.client-token-invalid The service requires a client token and the one provided was not valid
401
error.security.client-token-missing The service requires a client token and it was not provided
401
error.security.oauth-token-invalid Invalid OAuth access token
403
endpoint.unavailable.for.api-key The provided api key was not accepted
403
error.public-api.exceeded-account-allowance The account traffic allowance has been exceeded
403
error.public-api.exceeded-account-historical-data-allowance The account historical data traffic allowance has been exceeded
403
error.public-api.exceeded-account-trading-allowance The account trading traffic allowance has been exceeded
403
error.public-api.exceeded-api-key-allowance The api key traffic allowance has been exceeded
403
error.public-api.failure.stockbroking-not-supported Stockbroking not supported for Public API users.
403
error.security.api-key-disabled The provided api key was not accepted because it is not currently enabled
403
error.security.api-key-invalid The provided api key was not accepted
403
error.security.api-key-restricted The provided api key was not valid for the requesting account
403
error.security.api-key-revoked The provided api key was not accepted because it has been revoked
404
error.trading.otc.instrument-not-found Instrument not found
404
invalid.url
500
system.error