Red alert, stop trading

Discussion in 'Automated Trading' started by nooby_mcnoob, Feb 23, 2018.

  1. Presumably though mobile.

    This is pretty clever. What kind of settings do you have in your CSV files?
    #31     Feb 23, 2018
  2. I'm not sure I follow. Would you mind elaborating?
    #32     Feb 23, 2018
  3. TDMA


    Poll the DM API for new messages to launch background processes to cut/start/adapt access. Why build a messaging system when Twitter has already done it for you.
    #33     Feb 23, 2018
    nooby_mcnoob likes this.
  4. The kind of settings that you want to store depends a lot on what you are trading and how you are trading. In my case: I am trading a basket of futures. This basket is in a csv file. I can add or remove instruments on the fly, without having to stop and restart the software. Each of these instruments comes with some parameters, such as which contract I want to use and, when nearing expiry, which contract to roll into. I can also modify the weights of these in the portfolio. This gives the possibility that if a certain instrument seems to "go haywire" I could set the weight to 0%, which means that my system will close the position on this instrument (if there is any). Of course can I use this for multiple instruments at a time as well.
    Besides the instruments-related settings do I have a csv file which defines at what times I run the reviews for which instruments (I run a daily system), and a list of exchange holidays.
    Of course does my software create logfiles. These are saved as simple .txt text files, also placed in the Dropbox folder. The Dropbox app on my iPad comes with a built-in file viewer and allows me to read those log files. When away from home (e.g. on a holiday abroad) I can thus monitor how things are going during my absence. This reporting assumes action/initiative from me: I have to show interest and go into the Dropbox app to see how things are going. There are a few items which I consider too important for this passive approach. In those cases does the software send me an email. But this is really limited otherwise the inbox would get overloaded and I would start to ignore the incoming messages. So it is limited to what I would call "high priority" stuff.
    #34     Feb 23, 2018
    nooby_mcnoob likes this.
  5. Tweeting is a nice idea but I personally prefer using email, which you get 'out of the box' on a linux system.

    More on what checks you can do in my blog here.

    #35     Feb 24, 2018
    Van_der_Voort_4 and nooby_mcnoob like this.
  6. zdreg


    #36     Feb 24, 2018
    nooby_mcnoob likes this.
  7. Thanks for all your comments guys. Regarding monitoring, one of the things I'm definitely looking to do is a combination of what has been presented. I've got copious log files that track everything from quotes, to orders, to signals but it's a mishmash. I can monitor the health of my system based on these log files, and what I do right now is keep open a few terminals with the log files using The plan is to send these log files to some external log aggregator that allows me to query and set monitoring expressions so that I can get notified if something is going wonky. I will obviously manually check this initially to make sure nothing is slipping through.

    I think the idea of using Twitter as a message bus to communicate between you and your algorithms is pretty cool, and I may actually try that if it turns out I need more than "shut down/restart" capability (I can do that without communicating with the algorithm).

    And to your point @zdreg I definitely want to KISS so if I'm doing anything that sounds complex, please call me out :)
    #37     Feb 24, 2018
  8. zzulus


    Why not to use AWS SQS or SNS? Create a simple website that shows your logfile, add some password protection, add a big red button sending a stop message to sqs. Your algo trader will listen to sqs queue and stop when you hit a button.

    Most likely you can use a free tier and won't have to pay for it.
    #38     Feb 24, 2018
  9. I don't want to manually scrutinize the log file except as a spot check. I want the log file to be analyzed automatically. Met an IT nerd yesterday who suggested Elastic Search.
    #39     Feb 24, 2018
  10. zzulus


    Elastic Search? I don't know what you are looking for, but I guess that is not it.

    Back to the original questions:
    > You want to shut down all trading
    If you want to have a remote kill switch, then SQS or its analogue from Azure / Google Cloud is what you can use. Halt all your trading workflows and initiate the liquidation.

    > How would I liquidate as step 2?
    What is liquidation - stop loss orders? There is no magic, your app can cancel all orders, and do P&L based decision if it can close positions by itself or a human being should do that manually. Depending on the market situation both auto and manual closing of positions can lead to the loss or eventual profit.
    #40     Feb 24, 2018
    Van_der_Voort_4 likes this.