Live data from Hacker News

Lessons learned building an ML trading system

tradientblog.com

81–90 of 160 posts

Re: Lessons learned building an ML trading system

#81

Earlier quoted context omitted.

What's the value of HFT? If exchanges were required to add a random delay to very trade to work against high frequency traders, would anything of value be lost?

If exchanges added a random delay, that would mean traders have to plan for a longer time horizon, which means they need to offer more conservative prices. That means when you're selling, you get less money, and when you're buying, you get less stuff. Some people have this notion that if their trade got matched against a HFT that they have somehow lost out. The exact opposite is true. If the party on the other side o…

Hang on, that is conflating separate ideas.

The substance of your post is describing price discovery - price discovery isn't the issue here. The issue is that the price discovery is being done in milliseconds.

The substance of the complaint is the speed of the auction that discovers the price. The faster price discovery is being done, the fewer traders can participate. If a few milliseconds can change the value of a financial instrument then we have to accept that waiting a second or two will allow a lot more traders to reevaluate and offer a fair price.

The HF in HFT looks like a play to reduce the number of traders who can act on information, which means the buyer/seller is probably getting scalped. HFT traders are making money arbitraging the speed of information dissemination, which indicates that other traders would offer different (/better) prices if the market waited a half-second or so to let everyone gather all the relevant data.

Re: Lessons learned building an ML trading system

#82
post #79
post #77

Earlier quoted context omitted.

It isn't obvious that the retail investors are that excited by sub-second liquidity. Speaking personally, I'd even be happy to wait several seconds to see if someone else is willing to pay a better price.

That's not how things work. You would see much less demand/supply for a particular stock at every price level, which means you'd pay much more to buy less and would have to pay much more to sell less also. There are no upsides to having fewer market makers.

> you would see much less demand/supply

Why? If the HFT firm was willing to offer me $X 2 milliseconds ago they are probably still willing to offer $X now. It isn't like there has been time for anything to change; there are going to be short periods of time where there is literally no new information.

And they are just as likely to be offering me more now than less as conditions change.

Re: Lessons learned building an ML trading system

#83

After having spent an insane amount of time in late 2017/2018 building an HFT bot for Binance I can say this is a pretty solid article. In our case we were doing triangle trading between BTC/ETH/USDT pairs and had our buys/sell delay down to 3-7ms. At one point moving 0.3-0.7% of Binance’s daily volume. Few notes: * Finding an objective point of truth for value when all of the currencies are floating is hard but vita…

What's the value of HFT? If exchanges were required to add a random delay to very trade to work against high frequency traders, would anything of value be lost?

Yes, adding delay generally lowers the economic value of markets. In addition to improving liquidity, as mentioned by others here, HFT also improves the relative pricing of related instruments. There is an enormous number of financial instruments traded for the purpose of prioritizing resources, transforming assets, and offsetting risk. Equities and cryptocurrencies are a small part of this connected financial universe. There are many trading entities with unique information and/or understanding about different parts of this constantly changing universe of prices. None of them has a complete view, but by communicating with each other through trading, their expertise is pooled. HFT speeds this communication network, which improves the dynamic consensus.

Re: Lessons learned building an ML trading system

#84
I spent the last year working fulltime on a system similar to the one described here. I trade the top ~20 cryptos on binance. I use deep learning models (combination of temporal, causal convnets and RNNs) with heavy data augmentation. I built my own tooling for data collection, training, backtesting and live deployment. Having a data engineer background coming into this was hugely helpful: most of my time was spent manipulating data in some way (and not playing around with the models). One of the most demanding parts was estimating spread/slippage costs and including it into the loss function.

Most of what the author talked about, I learned the hard way.

I'm now at the point where I ran some tests (trading small amounts) live on binance and the results are positive: I do manage to make small profits, but more importantly, the recorded live trades reflect very closely the backtest trades (for a given period). I'm currently scaling up my model and adding better monitoring / reporting / CI.

I'd be happy to chat with anyone having done similar projects or willing to exchange ideas.

Re: Lessons learned building an ML trading system

#85
post #81

Earlier quoted context omitted.

If exchanges added a random delay, that would mean traders have to plan for a longer time horizon, which means they need to offer more conservative prices. That means when you're selling, you get less money, and when you're buying, you get less stuff. Some people have this notion that if their trade got matched against a HFT that they have somehow lost out. The exact opposite is true. If the party on the other side o…

Hang on, that is conflating separate ideas. The substance of your post is describing price discovery - price discovery isn't the issue here. The issue is that the price discovery is being done in milliseconds. The substance of the complaint is the speed of the auction that discovers the price. The faster price discovery is being done, the fewer traders can participate. If a few milliseconds can change the value of a…

> The substance of the complaint is the speed of the auction that discovers the price. The faster price discovery is being done, the fewer traders can participate.

The faster the price discovery, the shorter the validity time. This means a more accurate price.

> If a few milliseconds can change the value of a financial instrument then we have to accept that waiting a second or two will allow a lot more traders to reevaluate and offer a fair price.

