开云体育

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

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?


 

. 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.


 

开云体育

That should be doable.? I don't have code for that, but if you already have the code to place the order, wrap that in a loop that until filled place order plus .01, wait whatever time you want between orders, cancel order and back to top of loop.
Now you will need to watch (and wait) for callbacks to assure that the order was placed and that the cancel order was placed.?
Another option might be to place modify orders in the loop.? I've never used them so not sure if there are issues with that, but others may chi.e i? with advice on that.
Cheers,
Mel





-------- Original message --------
From: "28coins via groups.io" <28coins@...>
Date: 2025-02-10 8:26 a.m. (GMT-08:00)
Subject: Re: [ib-async] 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.


 

开云体育

This is a good idea. I have the code for the order. Hoped that there was a preset order type for it. Appreciate the response!

--
Secured with Tuta Mail:



Feb 10, 2025, 17:46 by climbermel@...:

That should be doable.? I don't have code for that, but if you already have the code to place the order, wrap that in a loop that until filled place order plus .01, wait whatever time you want between orders, cancel order and back to top of loop.
Now you will need to watch (and wait) for callbacks to assure that the order was placed and that the cancel order was placed.?
Another option might be to place modify orders in the loop.? I've never used them so not sure if there are issues with that, but others may chi.e i? with advice on that.
Cheers,
Mel






-------- Original message --------
From: "28coins via groups.io" <28coins@...>
Date: 2025-02-10 8:26 a.m. (GMT-08:00)
Subject: Re: [ib-async] 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.


 

You could just use a limit order and change the limit price every x seconds by a certain price increment that you choose.
So you would basically simulate the IB Algo order type. Only, you have more control over it.
With IB Algo, you can just set the 'aggressiveness' of the order, but not actual parameters (such as price increments).
?
?


 

开云体育

Agreed, that would be an option. I would like to prevent to put in a timer though. Makes the code a bit unreliable. Or do you have something else in mind. Appreciate the response!

--
Secured with Tuta Mail:



Feb 11, 2025, 09:34 by lasgo2000-1@...:

You could just use a limit order and change the limit price every x seconds by a certain price increment that you choose.
So you would basically simulate the IB Algo order type. Only, you have more control over it.
With IB Algo, you can just set the 'aggressiveness' of the order, but not actual parameters (such as price increments).
?
?


 

Well, you can make your 'emulated IB Algo' as complicated as you like. To start with a timer (like I described above) seems like the simplest and most logical choice.
To make you algo 'smarter' you can also look how the market ('last') price is moving. If the current price is moving towards your limit price, you can simply sit and wait and 'let the market come to you'. If market price is moving away from your current limit price, you have to decide how bad you want the order filled. If you want very much to have the order filled, you must 'chase the market' and move your limit price faster towards the market price ...
That's why the IB Algo has this 'aggressiveness' parameter.
You could for example create a parameter in your algo, that specifies the 'change rate' of your limit price. That would be 'how much cents per minute' you want your limit to change. A high change rate would compare with a high aggressiveness in the IB Algo ....
What I describe above is basically how I fill my orders manually. I start with a limit price that is very much in my favour (right at the bid or ask price), and start changing the limit price until filled. With a liquid security that is usually around the mid price. And with options it is usually also very close to the model price that my orders are filled.
?
?
?


 

How about the Relative/Pegged to Primary order-type? I have used them in the past and they're pretty neat. IB continually adjusts your order's limit price as the market moves. You can also set an offset to be a penny or more competitive than the market to help it fill quicker. The order type allows one to set a limit as well.?
?
You can read more about it here: https://www.interactivebrokers.com/en/trading/ordertypes.php