开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: ISSUES WITH SMOOTH FAILOVER IN TWS APPLICATION - IBKR SERVER CONECTION DROP.

 

Richard nicely described how you'd use the various order and trade related callbacks to manage your orders, and there is really nothing for me to add there.

Orders and trades do not happen in the vacuum and they are always related to an Account and a Position. TWS API has a rich set of requests, subscriptions, and callbacks that keep your client informed about those as well. Every trade changes the position so that you have a "second opinion" of the exact impact of an order (or a series of orders or modifications). You can simply compare the cumulative effect of a series of execDetails() callbacks with the change of the position over the same time frame.

Below a very simplified data model of how they fit together.

闯ü谤驳别苍

PS. Generally one Trade will receive one TradeReport. But for completeness the model indicates there may be more than one. In rare situations (and I never had that happen, but it may), TWS API clients may receive one or more TradeReport corrections through execDetails callbacks later in time. The documentation says:

Note if a correction to an execution is published it will be received as an additional IBApi.EWrapper.execDetails callback with all parameters identical except for the execID in the Execution object. The execID will differ only in the digits after the final period.

?

?
?
?
?
On Fri, Feb 14, 2025 at 01:01 PM, Richard L King wrote:

Rather than comment on the questions you’ve raised, what I’ll do here is just lay out the basic principles that underly the order management component of my trading platform, which I have honed over the past 22 years. I believe it is immune to all the situations you describe.

?

  1. Maintain a model in the client containing information about all current orders. This is the client’s view of the current state of affairs, which may not be the same as the reality at any moment because of the unavoidable asynchronicity of multiple cooperating (very) loosely--coupled components.

?

  1. Record the state of the model in a persistent data store that can be used to reconstitute the model after a restart of the client (for any reason). As a matter of implementation, I use a text file containing JSON-encoded records that reflect every order-related operation or event sent to or received from the API. This ‘transaction log’ can be replayed to reconstruct the model as it was at the time the last record was written.

?

  1. Update the model whenever an order is placed, modified, or cancelled.

?

  1. Update the model whenever an open order, order status, execution or error notification is received from the API. Note that it is execution notifications that are really in control of order state; open order and order status notifications merely provide confirmation, and an inconsistency would be a definite fault (see 6 below).

?

  1. As a practical matter, the representation of orders in the model is the actual order objects used in the place order call, updated on receipt with data from open order notifications.

?

  1. If at any point an irreconcilable inconsistency emerges (for example receipt of an open order notification for an order that is no longer in the model), this is a situation that needs to be investigated (typically a programming error): execution of the client must be immediately stopped since it is not safe to proceed from an indeterminate state. (This might surprise some, but where real money is at stake it is unwise to assume that the situation will somehow correct itself.)

?

  1. Provide an optional capability to ensure that every order always has a protective stop-loss. For a manual trading client, this may not be needed, because there is a least a strong possibility that there will be a human present to assess unexpected conditions and take corrective action if need be. For an unattended auto-trading system, the situation may be very different.

?

I think that more or less covers it, though there is a lot of detail I’ve glossed over.

?

Sounds like a lot of work? It is!...

?

?

Richard

?


Re: ISSUES WITH SMOOTH FAILOVER IN TWS APPLICATION - IBKR SERVER CONECTION DROP.

 

开云体育

Rather than comment on the questions you’ve raised, what I’ll do here is just lay out the basic principles that underly the order management component of my trading platform, which I have honed over the past 22 years. I believe it is immune to all the situations you describe.

?

  1. Maintain a model in the client containing information about all current orders. This is the client’s view of the current state of affairs, which may not be the same as the reality at any moment because of the unavoidable asynchronicity of multiple cooperating (very) loosely--coupled components.

?

  1. Record the state of the model in a persistent data store that can be used to reconstitute the model after a restart of the client (for any reason). As a matter of implementation, I use a text file containing JSON-encoded records that reflect every order-related operation or event sent to or received from the API. This ‘transaction log’ can be replayed to reconstruct the model as it was at the time the last record was written.

