API Overnight Trading

Articles From: Interactive Brokers
Website: Interactive Brokers


IBKR-API Support Supervisor

Interactive Brokers

In recent posts from Interactive Brokers, customers may be aware that overnight trading for US Stocks and Options is now available through Interactive Brokers. For those that are unfamiliar, the US Overnight Trading article is available for more information. But what users may not know is that overnight trading is available through our API offerings as well.

For the TWS API, the process to place Overnight orders is quite simple. To begin, users will want to upgrade to the Latest release for Trader Workstation or IB Gateway, as well as the API.

After upgrading your software, customers will only need to update the contracts to direct orders appropriately. This would mean that your existing exchange should be set to “OVERNIGHT” while the primaryExchange should be set to the instrument’s primary listing exchange. An example of an Apple INC. contract being routed to OVERNIGHT is displayed below. Now your order will be directed to the Overnight exchange.

contract = Contract()
contract.symbol = "AAPL"
contract.secType = "STK"
contract.currency = "USD"
contract.exchange = "OVERNIGHT"
contract.primaryExchange = "NASDAQ"

The Client Portal API’s system is identical in this manner. The CPAPI simply requires that the listingExchange value be added to orders, or the exchange value be added to market data requests. Setting these values to “OVERNIGHT” will result in an order directed to the Interactive Brokers Overnight exchange. An example of the JSON order would look similar to the details below:

  "listingExchange": "OVERNIGHT"

With the exchange value set in either API, the order should be routing correctly. It’s important to note that the same routing information should be used when looking at Market Data. This is because the OVERNIGHT trading does not coincide with regular SMART routed data, so trade values may differ than what may be shown when making API market data requests or reviewing a contract in Trader Workstation. A similar structure to the requests above will apply to market data requests. For users that might want to view data in Trader Workstation differently should follow the direct routing steps listed in our Direct Routing guide, with the OVERNIGHT exchange set.

Please note that the API maintains the same trading permission restrictions as documented for the Trader Workstation guide. For more information on requesting the Overnight Trading Permission, please see the additional US Overnight Trading Instructions.

Join the Discussion

Thank you for engaging with IBKR Campus. If you have a general question, it may already be covered in our FAQs. If you have an account-specific question or concern, please reach out to Client Services.

Your email address will not be published. Required fields are marked *

Disclosure: Interactive Brokers

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

The views and opinions expressed herein are those of the author and do not necessarily reflect the views of Interactive Brokers, its affiliates, or its employees.

Disclosure: Order Types / TWS

The order types available through Interactive Brokers LLC’s Trader Workstation are designed to help you limit your loss and/or lock in a profit. Market conditions and other factors may affect execution. In general, orders guarantee a fill or guarantee a price, but not both. In extreme market conditions, an order may either be executed at a different price than anticipated or may not be filled in the marketplace.

Disclosure: Options Trading

Options involve risk and are not suitable for all investors. Multiple leg strategies, including spreads, will incur multiple commission charges. For more information read the “Characteristics and Risks of Standardized Options” also known as the options disclosure document (ODD) or visit ibkr.com/occ

Disclosure: API Examples Discussed

Throughout the lesson, please keep in mind that the examples discussed are purely for technical demonstration purposes, and do not constitute trading advice. Also, it is important to remember that placing trades in a paper account is recommended before any live trading.