News for hackers. Stuff that matters.
Re:Algorithmic Trading with Go by k9jd883jb on Friday June 30, 2023 @02:21PM (#36539758)
Awesome write up. I have a similar project in Go myself, although I just use minute bar data instead of realtime ticks.

Can you share your approach for plugging in various strategies? I quickly learned that having a pluggable strategy system is tricky as it could span across multiple layers of the system.

Also, with backtesting, are you storing and replaying all the quote/tick data? or just using the historical aggregates?

Re:Algorithmic Trading with Go by WestCoastJustin on Friday June 30, 2023 @02:35PM (#36539987)
I wish this was better, but honestly, I'm just hard coding them right into the BUY loop. So, I need to restart the app anything I want to change something. That's why I build this logic to dump and reload the state into a gob file (go memory dump essentially). Ideally, you'd have some type of format to write out your algorithm, and then have a way of hot loading it or something. But, I don't change these enough to really do that yet.

For back testing, I download all raw trades and quotes, and put them into 1 file sorted by time. Then, I compress them using lz4. This allows me to sort of replay the entire market and build up all my intraday backtesting from the source. This took me a long time to figure out and build but has been so worth it. So, I have an off-line script that basically, loops through these files, and replays the market, and makes simulated trades, and then spits out what would have happened. There is a GUI for that too so you can go in an explore the trades and see what triggered the buy and sell. I have seen nothing that goes backtesting for intraday like this.

This is super inefficient but I'm just building the aggregates on the fly. I could probably cache them somewhere but it takes maybe 4-5 minutes to replay a days worth of trades/quotes and build all this so I haven't bothered yet.

Re:Algorithmic Trading with Go by slashdev on Friday June 30, 2023 @03:15PM (#36540641)
Fascinating. Have you considered open sourcing this without your algorithms ( empty buy/ sell loops)?

I’d like to play with something like this but I couldn’t be bothered to build it all from scratch.

Re:Algorithmic Trading with Go by WestCoastJustin on Friday June 30, 2023 @03:22PM (#36540746)
Yeah, I can do that. Ping me at justin @ sysadmincasts . com and I'll send you a note when I've done it.
Re:Algorithmic Trading with Go by dzink on Friday June 30, 2023 @04:26PM (#36541737)
Count me in the group of solo algo trading developers (Go and Python and Tradingview Pinescript and other sruff). Planning to send you an email but maybe we can form a group/discord or something online.
Re:Algorithmic Trading with Go by devgoth on Friday June 30, 2023 @05:38PM (#36542696)
sign me up as well! I would def be interested too.
Re:Algorithmic Trading with Go by reallymental on Friday June 30, 2023 @09:33PM (#36545319)
Do count me in as well! Literally in the middle of building something like this myself.

I've also got a few questions regarding the way you manage memory, so I might ask you a couple !