Brokerages

Trading Technologies

Introduction

QuantConnect enables you to run your algorithms in live mode with real-time market data. We have successfully hosted more than 200,000 live algorithms and have had more than $15B in volume traded on our servers since 2015. Brokerages supply a connection to the exchanges so that you can automate orders using LEAN. You can use multiple data feeds in live trading algorithms.

Trading Technologies (TT) was founded by Gary Kemp in 1994 with the goal to create professional trading software, infrastructure, and data solutions for a wide variety of users. TT provides access to trading Futures, Options, and Crypto. TT also provides a charting platform, infrastructure services, and risk management tools. TT is not actually a brokerage. The firm is a brokerage router with access to more than 30 execution destinations.

Modeling

The TradingTechnologiesBrokerageModel does not have specific modeling for fees and slippage because TT is not a real brokerage. In live trading, TT reports the total fees of your orders after each order fill. Pass a different BrokerageName to SetBrokerageModel to backtest your algorithm with fee and slippage modeling. The brokerage model you set should support the asset classes and orders in your algorithm.

SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Cash);
SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Margin);
self.SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Margin)

Create an Account

Follow the account creation wizard on the TT website to create a TT account.

Paper Trading

Our TT integration does not support paper trading through the TT Simulation environment, but you can follow these steps to simulate it:

  1. In the Initialize method of your algorithm, add one of the preceding SetBrokerageModel method calls.
  2. Deploy your algorithm with the QuantConnect Paper Trading brokerage.

Asset Classes

Our TT integration supports trading Futures.

AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, Market.CME);
self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, Market.CME)

If you call the SetBrokerageModel method with the correct BrokerageName, then you don't need to pass a Market argument to the AddFuture method because the brokerage model automatically selects the correct market.

Assets Available

Refer to the US Futures dataset to see the assets available.

Orders

We model the TT API by supporting several order types, the TimeInForce order property, and order updates. When you deploy live algorithms, you can place manual orders through the IDE.

Order Types

TT supports the following order types:

  • MarketOrder
  • LimitOrder
  • StopMarketOrder
  • StopLimitOrder
MarketOrder(_symbol, quantity);
LimitOrder(_symbol, quantity, limitPrice);
StopMarketOrder(_symbol, quantity, stopPrice);
StopLimitOrder(_symbol, quantity, stopPrice, limitPrice);
self.MarketOrder(self.symbol, quantity)
self.LimitOrder(self.symbol, quantity, limit_price)
self.StopMarketOrder(self.symbol, quantity, stop_price)
self.StopLimitOrder(self.symbol, quantity, stop_price, limit_price)

TT enforces the following order rules:

  • If you are buying (selling) with a StopMarketOrder or a StopLimitOrder, the stop price of the order must be greater (less) than the current security price.
  • If you are buying (selling) with a StopLimitOrder, the limit price of the order must be greater (less) than the stop price.

Time In Force

We model the TimeInForce order property from the TT API. TT supports the Day and GoodTilCanceled TimeInForce properties.

public override void Initialize()
{
    // Set the default order properties
    DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
}

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 OrderProperties
               { 
                   TimeInForce = TimeInForce.Day 
               });
}
def Initialize(self) -> None:
    # Set the default order properties
    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled

def OnData(self, slice: Slice) -> None:
    # Use default order order properties
    self.LimitOrder(self.symbol, quantity, limit_price)
    
    # Override the default order properties
    order_properties = OrderProperties()
    order_properties.TimeInForce = TimeInForce.Day
    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

Updates

We model the TT API by supporting order updates. You can define the following members of UpdateOrderFields object to update active orders:

  • Quantity
  • LimitPrice
  • StopPrice
  • Tag
var ticket = StopLimitOrder(symbol, quantity, stopPrice, limitPrice, tag);
var orderFields = new UpdateOrderFields { 
Quantity = newQuantity,
LimitPrice = newLimitPrice,
StopPrice = newStopPrice,
Tag = newTag
}; ticket.Update(orderFields);
ticket = self.StopLimitOrder(symbol, quantity, stop_price, limit_price, tag)
update_fields = UpdateOrderFields() update_fields.Quantity = new_quantity
update_fields.LimitPrice = new_limit_price
update_fields.StopPrice = new_stop_price update_fields.Tag = new_tag ticket.Update(update_fields)

Fees

We model the order fees of TT, which are $0. To check the latest fees, see the Pricing page on the TT website.

Margin

We model buying power and margin calls to ensure your algorithm stays within the margin requirements and only submits valid orders to TT in live trading.

Buying Power

The DefaultBrokerageModel allows up to 1x leverage on Futures trades.

Margin Calls

Regulation T margin rules apply. When the amount of margin remaining in your portfolio drops below 5% of the total portfolio value, you receive a warning. When the amount of margin remaining in your portfolio drops to zero or goes negative, the portfolio sorts the generated margin call orders by their unrealized profit and executes each order synchronously until your portfolio is within the margin requirements.

Slippage

Orders through TT do not experience slippage in backtests. In live trading, your orders may experience slippage.

Fills

We fill market orders immediately and completely in backtests. In live trading, if the quantity of your market orders exceeds the quantity available at the top of the order book, your orders are filled according to what is available in the order book.

Security and Stability

Note the following security and stability aspects of our TT integration.

Account Credentials

When you deploy live algorithms with TT, we don't save your brokerage account credentials.

API Outages

We call the TT API to place live trades. Sometimes the API may be down. Check the TT status page to see if the API is currently working.

Deposits and Withdraws

You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM Eastern Time (ET).

Demo Algorithm

The following algorithm demonstrates the functionality of the TT brokerage:

Deploy Live Algorithms

You must have an available live trading node for each live trading algorithm you deploy.

Follow these steps to deploy a live algorithm:

  1. Open the project that you want to deploy.
  2. Click the Deploy Live icon.
  3. On the Deploy Live page, click the Brokerage field and then click Trading Technologies from the drop-down menu.
  4. Enter your TT user name, account name, routing sender, session password, app key, and app secret.
  5. Our TT integration routes orders via the TT FIX 4.4 Connection. Contact your TT representative to set the exchange where you would like your orders sent. Your account details are not saved on QuantConnect.

    Our integration fetches your positions using the REST endpoint, so the app key and app secret are your REST App credentials.

  6. Click the Environment field and then click one of the environments from the drop-down menu.
  7. The following table shows the supported environments:

    EnvironmentDescription
    LiveTrade in the production environment
    UATTrade in the User Acceptance Testing environment
  8. Click the Node field and then click the live trading node that you want to use from the drop-down menu.
  9. If your brokerage account has existing cash holdings, follow these steps:
    1. In the Algorithm Cash State section, click Show.
    2. Click Add Currency.
    3. Enter the currency ticker (for example, USD or CAD) and a quantity.
  10. (Optional) Set up notifications.
  11. Configure the Automatically restart algorithm setting.
  12. By enabling automatic restarts, the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection.

  13. Click Deploy.

The deployment process can take up to 5 minutes. When the algorithm deploys, the live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

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: