QuoteTracker. Real-Time Intraday Charts, Quotes, Alerts, News Monitoring and Portfolio Management.

 

SCREENS
BETA SITE
DOWNLOAD
TESTIMONIALS
REGISTRATION
INVESTOR
RESOURCES

SALES



QT Trading API - Interactive Brokers (IB.TRD)


SEND COMMANDS (Client Application to QT Server)

The following SEND TYPE commands are supported for Interactive Brokers:

NEWORDER- Sends a New Order to the broker
MODIFYORDER- Modifies an existing order
CANCELORDER- Cancels one or more orders
REFTRAN- Forces a refresh of transactions. No parameters
REFBAL- Forces a refresh of Balances and Positions. No parameters

NOTIFICATION RESPONSES (QT Server to Application)

The following is a list of Notification TYPES that can be returned:

ACK- acknowledgement of a successful order transaction.
ERROR- Error while parsing command or error returned from the broker
TRANSACTIONS- List of transactions for the day
BALANCES- Current Balances information
POSITIONS- Current Positions information

SEND COMMANDS DETAILS

NEWORDER - Send a New Order to the broker Back to Top

 Parameter Name  Parameter Values and Description 
 Symbol Symbol of the security being traded 
 SymbolType STOCK, OPTION, FUTURE, FUTOPTION, WARRANT, CASH 
 Action BUY, SELL, SHORT 
 Quantity Number of Shares or Contracts in the transaction 
 OrderType LIMIT, MARKET, MKTCLS, LMTCLS, RELATIVE, STOPLIMIT, STOPMARKET, TSTOP, VWAP, PEGMKT 
 LimitPrice LIMIT Price for Limit AND Stop Limit orders 
 StopPrice STOP Price for STOP orders, or Trail Amount for Trailing Stop 
 TIF Time In Force: DAY, GTC, IOC 
 Route SMART, GLOBEX, etc... 
 Currency SMART, GLOBEX, etc... 
 TriggerMethod Integer value that specifies how various STOP orders are triggered. Valid Values are (Same as IB API):

0 - the default value. The "double bid/ask" method will be used for orders for OTC stocks and US options. All other orders will used the "last" method.

1 - use "double bid/ask" method, where stop orders are triggered based on two consecutive bid or ask prices.

2 - "last" method, where stop orders are triggered based on the last price.

3 - "double-last" method, where stop orders are triggered based on last two prices.

 IgnoreRTH If set to YES (or TRUE), allows triggering of orders outside of regular trading hours. 
 Symbol Symbol of the security to be traded 
 Action BUY, SELL, SHORT
 Can also use COVER, BUY_OPEN, BUY_CLOSE, SELL_OPEN, SELL_CLOSE, but they will just be converted to BUY/SELL/SHORT 
 OrderType LIMIT, MARKET, STOPMARKET, STOPLIMIT, TSTOP,TTO,MARKET+TTO,LIMIT+TTO,STOPMARKET+TTO,MARKET+TSTOP,LIMIT+TSTOP 
 Quantity Number of Shares or Contracts in the transaction 
 LimitPrice LIMIT Price for Limit AND Stop Limit orders 
 StopPrice STOP Price (Activation Price) for STOP orders, or Trail Amount for Trailing Stop 

NOTE: Very little error checking is done for API order prior to sending them to the broker. Some parameter value combinations are not available, such as OrderType: MARKET Route: INET. Invalid orders will be rejected by Interactive Brokers and the rejection will be returned to you in a NOTIFICATION message.

EXAMPLE:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <ACTION>SEND</ACTION>
    <TYPE>NEWORDER</TYPE>
    <PARAMS>
        <Symbol>DELL</Symbol>
        <Action>BUY</Action>
        <OrderType>LIMIT</OrderType>
        <Quantity>500</Quantity>
        <LimitPrice>41.72</LimitPrice>
        <TIF>DAY</TIF>
        <Route>SMART</Route>
    </PARAMS>
</TRADEAPI>
{FF}

 
MODIFYORDER - Modifies an existing order Back to Top

 Parameter Name  Parameter Values and Description 
 OrderID REQUIRED - The Order ID of the order being modified. Should be retrieved from TRANSACTIONS 
 Quantity OPTIONAL - Number of Shares or Contracts in the transaction 
 LimitPrice OPTIONAL - LIMIT Price for Limit AND Stop Limit orders 
 StopPrice OPTIONAL - STOP Price (Activation Price) for STOP orders, or Trail Amount for Trailing Stop 
 TriggerMethod OPTIONAL - Specifies how various STOP orders are triggered. (Same as in NEWORDER) 

NOTE: Only the Order ID is required. For the other fields, only the ones that are modified need to be sent. The others can be omitted or you can send the value that was returned in TRANSACTIONS. For TriggerMethod, the User Specified default in QuoteTracker will be used if the tag is omitted.

EXAMPLE:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <ACTION>SEND</ACTION>
    <TYPE>MODIFYORDER</TYPE>
    <PARAMS>
        <OrderID>:A33005896:0003</OrderID>
        <LimitPrice>41.72</LimitPrice>
        <DisplaySize>200</DisplaySize>
    </PARAMS>
</TRADEAPI>
{FF}

 
CANCELORDER - Cancels one or more orders Back to Top

 Parameter Name  Parameter Values and Description 
 OrderID The Order ID of the order to be canceled.

NOTE: To cancel more than one order at a time, just include multiple OrderID XML tags, one for each order

EXAMPLE:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <ACTION>SEND</ACTION>
    <TYPE>CANCELORDER</TYPE>
    <PARAMS>
        <OrderID>1183913536</OrderID>
        <OrderID>1183913537</OrderID>
        <OrderID>1183913538</OrderID>
    </PARAMS>
</TRADEAPI>
{FF}

 

NOTIFICATION RESPONSES

NOTE: The examples below will not show Record ID or Record Length for simplicity, even though they are sent with every message.




ACK - Acknowledgement of a successful order transaction Back to Top

Result returned in XML.
EXAMPLES:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>ACK</TYPE>
    <MESSAGE>Transaction Sent</MESSAGE>
</TRADEAPI>

  OR

 
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>ACK</TYPE>
    <MESSAGE>Cancel Order Sent - 1183913539</MESSAGE>
</TRADEAPI>

 
ERROR - Error while parsing command or error returned from the broker Back to Top

Result returned in XML.
EXAMPLES:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>ERROR</TYPE>
    <MESSAGE>Unable to get Positions data</MESSAGE>
</TRADEAPI>

 
TRANSACTIONS - List of transactions on the account for the day Back to Top

Result returned in XML.
 Parameter Name  Parameter Values and Description 
 OrderID Order ID of the order 
 Action BUY, SELL, etc. (Same as in NEWORDER) 
 Quantity Number of Shares or Contracts in the transaction 
 Symbol Symbol of the security being traded 
 SymbolType STOCK, OPTION, FUTURE, FUTOPTION, WARRANT, CASH 
 OrderType LIMIT, MARKET, etc. (Same as in NEWORDER) 
 LimitPrice LIMIT Price for Limit AND Stop Limit orders 
 StopPrice STOP Price for STOP orders, or Trail Amount for Trailing Stop 
 TIF Time In Force: DAY, GTC, IOC (Same as in NEWORDER) 
 OrderStatus Current Status of the order (Submitted, Cancelled, Filled, Pending Submit, Pending Cancel, PreSubmitted, etc) 
 Open YES/NO - Whether or not this is an OPEN order - Still being processed 
 Route SMART, GLOBEX, etc... (Same as in NEWORDER) 
 FillPrice The execution price (Average if partial fills) 
 FillTime Date/Time of the last fill  
 FilledQuantity Number of Shares or Contracts that have been filled  
 UnfilledQuantity # of Shares or Contracts yet to be filled 

