开云体育

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

Re: Automatic bid or ask price change until funded

 

开云体育

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


Re: Automatic bid or ask price change until funded

 

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


Re: Automatic bid or ask price change until funded

 

开云体育

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.


Re: Automatic bid or ask price change until funded

 

开云体育

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.


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.


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?


discrepancy with historic data

 

Hi, when i download historic data on say BIDU, primary exchange is NASDAQ (ISLAND on ib) i dont get the correct info relating to open price.
?
For example, on the 5th Feb just gone, the open price for BIDU was 90.21 according to TWS tick history which correlates to the info on the TWS quote summary, but when i download, with primary exchange set to ISLAND?
i get 90.28. Infact i cant get 90.21 with any variation i can think of sofar? Does anyone have any thoughts on why this is? Is it a shortcoming of the download functionality or could i be doing something else incorrect? Regards B.
?
contract = Stock('BIDU', 'ISLAND', 'USD')
? ? ? ? ? ? ? ? ? ? ib.qualifyContracts(contract)
? ? ? ? ? ? ? ??? ? ? ? ? ? ? ?
bars = ib.reqHistoricalData(
? ? ? ? ? ? ? ? ? ? ? ? ? ? contract,
? ? ? ? ? ? ? ? ? ? ? ? ? ? endDateTime='',
? ? ? ? ? ? ? ? ? ? ? ? ? ? durationStr='1 Y',
? ? ? ? ? ? ? ? ? ? ? ? ? ? barSizeSetting='1 Day',
? ? ? ? ? ? ? ? ? ? ? ? ? ? whatToShow='TRADES',
? ? ? ? ? ? ? ? ? ? ? ? ? ? useRTH=True,
? ? ? ? ? ? ? ? ? ? ? ? ? ? formatDate=2)


Re: Caution

 

I managed to recover my Discord, but it reminded me how much trouble it can be if only one person holds the keys to the clubhouse! I remember the confusion and frustration when Ewald passed away and the old group was deleted. So I will be adding at least one more admin to both this group and the discord, just in case something should happen to me (or my account).

Thanks, Mel


Re: Caution

 

开云体育

Thanks, it brings up shared admin for me.? I have thought about it before and now feel I really need to get at least 1 other person set up as admin for this group and the duscord group.? I hate the idea of something happening to me and both groups get locked or worse deleted...
Anyone interested let me know...?

Mel





-------- Original message --------
From: "wordd via groups.io" <howtoreached@...>
Date: 2025-01-21 10:23 p.m. (GMT-08:00)
Subject: Re: [ib-async] Caution

Discord looks ok. at least, no strange messages from your account so far.


Re: Does ib_insync work with TWS 10.30?

 

The interesting thing there is that within minutes of it not working on 10.30, I went back to 10.19 to see if it would work, and it did. Will keep that link handy though. Thanks.?


Re: Define “NOT for AM-settled” SPX option contracts

 

Oh no ! Never thought this was caused by IBKR. I will search for the relevant thread about this issue. Thanks for pointing me to the right direction.
However, I am afraid the issue actually occurs every day.
I looked into yesterday's situation (i.e. 20250121) where I traded as usual the 0DTE SPX options. Here are the details :

opt_contract = Option(‘SPX’, ’20250121’, 6015, ‘P’, ‘SMART’, currency=‘USD’, tradingClass=‘SPXW’)

Then, after ib.qualifyContracts(opt_contract), I got the contents of opt_contract as follows :

Option(conId=750913196, symbol='SPX', lastTradeDateOrContractMonth='20250122', strike=6015.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='SPXW? 250121P06015000', tradingClass='SPXW')

So, I started wondering whether this is IBKR's screw-up or ib_insync's problem.


Re: Caution

 

Discord looks ok. at least, no strange messages from your account so far.


Caution

 

My discord account may have been compromised, so until I can get that resolved please be cautious of any messages from ClimberMel. Can anyone on the ib_async discord group check and let me know if there is any odd activity?

Mel


Re: Define “NOT for AM-settled” SPX option contracts

 

Oh, I remember now. A few days ago IBKR screwed up something with AM vs PM expiration chain data. Lots of people had an issue on that date and could not trade. I think there was a separate thread about that. First time I saw an issue like that at IBKR. They knew about it (I called to inquire) but probably didn't fix it. I wonder if the issue you are getting is for that specific date?


On Tue, Jan 21, 2025, 10:20?PM Lewis_Tang via <lewis91960127=[email protected]> wrote:
Thanks leop for your reply. I did use "SPXW" (and always use it) in the tradingClass specification. The following was exactly how I define the option contract :
opt_contract = Option(symbol='SPX', lastTradeDateOrContractMonth='20250116', strike=6005.0, right='C', multiplier=100, exchange='SMART', currency='USD', tradingClass='SPXW')
?
And after ib.qualifyContracts(opt_contract), I print the contents of opt_contract and got the following :
Option(conId=750912933, symbol='SPX', lastTradeDateOrContractMonth='20250117', strike=6005.0, right='C', multiplier='100', exchange='SMART', currency='USD', localSymbol='SPXW ?250116C06005000', tradingClass='SPXW')
?
Then, I tried to find out why the lastTradeDateOrContractMonth between the above two (20250116 vs 20250117) and later I noticed that 202250116 was a trade day where both AM and PM settlement existed for SPX/SPXW. I therefore searched over the web and noticed in Reddit that some traders suggested never trade AM-settled SPX options as the settlement time is set at the morning of next day. As my algo trades 0DTE SPX and expects settlement price to be set at market close on the same day, so this is why I do not want to trade AM-settled SPX options.


