Crypto arbitrage bot
===
API Interaction
---
- CCXT - https://github.com/ccxt/ccxt - unified API for all exchanges
- When slow -> use own implementation
- **Do NOT** use libraries from exchanges - shitty quality
- Data - https://docs.tardis.dev/api/tardis-machine
State verification
---
- Use both REST and Websockets
- Send REST request regularly to check everything
Logging
---
- Use standard logging levels (debug, info, warning, error, critical)
- Use logger.exception() to automatically log the stack trace with log message
- Do not hardcode config - load from file - allows to change config without modyfying app
GUI & Monitoring (Dashboard)
---
- Telegram bot for updates from algo and to control - start/stop etc.
- Grafana / AWS Cloudwatch
- **The dashboard is for the algorithm - NOT the other way around!** - algo first, then dashboard :D
- External monitoring script that will close all positions when bot is down
- Pagerduty alerts
Good to know
---
1. Pandas is much slower than NumPy
2. AsyncIO with uvloop [https://github.com/MagicStack/uvloop] is 2-2.5x faster than multithreading
3. When using websockets, websockets [https://websockets.readthedocs.io/en/stable/] is fastest
4. REST requests - use aiosonic [https://github.com/sonic182/aiosonic]
Useful links
---
https://www.algos.org/p/developing-trading-algorithms-python (mirror https://docs.google.com/document/d/16fQH4JlFSxnqEKy34aq5920Rz2E0bP3khI3rZjWGfNA)