Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevingastelum/myquantsfinance

My Algorithmic trading bots and strategies for Quantitative and High-Frequency trading in FinTech
https://github.com/kevingastelum/myquantsfinance

Last synced: 1 day ago
JSON representation

My Algorithmic trading bots and strategies for Quantitative and High-Frequency trading in FinTech

Awesome Lists containing this project

README

        

# Quants 🤖

_"A Quant, or Quantitative Analyst, embodies the fusion of finance and technology, leveraging mathematical, statistical, and computational techniques to decode the complexities of financial markets."_

## Becoming a Quant ⚖️

I'll begin by coding the [Basic Indicators](#basic-indicators) listed below. These indicators have been used for decades but mastering these allows you to identify Market Trend (downtrend or uptrend), Supply and Demand zones (areas where most people bought or sold), Volume, and Volatility. From there I'll focus on creating [Trading Strategies](#trading-strategies) that leverage these insights to automize spotting entry/exit points, risk/returns, breakouts, reversals, and profits. Before executing any trade live, a backtest is needed to ensure a [Profitable Strategy](#profitable-quant-strategy-results)

## Demistifying the Financial Market [(FinTech)](https://en.wikipedia.org/wiki/Fintech#:~:text=Fintech%2C%20a%20clipped,fintech.%5B6%5D) 🔮

Key Terms:

- **Assets** - Equities (Fancy name for Stocks), Commodities, Cryptocurrencies 📉📈
- **Liquidity** (Fancy way of saying Funds) 💧
- **Derivatives** - AKA Options | Futures | Perpetuals 📈 - used to trade with margin.
- **Margin/Leverage** - Many exchanges allow you to borrow funds to execute trades, with the risk of being liquidated, this occurs once your available liquidity runs out 💰.

$1,000 with 10x margin = $10,000 (CAUTION ⚠️ this also means you risk losing money 10x faster)

# Quant Trading 🧠💼

### Basic Indicators:

1. **[EMA](https://github.com/KevinGastelum/MyQuantsFinance/blob/7c416ef28ae63db1776273cb132bac01a5eebee9/1_indicators/indicators.py#L119)** (Exponential Moving Average) - Weighted moving average used for trend identification 📉.
2. **[RSI](https://github.com/KevinGastelum/MyQuantsFinance/blob/7ff0b32cc68e3cbbc401769fcd3fda117dc62380/1_indicators/indicators.py#L14)** (Relative Strength Index) - Momentum oscillator identifying overbought or oversold conditions 🔴🟢.
3. **[VWAP](https://github.com/KevinGastelum/MyQuantsFinance/blob/fa33cae78d44d042aba350a1dfe1def684cc7e87/1_indicators/indicators.py#L57)** (Volume Weighted Average Price) - Average price based on volume and price 🔍.
4. **[MACD](https://github.com/KevinGastelum/MyQuantsFinance/blob/7ff0b32cc68e3cbbc401769fcd3fda117dc62380/1_indicators/indicators.py#L43)** (Moving Avg Convergence Divergence) - Uses two moving avgs to identfy momentum and revrsal points.
5. **[Bollinger Bands](https://github.com/KevinGastelum/MyQuantsFinance/blob/7ff0b32cc68e3cbbc401769fcd3fda117dc62380/1_indicators/indicators.py#L24)** - Used to spot reversals, corrections, and entry/exit points based on Standard deviation of EMAs.
6. **Fibonacci Retracement** - Uses Fibonacci ratios to indicate potential support or resistance levels 🔢.

### Trading Strategies:

1. **Mean Reversion** - Assumes prices revert back to the mean and trades against trends 🔁.
2. **[GARCH](https://github.com/KevinGastelum/MyQuantsFinance/blob/main/2_strategies/strat_garch.py)** - Good at forecasting future volatility, derivative pricing, risk management and portfolio optimization 🗞️

3. **Pair Trading** - Bets on the convergence/divergence of two similar companies' stock prices 📊.
4. **Breakout Trading** - Looks for levels or areas that a stock has been unable to move beyond, and waits for it to move beyond those levels 🚪🔓.
5. **[Lorentzian Classifier](https://github.com/KevinGastelum/MyQuantsFinance/blob/main/2_strategies/strat_lorentzian_classifier.py)** - Uses Lorentzian distance metric and KNN algo for price forecasting 🏃‍♂️💨.

### Advanced Trading Strategies:

1. **[MLSentiment Strat](https://github.com/KevinGastelum/MyQuantsFinance/blob/main/2_strategies/strat_sentiment_lumibot.py)** - Analyzes market mood through news and social media using FinBert for trading signals 💬

2. **Machine Learning Models** - Predicts market movements using historical data and algorithms; LSTM, K-Means Clustering 🤖📈.
3. **Option Strategies** - Employs methods like delta-neutral trading to hedge market movements 🛡️.
4. **High-Frequency Trading** (HFT) - Executes numerous trades daily to capture small price movements ⚡.
5. **Market Making** - Provides market liquidity, profiting by looking at the Order book and seeing bid-ask spread to see where price is likely to gravitate to ↔️.

# [Profitable Quant Strategy results](https://github.com/KevinGastelum/MyQuantsFinance/blob/main/2_strategies/strat_sentiment_lumibot.py)

Comparing [My Strategy](https://github.com/KevinGastelum/MyQuantsFinance/blob/main/2_strategies/strat_sentiment_lumibot.py) vs Simply holding S&P500

# [Quant AI Assistant](https://github.com/KevinGastelum/MyQuantsFinance/tree/main/4_llm)

Building LLM locally to specialize in FinTech, automize analyzing research articles, data, and backtest strategies.

[Autogen](https://microsoft.github.io/autogen/docs/Getting-Started) - Create personalized agents that specialize in specific task i.e., AI Quant Research assistant

```shell
pip install autogenstudio
autogenstudio ui --port 8081 # Access AutoGenStudio in your localhost
```

[Ollama](https://github.com/ollama/ollama) - Allows you to download and run LLMs locally.

```shell
pip install ollama
ollama serve # Should run on Localhost:11434
ollama run mistral # Download & installs Mistral LLM locally ~4gb size file
```

[LiteLLM](https://litellm.ai/) - Provides embeddings, error handling, chat completion, function calling

```bash
pip install litellm
litellm --model ollama/mistral # Launches Mistral LLM locally
```