?

  1. Update the model whenever an order is placed, modified, or cancelled.

?

  1. Update the model whenever an open order, order status, execution or error notification is received from the API. Note that it is execution notifications that are really in control of order state; open order and order status notifications merely provide confirmation, and an inconsistency would be a definite fault (see 6 below).

?

  1. As a practical matter, the representation of orders in the model is the actual order objects used in the place order call, updated on receipt with data from open order notifications.

?

  1. If at any point an irreconcilable inconsistency emerges (for example receipt of an open order notification for an order that is no longer in the model), this is a situation that needs to be investigated (typically a programming error): execution of the client must be immediately stopped since it is not safe to proceed from an indeterminate state. (This might surprise some, but where real money is at stake it is unwise to assume that the situation will somehow correct itself.)

?

  1. Provide an optional capability to ensure that every order always has a protective stop-loss. For a manual trading client, this may not be needed, because there is a least a strong possibility that there will be a human present to assess unexpected conditions and take corrective action if need be. For an unattended auto-trading system, the situation may be very different.

?

I think that more or less covers it, though there is a lot of detail I’ve glossed over.

?

Sounds like a lot of work? It is!...

?

?

Richard

?


ISSUES WITH SMOOTH FAILOVER IN TWS APPLICATION - IBKR SERVER CONECTION DROP.

 

ALERT LONG MESSAGE.

Hello Folks,

I am working on implementing a smooth failover mechanism to ensure the integrity of the code whenever there is a connection drop between the TWS application and the IBKR server.


Request you to provide valuable insights on below scenarios.


Case 1:


An order modification request was placed, increasing the order size beyond the previously placed quantity. The request was successfully sent to the IBKR server, but before we could receive an Order Status Callback(from that we can extract updated Order TotalQuantity), the connection between TWS and IBKR was lost.

Despite the connection drop, the order was successfully modified at the exchange.

Scenario During Connection Loss

  • If the internet was down during this period, it is possible that the order was fully executed at the exchange.

  • Once the connection is restored and we request OpenOrders, we will not receive any update related to this order because it is no longer active at the exchange.

  • However, when we request Executions, we will receive all partial or full executions for the order.

Problem with Execution Callback Data

  • The Executions Callback does not provide the remaining order size, unlike the Order Status Callback.

  • As a result, we cannot determine the actual remaining order size that was present at the exchange.

  • This forces us to rely on our internal maps, which in this case would not reflect the correct remaining size of the order.

  • Consequently, we may process extra executions, leading to discrepancies.

Example to Illustrate the Issue

  1. Initial Order Size → 10

  2. Modified Order Size → 15 (Modification was sent but confirmation was not received due to connection loss)

  3. Upon reconnection:

    • We do not receive an Order Status update for the modified order.

    • We receive a cumulative execution size of 15, but we have no way of verifying the actual remaining order size at the time of execution.

This results in an inconsistency in tracking the order status and execution details.

Currently, each time the TWS API receives an execution update, we calculate the remaining order size as follows:

remaining_order_size = remaining_order_size - current_execution_size;

if (remaining_order_size <= 0) {

????std::cout << "Order is fully executed";

????// Remove order from metadata maps

}

if(remaining_order_size<0) remaining_order_size = 0;

To ensure proper synchronization, we need to pass the remaining order size to the Execution listeners. However, in the above logic, as soon as remaining_order_size reaches zero or a negative value, the order is immediately removed from the metadata maps.

To prevent premature removal and ensure consistency, I have implemented a safeguard by updating the order size at the time of order submission. This adjustment helps maintain synchronization and prevents potential discrepancies.


Issues in using above mechanism :(

I have identified a potential issue with updating the order size at the time of order submission. Consider the following scenario:

  • A modification request is placed while the internet is down.

  • At this point, we update the order size in our system to 15 (UPDATED AT THE TIME OF SENDING THE ORDER).

  • Meanwhile, during the disconnection, the order is executed at the exchange for 10 units.

  • Once the connection is restored, we receive only the cumulative execution size of 10 from TWS (WE ASSUMED ORDER SIZE TO BE UPDATED TO 15).

  • However, since we do not receive all individual execution details, the internal system will not recognize that the order is fully executed.

As a result, the order remains in our internal maps, and we continue requesting execution details for the remaining 5 units that no longer exist.


To address this issue, we can retrieve CompletedOrders from TWS.


Any other method to handle above scenarios.?

Thanks for you patience :)


