¿ªÔÆÌåÓý

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

Problems with the API in receiving data in real time with reqMarketData ()

 

Dear all:

I have problems with the API in receiving data in real time with reqMarketData ()
?
I get the message:
2023-07-04 16:37:30,321 - ibapi.wrapper- Linea = 57 en wrapper ERROR ERROR 1000 10089 Requested market data requires additional subscription for API. See link in 'Market Data Connections' dialog for more details.TSLA NASDAQ.NMS/TOP/ALL
?
According to my account,? I have a subscription to:
Level I (NBBO)
Cboe One
Real-time streaming quotes from the four Cboe US Equity Exchanges.
USD 5.00 /Month
?
Please can you help me?
?
Regards, Jesus Barbero


Re: Is there a limit/penalty on changing STP order more than X times?

 

¿ªÔÆÌåÓý

Just to make sure I understand correcty, you are referring to an order to aquire a position?

Would the same regulation apply to a stp child order connected to an open posiition? My algo places a lmt order with several child orders connected, amongst which a stp and trail. The trail is wide, the stp small. When the parent order is filled and the position becomes profitable my algo keeps changing the stp price to a certain level (acting like a smal trail order really). For one open position this may be up to 80 changes. Btw, this is on futures trading on the cme.

Thanks, regards,
Raoul


On 30-06-2023 15:21, FreeGoldRush wrote:

Yes, IB will charge you if you change an order too frequently.? I believe the rule used to be 25-to-1 for the order-to-fill ratio in a day.? NASDAQ and NYSE also charge IB if they send too many orders and don't get enough fills.?


Re: Is there a limit/penalty on changing STP order more than X times?

 

10 seems to me above IB criteria for an efficient ordering, try staying below 5.
Also the rate of your change have an impact: Think "human", IB is very tolerant to anything that match human pace.

Why do you need to change so frequently a TRAIL order ?
Looks like you expect IB to react faster than your algo, but somewhere this is a catch 22 situation because IB may react too fast too. You may have to consider improving speed of your code and directly send a sell at market or hedging your position by going opposite? then release both, this increase trades and may improve IB view of your efficiency (I never try hedging for that reason).


Re: Is there a limit/penalty on changing STP order more than X times?

 

Thank you for this information. So if my strategy would be to change the STP or TRAIL order up to 10 times before it hopefully executes, that would not be a problem then?


Python - listening for trading oppertuneties - disconnected - how to reconnect

 

I have a python script listening to market data, waiting for trading oppertunities.
The script runs fine for hours and will execute an order successfully if conditions are met.

However after several hours the market data will stop and the program will freeze due to that.

1. Why does my python program loose connection to TWS (or why does TWS drop the connection)?
2. How can I test if the connection is active?
3. How can I establish the connection again so the program will keep on running?

I have googled a lot and there are many different answers, but none that answer my questions.

I would be greatly thankful for your answers.


Re: Is there a limit/penalty on changing STP order more than X times?

 

Yes, IB will charge you if you change an order too frequently.? I believe the rule used to be 25-to-1 for the order-to-fill ratio in a day.? NASDAQ and NYSE also charge IB if they send too many orders and don't get enough fills.?


Re: Problem with breaking change in Python API

 

Yep, just tested it out today and definitely works. Thanks for responding.

Cheers,

Colin


On Fri, 30 Jun 2023 at 03:08, misantroop <alepik@...> wrote:
That argument can be sent as an empty string.


Re: Is there a limit/penalty on changing STP order more than X times?

 

Seems close to this thread?? /g/twsapi/topic/80863099#46628
Look to me that the link to IB article is broken, try search with keyword/sentence is "Order Efficiency Ratio" or "Optimizing Order Efficiency"

IB require some "efficiency" in the management of your orders, IB even give you report tool to analyze your account order efficiency (or lack thereof).

This is a Pandora-box issue because there are a lot of tradeoff behind it, many of theses tradeoffs require strategical choices: Speed versus flexibility versus safety when lack of liquidity etc ...
Suggestion: study IB offers first, . They do a lot for you and are well integrated.


Re: Problem with breaking change in Python API

 

That argument can be sent as an empty string.


Re: Problem with breaking change in Python API

 

I didn't know about the sample Program.py. That's good advice - I'll check that. Also thanks for your documentation link. That is much clearer than the docs link I was using.

Cheers and thanks for the help.

Colin



On Thu, 29 Jun 2023 at 11:25, buddy <spy@...> wrote:

Did you look at the sample Program.py provided w/ the API? It seems to imply you can just pass an empty string. I wonder why it's not the default argument?

Anyway... it's interesting that there's basically . Thanks for point it out.

Perhaps a little experimentation w/ a paper trading account is in order?

-Good luck


Re: Problem with breaking change in Python API

 

Did you look at the sample Program.py provided w/ the API? It seems to imply you can just pass an empty string. I wonder why it's not the default argument?

Anyway... it's interesting that there's basically . Thanks for point it out.

Perhaps a little experimentation w/ a paper trading account is in order?

-Good luck


Problem with breaking change in Python API

 

Hi all,

I'm trying to upgrade the Python API from 9.76 to 10.19. For the most part, I'm only needing to make minor adjustments for conversions between decimal and float.

However, I've just run into the following error:
```
TypeError("EClient.cancelOrder() missing 1 required positional argument: 'manualCancelOrderTime'")
```
The line of code that errors is:
```
app.cancelOrder(orderid)
```
where `orderid` is an integer that is the relevant order id. On the face of it, it sounds like the latest version requires a second argument to `app.cancelOrder`. However, the docs here: seem to be saying that there is still only one input argument to this function.

