CFDs | XTB

This document outlines the appropriate format that the traders must follow while writing the webhook payload for a particular CFD (Contracts for Difference) asset class on the XTB trading platform.

With XTB you can trade CFDs on multiple asset classes:

Let's get started 🚀

Stock

The following outlines the appropriate format that the traders must follow while writing the webhook payload for setting up the following types of stock orders to be executed on the XTB platform.

Market Order

The traders can write the webhook payload for setting up Market orders using these three payload fields:

  • Symbol
  • Action
  • Quantity

Symbol

The ticker symbol of the stock CFD. XTB represents this asset class by pairing the stock ticker symbol with its corresponding market designation and binds with (.).

For Example:

  • AAPL.US: Indicates the Apple stock CFD traded on a U.S. market.
  • AGS.BE: Indicates the Ageas stock CFD traded on the Belgium market.
  • CARLB.DK: Indicates the Carlsberg stock CFD traded on the Denmark market.

For the complete list of Stock CFD ticker symbols, please check this page.

Action

The single action field in the order of the option can be any one of the following.

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

EXAMPLE

I. Buy

{
  "symbol": "AAPL.US"
  "action": "buy",
  "quantity":123
}

II. Sell

{
  "symbol": "AAPL.US"
  "action": "sell",
  "quantity":123
}

Limit Order

The traders can write the webhook payload for setting up Limit orders using these four payload fields:

  • Symbol
  • Action
  • Quantity
  • Limit_price

Symbol

The ticker symbol of the stock CFD. XTB represents this asset class by pairing the stock ticker symbol with its corresponding market designation and binds with (.).

For Example:

  • AAPL.US: Indicates the Apple stock CFD traded on a U.S. market.
  • AGS.BE: Indicates the Ageas stock CFD traded on the Belgium market.
  • CARLB.DK: Indicates the Carlsberg stock CFD traded on the Denmark market.

For the complete list of Stock CFD ticker symbols, please check this page.

Action

The signal action indicates the type of trade to be triggered. The action can be any of the following:

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

Limit_price

An optional field specifying the execution price for a “buy” or  “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.

EXAMPLE

I. Buy

{
  "symbol": "AAPL.US",
  "action": "buy",
  "quantity": 123,
  "limit_price": 123.98,
}

II. Sell

{
  "symbol": "AAPL.US",
  "action": "sell",
  "quantity": 123,
  "limit_price": 123.98,
}

Stop Order

The traders can write the webhook payload for setting up Stop orders using these four payload fields:

  • Symbol
  • Action
  • Quantity
  • Stop_price

Symbol

The ticker symbol of the stock CFD. XTB represents this asset class by pairing the stock ticker symbol with its corresponding market designation and binds with (.).

For Example:

  • AAPL.US: Indicates the Apple stock CFD traded on a U.S. market.
  • AGS.BE: Indicates the Ageas stock CFD traded on the Belgium market.
  • CARLB.DK: Indicates the Carlsberg stock CFD traded on the Denmark market.

For the complete list of Stock CFD ticker symbols, please check this page.

Action

The signal action indicates the type of trade to be triggered. The action can be any of the following:

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

Stop_price

An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.

EXAMPLE

I. Buy

{
  "symbol": "AAPL.US",
  "action": "buy",
  "quantity": 123,
  "stop_price": 123.98,
}

II. Sell

{
  "symbol": "AAPL.US",
  "action": "sell",
  "quantity": 123,
  "stop_price": 123.98,
}

ETF

The following outlines the appropriate format that the traders must follow while writing the webhook payload for setting up the following types of ETF orders to be executed on the XTB platform.

Market Order

The traders can write the webhook payload for setting up Market orders using these three payload fields:

  • Symbol
  • Action
  • Quantity

Symbol

The ticker symbol of the ETF CFD. XTB represents this asset class by pairing the ETF ticker symbol with its corresponding market designation and binds with (.).

For example:

  • AAXJ.US: Indicates the iShares MSCI All Country Asia ex Japan ETF CFD traded on a U.S. market.
  • AGG.US:  Indicates the iShares Core US Aggregate ETF CFD traded on a U.S. market.
  • ARKF.US: Indicates the Ark Fintech Innovation ETF (Dist, USD) CFD traded on the U.S.

For the complete list of ETF CFD ticker symbols, please check this page.

Action

The single action field in the order of the option can be any one of the following.

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

EXAMPLE

I. Buy

{
  "symbol": "AAXJ.US"
  "action": "buy",
  "quantity":123
}

II. Sell

{
  "symbol": "AAXJ.US"
  "action": "sell",
  "quantity":123
}

Limit Order

The traders can write the webhook payload for setting up Limit orders using these four payload fields:

  • Symbol
  • Action
  • Quantity
  • Limit_price

Symbol

The ticker symbol of the ETF CFD. XTB represents this asset class by pairing the ETF ticker symbol with its corresponding market designation and binds with (.).

For example:

  • AAXJ.US: Indicates the iShares MSCI All Country Asia ex Japan ETF CFD traded on a U.S. market.
  • AGG.US:  Indicates the iShares Core US Aggregate ETF CFD traded on a U.S. market.
  • ARKF.US: Indicates the Ark Fintech Innovation ETF (Dist, USD) CFD traded on the U.S.

For the complete list of ETF CFD ticker symbols, please check this page.

Action

The signal action indicates the type of trade to be triggered. The action can be any of the following:

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

Limit_price

An optional field specifying the execution price for a “buy” or  “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.

EXAMPLE

I. Buy

{
  "symbol": "AAXJ.US",
  "action": "buy",
  "quantity": 123,
  "limit_price": 123.98,
}

II. Sell

{
  "symbol": "AAXJ.US",
  "action": "sell",
  "quantity": 123,
  "limit_price": 123.98,
}

Stop Order

The traders can write the webhook payload for setting up Stop orders using these four payload fields:

  • Symbol
  • Action
  • Quantity
  • Stop_price

Symbol

The ticker symbol of the ETF CFD. XTB represents this asset class by pairing the ETF ticker symbol with its corresponding market designation and binds with (.).

For example:

  • AAXJ.US: Indicates the iShares MSCI All Country Asia ex Japan ETF CFD traded on a U.S. market.
  • AGG.US:  Indicates the iShares Core US Aggregate ETF CFD traded on a U.S. market.
  • ARKF.US: Indicates the Ark Fintech Innovation ETF (Dist, USD) CFD traded on the U.S.

For the complete list of ETF CFD ticker symbols, please check this page.

Action

The signal action indicates the type of trade to be triggered. The action can be any of the following:

  • Buy: Triggers an action to buy the asset.
  • Sell: Triggers an action to sell the asset.

Quantity

The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.

Stop_price

An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.

EXAMPLE

I. Buy

{
  "symbol": "AAXJ.US",
  "action": "buy",
  "quantity": 123,
  "stop_price": 123.98,
}

II. Sell

{
  "symbol": "AAXJ.US",
  "action": "sell",
  "quantity": 123,
  "stop_price": 123.98,
}

Contact Us

Not finding what you're looking for? Contact Us Directly