Re: TWS & IBKR CONNECTION STATUS.

 

Hello Richard,

First of all, thank you for the detailed information.

To answer your question—if such a mechanism existed, I would use it to prevent any order requests (new, modify, or cancel) from being sent while the connection is down. During the 45-second interval before the disconnect callback is received, multiple requests could be placed. Once the connection is restored, I want TWS to discard all order requests made during the disconnection period, ensuring they are not sent to the IBKR server.

However, any pending orders that were already active on the exchange should remain unaffected. In essence, TWS should flush only the unsent requests while maintaining all existing orders.

Additionally, I have another question regarding the reliability of the connection loss/recovery callbacks.

Is it guaranteed that the following callbacks will always be triggered in the event of a connection loss and subsequent restoration?

  • Code: 1100 – "Connectivity between IBKR and Trader Workstation has been lost."
  • Code: 1102 – "Connectivity between IBKR and Trader Workstation has been restored."

I ask because, in some cases, I have manually disconnected the internet, yet I did not receive these callbacks. Could you clarify if there are scenarios where these messages might not be triggered?

Looking forward to your insights.


Re: TWS & IBKR CONNECTION STATUS.

 

开云体育

No, there is no way for either of these things.

?

The TCP protocol suite contains a variety of mechanisms to automatically detect and recover from such incidents. But what it doesn’t have is a mechanism whereby an unexpected incident (eg spade through a cable, plug pulled from patch panel) results in some kind of notification being sent to the entities at both ends of the connection. It’s easy to imagine such a thing, but the practicality of doing it is close to zero, especially if you take into account all the timeouts, retries, resend requests etc involved in the automatic error detection and recovery machinery (not to mention the considerable range of different technologies that may be ?involved in what appears to be a simple internet connection). Also it would not be very helpful. Do you really want your application to be notified of every event that causes data to find a different route through the internet? All such mechanisms take time, not least because it takes time for them to even suspect that something might be wrong somewhere.

?

Although the TCP/IP stack makes great efforts to ensure that what goes in one end comes out at the other end in the same order, it inevitably incurs delays when something nasty happens somewhere in the middle. And if the recovery efforts are successful, you really don’t want the application entities to be told about this at all.

?

It’s worth noting that the API connection to TWS uses TCP Keepalives to ensure that failures are notified to the application fairly quickly. Presumably they are also used for the TWS to IBKR server connection. Without this optional TCP extension, an application only knows an error has occurred next time it tries to write to the connection (reads don’t generate an error if there is nothing to read). But the TCP Keepalives helps this by sending small packets periodically and checking for receipt of acknowledgment packets: if these acknowledgements are not received (after a suitable number of retries etc) then a fault is notified on the read.

?

As an example, a TWS API client application connection might not send anything for hours: for example, if the application is just receiving market data there is no reason to send anything. Without the TCP Keepalives, it would never know if there were a network fault, or if TWS froze and stopped sending data.

?

The parameters used for Keepalives for the TWS API connection (see the SetKeepAlive method in EClientSocket.cs) use an initial inactivity period of 20 seconds, followed by up to 10 repeats of the Keepalive packet at 100ms intervals after which an error occurs, so you can see that an error on this connection can result in a wait of up to 21 seconds before ?it is notified to the application.

?

Presumably the connection from TWS to the IBKR server uses Keepalives with longer parameters to give the 45 seconds you’ve observed.

?

But for neither connection can you specify the Keepalive parameters.

?

Thus there’s no way to get an instant error callback. What would you even do differently if there were such a thing? You just need to know when it’s possible for you to start sending and receiving data again, and 1102 gives you this.

?

