SkillAgentSearch skills...

Docs

Project documentation, served to debutjs.io

Install / Use

npx skills add debut-js/Docs

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Debut - Trading Framework

Debut is an ecosystem for developing and launching trading strategies. An analogue of the well-known ZenBot, but with much more flexible possibilities for constructing strategies. All you need to do is come up with and describe the entry points to the market and connect the necessary plugins to work. Everything else is a matter of technology: genetic algorithms - will help you choose the most effective parameters for the strategy (period, stops, and others), ticker selection module - will help you find an asset suitable for the strategy (token or share), on which it will work best.

Debut is based on the architecture of the core and add-on plugins that allow you to flexibly customize any solution. The main goal of the entire Debut ecosystem is to simplify the process of creating and launching working trading robots on various exchanges.

Features

<p align="center"><img src="./assets/preview.gif" width="800"></p>
  • Multiple exchanges API
  • Backtesting with historical data
  • Backtesting results visualization
  • Backtesting live preview
  • Strategy optimisation (genetic algorithms, multi thread)
  • Stretegy overfitting control (Walk-Forward)
  • Cross timeframe candles access
  • Simple working with data using callbacks e.g. onCandle, onTick, onDepth ...
  • Written in TypeScript (JavaScript), may be executed in browser
  • Customizable with plugins
  • Can use community edition for free with limitations

Available brokers

<p> <img src="https://raw.githubusercontent.com/debut-js/Core/master/.github/assets/alpaca.png" alt="Alpaca API" width="64"> <img src="https://raw.githubusercontent.com/debut-js/Core/master/.github/assets/binance.png" alt="Binance API" width="64"> <img src="https://raw.githubusercontent.com/debut-js/Core/master/.github/assets/tinkoff.png" alt="Tinkoff API (Russia only)" width="64"> <img src="https://raw.githubusercontent.com/debut-js/Core/master/.github/assets/ibkr.png" alt="Interactive Brokers (beta)" width="64"> </p>

Didn't see your broker? You can donate for support.

Community edition

We believe in the power of the community! That is why we decided to publish the project. The community version is free, but it has some limitations in commercial use (income from trading startups is not commerce), as well as technical differences in testing strategies. Join the community, join the developer chat

Enterprise edition

(Available by subscription for $20/mo)

  • Cross timeframe candles access (from lower to higher candles)
  • Advanced tick emulation in backtesting (60+ ticks per candle)
  • Tinkoff and Alpaca supports all timeframes (programmaticaly solved broker issue)

Live orders streaming

We broadcast our experiments on telegram channels, where you can see our orders on cryptocurrencies and stocks.

Telegram crypto trading orders stream Telegram stocks trading orders stream

Order stream schema

Disclaimer

  • Debut does not guarantee 100% probability of making a profit. Use it at your own peril and risk, relying on your own professionalism.
  • Cryptocurrency is a global experiment, so Debut is also. That is, both can fail at any time.

Quick Start Guide

Step 1: Install

Fork the repository and install dependencies by npm i

Step 2: Get broker API keys Follow broker instruction and get API access token. The access level is required only for trading, be careful when choosing access settings.

Broker API guides: Tinkoff instructions or Binance instructions For interactive brokers you need to copose docker image from this repo

Then create tokens file .tokens.json in root directory via copy and rename file .token.example.json. Just replace placeholders by you broker API access tokens and remove unused.

.tokens.exapmle.json listing:

{
    "binance": "YOU_BINANCE_TOKEN",
    "binanceSecret": "YOU_BINANCE_SECRET",
    "tinkoff": "YOU_TINKOFF_TOKEN",
    "tinkoffAccountId": "YOU_TINKOFF_ACCOUNT",
    "alpacaKey": "YOU_ALPACA_KEY",
    "alpacaSecret": "YOU_ALPACA_SECRET"
}

Step 3: Create strategy

Execute command npm run create in root project directory and enter name of strategy. This command creates empty strategy file structure with next files:

  • src/strategies/{name}/bot.ts - Main strategy file for strategy logic
  • src/strategies/{name}/cfgs.ts - Store for strategy configuration objects
  • src/strategies/{name}/meta.ts - Meta information for creating, optimising, backtesting and executing

