Live data from Hacker News

Algorithmic Trading: A Practitioner’s Guide

henrikwarne.com

51–60 of 149 posts

Re: Algorithmic Trading: A Practitioner’s Guide

#51
I have been working my way through a 2013 book, "Professional Automated Trading: Theory and Practice" that uses Lisp as the language to implement a trading system of different frequencies using concepts from artificial life and control theory (I recall studying all of the stuff coming out of the Santa Fe Institute in the late 80's - Artificial Life I, swarm intelligence, etc.). Some of the AI/AL stuff is dated, but the trading knowledge covered and how to build an automated trading platform are great. He covers a lot of ground very concisely and based on solid experience. I love Lisp, so that was also why I gravitated towards this book.

I am currently into the April programming language, Array Programming Reimagined In Lisp[1], and I may try to implement the mathy parts of the book's code in APL and the remainder in Lisp as presented with some improvements. April is very flexible and takes advantage of the libraries and symbolic processing of Lisp. The creator of April just switched it to lazy evaluation from eager evaluation last month.

[1] https://github.com/phantomics/april

Re: Algorithmic Trading: A Practitioner’s Guide

#52

I always wonder if this space hasn’t been entirely cornered by HFTs. Isn’t it futile as an individual?

Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. There are always ways to make money even when your competitors have such advanced tools. The world of finance is big enough that there are opportunities for players of all sizes and resources. Look how badly AQR has done despite hiring from such a qualified talent pool.

>Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009.

This is a common misconception or a poorly phrased statement. It's not true that someone who bought/held tech stocks, or an ETF beat virtually all managed funds or that holding on to ETFs beats virtually every managed fund. It's true that passive investing, in tech or ETFs would have beat the average managed fund, and it's also true that an investor is better off investing in an ETF/diversified portfolio, but there are exceptional managed funds that significantly outperform the market.

The problem is that you are no more likely to know which managed fund will outperform the market than you are to know which stock will outperform the market. Picking a fund that will outperform the market, especially after fees, is just as hard as picking stocks, and in fact it might be even harder due to the fees.

But this does not mean that all, or virtually all funds perform worse than the market or even a segment of it.

One of the advantages of hedge funds in particular is that they can employ leverage in a way that provides almost all of the upside of leverage while protecting an investor from some of the downside. For example if I, as an individual, used leverage to trade on the market and some black swan even happens, not only would I lose the amount I invested, I could also end up in debt and have to sell my house or other assets to cover my obligations.

If I use leverage through a hedge fund, then I still get almost all of the benefits if the market moves in my favor, but if the market moves heavily against me the most I can lose is my investment.

Re: Algorithmic Trading: A Practitioner’s Guide

#53
post #44
post #37

Earlier quoted context omitted.

This is such weird commentary that pops up on every algotrading post. Why does it have to be socially productive? No one makes the claim it is.

It’s parasitic.

Okay, and is that bad? The entire world has systems which parasitic relationships exist that if they simply did not the entire ecosystem of live could collapse.

But here we are with 26 letters complaining on perhaps the most advanced thing humans have made because you don’t see the value of saving some money while trading.

People don’t exist to give things a way, expecting people to pay more is parasitic.

Re: Algorithmic Trading: A Practitioner’s Guide

#54

Trading seems dauting, especially when your competition are HFTs and huge firms, but there are even very simple patterns that can be profitable, that does not require any advanced coding, APIs, huge troves of data, quant formulas, etc. Once such simple method, which still works, is to short BTC and go long QQQ/SPY during market hours if there is relative weakness of BTC before the market open, whilst going long QQQ/S…

By the relative weakness do you just mean price drop? And how can SPY be hedge considering bitcoins incomparable volatility. Are position sizes proportional to volatility or something like that?

The US market opens at 6:30 AM PST. In the 30 minutes before the market open, BTC and the SPY/QQQ futures tend to be highly correlated, but let's say NQ (which is a futures contract that tracks the Nasdaq) rises .5% but BTC only rises .25%, then this would be relative weakness on the part of BTC. The trade would be to short BTC and go long QQQ in equal size.

Re: Algorithmic Trading: A Practitioner’s Guide

#55

I always wonder if this space hasn’t been entirely cornered by HFTs. Isn’t it futile as an individual?

HFT is mostly arbitrage, that's why they need the speed to reduce the risk. The rest of algo trading (and quant trading in general) tries to guess which way the market and individual securities will go based on market indicators and work over longer time horizons than HF traders work in. A simple example is that in low interest rate stocks will tend to outperform bonds, so the trade is to go long stocks and short bonds. Of course we expect that simple trades like this quickly be seen to be profitable and do more people do it and so the benefit of doing the trade versus just going long the market (beta) should eventually go down. So quants are always looking for other, more complicated trades as their current ones become less profitable.

Re: Algorithmic Trading: A Practitioner’s Guide

#56

Earlier quoted context omitted.

Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. There are always ways to make money even when your competitors have such advanced tools. The world of finance is big enough that there are opportunities for players of all sizes and resources. Look how badly AQR has done despite hiring from such a qualified talent pool.

>> Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. This is both absolutely correct, and entirely in-actionable since it uses hindsight. The question would be...what are the two stocks to buy to beat the market for the next 13yrs.

Saturation of markets picked up pace across the 2nd half of the 20th century. Postwar, with transistors, electronic goods went to saturation over decades. Since mobile phones, a localized saturation can happen in 1-2 years. The rate Americans bought washing machines and microwaves changed to the rate americans bought iPods and phones. White goods manufacturers stopped looking like profit machines.

Apple has a huge problem now: it's eating it's own market. Believing there is an endless belt of profit owning Apple shares is to ignore the risks of consumers changing their minds about "I need this years iPhone" and sales tanking. I read more people saying "my iPhone 12/13 is still fine" than I read people saying "I want to spend $1500 on an iPhone 15"

The cost of being Apple never gets better. They now have exposure to costs they didn't have in 2009. They will have exposure to more costs (s/w complexity, VLSI in-house) and they will have exposure to more market entrants. They are also at risk of supply chain dynamics which could erode profits multi-year if bad enough: imagine if TSMC's yield drops on complex must-have chips? It's force majeure stuff.

I certainly wish I'd bought apple in the 2000s or before. I would hesitate to assume its worth owning FAANG stock now, rather than other things (including EFT)

The long-term rate of return on investment across markets is 6-7% and being above that for periods is unusual and begs questions.

Re: Algorithmic Trading: A Practitioner’s Guide

#57
post #52

Earlier quoted context omitted.

Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. There are always ways to make money even when your competitors have such advanced tools. The world of finance is big enough that there are opportunities for players of all sizes and resources. Look how badly AQR has done despite hiring from such a qualified talent pool.

>Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. This is a common misconception or a poorly phrased statement. It's not true that someone who bought/held tech stocks, or an ETF beat virtually all managed funds or that holding on to ETFs beats virtually every managed fund. It's true that passive investing, in tech or ETFs would have beat the average managed fun…

For example if I, as an individual, used leverage to trade on the market and some black swan even happens, not only would I lose the amount I invested, I could also end up in debt and have to sell my house or other assets to cover my obligations.

This is not true. The broker would try to liquidate your positions well before that happens. Failure to put up collateral means your position will be forcibly closed. It's called Maintenance Margin. The last thing the broker is going to allow is for its clients to incur a debt and be on the hook. The hedge fund instead will send you a letter that your money is gone. Same thing.

Re: Algorithmic Trading: A Practitioner’s Guide

#58
post #52

Earlier quoted context omitted.

>Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. This is a common misconception or a poorly phrased statement. It's not true that someone who bought/held tech stocks, or an ETF beat virtually all managed funds or that holding on to ETFs beats virtually every managed fund. It's true that passive investing, in tech or ETFs would have beat the average managed fun…

For example if I, as an individual, used leverage to trade on the market and some black swan even happens, not only would I lose the amount I invested, I could also end up in debt and have to sell my house or other assets to cover my obligations. This is not true. The broker would try to liquidate your positions well before that happens. Failure to put up collateral means your position will be forcibly closed. It's c…

I'd be very careful to categorically state what is true or isn't true on a topic that you may not quite be an expert in.

Brokers have no ability to liquidate a position on a company that declares bankruptcy after market hours. In fact, most major events happen during times when trading is either halted or the market is closed.

As sad as it is, there are people who have committed suicide over having a negative balance including this individual who carried a -$730,000 balance:

https://www.nytimes.com/2020/07/08/technology/robinhood-risk...

Re: Algorithmic Trading: A Practitioner’s Guide

#59
post #3

How would I implement algorithmic trading at home? And would this be a viable idea if I knew what I was doing? Has anyone done this successfully?

First, become a PDT (25k min to pattern day trade), meaning you can't execute more than 4 trades in a 5 business day time-period. So if you are serious, you have to get to that first... then realize that whatever broker you are using, they probably have an API.

I do raw api calls, but you have to be so very careful. You can do something wrong and totally, absolutely jack yourself up, so this way is only for the very brave, but I think it offers good opportunities to understand the markets better if you can stomach the extreme risk profile.

Check out https://algotrading101.com/learn/ for a good set of practical articles to give you some context. I wish I could still point to Quantopian, which is where I started my learning process on this, but it died.

Re: Algorithmic Trading: A Practitioner’s Guide

#60
post #52

Earlier quoted context omitted.

Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. There are always ways to make money even when your competitors have such advanced tools. The world of finance is big enough that there are opportunities for players of all sizes and resources. Look how badly AQR has done despite hiring from such a qualified talent pool.

>Someone who merely bought and held tech stocks, like Apple & Nvidia, beat virtually all funds since 2009. This is a common misconception or a poorly phrased statement. It's not true that someone who bought/held tech stocks, or an ETF beat virtually all managed funds or that holding on to ETFs beats virtually every managed fund. It's true that passive investing, in tech or ETFs would have beat the average managed fun…

That largely depends on the type of leverage used (not all individual margin loans have the same conditions). It's possible to get pretty good terms as an individual in some circumstances (mostly if the loans are smaller and personally guaranteed), mostly by getting loans without margin calls attached. If you own a home, you can trivially borrow against it to invest without the risk of a margin call.

It's all tradeoffs - the broader the conditions at which a bank can recall your margin, the cheaper the interest and lower personal guarantee requirements (some may not hold you personally liable for negative balances - check your T&Cs). Funds can obviously borrow more, and at lower interest rates because of that though. Obviously their loans will be wound up on the way down no matter what, because the bank can't get money out of a negative balance like they would an individual.

Funds also don't tend to all-in on three tech stocks, so the fact they are very exposed to volatility with that type of leverage is less of an issue.

Post reply on HN