As for as the second part of your question is concerned, I’m not even sure what you have in mind. When you get an error 1100, you must not send any further API requests until you’ve had the 1102. There could be one or more requests that you sent before the 1100 which you don’t know whether they have been processed. When you get the 1102, you can determine the state of PlaceOrder requests by use of ReqOpenOrders and ReqExecutions. But for things like market data or historical data requests you’re pretty much on your own. Personally I maintain a ‘ticker table’ where I record that data has been received, and after an 1102 I cancel and then reissue the market data request for any entry that is not marked as having received data.

?

I hope at least some of this makes sense!...

?

Richard


TWS & IBKR CONNECTION STATUS.

 

Hello Folks,

Is there a mechanism to receive an instant callback when the connection between the TWS application and the IBKR server is lost, specifically due to an internet disruption?

Currently, TWS provides this information via the following callback:

void error(
? ? int id, int errorCode, const std::string& errorString,
? ? const std::string& advancedOrderRejectJson)

With the response:
Code: 1100"Connectivity between IBKR and Trader Workstation has been lost."

However, this callback takes approximately 45 to 60 seconds to trigger. I'm looking for a way to detect the disconnection immediately.

Additionally, is there a method to cancel all pending requests that the TWS application attempts to send to the IBKR server once the connection is restored? Currently, reconnection is indicated by:
Code: 1102"Connectivity between IBKR and Trader Workstation has been restored."

?

Thanks.


Re: 10326 - OCA group revision is not allowed

 

Today,?OcaType 2 works with both 10.30 and 10.34, at least in a paper trading account.?
I will try it in a live account with?version 10.30 this evening, and if it works, in a live account during the day tomorrow.

On Tue, Feb 11, 2025 at 2:22?PM Jimmy via <jimmydtalbot=[email protected]> wrote:
If one order gets 1 contract filled, I don't want the other orders in the OCA group to be cancelled immediately; I want the other orders to remain active, with 1 contract to get subtracted from their?quantity.?
Only when an entire order in the?OCA group is filled do I want the other orders to be cancelled.?
This is the "reduce" behavior I believe (at least it was until now).
I could live with OcaType 2 or 3, but right now, as far as I can tell, neither works with TWS 10.30+.



On Tue, Feb 11, 2025 at 12:42?PM 闯ü谤驳别苍 Reinold via <TwsApiOnGroupsIo=[email protected]> wrote:

Thanks for the clarification, Jimmy. I had responded to when you had said in an earlier reply "I see this message when trying to modify the limit or stop price of an OCA order"

What are you trying to achieve with the OCA order? Do you want one and only one of those two orders to fill? If that is the case, wouldn't OCA Type 1 "CancelWithBlocking" be the type you are looking for? Types 2 and 3 are "Reduce" types with and without blocking.

闯ü谤驳别苍

?

On Tue, Feb 11, 2025 at 11:18 AM, Jimmy wrote:
Thanks for the reply 闯ü谤驳别苍.
?
At this time, I'm not modifying orders. I am just submitting two single-legged option OCA bracket orders, one with a stop price, one with a limit price.
?
I am testing using a paper trading account.
I unchecked the "bypass No Overfill Protection precaution for destinations where implied natively" checkbox in API -> precautions, but I can't get the dialog to come up again (I don't know if the behavior would be the same a live account).
?
I tested with both the current stable version (10.30.1t) and latest (10.34.1b); the results are the same
?
When submitting Option OCA orders with OcaType = 2 (which the precaution dialog implies is what is needed), they get rejected with "OCA handling method mismatch".
When using OcaType = 3, they get rejected with "Invalid parameter for OCA group for exchange SMART".
?
OcaType = 3 works fine in 10.19 and before (that's what I've always used). However, I tried OcaType = 2 with 10.19 in a live account yesterday, and I also got the same error message "Invalid parameter for OCA group for exchange SMART".
?
Is anyone else using OCA orders with options? Is it working for you in 10.30+? What OcaType are you using??
?
Thanks
Jimmy


Re: 10326 - OCA group revision is not allowed

 

