• Invest: 1-855-880-2559
  • Open 24/7

Ally Invest API

POST accounts/:id/orders{.format}

Description

This call will allow you to place an order. This requires the order data is submitted in FIXML format submitted as XML within the body.

Authentication Required
Yes OAuth 1.0a
URI Parameters
id a valid account number
format a response format, default is xml (See Response Structure)
Header Parameters
TKI_TRADEPASS The user's trading password (if necessary). This is not common. Normally used when many accounts are tied to the same user, but specific accounts require separate trading passwords.
TKI_OVERRIDE Override any order warnings. If there are no order warnings, this is not required. In the event of an order warning, this must be used to successfully send orders and bypass the warning messages.
Example URL
https://api.tradeking.com/v1/accounts/12345678/orders.xml

Special Considerations

The request for order placement must be FIXML format submitted within the message body. Please visit the FIXML page as well as the Trading page for more information.

Data Fields

Please see the FIXML documentation for more information.

Request Example

POST /v1/accounts/123456878/orders.xml HTTP/1.1
Authorization: OAuth
  oauth_consumer_key="672e71387c0a126f4e13296ecfb2b7bc",
  oauth_nonce="cfdb7f42de425d94fbc24c11a920c33e",
  oauth_signature="Vfm148kAgBZ6azEHqds43aY2UsEg3D",
  oauth_signature_method="HMAC-SHA1",
  oauth_timestamp="1306871932",
  oauth_token="819682555b63ab8bd90a4138138e7365",
  oauth_version="1.0"
Connection: close
TKI_TRADEPASS: myPass
TKI_OVERRIDE: true
Host: api.tradeking.com
<?xml version="1.0" encoding="UTF-8"?>
<FIXML xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2">
  <Order TmInForce="0" Typ="1" Side="1" Acct="12345678">
    <Instrmt SecTyp="CS" Sym="GE"/>
    <OrdQty Qty="1"/>
  </Order>
</FIXML>

Response Example (Successful trade with override)

<?xml version="1.0" encoding="UTF-8"?>
<response id="77cf30da:12e0091b2c0:-50cb">
  <clientorderid>SVI-12345678</clientorderid>
  <orderstatus>0</orderstatus>
</response>

Response Example (Successful request but with override set to false)

<?xml version="1.0" encoding="UTF-8"?>
<response id="77cf30da:12e0091b2c0:-4f5d">
  <warning>
    <warningcode>004</warningcode>
    <warningtext>This may be a duplicate order. Please go to the Order Status screen and review your open orders before continuing.</warningtext>
  </warning>
  <estcommission>4.95</estcommission>
  <marginrequirement>0.0</marginrequirement>
  <netamt>25.85</netamt>
  <principal>20.9</principal>
  <quotes>
    <instrumentquote>
      <greeks/>
      <instrument>
        <desc>GENERAL ELECTRIC CO</desc>
        <exch>NYE</exch>
        <sectyp>CS</sectyp>
        <sym>GE</sym>
      </instrument>
      <quote>
        <askprice>20.91</askprice>
        <bidprice>20.9</bidprice>
        <change>0.34</change>
        <extendedquote>
          <asksize>247</asksize>
          <bidsize>264</bidsize>
          <dividenddata>
            <amt>0.14</amt>
            <exdate>2010-12-22T00:00:00-05:00</exdate>
            <paydate>2011-01-25T00:00:00-05:00</paydate>
            <yield>2.68</yield>
          </dividenddata>
          <earningspershare>1.15</earningspershare>
          <high52price>21.0</high52price>
          <highprice>21.0</highprice>
          <low52price>13.75</low52price>
          <lowprice>20.73</lowprice>
          <openprice>20.77</openprice>
          <prevclose>20.56</prevclose>
          <priceearningsratio>18.18</priceearningsratio>
          <sessionvolume>20000033</sessionvolume>
          <volume>20321868</volume>
        </extendedquote>
        <lastprice>20.9</lastprice>
        <pctchange>1.65</pctchange>
      </quote>
      <unknownsymbol>false</unknownsymbol>
    </instrumentquote>
  </quotes>
  <secfee>0.0</secfee>
</response>
Disclaimer:

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.