pyetrade icon indicating copy to clipboard operation
pyetrade copied to clipboard

[Warning!] ETrade API *sever* bug: Stop Price and Trailing Stop Parameter are swapped!

Open mw66 opened this issue 3 years ago • 5 comments

with this parameter:

[ place_equity_order()] {'accountId': 'xxx', 'symbol': 'STLD', 'orderAction': 'SELL', 'clientOrderId': xxx,
 'priceType': 'TRAILING_STOP_CNST', 'offsetType': 'TRAILING_STOP_CNST',
 'offsetValue': '0.66', 'trailPrice': '0.66', 'stopPrice': '64.49', 'allOrNone': False,
 'quantity': 50, 'orderTerm': 'GOOD_UNTIL_CANCEL', 'marketSession': 'REGULAR'}

I saw the placed order is:

STLD
Initial Stop Price: 0.66
Trailing Stop Parameter: 64.49 point(s) below bid

This is ridiculous: the Initial Stop Price and Trailing Stop Parameter are swapped!

I contacted ETrade customer service, this is what they said:

The current trailing stop price is set in "stopPrice" field

I cannot believe it, looks like they are not going to fix their bugs!

mw66 avatar Dec 10 '21 22:12 mw66

@mw66 I appreciate the heads up but I am unsure what to do with this issue. I think the best course of action for this project would be to make a known issues section in the docs.

jessecooper avatar Dec 13 '21 14:12 jessecooper

Yes, let's doc it.

mw66 avatar Dec 13 '21 16:12 mw66

This drove me nuts for a day. See instruction on page 22 here:

stopPrice

The designated boundary price for a stop order. For trailing stop orders this will
represent the dollar amount or percentage trailing value. Enter percentages as
whole numbers.

A PreviewOrderRequest example for options:

<PreviewOrderRequest>
    <Order>
        <Instrument>
            <Product>
                <callPut>CALL</callPut>
                <expiryDay>...</expiryDay>
                <expiryMonth>...</expiryMonth>
                <expiryYear>...</expiryYear>
                <securityType>OPTN</securityType>
                <strikePrice>4.00</strikePrice>
                <symbol>...</symbol>
            </Product>
            <orderAction>SELL_CLOSE</orderAction>
            <quantity>1</quantity>
        </Instrument>
        <allOrNone>false</allOrNone>
        <marketSession>REGULAR</marketSession>
        <orderTerm>GOOD_UNTIL_CANCEL</orderTerm>
        <priceType>TRAILING_STOP_CNST</priceType>
        <offsetType>TRAILING_STOP_CNST</offsetType>
        <stopPrice>0.15</stopPrice>
    </Order>
    <clientOrderId>...</clientOrderId>
    <orderType>OPTN</orderType>
</PreviewOrderRequest>
  • do not pass trailPrice for trailing stops; pass that value via stopPrice
  • API does not allow TRAILING_STOP_PRCT orders on options, so you'll have to stick to TRAILING_STOP_CNST's

rahulrajaram avatar Dec 28 '22 02:12 rahulrajaram