Also file schema.json will be modified with strategy path description

Step 4: Describe strategy

In bot.ts file you can start working with strategy runtime. MyStrategy class for working with anything around you own trading strategy, this class extended from core Debut which provided runtime methods and data.

// bot.ts file example
import { Debut } from '@debut/community-core';

// Basic strategy runtime
export class MyStrategy extends Debut {
    // this - is strategy runtime for working with broker and runtime data or methods
}

Step 5: Configure strategy Before launching, you need to add a strategy configuration setting for the selected instrument and broker.

Step 6: Backtesting

Use historical simulation to evaluate the trading performance of your strategy. Backtesting can be started with the command:

npm run compile && npm run testing -- --ticker=TSLA --bot=MyStrategy --days=200 --olhc

For results visualisation use Report Plugin See detailed command descriptions in strategy tester docs

<hr/>

Documentation

Runtime public methods

registerPlugins

Contract: this.registerPlugins(plugins: PluginInterface[]);

Description: Register plugins. It can be called at any convenient moment, but it is recommended to register all the necessary plugins at the stage of creation in the strategy constructor or in the environment constructor in the meta file

Example:

import { Debut } from '@debut/community-core';
import { DebutOptions, BaseTransport } from '@debut/types';
import { gridPlugin, GridPluginOptions, Grid, GridPluginAPI } from '@debut/plugin-grid';

export interface MyStrategyOptions extends DebutOptions, GridPluginOptions {}

export class MyStrategy extends Debut {
    declare opts: MyStrategyOptions;
    declare plugins: GridPluginAPI;

    constructor(transport: BaseTransport, opts: MyStrategyOptions) {
        super(transport, opts);

        // Register grid plugin
        this.registerPlugins(gridPlugin(opts));
    }
}

start

Contract: this.start();

Description: When called, a subscription to ticks for the current transport (Binance / Tinkfff / Tester) will be created. In production, it creates a web socket connection to the exchange and receives updates by the ticker from the settings.

Example:

    // ...
    // Take the required field from the available configurations
    const config = cfgs.TSLA;
    // Create a robot in Production mode
    const bot = await meta.create(getTransport(config), config, WorkingEnv.production);

    // Subscribe to data from the exchange in real time to work
    // Calling the start method, returns the stop function, which, when called,
    // will delete the strategy and close active positions on it
    const dispose = await bot.start();

    // Stop trading and restroy strategy instance
    dispose()

getName

Contract: this.getName();

Description: Returns the name of the strategy constructor, in fact the name of the strategy. For various needs, for example, for logging, so that it is clear by what strategy the event occurred.

Example:

import { Debut } from '@debut/community-core';
import { DebutOptions, BaseTransport } from '@debut/types';

export class MyStrategy extends Debut {
    // ...
    constructor(transport: BaseTransport, opts: DebutOptions) {
        super(transport, opts);

        // Show class constructor name
        console.log(this.getName()) // MyStrategy
    }
}

createOrder

Contract: this.createOrder(operation: OrderType): Promise<ExecutedOrder>;

Description: Creates a trade on the market with the direction OrderType

Example:

import { Debut } from '@debut/community-core';
import { Candle, OrderType, DebutOptions } from '@debut/types';

// Basic strategy runtime
export class MyStrategy extends DebutOptions {
    // ...
    async onCandle(candle: Candle) {
        // Create order
       const order = await this.createOrder(OrderType.BUY);
    }
}

closeOrder

Contract: this.closeOrder(closing: ExecutedOrder): Promise<ExecutedOrder>;

Description: Closes the specified application. Accepts a previously executed order as input ExecutedOrder

Example:

import { Debut } from '@debut/community-core';
import { Candle, OrderType, BaseTransport } from '@debut/types';

// Basic strategy configuration
export interface MyStrategyOptions extends DebutOptions {}

// Basic strategy runtime
export class MyStrategy extends Debut {
    // ...
    async onCandle(candle: Candle) {
        // Create order
       const order = await this.createOrd

Related Skills

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated1y ago
Forks4

Languages

HTML

Security Score

70/100

Audited on Mar 28, 2025

No findings