TaiwanQuant's Newsletter

TaiwanQuant's Newsletter

Share this post

TaiwanQuant's Newsletter
TaiwanQuant's Newsletter
Realistic Backtester for Perpetual Futures (Part 2/2) (With Code)
Copy link
Facebook
Email
Notes
More

Realistic Backtester for Perpetual Futures (Part 2/2) (With Code)

A guide to writing a realistic market simulator for Crypto perpetual futures.

TaiwanQuant's avatar
TaiwanQuant
Jul 29, 2023
∙ Paid
3

Share this post

TaiwanQuant's Newsletter
TaiwanQuant's Newsletter
Realistic Backtester for Perpetual Futures (Part 2/2) (With Code)
Copy link
Facebook
Email
Notes
More
Share

(Part 2)

In Part 1, we wrote a basic event-driven simulator/backtester using candle data. In this Part 2, we extend it to make the simulator realistic by adding costs and funding. We also add support for simulating an arbitrary number of markets simultaneously.

Table of Contents

Part 1:

  • Introduction

  • Simulator/backtester architecture

  • Preparing the data

  • Simulating a single market

  • Simulating market orders

Part 2:

  • Simulating trading costs

  • Simulating funding

  • Simulating many markets

  • Finish

  • Subscriber materials (source code)

Simulating Trading Costs

Keep reading with a 7-day free trial

Subscribe to TaiwanQuant's Newsletter to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 TaiwanQuant
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More