开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

API call: Error validating request.-'bF' : cause - Please enter a stop price


 

Hello all,
?
I am sending 2 STP API calls (to sell at a specific increase and decrease from the current price, whichever reaches first), but I am getting an error message regarding "enter a stop price".
What am I doing wrong? (and what is "bF"?)
Thanks
?
From the API log:
?
SMCI-STK--0.0---SMART-Nasdaq-USD-----SELL-120-STP-34.71
SMCI-STK--0.0---SMART-Nasdaq-USD-----SELL-120-STP-31.2
?
getting:
?
Error validating request.-'bF' : cause - Please enter a stop price
?
Error validating request.-'bF' : cause - Please enter a stop price


 

开云体育

That message means exactly what it says.

?

The API log entries show that you have set the LmtPrice field to 34.71. But it’s the AuxPrice field you need for the STOP price.

?


 

?
?
thanks
?
Can I use a 'stop limit' for my 2 SELL calls? (one for a stop above the current market and another for below the current market, whichever reaches first)
Here it says that a 'stop limit' can only be used for a stop at a price below?the current market, and to use 'Limit if Touched' for a SELL for a price above the current market
?
?

Limit if Touched

A??is an order to buy (or sell) a contract at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. An LIT order is similar to a stop limit order, except that an LIT sell order is placed above the current market price, and a stop limit sell order is placed below.

  • Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR
  • Order order = new Order();
    order.Action = action;
    order.OrderType = "LIT";
    order.TotalQuantity = quantity;
    order.LmtPrice = limitPrice;
    order.AuxPrice = triggerPrice;
    ?
    ?


 

开云体育

For a sell order, you only use stop or stoplimit when the market is above the trigger price (ie the AuxPrice). When the price drops to the trigger price, either a market or a limit order is then entered into the exchange. So you can use this to exit from a long position (this is typically a stop-loss, but it can alternatively be a profit taker if the position is currently in profit).

?

You can use a buy stop or stoplimit to enter a new position, in which case market price must be below the trigger price.

?

Be careful not to confuse a stop or stoplimit ?order with a ‘stop-loss’ order: stop and stoplimit orders are specific types of order, whereas a stop-loss order is really a mode of operating that protects a position against excessive loss, and can be of several different types.

?

Note also that a market- or limit--if-touched order can also be used either to enter or exit a position, but you wouldn’t use it as a stop-loss. I’ll leave you to think about why that is. You need to make sure you have a clear understanding of these different order types.

?

But here’s an example: suppose the market is trading in a range, and you want to catch a breakout from that range in either direction: you could use a sell stop with trigger 1-tick below the bottom of the range, and a buy stop with trigger 1-tick above the high of the range. And you would put both orders in an OCA group so if one order fills, the other is cancelled.

?

?

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of Danny via groups.io
Sent: 22 November 2024 18:01
To: twsapi@groups.io
Subject: Re: [TWS API] API call: Error validating request.-'bF' : cause - Please enter a stop price

?

?

?

thanks

?

Can I use a 'stop limit' for my 2 SELL calls? (one for a stop above the current market and another for below the current market, whichever reaches first)

Here it says that a 'stop limit' can only be used for a stop at a price below?the current market, and to use 'Limit if Touched' for a SELL for a price above the current market

?

?

Limit if Touched

A??is an order to buy (or sell) a contract at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. An LIT order is similar to a stop limit order, except that an LIT sell order is placed above the current market price, and a stop limit sell order is placed below.

  • Products: BOND, CFD, CASH, FUT, FOP, OPT, STK, WAR

·?????????????????????? Order order = new Order();

order.Action = action;

order.OrderType = "LIT";

order.TotalQuantity = quantity;

order.LmtPrice = limitPrice;

order.AuxPrice = triggerPrice;

?

?


 

The TWS documentation on orders is most useful when you want to determine, which order object fields need to be initialized. But that documentation does not give you any details on exactly what the different order types (or algos) do, what thez are intended for, or what their major limitations are.

Richard gave you an overview of the STP, STLMT, and "IF TOCUHED" orders, but I recommended that, if you have not done so yet, you spend some time with this IBKR "" explorer. Here the .

闯ü谤驳别苍

?

?
On Fri, Nov 22, 2024 at 12:01 PM, Danny wrote:

..
?

Limit if Touched

A??is an order to buy (or sell) a contract at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. An LIT order is similar to a stop limit order, except that an LIT sell order is placed above the current market price, and a stop limit sell order is placed below.

...