Fully Automated Stocks Trading

Status
Not open for further replies.
Thought I'll mention this as didn't see anyone using "Slack" for controlling their automation. Though, it is extremely powerful and efficient in terms of dev cost/value.

When I started working on my first execution software I had the following key requirements in mind:
  1. Have something that runs as 24x7 as possible and is resilient to typical failures
  2. Have good transparency on what's going / available literally on the go
  3. Have ability to control it / fix it on the go
It took a while to find a right balance considering cost and development time.

Ended up implementing my own Slack bot which is very easy.
Biggest advantage was leveraging their mobile/desktop apps. Can send a message to my own channel in one line of code, another line to handle Slack initiated command.

I try not to look at it during a day but it has everything normally needed to get the full picture of what's going on / was happening historically.

  1. Once every 30 mins it posts quick status report with all systems status, positions, orders, closest triggers, proximity to exit points, exact plan for scheduled actions etc.
  2. It notifies about key actions like executions
  3. Alerts on unusual stuff like very high margins or borrow rates for my some items on my watchlist
  4. Once a day, after EOD data is available it runs backtesting software to generates model vs backtest comparison report and calculates any discrepancies
  5. There are secondary notifications for critical stuff like broker or data feed is down / generated by separately hosted service. SMS + email. So I don't need to open Slack unless I really want to.
Overtime I came up with little tricks like completely removing indication of P&L in intraday reports. So if I do look at them there is less chance of emotional reaction.

View attachment 235199

In general I don't think that software component is very important in trading. So I didn't start this journal with this.

It also tends to be a rabbit hole. Whenever I think I need to work on software more I ask myself a question - how much money it's gonna potentially make or save. That really helps to stay focused.

Biggest return on time invested normally will be on strategy development or looking for ways to improve executions.

Val
Cool to see someone else using Slack for notifications. All of my strategies log structured events which get pushed up to AWS CloudWatch and from there I have Lambda's sending messages to various Slack channels. This setup works really well because all my strategies have to do is log events and then I can easily change how I report those events without touching any of my strategy code.

One thing you might want to consider is having a separate channel for reporting alarms. I have found this very helpful in that sometimes I will mute all channels except the alarm channel where I know that if I get a notification it is because there is a problem.
 
Last edited:
Cool to see someone else using Slack for notifications. All of my strategies log structured events which get pushed up to AWS CloudWatch and from there I have Lambda's sending messages to various Slack channels. This setup works really well because all my strategies have to do is log events and then I can easily change how I report those events without touching any of my strategy code.

One thing you might want to consider is having a separate channel for reporting alarms. I have found this very helpful in that sometimes I will mute all channels except the alarm channel where I know that if I get a notification it is because there is a problem.

Awesome!

Thank you for sharing. Found your thread with details. It seems like a good and scalable solution.

--
I am using separate channels just split by a different criteria.
For the sake of reducing distractions I have everything critical pushed as SMS+email. My watch is configured to vibrate on margin warning, data/broker/my software didn't pass a health check.

Are you using slack to control your bot?

I have ~20 commands to let me handle pretty much any emergency from my phone. Irreplaceable if I'm on vacation or traveling.

PS. All my trading stack is in CI/CD pipeline. So a code change is as easy as changing a config or a lambda. Once I "git push" it's live under <1 min

Val
 
Awesome!

Thank you for sharing. Found your thread with details. It seems like a good and scalable solution.

--
I am using separate channels just split by a different criteria.
For the sake of reducing distractions I have everything critical pushed as SMS+email. My watch is configured to vibrate on margin warning, data/broker/my software didn't pass a health check.

Are you using slack to control your bot?

I have ~20 commands to let me handle pretty much any emergency from my phone. Irreplaceable if I'm on vacation or traveling.

PS. All my trading stack is in CI/CD pipeline. So a code change is as easy as changing a config or a lambda. Once I "git push" it's live under <1 min

Val
I am not using Slack to control my live trading but that is a great idea! What are some example commands you are using?
 
