Skip to content

Latest commit

 

History

History
158 lines (111 loc) · 6.73 KB

README.md

File metadata and controls

158 lines (111 loc) · 6.73 KB

GitHub GitHub package.json version

Hits

📜 Description

Elevate your trading strategies with BacktestJS, the premier CLI tool designed for traders and developers alike. Harness the power of Typescript or Javascript to backtest your strategies with precision, efficiency, and flexibility.

 

🌟 Key Features

  • 🖥️ Streamlined CLI Interface: Intuitive command-line interface for streamlined operation.

  • 📊 Candle Data at Your Fingertips: Download historical candle data directly from Binance or import your own from CSV files.

  • 🗃️ Seamless SQLite Integration: Efficient storage for your candle data, strategies, and results (no coding required).

  • 📚 Extensive Documentation: Unlock the full potential of BacktestJS with detailed guides and resources.

 

🚀 Quick Start

📦 Setup Environment

Follow these one time instructions below to setup the environment.

  git clone https://github.com/andrewbaronick/BacktestJS.git
  cd BacktestJS
  npm i

🌈 Launch BacktestJS

Enter the world of strategic backtesting with a single command:

  npm start

 

Immerse yourself in the BacktestJS universe with our Full Documentation. Discover tutorials, video guides, and extensive examples. Engage with our community forum for unparalleled support and discussions. Visit our site to unleash the full capabilities of BacktestJS.

 

🔄 Download / Import Historical Candle Data

Effortlessly download candle data from Binance or import from a CSV for strategy execution — no coding required! Plus, easily export your data to CSV via the CLI at anytime with a few clicks.

 

💡 Examples

No Params

Below is an example of a simple 3 over 45 SMA strategy. You buy once the 3 crosses the 45 and sell if not. In this example we dont use the power of params.

import { BTH } from "../infra/interfaces"
import { indicatorSMA } from "../indicators/moving-averages"

export async function sma(bth: BTH) {
    // Get Candles
    const lowSMACandles = await bth.getCandles('close', 0, 3)
    const highSMACandles = await bth.getCandles('close', 0, 45)

    // Get SMA
    const lowSMA = await indicatorSMA(lowSMACandles, 3)
    const highSMA = await indicatorSMA(highSMACandles, 45)

    // Perform Buy / Sell when low crosses high
    if (lowSMA > highSMA) {
        await bth.buy()
    } else {
        await bth.sell()
    }
}

With Params

Below is an example of a simple SMA strategy like above but its not hard coded to the 3 over 45. When you run the strategy through the CLI you will be asked to provide a low and high sma. You can even provide multiple lows and multiple highs and all the variations will be tested in one shot.

import { BTH } from "../infra/interfaces"
import { indicatorSMA } from "../indicators/moving-averages"

export async function sma(bth: BTH) {
    // Get low and high SMA from input
    const lowSMAInput = bth.params.lowSMA
    const highSMAInput = bth.params.highSMA

    // Get Candles
    const lowSMACandles = await bth.getCandles('close', 0, lowSMAInput)
    const highSMACandles = await bth.getCandles('close', 0, highSMAInput)

    // Get SMA
    const lowSMA = await indicatorSMA(lowSMACandles, lowSMAInput)
    const highSMA = await indicatorSMA(highSMACandles, highSMAInput)

    // Perform Buy / Sell when low crosses high
    if (lowSMA > highSMA) {
        await bth.buy()
    } else {
        await bth.sell()
    }
}

 

🎨 Showcase of Results

BacktestJS not only delivers performance insights but also visualizes your strategy's effectiveness through comprehensive charts and statistics.

🏆 Income Results, Buy/Sell Locations, and More

Explore the visual representation of your trading outcomes, from income results to buy/sell locations, offering you a clear view of your strategy's performance.

Income Results

Buy Sell Locations

General Info

Total Stats

All Orders

Trade Stats

Trade Buy Sell Stats

Asset Stats

🔍 Multi Value Results

Examine permutation results and heatmap visualizations to refine your strategies across different values all in one run.

Permutation Results

Heatmap

General Info

Total Stats

🌍 Multi Symbol Results

See if that killer strategy works across the board on many symbols and timeframes with ease. Get all your results in one shot with blazing fast results.

General Info

Total Stats

Permutation Results

 

✍️ Author

Andrew Baronick

Github
LinkedIn