If one order gets 1 contract filled, I don't want the other orders in the OCA group to be cancelled immediately; I want the other orders to remain active, with 1 contract to get subtracted from their?quantity.?
Only when an entire order in the?OCA group is filled do I want the other orders to be cancelled.?
This is the "reduce" behavior I believe (at least it was until now).
I could live with OcaType 2 or 3, but right now, as far as I can tell, neither works with TWS 10.30+.



On Tue, Feb 11, 2025 at 12:42?PM 闯ü谤驳别苍 Reinold via <TwsApiOnGroupsIo=[email protected]> wrote:

Thanks for the clarification, Jimmy. I had responded to when you had said in an earlier reply "I see this message when trying to modify the limit or stop price of an OCA order"

What are you trying to achieve with the OCA order? Do you want one and only one of those two orders to fill? If that is the case, wouldn't OCA Type 1 "CancelWithBlocking" be the type you are looking for? Types 2 and 3 are "Reduce" types with and without blocking.

闯ü谤驳别苍

?

On Tue, Feb 11, 2025 at 11:18 AM, Jimmy wrote:
Thanks for the reply 闯ü谤驳别苍.
?
At this time, I'm not modifying orders. I am just submitting two single-legged option OCA bracket orders, one with a stop price, one with a limit price.
?
I am testing using a paper trading account.
I unchecked the "bypass No Overfill Protection precaution for destinations where implied natively" checkbox in API -> precautions, but I can't get the dialog to come up again (I don't know if the behavior would be the same a live account).
?
I tested with both the current stable version (10.30.1t) and latest (10.34.1b); the results are the same
?
When submitting Option OCA orders with OcaType = 2 (which the precaution dialog implies is what is needed), they get rejected with "OCA handling method mismatch".
When using OcaType = 3, they get rejected with "Invalid parameter for OCA group for exchange SMART".
?
OcaType = 3 works fine in 10.19 and before (that's what I've always used). However, I tried OcaType = 2 with 10.19 in a live account yesterday, and I also got the same error message "Invalid parameter for OCA group for exchange SMART".
?
Is anyone else using OCA orders with options? Is it working for you in 10.30+? What OcaType are you using??
?
Thanks
Jimmy


Re: 10326 - OCA group revision is not allowed

 

Thanks for the clarification, Jimmy. I had responded to when you had said in an earlier reply "I see this message when trying to modify the limit or stop price of an OCA order"

What are you trying to achieve with the OCA order? Do you want one and only one of those two orders to fill? If that is the case, wouldn't OCA Type 1 "CancelWithBlocking" be the type you are looking for? Types 2 and 3 are "Reduce" types with and without blocking.

闯ü谤驳别苍

?

On Tue, Feb 11, 2025 at 11:18 AM, Jimmy wrote:

Thanks for the reply 闯ü谤驳别苍.
?
At this time, I'm not modifying orders. I am just submitting two single-legged option OCA bracket orders, one with a stop price, one with a limit price.
?
I am testing using a paper trading account.
I unchecked the "bypass No Overfill Protection precaution for destinations where implied natively" checkbox in API -> precautions, but I can't get the dialog to come up again (I don't know if the behavior would be the same a live account).
?
I tested with both the current stable version (10.30.1t) and latest (10.34.1b); the results are the same
?
When submitting Option OCA orders with OcaType = 2 (which the precaution dialog implies is what is needed), they get rejected with "OCA handling method mismatch".
When using OcaType = 3, they get rejected with "Invalid parameter for OCA group for exchange SMART".
?
OcaType = 3 works fine in 10.19 and before (that's what I've always used). However, I tried OcaType = 2 with 10.19 in a live account yesterday, and I also got the same error message "Invalid parameter for OCA group for exchange SMART".
?
Is anyone else using OCA orders with options? Is it working for you in 10.30+? What OcaType are you using??
?
Thanks
Jimmy


Re: 10326 - OCA group revision is not allowed

 

