# Contango
Have you ever wanted to create strategies programmatically for the stock market, cryptocurrencies, or anything else related to trading?! Maybe not... But I have!
## So, what *is* Contango?
[Contango](https://github.com/igowuu/Contango) is a full trading engine that allows you to make strategies in Python without worrying about any potential biases in your workflow. Instead of focusing on simulation, metrics, results, and graphs, you can avert your focus solely to the quality of the strategies you create.
## Strategies - what do they look like?
Strategies are a part of an event-driven engine. This means that they receive and react to events that are released from a "mode". A "mode" is anything that handles the logic of the event bus and/or engine - backtesting, live trading, etc. An example of a strategy:
```python
class MyStrategy(Strategy):
"""
A very simple strategy outline - not all logic is included.
"""
def on_market_event(self, event: MarketDataEvent) -> None:
# Strategy market logic here
def on_end(self) -> None:
...
```
## Results
[Contango](https://github.com/igowuu/Contango) processes the raw events emitted from your strategy and converts them to metrics. These metrics are then used to produce seven unique graphs. Each of these graphs tell you something unique about the strategy, whether it be profitability, risk, drawdown, consistency, win rate, etc. For most modern workflows, this is enough; however, all modules are cleanly decoupled from each other, so raw events or raw metrics can be processed & analyzed however you would like.
## Challenges
Challenges:
- A massive learning curve. I've spent probably 50 hours or more just researching and absorbing the information used in this project.
- Packaging was difficult to get right, whether it be "missing type stub" warnings or incorrect rendering of my README.md.
- Documentation was terrible to write. Spending large amounts of time writing English words instead of code that accomplishes something was extremely tedious, yet completely necessary for a shipped project like this.
## I'm proud of this project
Genuinely, this is one of the first big project I've ever made. I have never released anything to PyPI, nor shipped something of this scale before.
Hackatime only shows 22 hours since I set it up partway through, but Contango's been my main project since June, and it's the second largest thing I've built.
## Usage
The [GitHub](https://github.com/igowuu/Contango) has detailed instructions, demos, videos, and more; however, since it's so short, here is how to install the project & run the built-in demo from any python IDE:
```powershell
pip install contango
```
```powershell
python -m contango.research.research_strategies.bollinger_band_mean_reversion.runner
```
## Final Notes
I've had a lot of fun with this project, and I hope anyone who sees this enjoys it just as much as me. Happy coding!
- 1 devlog
- 22h