You're making the mistake of assuming the price is static. If I have to quote you a price on an instrument that's valid for the next 5s, I have to be more conservative than if I'm quoting for the next 5ms. Which means you get a worse price.

> The HF in HFT looks like a play to reduce the number of traders who can act on information, which means the buyer/seller is probably getting scalped. HFT traders are making money arbitraging the speed of information dissemination, which indicates that other traders would offer different (/better) prices if the market waited a half-second or so to let everyone gather all the relevant data.

There's literally nothing stopping or limiting the numbers of players operating at this speed. What the race actually results in is all market participants getting smaller spreads and better prices.

Re: Lessons learned building an ML trading system

#86

After having spent an insane amount of time in late 2017/2018 building an HFT bot for Binance I can say this is a pretty solid article. In our case we were doing triangle trading between BTC/ETH/USDT pairs and had our buys/sell delay down to 3-7ms. At one point moving 0.3-0.7% of Binance’s daily volume. Few notes: * Finding an objective point of truth for value when all of the currencies are floating is hard but vita…

What's the value of HFT? If exchanges were required to add a random delay to very trade to work against high frequency traders, would anything of value be lost?

Liquidity, which honestly has very little value to a traditional stock market. HFT and day trading both just exist as rent seeking behaviors on company valuation growth.

Re: Lessons learned building an ML trading system

#87

After having spent an insane amount of time in late 2017/2018 building an HFT bot for Binance I can say this is a pretty solid article. In our case we were doing triangle trading between BTC/ETH/USDT pairs and had our buys/sell delay down to 3-7ms. At one point moving 0.3-0.7% of Binance’s daily volume. Few notes: * Finding an objective point of truth for value when all of the currencies are floating is hard but vita…

I have had a similar experience. The house always wins.

Re: Lessons learned building an ML trading system

#88
post #50
post #37

Earlier quoted context omitted.

Even in regulated markets there are problems. I have a friend who built an HFT algorithm that he was using for trading stocks. He had some really good results with early testing. But at some point he was confused why many of his buy/sell orders weren't being executed despite being open for several minutes (hours?) his algo would make bids far away from the current spread, anticipating movement. He finally concluded t…

> But at some point he was confused why many of his buy/sell orders weren't being executed despite being open for several minutes (hours?) his algo would make bids far away from the current spread, anticipating movement * Did his levels actually get crossed? It could be that he never had the opportunity to get filled at the price he hoped for. * What was his queue position? Stock exchanges tend to be price time order…

It's a fact that Joe Blow will get sub-penny price improvement at random. I have no idea how often or how long it's been a thing, but it happens.

Re: Lessons learned building an ML trading system

#89
post #85
post #81

Earlier quoted context omitted.

Hang on, that is conflating separate ideas. The substance of your post is describing price discovery - price discovery isn't the issue here. The issue is that the price discovery is being done in milliseconds. The substance of the complaint is the speed of the auction that discovers the price. The faster price discovery is being done, the fewer traders can participate. If a few milliseconds can change the value of a…

> The substance of the complaint is the speed of the auction that discovers the price. The faster price discovery is being done, the fewer traders can participate. The faster the price discovery, the shorter the validity time. This means a more accurate price. > If a few milliseconds can change the value of a financial instrument then we have to accept that waiting a second or two will allow a lot more traders to ree…

"The faster the price discovery, the shorter the validity time. This means a more accurate price."

A continuous market price is an illusion; let's not forget that. Every market is made up of trades, which are discrete, and every price has an unstated amount of uncertainty, which may be large by any standards. You can't know from first principles whether a change in quoted price is even a change in the market, because it could be within the +/- range that's implicit. Apple is quoted to the nearest penny, at least, but the idea that the current price is accurate to within 0.004% is ridiculous.

Edit:

"Fischer Black famously defined an efficient market as “one in which price is within a factor of 2 of value, i.e., the price is more than half of value and less than twice value,”

...I hadn't heard this before Matt Levine mentioned it, but I was like "yeah, obviously, why haven't most people gotten the message?"

But: "BNP Paribas...said [Saudi] Aramco was worth exactly $1.424394 trillion."

I wonder which particular millisecond that held for.

Edit Edit: The market has a whole (mostly) unseen dimension other than uncertainty, which is depth. You can only buy or sell so many shares at the instantaneous market price. Further away, there may be orders, but the price of the whole company is going to be way outside of that. The shorter the timescale, the shallower the "market" so you can't just say we're making progress by doing things faster. It's like when research lasers are said to make unbelievable power, but it's like for a femtosecond or something. Liquidity, in my mind, requires depth, just as with water.

Re: Lessons learned building an ML trading system

#90

This post is an exemplar of the crucial relationship between domain-specific knowledge and ML competency in the ML space. The bulk of the post is detailing the tricky ins and outs of trading, and overall the author gives the impression that they're broadly knowledgeable about stock markets. Contrast this post with those you see with ML hobbyists who delve into medicine or fake-news and produce useless results testame…

Domain knowledge is essential to almost any project that aims for eventual commercial success, it is quite rare than an outsider will come into a field, apply some ML and make a killing.
Post reply on HN