Re: Define “NOT for AM-settled” SPX option contracts

 

Thanks leop for your reply. I did use "SPXW" (and always use it) in the tradingClass specification. The following was exactly how I define the option contract :
opt_contract = Option(symbol='SPX', lastTradeDateOrContractMonth='20250116', strike=6005.0, right='C', multiplier=100, exchange='SMART', currency='USD', tradingClass='SPXW')
?
And after ib.qualifyContracts(opt_contract), I print the contents of opt_contract and got the following :
Option(conId=750912933, symbol='SPX', lastTradeDateOrContractMonth='20250117', strike=6005.0, right='C', multiplier='100', exchange='SMART', currency='USD', localSymbol='SPXW ?250116C06005000', tradingClass='SPXW')
?
Then, I tried to find out why the lastTradeDateOrContractMonth between the above two (20250116 vs 20250117) and later I noticed that 202250116 was a trade day where both AM and PM settlement existed for SPX/SPXW. I therefore searched over the web and noticed in Reddit that some traders suggested never trade AM-settled SPX options as the settlement time is set at the morning of next day. As my algo trades 0DTE SPX and expects settlement price to be set at market close on the same day, so this is why I do not want to trade AM-settled SPX options.


Inconsistent expiry date obtained from ib.reqTickers()

 

I defined option contract as follows :

opt_contract = Option(‘SPX’, ’20250121’, 6015, ‘P’, ‘SMART’, currency=‘USD’, tradingClass=‘SPXW’)

?

Then, I wish to get the contract's current bid/ask prices, so I used reqTickers() as follows :

tick_details = ib.reqTickers(opt_contract)

?

For error tracing purpose, I used to print the tick_details contents. Here it is :

Ticker(contract=Option(conId=750913196, symbol='SPX', lastTradeDateOrContractMonth='20250122', strike=6015.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='SPXW? 250121P06015000', tradingClass='SPXW'), time=datetime.datetime(2025, 1, 21, 14, 48, 54, 103595, tzinfo=datetime.timezone.utc), minTick=0.05, bid=6.4, bidSize=54.0, bidExchange='C', ask=6.5, askSize=2.0, askExchange='C', last=6.6, lastSize=4.0, volume=2238.0, high=14.05, low=6.45, close=27.7, halted=0.0, bidGreeks=OptionComputation(tickAttrib=0, impliedVol=0.21785950015907832, delta=-0.7116085792422059, optPrice=6.400000095367432, pvDividend=0.0, gamma=0.009767866599599677, vega=0.5477427109390766, theta=-0.0, undPrice=6035.17), askGreeks=OptionComputation(tickAttrib=0, impliedVol=0.22130962943480934, delta=-0.7085997644685299, optPrice=6.599999904632568, pvDividend=0.0, gamma=0.009662509828098607, vega=0.5504154854592325, theta=-0.0, undPrice=6035.17), lastGreeks=OptionComputation(tickAttrib=0, impliedVol=0.2021892365912554, delta=-0.7263385475706803, optPrice=6.599999904632568, pvDividend=0.0, gamma=0.010261604472690885, vega=0.5340398776862891, theta=-0.0, undPrice=6035.17), modelGreeks=OptionComputation(tickAttrib=0, impliedVol=0.21812797350188606, delta=-0.2774263862329315, optPrice=6.0125608711161505, pvDividend=0.0, gamma=0.009575647492098521, vega=0.5376558371343124, theta=-6.0125608711161505, undPrice=6035.34), bboExchange='c70003', snapshotPermissions=3)

?

As seen, the expiry date in my contract definition was 20250121, but the reqTickers() returned 20250122.

I then check IB's contract spec (by right-clicking the relevant contract on TWS and select "Details") and go the following :

?

As seen from the pic, everything is normal, i.e. conId was 750913196, strike was 6015, right was PUT, expiration and last trading date was both 20250121 and the tradingClass was correct (i.e. SPXW).

Anyone had experienced the same and how you solve this issue ? Is there a problem with ib.reqTickers() ? If so, any idea what should be used to replace ib.reqTickers()?

?


Re: Does ib_insync work with TWS 10.30?

 

During the weekend, there is high chance of maintenance including scheduled downtime, so verify here before doing tests. That is probably what happened to you.


Re: Does ib_insync work with TWS 10.30?

 

Thanks for the response. I just tried again now and it works with TWS 10.30. When I tried originally, it was over the weekend, which is when I usually run those scripts. Will try again next weekend.


Re: Define “NOT for AM-settled” SPX option contracts

 

One of the contract fields has SPX vs SPXW. You want to filter so you only have SPXW.


On Tue, Jan 21, 2025, 8:41?AM Lewis_Tang via <lewis91960127=[email protected]> wrote:
Sorry, the subject title was badly written. Should be “How to define afternoon-settled SPX options”


Re: Does ib_insync work with TWS 10.30?

 

Hi Rajeshh, I am still on ib-insync as well but my scripts work even after migration to 10.30, even orders, fills and adjustments, although I use the Gateway instead of TWS. I suggest to try Gateway and see what happens. Also remember to adjust API Settings again, sometimes they get lost with the update