Automated emails based on price spreads

Discussion in 'Automated Trading' started by ajensen, Nov 9, 2022.

  1. ajensen

    ajensen

    Suppose there are related securities, such as two preferred stocks of the same company, whose price difference should trade in a narrow band. How would you poll the market at a relatively low frequency (say every 5 minutes) and send an email when the price spread is outside a specified band? Since preferred stocks are pretty illiquid I am not looking to fully automate execution but to get alerts.
     
  2. spy

    spy

    Are you asking people what they, themselves, would personally do? Because, if not, you're going to have to be more specific regarding your task and expectations... like what kind of computer do you have? Who is providing the data/quotes? And what about your email service?

    And one last really important question... how much does this job pay? Lol
     
  3. ZBZB

    ZBZB

    Write to the IB api. Have an email server in your code.
     
    gwb-trading and ajensen like this.
  4. ZBZB

    ZBZB

    You could probably do it in Excel with the IB api. There is an example excel file in the IB api download.
     
    ajensen likes this.
  5. 2rosy

    2rosy

    subscribe to some datafeed
    configure stock pairs and thresholds
    onMarketData() determine if threshold breached
    send email. I think you can send to gmail or any free account

    would take at most half a day, maybe half an hour
     
    N2M likes this.
  6. N2M

    N2M

    Easy script to write, What broker do you use?
     
  7. ajensen

    ajensen

    Interactive Brokers is one I use.
     
  8. N2M

    N2M

    I'm just winging this
    if (stock_price_a - stock_price_b) < x:
    send email
     
    spy likes this.
  9. spy

    spy

    You probably want to check the absolute difference and make sure it's greater than some epsilon. But you're off to a good start! Lol
     
    N2M likes this.
  10. N2M

    N2M

    My coding is very basic..
     
    #10     Nov 27, 2022