EXAMPLES:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>TRANSACTIONS</TYPE>
    <TRANSACTIONS>
        <ORDER>
            <OrderID>1183913539</OrderID>
            <Action>BUY</Action>
            <Quantity>3</Quantity>
            <Symbol>@ESM5</Symbol>
            <SymbolType>FUTURE</SymbolType>
            <OrderType>LIMIT</OrderType>
            <LimitPrice>1,171.00</LimitPrice>
            <StopPrice></StopPrice>
            <TIF>DAY</TIF>
            <OrderStatus>Submitted</OrderStatus>
            <Open>YES</Open>
            <Route>GLOBEX</Route>
            <FillPrice></FillPrice>
            <FillTime></FillTime>
            <FilledQuantity>0</FilledQuantity>
            <UnfilledQuantity>3</UnfilledQuantity>
        </ORDER>
        <ORDER>
            <OrderID>1183913540</OrderID>
            <Action>BUY</Action>
            <Quantity>3</Quantity>
            <Symbol>@ESM5</Symbol>
            <SymbolType>FUTURE</SymbolType>
            <OrderType>MARKET</OrderType>
            <LimitPrice></LimitPrice>
            <StopPrice></StopPrice>
            <TIF>DAY</TIF>
            <OrderStatus>Filled</OrderStatus>
            <Open>NO</Open>
            <Route>GLOBEX</Route>
            <FillPrice>1,172.00</FillPrice>
            <FillTime>05/12/2005 21:46:41</FillTime>
            <FilledQuantity>3</FilledQuantity>
            <UnfilledQuantity>0</UnfilledQuantity>
        </ORDER>
    </TRANSACTIONS>
</TRADEAPI>

 
BALANCES - Current Balances information Back to Top

Result returned in XML.
NOTE: The values for the NAME Field are coming directly from Interactive Brokers. They can change without notice.
EXAMPLES:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>BALANCES</TYPE>
    <BALANCES>
        <UnalteredInitMarginReq>-1.00</UnalteredInitMarginReq>
        <BuyingPower>80,984.60</BuyingPower>
        <UnrealizedPnL></UnrealizedPnL>
        <TotalCashBalance></TotalCashBalance>
        <PreviousDayEquityWithLoanValue>50,000.00</PreviousDayEquityWithLoanValue>
        <NetLiquidation>49,942.30</NetLiquidation>
        <InitMarginReq>11,812.50</InitMarginReq>
        <RealizedPnL></RealizedPnL>
        <StockMarketValue></StockMarketValue>
        <UnalteredMaintMarginReq>-1.00</UnalteredMaintMarginReq>
        <FutureOptionValue></FutureOptionValue>
        <OptionMarketValue></OptionMarketValue>
        <EquityWithLoanValue>40,492.30</EquityWithLoanValue>
        <FuturesPNL></FuturesPNL>
        <GrossPositionValue>0.00</GrossPositionValue>
        <DayTradesRemaining>-1</DayTradesRemaining>
        <MaintMarginReq>9,450.00</MaintMarginReq>
    </BALANCES>
</TRADEAPI>

 
POSITIONS - Current Positions information Back to Top

Result returned in XML.
EXAMPLES:
     <TRADEAPI>
    <ID>MISCS1</ID>
    <TYPE>POSITIONS</TYPE>
    <POSITIONS>
        <POSITION>
            <Symbol>@ESM5</Symbol>
            <Quantity>3</Quantity>
            <SymbolType>FUTURE</SymbolType>
            <Cost>1,171.75</Cost>
            <Expire>20050616</Expire>
            <Strike>0.0</Strike>
            <Right></Right>
            <Currency>USD</Currency>
            <Value>175,762.50</Value>
        </POSITION>
        <POSITION>
            <Symbol>DELL</Symbol>
            <Quantity>500</Quantity>
            <SymbolType>STOCK</SymbolType>
            <Cost>36.70</Cost>
            <Expire></Expire>
            <Strike>0.0</Strike>
            <Right></Right>
            <Currency>USD</Currency>
            <Value>18,350.00</Value>
        </POSITION>
        ... More POSITION records ...
    </POSITIONS>
</TRADEAPI>