Live data from Hacker News

Case study: Algorithmic trading with Go

polygon.io

61–70 of 311 posts

Re: Case study: Algorithmic trading with Go

#62
post #54
post #46

Earlier quoted context omitted.

That's sort of the secret sauce. But, having a platform like this is more than 75% of the solution. The rest is more around trend following.

It’s also stunningly easy to convince yourself you have a profitable algorithm when you actually have a money loser. Gaining 0.5%/day 60% of the time and breaking even 39% of the time looks great until you run into the 1% of the time where you lose 50%.

Yes, 100%. Like I said in the article there. I once lost like 40% in a few minutes in the pre-market because my app didn't have the correct sell logic. Honestly, I don't even know if I had the correct logic that would have even saved me, because the market was falling so quickly I probably could not have even for the fills I wanted. So, I've moved to breaking things into tons of small bets and really trying to manage risk.

Re: Case study: Algorithmic trading with Go

#63
post #27

Earlier quoted context omitted.

1. I think buying and holding is more probable to have a higher return 2. Sometimes you get a cool api and think wow this would be fun, and next thing you know you've lost thousands on boneheaded trades. I did something similar during the pandemic with Rust with the Polygon API (and instead of interactive brokers, I used tradier). Eventually I learned I actually had more fun building the thing than actually trying to…

I have won and lots thousands for sure. Haha. When stocks were on a rip the bot was making lots of money just because everything was going way up. Then, in 2022 when everything went way down, like tons of tech stocks, my bot sucked. So, I really need to add shorting or something. I'm still exploring things on the strategy side.

Aka, everyone thinks they’re an investing genius when the whole market is going up.

Re: Case study: Algorithmic trading with Go

#64

I worked in HFT for a while. I find the whole space fascinating. I'm glad OP found similar thrills. "This aspect, the platform itself, seems to be often overlooked in most discussions. Many conversations revolve around strategies (mean reversion, trend following, linear regression, etc.), and backtesting, without fully addressing the practical mechanics or logistics of strategy implementation, particularly in the con…

Not only are the platforms table stakes they are the more straightforward part to build. Even at the bleeding edge of latency you can usually work your way to the limits of your platform budget without having to find anything novel. The strategies though are where the discovery is. There are a few strategies that are well known and still profitable but those are largely consolidated to the biggest firms. For everythi…

"they are the more straightforward part to build"

More straightforward, heh, sure. But still damnably complicated. Which just goes to show how much money and how much engineering talent is invested in this world that these things are so taken for granted.

Re: Case study: Algorithmic trading with Go

#65

I worked in HFT for a while. I find the whole space fascinating. I'm glad OP found similar thrills. "This aspect, the platform itself, seems to be often overlooked in most discussions. Many conversations revolve around strategies (mean reversion, trend following, linear regression, etc.), and backtesting, without fully addressing the practical mechanics or logistics of strategy implementation, particularly in the con…

Not only are the platforms table stakes they are the more straightforward part to build. Even at the bleeding edge of latency you can usually work your way to the limits of your platform budget without having to find anything novel. The strategies though are where the discovery is. There are a few strategies that are well known and still profitable but those are largely consolidated to the biggest firms. For everythi…

[deleted]

Re: Case study: Algorithmic trading with Go

#66
post #57

also having worked in the space: HFT should not exist. Break up the day into segments and have a single crossing. Do it every five minutes or whatever for sufficient timeliness. the millisecond race does not make anything better for anybody except the people doing the trading.

Amazing, I just checked out your profile. I used del.icio.us religiously back in the day. Thank you!

Re: Case study: Algorithmic trading with Go

#67
QQ for everybody since OP is using IB API which is notoriously bad that many wrappers have been written for it (ib-insync).

This is a general question, I'm wondering is there any good framework/wrappers out there that one can learn from to code up a complex trading application?

Like dealing with all the asynchronous nature of process/submitting trading and quotes messages.

Re: Case study: Algorithmic trading with Go

#68
I've been building a bot with Typescript because it is what I know and Python because of the tools available.

It is an overwhelming lonely endeavor. With all my other projects, I've always worked on teams, although they have always been very small teams and most of my work was autonomous -- still there was the occasional meeting and stand-ups. I've been working on this for six months and thought about bringing a friend onboard for no other reason than to not be alone.

Re: Case study: Algorithmic trading with Go

#69

Has the network or the power ever gone out at a bad time?

Yes, both. Basically, I learned early that I needed a backup power supply. I have a couple that power my computer, monitors, and the internet router. For the network, that one is really tricky. In that, you're screwed. I've only had this happen once and then I needed to manually sell all my positions. Luckily, I didn't lose any money.

Re: Case study: Algorithmic trading with Go

#70
post #57

also having worked in the space: HFT should not exist. Break up the day into segments and have a single crossing. Do it every five minutes or whatever for sufficient timeliness. the millisecond race does not make anything better for anybody except the people doing the trading.

I think you would still end up with races, they'd just move around. IEX's "speed bump" was just marketing and didn't really matter to actual HFTs.

Plus, some of it is unavoidable if you don't have a single unified exchange. Where there's latency, there's inefficiencies, and where there's inefficiency, there's profit to be made. And competition among exchanges is healthy for the ecosystem, so I don't think we'd want to consolidate.

And lastly, HFT has consolidated so much that I don't think it's worth worrying about. Virtu literally switched sides and make most of their money on order execution. Industry-wide, HFT revenues are down like 80% over the last 5-8 years. Between wholesaling/PFOF taking non-toxic order flow off the lit exchanges, and banks finally wising up on not being pants-on-head about their order execution, it's literally just sharks in the pool now, there's not even any water.

Post reply on HN