Thanks for the reply 闯ü谤驳别苍.
?
At this time, I'm not modifying orders. I am just submitting two single-legged option OCA bracket orders, one with a stop price, one with a limit price.
?
I am testing using a paper trading account.
I unchecked the "bypass No Overfill Protection precaution for destinations where implied natively" checkbox in API -> precautions, but I can't get the dialog to come up again (I don't know if the behavior would be the same a live account).
?
I tested with both the current stable version (10.30.1t) and latest (10.34.1b); the results are the same
?
When submitting Option OCA orders with OcaType = 2 (which the precaution dialog implies is what is needed), they get rejected with "OCA handling method mismatch".
When using OcaType = 3, they get rejected with "Invalid parameter for OCA group for exchange SMART".
?
OcaType = 3 works fine in 10.19 and before (that's what I've always used). However, I tried OcaType = 2 with 10.19 in a live account yesterday, and I also got the same error message "Invalid parameter for OCA group for exchange SMART".
?
Is anyone else using OCA orders with options? Is it working for you in 10.30+? What OcaType are you using??
?
Thanks
Jimmy


looking for earning data vendor

 

The reqFundamentalData() does not seem to work.? I like to get the earning per share of the stock for the next three years.? What data provider do you recommend?? Thanks.


Re: 10326 - OCA group revision is not allowed

 

You can permanently enable/disable various order precautions in the global settings of TWS and IBGW under API --> Precautions.

When you call placeOrder() to modify the OCA order, what kind of Order object do you use?

  • The object you used when you placed the original bracket order (with modified stop price and possibly other fields) ?
  • Or the Order objects you received in the most recent openOrder() callback?

Also, do you modify OCA order before or after the parent order has been filled?

闯ü谤驳别苍

?

?
On Mon, Feb 10, 2025 at 07:08 PM, Jimmy wrote:

Revisiting this as the deadline to upgrade to 10.30.1t looms.
?
Raoul, my OCA orders' parent id is 0 already, so unfortunately I think the issue I'm encountering is different than what your post suggests.
?
The first time I run 10.30.1t and submit (via the API) OCA orders, a dialog comes up that says:
?
Overfill Protection Precaution
Invalid parameter for OCA group for exchange SMART. Overfill protection is implied.
Do you want to apply the correct parameter?
?
I choose yes and check "Don't display this message again".
?
Afterwards, the OCA orders get submitted, but they get rejected with "OCA handling method mismatch".
?
I brought this up with IB in October, yet the issue persists in "stable" version 10.30.1t.
?
Has anyone here figured out a solution to this "OCA handling method mismatch"?
My previous tests showed this was working in 10.32, but I will try this again tomorrow to confirm (likely in the latest offline version 10.34.1a, since 10.32 is not available anymore).
?
Thanks!


Re: 10326 - OCA group revision is not allowed

 

Revisiting this as the deadline to upgrade to 10.30.1t looms.
?
Raoul, my OCA orders' parent id is 0 already, so unfortunately I think the issue I'm encountering is different than what your post suggests.
?
The first time I run 10.30.1t and submit (via the API) OCA orders, a dialog comes up that says:
?
Overfill Protection Precaution
Invalid parameter for OCA group for exchange SMART. Overfill protection is implied.
Do you want to apply the correct parameter?
?
I choose yes and check "Don't display this message again".
?
Afterwards, the OCA orders get submitted, but they get rejected with "OCA handling method mismatch".
?
I brought this up with IB in October, yet the issue persists in "stable" version 10.30.1t.
?
Has anyone here figured out a solution to this "OCA handling method mismatch"?
My previous tests showed this was working in 10.32, but I will try this again tomorrow to confirm (likely in the latest offline version 10.34.1a, since 10.32 is not available anymore).
?
Thanks!


Re: Automatic bid or ask price change until funded

 

. I found the IB algo etc, but this seems to peg the order to the midpoint and changes the price based on market price changes. Within the api I'd like to give my order a start price and have the algo add say 0.1$ per second until the buy is filled. So regardless of market price changes in that one second.


Re: TrailStopPrice is not correct in the OrderStatusEvent

 

开云体育

Is this email intended for me?

