algo-trading

/algo-trading41

Discuss about algorithmic trading, quant finance and automated trading strategies.

GM.

Good Algo Monday for everyone.

What are delta-hedged and gamma-hedged positions? These terms are used in option trading, but can be applied to some degree to other crypto trading as well (perps, staking, etc.)

Delta means you are neutral to the price movements of the underlying asset, e.g., ETH. Usually, this is done by having both long and short positions open at the same time. Typical is long spot ETH, short perps.

Gamma is neutral to the *speed* of the price movement of the underlying asset. Because for a delta neutral position, you need to constantly rebalance it (with a cost). If crypto price moves fast enough (volatility spike), you cannot rebalance your delta neutral fast enough and you get expose due to bad trade execution.

More here:

https://tradingstrategy.ai/glossary/delta-hedged

https://tradingstrategy.ai/glossary/gamma-hedged
Uniswap v3 and Aave delta hedged strategy.

A post outlining an example trading strategy creating Uniswap V3 liquidity provision position which is delta hedged using Aave lending protocol.

https://medium.com/zelos-research/how-to-implement-uniswap-delta-neutral-strategy-with-lending-protocol-eee10371a77f
Looking to get started in algorithmic trading?

PyQuant offers free and paid online courses for Python and stock market algorithmic trading.

https://www.pyquantnews.com/getting-started-with-python-for-quant-finance

(not an affiliate, just like the project)
Optimal Factor Timing in a High-Dimensional Setting.

"We develop a framework for equity factor timing in a high-dimensional setting when the number of factors and factor return predictors can be large. To ensure good out-of-sample performance, the approach is disciplined by shrinkage that effectively expresses a degree of skepticism about outsized gains from timing. "

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4938729
Awesome Quant is a curated Github list for tools for algorithmic trading for various programming languages

https://github.com/wilsonfreitas/awesome-quant
Advanced Futures Trading Strategies.

So far the best book on algorithmic trading I have read. Intermediate level. You need to know basics and then you can follow the book.

Robert Carver, a hedge fund manager, explains how you can use leverage as a risk control mechanism and how you should allocate capital across different strategies and assets.

https://www.amazon.com/Advanced-Futures-Trading-Strategies-Robert/dp/0857199684
In a bull market it is super hard to outperform the underlying asset if you trade spot (you would need a leverage for that).

However long term a smart strategy can beat buy and hold, as it has likely better timings than an average trader for entries and exits.

Here is an RSI-based momentum strategy overperforming underlying Bitcoin and Ether.

https://tradingstrategy.ai/blog/outperfoming-eth
Algorithmic trading cannot make miracles if the underlying assets perform poorly.

Here is a trading strategy that trades MATIC-USDC pair. Matic is down -44%. The strategy is down -11%.

This is why any portfolio strategy should diversify over multiple assets.

Some more strategy performance reviews here:

https://tradingstrategy.ai/blog/the-first-strategy-performance-review
EQUITY CURVE

Both manual and algorithmic trading strategies can be compared with an equity curve: how does the strategy accumulate wealth over time.

An equity curve shows the strategy profit, and is usually compared to some benchmark curve like SP500 stock index or buy and hold Bitcoin in crypto.

A good equity curve
- Keeps going up
- Has a stable slope (predictable)
- Does not have large dips (maximum drawdown)

More here:

https://tradingstrategy.ai/blog/assessing-trading-strategies-with-equity-curve-charts
Portfolio construction:

Portfolio construction is an automated trading strategy where you create a basket of assets (portfolio) based on how much "alpha signal" you think those assets have. Alpha signal meaning how likely the asset is outperform to its peers.

Then you regularly rebalance your portfolio based on those signals.

Here more:

https://tradingstrategy.ai/blog/writing-portfolio-construction-strategy-in-python
Crypto finally trending (up) again?

Pavel from Robuxio, a crypto algo trader in his September market overview

https://www.youtube.com/watch?v=Uq66LCf-qX0
RSI 50: The dumbest Bitcoin momentum trading strategy there is.

- Buy Bitcoin its price is above 50 days moving average.

- Sell otherwise.

Beats Bitcoin buy and hold in the past.

Python notebook here:

https://github.com/tradingstrategy-ai/getting-started/blob/master/notebooks/single-backtest/bitcoin-ma.ipynb

- Note logarithmic Y axis
- Mainly outperforms because it avoids the worst of the dips
How is AI use in cryptocurrency trading?

A blog post and links Python frameworks to papers researching on the topic.

https://tradingstrategy.ai/blog/how-is-ai-used-in-cryptocurrency-trading
The Varadi Oscillator (DVO) is a leading indicator first proposed by David Varadi and originally aimed to reduce the influence of the trend component in oscillators. The DVO can be described as a rolling percent rank of detrended prices over a particular lookback period.

https://www.quantitativo.com/p/a-different-indicator
ETH 10 days high strategy: Buy ETH if the yesterday's close is above previous 10 days highest.

Verdict: Does not work (despite what some people claim on Twitter). You will lose all your money on trading fees.

Backtest in jupyter notebook: https://github.com/tradingstrategy-ai/getting-started/blob/master/notebooks/single-backtest/eth-10-days-high.ipynb