Any ideas? Also if there is a page anywhere that summarizes breaking changes, I'd be very grateful if anyone could direct me to it. I've had a look through the release notes (), as well as the changelog (), but couldn't see anything there that indicated a change to `cancelOrder`.

Cheers and thanks.

Colin


Re: Unable to parallelize entire python trade sequence

 

I forgot to attach a screenshot of what the order looks like on TWS, sorry for the double post.


Re: Unable to parallelize entire python trade sequence

 

So I took all your advice and I finally got it to work on paper. Will be testing it live tomorrow. Really appreciate all the help and advice.

For the next iteration, I am trying to replace trailing stop with a MIT and STP order, so that I can take profit on the upside and get protection from the downside until the cash out time at 3:50.

I added replaced the code accordingly, I looped over my tickers, their prices etc, but I get this error now, ERROR 490 104 Cannot modify a filled order. I have been trying it on paper the whole day but I only can seem to get the first ticker to fill properly, I don't know why it worked fine when it was just a trailing stop loss.

Am I understanding how STP and MIT orders work?

The first order gets sent properly (buy, stop market, market if touched and exit at 3:50 for AAPL), but the subsequent orders cascade down as a subset of the first orders, even different tickers. I have never seen this before, not sure what I am doing wrong.

I am doing a loop exactly like this . Any ideas?

def BracketOrder(self, parentOrderId:int, openinglimitPrice:float, quantity:Decimal, takeProfitPrice:float, stopLossPrice:float, timeCancel:str, timeSwitch:str, adaptive_type:str):

    # 1st part: Buy Adaptive Algo order
    opening = Order()
    opening.orderId = parentOrderId
    ....
    opening.conditionsCancelOrder = True 
    opening.conditionsIgnoreRth = True
    algo.FillAdaptiveParams(opening, adaptive_type)
    .....
    timeCondition = TimeCondition()
    timeCondition.time = timeCancel
    timeCondition.isMore = True
    opening.conditions.append(timeCondition)

    # 2nd part: Take profit if a price is touched
    takeProfit = Order()
    takeProfit.orderId = opening.orderId + 2
    takeProfit.action =  "SELL" if quantity > 0 else "BUY"
    takeProfit.orderType = "MIT"
    takeProfit.totalQuantity = abs(quantity)
    takeProfit.auxPrice = takeProfitPrice
    takeProfit.parentId = parentOrderId
    takeProfit.tif = "GTC"
    takeProfit.transmit = False

    # 2nd part: Stop loss
    stopLoss = Order()
    stopLoss.orderId = opening.orderId + 3
    stopLoss.action =  "SELL" if quantity > 0 else "BUY"
    stopLoss.orderType = "STP"
    stopLoss.totalQuantity = abs(quantity)
    stopLoss.auxPrice = stopLossPrice
    stopLoss.parentId = parentOrderId
    stopLoss.tif = "GTC"
    stopLoss.transmit = False

    # # 3rd part: Sell market order
    closing = Order()
    closing.orderId = opening.orderId + 4
    ...
    closing.parentId = parentOrderId
    closing.tif = "GTC"
    closing.transmit = True
    closing.conditionsCancelOrder = False
    closing.conditionsIgnoreRth = True

    timeCondition = TimeCondition()
    ....
    closing.conditions.append(timeCondition)

    bracketOrder = [opening, takeProfit, stopLoss, closing]
    return bracketOrder


Re: Is there a limit/penalty on changing STP order more than X times?

 

I would also like to do multiple changes to a TRAIL order, ie changing the trailingpercent value.? Would that be pelanized somehow?


Is there a limit/penalty on changing STP order more than X times?

 

I want to enter a STP order and then change the trigger price as time passes. Someone mentioned that the exchanges "dont like it", and therefore can penalize me in some unknown way for doing this. Is this correct? Is it exchange- ocr asset class-dependant??
Thx for any input
Peter


Re: MNQ Incorrect and Inconsistent Fills with Order Type = STP and any Market Order

 

Jurgen is right, at least you are learning your lesson in paper money, I had that happen to me in real money.


On Mon, Jun 26, 2023 at 8:22?AM DeepLearn <dydeeplearn@...> wrote:
Thanks for the response, on using UI we din't see 10-15 ticks increments, but with API we observed it more, as our test cases with API were more extensive.
We will try and use STP LMT as you suggested and find out a way to flatten orders when needed using Price/Time conditions.


Re: Time to Fill Orders During Paper Trading

 

For the sake of helping anyone who visits this thread in future,

My problem was solved when "Trading Permissions were set properly". I did not have trading permissions for Futures and thus future orders did not fill quickly. IB Paper account did not show any error/warning but the real one showed. The orders are filling nicely after setting correct trading permissions via IB Client Portal.

Thanks and Regards,
Pratik Babhulkar


Re: Unable to parallelize entire python trade sequence

 

On Tue, Jun 27, 2023 at 12:28 PM, omgwtfsalty@... wrote:

Why should I ignore the Rth, I don't want to trade beyond the regular trading hours, unless there is another reason?

It's a poorly named and confusing variable for the same reason it's bad to use double-negatives. But, if you read the description carefully, you'll probably want to set it to True. They should have named it something like conditionsValidOutsideRTH.

: Indicates whether or not conditions will also be valid outside Regular Trading Hours.


Re: Unable to parallelize entire python trade sequence

 

Hi J¨¹rgen, are you saying that because the opening orders and exit orders might be too close to each other? Then yeah probably I should make the opening order expire around 3pm.

Why should I ignore the Rth, I don't want to trade beyond the regular trading hours, unless there is another reason?

If i set the opening order to expire at 3pm and the closing order to activate at 3:50, even if there is a partial fill, my partial order will be taken care of correct?