--
Secured with Tuta Mail:



Feb 10, 2025, 01:23 by TwsApiOnGroupsIo@...:

You might want to ask this question in the ib_sync/ib_async group.

For IBKR provided TWS API implementations., openOrder() callbacks provide updated Order objects each time the trail order stop price has been adjusted. The "trailStopPrice" field of the Order object from the last openOrder() callback before the order executes shows the same price as TWS.

闯ü谤驳别苍

?

On Sun, Feb 9, 2025 at 09:34 AM, <hadry.hamza@...> wrote:

Hello,

I'm trying to get the trailing trigger price for the filled trail order (not the execution price) for that I'm using the orderStatusEvent :
self.ib_client.orderStatusEvent += self.on_order_status_event

but when checking the TrailStopPrice I don't see the same price as what I see in the TWS app:
trade.order.trailStopPrice

?

here is what I see in the TWS app 'the price = 364.38:

?

Do you have any idea if this is a common issue here? and how can I get the correct information please?

?

Thanks,
Hamza

?


Re: TrailStopPrice is not correct in the OrderStatusEvent

 

You might want to ask this question in the ib_sync/ib_async group.

For IBKR provided TWS API implementations., openOrder() callbacks provide updated Order objects each time the trail order stop price has been adjusted. The "trailStopPrice" field of the Order object from the last openOrder() callback before the order executes shows the same price as TWS.

闯ü谤驳别苍

?

On Sun, Feb 9, 2025 at 09:34 AM, <hadry.hamza@...> wrote:

Hello,

I'm trying to get the trailing trigger price for the filled trail order (not the execution price) for that I'm using the orderStatusEvent :
self.ib_client.orderStatusEvent += self.on_order_status_event

but when checking the TrailStopPrice I don't see the same price as what I see in the TWS app:
trade.order.trailStopPrice

?

here is what I see in the TWS app 'the price = 364.38:

?

Do you have any idea if this is a common issue here? and how can I get the correct information please?

?

Thanks,
Hamza

?


Automatic bid or ask price change until funded

 

开云体育

Tws interactive brokers visual basic api question

Is it possible within the IB Api (I use? the VB version) to use an order type that based on a user set bid ( or ask ) price, walks the price up ( or down ) in preset steps until the order is filled?


Re: ib market data. is it clean and any good alterantive sources?

 

开云体育

I used DTN-IQ for many years.? It is very affordable, but it does not give historical BBO data, only trades...

    
On 2/8/2025 3:17 PM, Dale Joyce via groups.io wrote:

It seems fairly decent.
If you want the best, DTN-IQ can't be beat.

On Sat, Feb 8, 2025 at 2:29?PM ds-avatar via <dimsal.public=[email protected]> wrote:
On Sat, Feb 8, 2025 at 08:32 PM, Harold Lanier wrote:
Take a look at ThetaData
?
Interesting, thank you.
?
--
Best,
DS


TrailStopPrice is not correct in the OrderStatusEvent

 

Hello,

I'm trying to get the trailing trigger price for the filled trail order (not the execution price) for that I'm using the orderStatusEvent :
self.ib_client.orderStatusEvent += self.on_order_status_event

but when checking the TrailStopPrice I don't see the same price as what I see in the TWS app:
trade.order.trailStopPrice

?

?

here is what I see in the TWS app 'the price = 364.38:

?

?

Do you have any idea if this is a common issue here? and how can I get the correct information please?

?

Thanks,
Hamza

?


Bug and fix in TWS python API 10.34 (unknown module "server_versions")

 

Hello all - I just wanted to share a bug and fix I found in the latest version. Using both the windows and mac/linux version 10.34 API, you will error out if you do:
?
from ibkr.client import *
?
for not being able to find the "server_versions" module. There's a typo in client.py. The fix is to go to line 138 of client .py and change
?
from server_versions import MIN_SERVER_VER_CURRENT_TIME_IN_MILLIS
?
to
?
from ibapi.server_versions import MIN_SERVER_VER_CURRENT_TIME_IN_MILLIS