How to get email alerts when the VIX goes above a certain number.

Discussion in 'Interactive Brokers' started by Sarah Bush, Feb 10, 2023.

  1. Hi everyone:D,

    My first post here, and I need help. I am with Interactive Brokers (Trader Workstation) and would like to know if there is a way to get alerts pushed to my phone when the VIX is above or below a certain number. I know how to set alerts with Interactive Brokers, but anytime an alert is triggered, I have to go back and reset it, or it won't alert me again. :banghead:

    For example, I want to get an alert when the VIX is above 22 and an alert below 20. I don't want to have to go in manually and have to reset it every time. I want to set it and forget it. Email, text, it doesn't matter.

    How can I automate this process of VIX alerts and not have to sit in front of the computer all day? Is there another software or platform that does this, or would you recommend something else?

    Thanks so much!:)
     
  2. destriero

    destriero

  3. @destriero Thank you very much for your help.

    I just called Interactive Brokers, and they told me that the price alerts on all their various platforms (mobile and desktop) are designed to notify only once before automatically deleting itself. The option repeatable doesn't work when I select it. Screenshot attached.

    Thanks so much!:)
     
  4. spy

    spy

    And here I was about to suggest writing something "special"... won't deny I like to do things the hard way sometimes:
    Code:
    #!/usr/bin/env python3
    
    # https://ib-insync.readthedocs.io/recipes.html#async-streaming-ticks
    import asyncio, sys, os
    import ib_insync as ibi
    
    class App:
    
        async def run(self):
            self.ib = ibi.IB()
            with await self.ib.connectAsync( port = 12345 ):
                self.ib.reqMarketDataType(3)  # change to 1 for live data
    
                vix = ibi.Contract(conId=13455763, exchange="CBOE")
                await self.ib.qualifyContractsAsync(vix)
    
                self.ib.reqMktData(vix)
                async for tickers in self.ib.pendingTickersEvent:
                    for ticker in tickers:
                        for tick in ticker.ticks:
                            if (tick.tickType==4):
                                self.ib.cancelMktData(vix)
                                if tick.price > 0:
                                    os.system("xmessage -center '"+
                                              str(tick.price)+"' &")
                                    sys.exit(0)
    
        def stop(self):
            self.ib.disconnect()
    
    
    app = App()
    try:
        asyncio.run(app.run())
    except (KeyboardInterrupt, SystemExit):
        print("Sayonara!", file=sys.stderr)
        app.stop()
    
     
    destriero likes this.
  5. destriero

    destriero

    Hit “alert active until…” and pick a date a month out and test it. It may bypass the auto delete (prob not). @spy has some code for you.
     
  6. spy

    spy

    Interesting. I was actually about to caution that one problem with a notification getting tripped for something like the VIX is... that if it's toggling right around your limit (e.g. vix 19.999/20 every 30ms and your trigger is >=20) you could potentially send a huge number of email/sms messages.

    So, the sample code I posted also exits after the the first time the limit is tripped. Ideally I'd suggest you consider how you'd like to rate limit the notifications you'll be receiving. For better or worse, that specific exercise must be left for the reader.

    P.S. My sample also has a bug... the cancelMktData call should be within the innermost if block. Oops, sorry :(
     
    Last edited: Feb 10, 2023
  7. destriero

    destriero


    Yeah, I think IBKR is limiting the messaging requests. I understand it’s a pain but you could receive hundreds of messages as it straddles a price. I would put alerts on futures instead of cash.
     
    qwerty11 and spy like this.
  8. GoldDigger

    GoldDigger

    Welcome Sarah!

    It would probably be easiest to set a ticker website
    or watchlist on your iphone, and check that every
    few minutes.

    If your broker account does not accommodate your
    specific needs, you have to think outside the box
    and do something different.
     
  9. learn to code use the IB api
     
    rb7, ET180 and spy like this.
  10. KonoJRX

    KonoJRX

    Hi Sarah,

    Sorry not able to answer your question but instead had a question on how you were able to set alerts on IBKR for VIX?

    Scanned through the other alternatives but none of them seem to be VIX?

    Thanks in advance :)
     
    #10     Feb 11, 2023