Supported Models

Terminal Link

Introduction

This page explains the Terminal Link brokerage, including the asset classes it supports, its default security-level models, and it's default markets.

Asset Classes

Terminal Link supports trading the following asset classes:

Orders

Terminal Link enables you to create and manage Bloomberg™ orders.

Order Types

The following table describes the available order types for each asset class that Terminal Link supports:

Order TypeEquityEquity OptionsFuturesIndex Options
Marketgreen checkgreen checkgreen checkgreen check
Limitgreen checkgreen checkgreen checkgreen check
Stop marketgreen checkgreen checkgreen checkgreen check
Stop limitgreen checkgreen checkgreen checkgreen check

Order Properties

We model custom order properties from the Bloomberg EMSX API. The following table describes the members of the TerminalLinkOrderProperties object that you can set to customize order execution:

PropertyData TypeDescriptionDefault Value
TimeInForcetime_in_forceTimeInForceA TimeInForce instruction to apply to the order. The following instructions are supported:
  • DayDAY
  • GoodTilCanceledGOOD_TIL_CANCELED
  • GoodTilDategood_til_date
TimeInForce.GoodTilCanceledTimeInForce.GOOD_TIL_CANCELED
NotesnotesstringstrThe free form instructions that may be sent to the broker.
HandlingInstructionhandling_instructionstringstrThe instructions for handling the order or route. The values can be preconfigured or a value customized by the broker.
CustomNotes1custom_notes_1stringstrCustom user order notes 1. For more information about custom order notes, see Custom Notes & Free Text Fields in the EMSX API documentation
CustomNotes2custom_notes_2stringstrCustom user order notes 2.
CustomNotes3custom_notes_3stringstrCustom user order notes 3.
CustomNotes4custom_notes_4stringstrCustom user order notes 4.
CustomNotes5custom_notes_5stringstrCustom user order notes 5.
AccountaccountstringstrThe EMSX account.
BrokerbrokerstringstrThe EMSX broker code.
StrategystrategyStrategyParameters An object that represents the EMSX order strategy details. You must append strategy parameters in the order that the EMSX API expects. The following strategy names are supported: "DMA", "DESK", "VWAP", "TWAP", "FLOAT", "HIDDEN", "VOLUMEINLINE", "CUSTOM", "TAP", "CUSTOM2", "WORKSTRIKE", "TAPNOW", "TIMED", "LIMITTICK", "STRIKE"
ExecutionInstructionexecution_instructionstringstrThe execution instruction field.
AutomaticPositionSidesautomatic_position_sidesboolA flag that determines whether to automatically include the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell).
PositionSideposition_sideOrderPosition?OrderPosition/NoneType An OrderPosition object that specifies the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell). This member has precedence over AutomaticPositionSidesautomatic_position_sides.
ExchangeexchangeExchangeDefines the exchange name for sending the order to.
public override void Initialize()
{
    // Set the default order properties
    DefaultOrderProperties = new TerminalLinkOrderProperties
    {
        TimeInForce = TimeInForce.GoodTilCanceled,
        Strategy = new TerminalLinkOrderProperties.StrategyParameters(
            "VWAP",
            new List<TerminalLinkOrderProperties.StrategyField>
            {
                new("09:30:00"),
                new("10:30:00"),
                new(),
                new()
            }
         )
    };
}

public override void OnData(Slice slice)
{
    // Use default order order properties
    LimitOrder(_symbol, quantity, limitPrice);
    
    // Override the default order properties
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new TerminalLinkOrderProperties
               { 
                   TimeInForce = TimeInForce.Day,
                   Account = "account1"
               });
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new TerminalLinkOrderProperties
               { 
                   TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                   Account = "account2"
               });
}
def initialize(self) -> None:
    # Set the default order properties
    self.default_order_properties = TerminalLinkOrderProperties()
    self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED
    self.default_order_properties.strategy = TerminalLinkOrderProperties.StrategyParameters(
        "VWAP",
        [
            TerminalLinkOrderProperties.StrategyField("09:30:00"),
            TerminalLinkOrderProperties.StrategyField("10:30:00"),
            TerminalLinkOrderProperties.StrategyField(),
            TerminalLinkOrderProperties.StrategyField()
        ]
    )

def on_data(self, slice: Slice) -> None:
    # Use default order order properties
    self.limit_order(self._symbol, quantity, limit_price)
    
    # Override the default order properties
    order_properties = TerminalLinkOrderProperties()
    order_properties.time_in_force = TimeInForce.DAY
    order_properties.account = "account1"
    self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)

    order_properties.time_in_force = TimeInForce.good_til_date(datetime(year, month, day))
    order_properties.account = "account2"
    self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)

For more information about the format that the Bloomberg EMSX API expects, see Create Order and Route Extended Request in the EMSX API documentation and the createOrderAndRouteWithStrat documentation on the MathWorks website.

Get Open Orders

Terminal Link lets you access open orders.

Monitor Fills

Terminal Link allows you to monitor orders as they fill through order events.

Updates

Terminal Link doesn't support order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates.

Cancellations

Terminal Link enables you to cancel open orders.

Handling Splits

If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

  • Quantity
  • Limit price
  • Stop price
  • Trigger price

Fills

To view how we model fills in backtests, see Fills.

Slippage

To view how we model slippage in backtests, see Slippage.

Fees

To view how we model fees in backtests, see Fees.

Buying Power

To view how we model buying power in backtests, see Buying Power.

Settlement

To view how we model settlements in backtests, see Settlement.

Margin Interest Rate

To view how we model margin interest rates in backtests, see Margin Interest Rate.

Default Markets

To view the default markets of each asset class when you use Terminal Link, see Default Markets.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: