top | item 25968348

Offline Algorithms in Low-Frequency Trading

349 points| hypomnemata | 5 years ago |queue.acm.org | reply

100 comments

order
[+] lowfreqtrader|5 years ago|reply
If low frequency trading interests you, here's a project some people might want to check out: https://github.com/brndnmtthws/thetagang

It's designed to sell option premium on major indices (like the S&P500 or NASDAQ-100) to generate mostly passive income, with a fairly reasonable risk-adjusted return. It uses a combination of strategies that involve selling naked puts and covered calls, which both have the same risk profile, but naked puts tend to have higher premiums.

[+] svmt|5 years ago|reply
I briefly looked at the README and code. The strategy is an implementation of The Wheel. Did you backtest the strategy including commissions?

I doubt there is much left after commissions. See [0] for a backtest including commissions and [1] for a blog post from ORATS on how to backtest the strategy using the ORATS backtester.

[0] https://www.reddit.com/r/options/comments/j3ofna/the_wheel_b...

[1] https://blog.orats.com/backtest-basics-how-to-set-up-the-whe...

[+] varyherb|5 years ago|reply
Genuine question, does this strike others as immensely off-topic? I'm curious if the parent commenter even opened the link. I'm sure there are applications of generalized knapsack problems (or dynamic programming generally) in options trading, but this isn't it.
[+] lordnacho|5 years ago|reply
Ex pro options trader here. Looks interesting, and I've starred it, but it does sound like it's just collecting premium?

If you're selling options, you probably need to risk adjust your returns a bit more than what's common:

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=377260

That's by Andrew Lo, big name in the area.

I'm sure you've also come across Taleb, who knows a thing or two about selling options.

[+] beezle|5 years ago|reply
Generally speaking, a seller of naked puts is looking to supplement income via a stock they are willing to own at a lower level. If you are not willing to take delivery, it is probably better to sell a vertical spread so that there is a built in stop out. Here I'm speaking of transactions of a reasonable premium amount, not 5 or 10 cents.

While it is true that the upside is unlimited against a naked call (and the downside is 0 on a naked put), naked puts suffer from systemic risk that calls for all intents do not. Both are subject to news/events specific to the company in question, but the risk of the short call running away from you because the market had a +20% day are well, fleeting. On the other hand, unexpected economic news, politcal/military events, liquidity issues, etc can tank the entire market 10, 20, 30% and have numerous times. A rise of similar magnitude, to my knowledge, has only happened after market crashes (so you would then be alert to the upside risk).

[+] hntrader|5 years ago|reply
What does the tail risk look like on this strategy and what kind of annual return do you expect?
[+] jkhdigital|5 years ago|reply
I’ve observed the opposite in cryptocurrency option markets; covered calls tend to net a higher yield than the equivalent puts.
[+] icedchai|5 years ago|reply
Seems like it would be less trouble to buy QYLD (nasdaq-100 covered call ETF), or one of the equivalent funds.
[+] RyanShook|5 years ago|reply
Have you been successful running this script/strategy?
[+] breck|5 years ago|reply
Unzipped the code and put it here for easy viewing: https://github.com/breck7/drillBits

(Note: if author wants to create a GitHub I'll edit this link and point to theirs!)

[+] boxfire|5 years ago|reply
Given the clear copyright statement,

> Copyright (C) 2020-2021 Terence Kelly. All rights reserved.

did you happen to get the author's permission to put that up? I don't even like IP law that much, but its funny to me how much no one gives a shit. This was a crime, albeit a silly and small one.

[+] omarhaneef|5 years ago|reply
This is worth a read if only because of the clear introductory explanation of the market clearing mechanism.

However, it’s not a profit maximizing algo that will make you rich (not that there’s anything wrong with that).

[+] kwhitefoot|5 years ago|reply
Will it make me better off?
[+] secondcoming|5 years ago|reply
The Vickery Auction was pretty much the de-facto auction type in adtech realtime bidding.

It's since been replaced with standard first-price auctions for reasons I don't fully understand, but I assume it was because websites misunderstood bid prices and though they were being ripped off.

[+] bobbydreamer|5 years ago|reply
Just asking anybody figured out, how to find high low for a period of time. Say in a period of 6months, starting from a initial point, next point could be a high or low, if high, program needs to find next lowest point and afterward, it needs to find highest amd continues to do so in zigzag. For low it's vice versa.
[+] IIAOPSW|5 years ago|reply
I think what you are asking is given a time series (x_0, x_1... x_n), what is the 6 month high (or low) on day i? In other words you want the max (or min) of the sub series (x_{i-180},x_{i-179}... x_i).

x_0 is obviously the 6 month high at day 0 (since there is no previous data). If x_1 > x_0 then x_1 is the new 6 month high so we can discard x_0 on day 1. If x_1 < x_0 then x_0 is still the 6 month high on day 1, but we cannot discard x_1 because it might become the 6 month high when x_0 expires on day 181. So we need to maintain some sort of data structure of potential 6 month highs such that we can lookup the current high and remove these highs as they expire or get replaced. The easiest way to do this is with a list of pairs [(x_i1, i1), (x_i2, i2)...] sorted by increasing x_i. Because it is sorted, the current high is always found on the element closest to the end of the list. Furthermore when a new element (x_k, k) is added, it replaces all the elements which come before it (thus they can be removed). As a corollary, because the newest element is always added to the back (after removing what's in front of it), the list is also sorted by order of expiry (with the oldest (x_i,i) at the end). Start with an empty list and i = 0

Find the sorted insertion point in the list for (x_i,i).

Remove everything prior to the insertion point.

Insert (x_i, i) at the start of the list.

If the element at the end of the list (x_n, n) is expired (n < i+180) then remove it.

The 6 month high on day i is found in the element at the end of the list. Store this in a new series h_i.

Increment i by 1 and repeat.

This method trivially works for finding the 6 month low as well.

[+] hntrader|5 years ago|reply
You can do it in a single pass fairly easily. Loop over the rows of data. Store the current high to low, as well as the largest high to low since inception. If the current exceeds the largest since inception, simply replace it. Should be about 30 lines of code.
[+] Jommi|5 years ago|reply
There is a mistake in the article, the 2nd graph is repeated. There is no figure 3.
[+] msilb|5 years ago|reply
I was also wondering about the missing figure 3. In the linked pdf version everything seems to be in place.
[+] dgb23|5 years ago|reply
Interesting, we’re in one of the largest crisis since decades and all these stock trading stories are popping up.
[+] m3at|5 years ago|reply
This has little to do with trading, and a lot to do with algorithms. I recommend reading the articl, it is well written :)
[+] mhh__|5 years ago|reply
Crisis for whom?