I am not using Slack to control my live trading but that is a great idea! What are some example commands you are using?

Two separate bots, (trader = t) to control execution, (remote = r) second for overall trading stack. I use what they call "slash commands"

"/t s" or "/t status" would pull a quick status report for everything I normally need. Other examples - pause/unpause executions, manually initiate some scheduled task, print execution environment internals like orders cache, force-reload signals from research software, override daily risk limits, emergency position liquidation/orders cancellation, state reset etc. Basically whatever I could possibly need to solve any abnormal situation on the go.

On practice I mostly just get reports outside of normal schedule if I get time to look at them earlier than they are scheduled to execute automatically.

/r <cmd> are to restart ib-gateway or my execution engine, manually trigger full CI/CD cycle or part of it. Mostly unused but I need them for then I need them.

Whole execution stack if mostly "self-healing", to the extend I cared about at least. All apps including ib-gateway have health criteria, which is pretty complex for trader itself. Auto-recovery attempt will kick in if any don't pass. That is mostly enough to run for weeks without touching anything.

Val
 
Two separate bots, (trader = t) to control execution, (remote = r) second for overall trading stack. I use what they call "slash commands"

"/t s" or "/t status" would pull a quick status report for everything I normally need. Other examples - pause/unpause executions, manually initiate some scheduled task, print execution environment internals like orders cache, force-reload signals from research software, override daily risk limits, emergency position liquidation/orders cancellation, state reset etc. Basically whatever I could possibly need to solve any abnormal situation on the go.

On practice I mostly just get reports outside of normal schedule if I get time to look at them earlier than they are scheduled to execute automatically.

/r <cmd> are to restart ib-gateway or my execution engine, manually trigger full CI/CD cycle or part of it. Mostly unused but I need them for then I need them.

Whole execution stack if mostly "self-healing", to the extend I cared about at least. All apps including ib-gateway have health criteria, which is pretty complex for trader itself. Auto-recovery attempt will kick in if any don't pass. That is mostly enough to run for weeks without touching anything.

Val
Looks like you have a tight setup. Let me guess, you write software for your day job :)
 
Quick performance update: +8.54% in June, over 75 trades.

YTD monthly: +4.91%, +0.59%, +14.03%, +18.86%, +6.27%, +1.23%, +8.54%

No negative months this year so far, which is pretty unusual and not likely to last.

June was quite volatile month for shorts but all systems were within expected parameters. Most also seen new highs which is great.

Traded only thru first 2 weeks.

For a first time in a while I decided to actually pause executions while I was working on software piece, because the change was too big and I needed to reduce distractions. My life outside of trading was extremely busy and all I could spare was 4-5 hours a day in the early mornings / evenings + more on weekends.

So spent the rest of the month on more sophisticated version of orders management engine and risk control for intraday executions. Added lots of extra stats to capture automatically on a trade entry/exit level, such as borrowing/rebate rates at the time, margin requirements, variations of spreads, etc.

For the lack of time I was literally troubleshooting in my sleep and going thru all sorts of edge case scenarios my software can encounter.

While testing new version in late July I was staring at the market intraday. Few setups in ES/VXX looked just too easy to miss out on. Net result was just under +2%. But that's not something I'd normally do. Nevertheless - free rent for a few months :)

In the upcoming months, I would not be surprised to see some nasty sharp drawdowns in short positions. Probably with relatively quick recoveries for the most part.

Val
 
Today is only July 19th, which I wouldn't call late July. Have you been "troubleshooting in your sleep" a bit too much? :)

July 18 for some of us. Even now? :p Late June obviously.

Btw, saw your last post in the futures thread - can related to that. Increasing software complexity was rarely contributing much to my profitability. With exceptions being when I knew exactly why I needed a change and how much money it was costing me not to make it.

Val
 
Hey @ValeryN excellent journal man, really good stuff.

you mentioned some great intraday set ups in ES and VXX. Care to explain what you saw that make you take these trades?
 
Status
Not open for further replies.
Back
Top