The API itself doesn't have any business objects defined by the system back-end that contain the data necessary to make trades. Instead, FIX protocol messages are required, using a standard known as FIXML.
The Ally Invest API supports order functionality for stock and option orders. Required order information is required to be submitted in FIXML format within the body of any order requests through the API. You can find sample orders in FIXML format to illustrate potential order messaging on the trading page. The current implementation relies on FIXML schema specification v 5.0 service pack 2, available for download at http://www.fixprotocol.org.
Order support is included for basic stock and options orders and well as multi-leg support for complex option strategies such as spreads, straddles, covered calls, & iron condors. Support includes the following:
FIXML tag attributes are repeated in several of the examples shown on the trading page. The following table is a sample list of the attributes required along with a description.
|FIXML Attribute||Description & Notes|
|Acct||Account number needs to be passed with all order requests.|
|AcctTyp||Only used for closing short positions, "Buy to Cover" orders should include this attribute as AcctTyp="5".|
|CFI||Abbreviation for "classification of financial instrument", used for options to distinguish "OC" for call option or "OP" for put option.|
|Mat||Represents the expiration date of a option. Needs to be in the format of "YYYY‐MM‐ DDT00:00:00.000‐05:00". For single leg orders, this attribute tag changes from Mat to MatDt.|
|MatDt||Represents the expiration date of a option. Needs to be in the format of "YYYY‐MM‐ DDT00:00:00.000‐05:00". For multiple leg orders, this attribute tag changes from MatDt to Mat.|
|MMY||Expiration of the option in the format of YYYYMM.|
|OrigID||Order ID that needs to be passed for any change or cancel requests. Note: for Multi‐leg orders, use tag OrigClOrdID instead of OrigID.|
|PosEfct||Used for options, option legs require and attribute of "O" for opening or "C" for closing.|
|Px||Price for price type if needed. This attribute would be required for limits (Typ = "2") or stop limits (Typ="4").|
|SecTyp||Security type attribute is needed. "CS" for common stock or "OPT" for option.|
|Side||Side of market as "1" ‐ Buy, "2" ‐ Sell, "5" ‐ Sell Short. Buy to cover orders are attributed as buy orders with Side="1".|
|Strk||Strike price of option contract. This tag changes from Strk to StrkPx for single leg orders.|
|StrkPx||Strike price of option contract. This tag changes from StrkPx to Strk for multi‐leg orders.|
|Sym||Ticker symbol of underlying security. This is utilized for stock, option, & multi‐leg orders.|
|TmInForce||Time in force, possible values include "0" ‐ Day Order, "1" ‐ GTC Order, "7" ‐ Market on Close. Not applicable when Typ="1" (market order).|
|Typ||Price Type as "1" ‐ Market, "2" ‐ Limit", "3" ‐ Stop, "4" Stop Limit, or "P" for trailing stop.|
|ExecInst||Used for trailing stop orders. Value of ExecInst="a" needs to be passed.|
|OfstTyp||Used for trailing stop orders. Value of OfstTyp="0" needs to be passed. The offset value of "0" denotes a "price" offset from the PegPxTyp field below. The offset value of "1" denotes a "basis point" offset from the PegPxTyp field below (used as a percentage offset).|
|PegPxTyp||Used for trailing stop orders defining type of peg (price used) for trailing. In this case, PegPxTyp="1" references "last price" of security.|
|OfstVal||Used for trailing stop orders. Signed value needs to be passed for amount of offset value combined with the PegPxTyp & OfstTyp fields. Negative values are normally used for sell trailing stops so the trigger trails below current price. Positive values are normally used for buy trailing stops so the trigger trails above the current price. For example, assuming an OfstTyp ="0", a sell order with a OfstVal of ‐.50 will trigger if the current price falls by more than .50 of its last highest value since the order was placed. OfstType="1" would require the signed value for a percentage. For example, OfstVal="5" would represent a 5% increase in price before a buy trailing stop is triggered.|
Any mention of actual symbols are to be used for coding purposes only and do not imply a recommendation or solicitation to buy or sell a particular security or to engage in any particular investment strategy.
At the time of publication and in the preceding month, Ally Invest did not have ownership greater than 1% in any stocks mentioned here and does not have any other actual, material conflict of interest known at the time of publication.
Ally Invest did not receive compensation from a public offering or from investment banking services related to any companies mentioned here within the past 12 months, or expects to receive any in the next 3 months. Ally Invest did not engage in market making in the securities mentioned here.
Ally Invest Securities' background can be found at FINRA's BrokerCheck. Options involve risk and are not suitable for all investors.
Review the Characteristics and Risks of Standardized Options brochure (PDF) before you begin trading options. Options investors may lose the entire amount of their investment in a relatively short period of time.