Obsidian Source: REALBT - A Simple Back-testing Engine in Pure Python
Summary
Pending synthesis from local Obsidian source.
Original source title: Example: Calculating transaction costs
Extracted Preview
Note: This is presented as a mini essay/worklog, with scopes of improvement everywhere. Contributions and suggestions are always welcome.
Finance huh, are you THAT guy?
I never thought I will work in finance, because I've always learned AI. Finance as a field has always fascinated me, because it was really mathematics heavy, and I really liked the stochastic + logical nature of it. Since my last two two roles were in fintech, I thought it is high time I learn more about finance, and what better way to learn than make something that can be used by the community, and hence REALBT was developed to deeper my understanding of finance fundamentals. REALBT is a back-testing engine written purely in python, and offers several advantages over existing back-testing engines.
What exactly is Back-Testing?
*"The idea that the future is predictable is a very foolish idea."*
As mentioned, finance is both stochastic and logical, and if you want to make a fortune, you need to play your cards well. Now, life would've been easy(but chaotic) if there were a mathematical model that just churns out correct stock prices, but reality is far from it. Markets are very unpredictable, and placing your bets on stocks is comparable to gambling, but that is not always true if you have the right tools in your arsenal - and that's exactly what a back-testing engine does. An analogy to better understand what exactly back-testing engine does is this:
*Imagine before buying a real car(a big investment), you buy a toy car to know whether your investment is worth it or not. A back-test is basically testing your toy car on a pretend road to see how well it drives. Now, a good condition test for the toy car would be when the pretend road is like a real road - with bumps, traffic, gas stations etc. In this way, when your toy car does well on the pretend road, you can be sure that the real car will also do well.*
That's exactly a backtesting engine like REALBT does. You can play with your trading strategy on past market data to see how well it performs. This gives you confidence about your trading strategy in the real world, so instead of playing a gamble, you make an educated choice about which stock to invest in or not.
What are REALBT's unique features?
REALBT (REAListic BackTesting) is made exactly for the reasons highlighted above. It is a Python-based framework designed for realistic backtesting of trading strategies. Unlike traditional backtesting frameworks, it emphasizes accurate modeling of market frictions such as slippage, market impact, and transaction costs. The package is made keeping in mind the requirements of traders and researchers who want to evaluate strategies under conditions that closely mimic real-world trading environments.
REALBT is modular, extensible, written fully in python and user-friendly, with a command-line interface (CLI) for ease of use. It also includes tools for data fetching, strategy creation, and result visualization - similar to existing solutions for backtesting. Here are some of the unique features of REALBT:
Integration Notes
- Source folder:
/home/yashs/Documents/Docs/Obsidian/Research-Notes - Local source:
/home/yashs/Documents/Docs/Obsidian/Research-Notes/REALBT - A Simple Back-testing Engine in Pure Python.md - Raw copy:
raw/obsidian/research-notes/REALBT - A Simple Back-testing Engine in Pure Python.md