bytex README

The project's README from github.com/BYTEX-TRADE/bytex. As one markdown file: README.md.

BYTEX

An event-driven algorithmic trading engine for .NET — one strategy, from backtest to live.

BYTEX is an open-source trading platform written in C#. It lets you write a trading strategy once and run it unchanged against historical data, against live market data with simulated execution, and against real exchange accounts. The engine is deterministic, asset-class agnostic, and built around a small set of composable components that are the same in every environment.

Status: pre-release. APIs may change between minor versions until 1.0, and the venue adapters are beta until they complete verification against live venues. Backtesting and sandbox trading are fully functional today.

Why BYTEX

Capabilities

Area What is included
Strategy SDK Actor and Strategy base classes with lifecycle, data, order, and position handlers; typed configuration; order factory; cache and portfolio access; clock and timers; indicators
Orders market, limit, stop-market, stop-limit, market-if-touched, limit-if-touched, trailing stops, market-to-limit; GTC / IOC / FOK / GTD / DAY; post-only, reduce-only, iceberg display quantity; OCO / OTO / OUO contingencies; bracket orders
Backtesting simulated venues with a per-instrument matching engine, fill and slippage models, fee models, cash and margin accounts; bar, quote, and trade data; Parquet data catalog; performance reports
Live trading trading node with live clock, exchange adapters, startup reconciliation, sandbox execution (live data, simulated fills), optional Redis state persistence
Risk pre-trade validation of precision, size, notional, rate limits; trading state control
Adapters Binance (spot, USDⓈ-M futures), Bybit (spot, linear perpetuals); Tardis historical data; adapter SDK for new venues
Tooling bytex CLI for backtests, live nodes, and catalog management; Docker image; notebook support

See the roadmap for what is planned next.

Quick start

Build from source (NuGet packages are planned; until they are published, reference the projects directly):

git clone https://github.com/BYTEX-TRADE/bytex
cd bytex
dotnet build
dotnet run --project examples/Bytex.Examples -- backtest-ema-cross
public sealed class EmaCrossConfig : StrategyConfig
{
    public required InstrumentId InstrumentId { get; init; }
    public required BarType BarType { get; init; }
    public int FastPeriod { get; init; } = 10;
    public int SlowPeriod { get; init; } = 20;
    public decimal TradeSize { get; init; } = 1m;
}

public sealed class EmaCross : Strategy<EmaCrossConfig>
{
    private readonly ExponentialMovingAverage _fast;
    private readonly ExponentialMovingAverage _slow;

    public EmaCross(EmaCrossConfig config) : base(config)
    {
        _fast = new ExponentialMovingAverage(config.FastPeriod);
        _slow = new ExponentialMovingAverage(config.SlowPeriod);
    }

    protected override void OnStart()
    {
        RegisterIndicatorForBars(Config.BarType, _fast);
        RegisterIndicatorForBars(Config.BarType, _slow);
        SubscribeBars(Config.BarType);
    }

    protected override void OnBar(Bar bar)
    {
        if (!_fast.IsInitialized || !_slow.IsInitialized)
        {
            return;
        }

        var instrument = Cache.Instrument(Config.InstrumentId)!;
        var quantity = instrument.MakeQuantity(Config.TradeSize);

        if (_fast.Value > _slow.Value && Portfolio.IsFlat(Config.InstrumentId))
        {
            SubmitOrder(OrderFactory.Market(Config.InstrumentId, OrderSide.Buy, quantity));
        }
        else if (_fast.Value < _slow.Value && Portfolio.IsNetLong(Config.InstrumentId))
        {
            CloseAllPositions(Config.InstrumentId);
        }
    }
}

The same class runs in a BacktestEngine, in a sandbox, or in a live TradingNode. Full walkthroughs are in docs/getting-started.

Command line

The bytex tool runs backtests and trading nodes from JSON configuration (installable with dotnet tool install --global Bytex.Cli once packages are published; from source, use dotnet run --project src/Bytex.Cli --):

bytex catalog fetch-instruments --path ./catalog --venue BINANCE --quote USDT
bytex catalog import-csv --path ./catalog --file btcusdt-1m.csv --kind bars --instrument BTCUSDT.BINANCE --bar-type BTCUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL
bytex --plugins ./plugins backtest --config examples/configs/backtest-ema-cross.json
bytex --plugins ./plugins run --config examples/configs/sandbox-binance-ema-cross.json

Strategies are referenced by type name in JSON and loaded from plugin assemblies, so one CLI runs any strategy. See docs/getting-started/cli.md.

Repository layout

src/Bytex.Core               domain model, messaging, clock, cache, portfolio, engines, Strategy SDK, adapter SDK, plugins
src/Bytex.Indicators         technical indicators
src/Bytex.Data               Parquet data catalog, CSV loaders
src/Bytex.Backtest           simulated venues, backtest engine and node, reports
src/Bytex.Live               trading node, kernel loop, network infrastructure, sandbox execution
src/Bytex.Adapters.*         Binance, Bybit, Tardis
src/Bytex.Persistence.Redis  Redis state persistence
src/Bytex.Cli                the bytex command-line tool
examples/                    example strategies and configurations
tests/                       unit, integration, and performance tests
docs/                        getting started, concepts, integrations, design notes, roadmap

Building from source

Requires the .NET 10 SDK.

dotnet build
dotnet run --project examples/Bytex.Examples -- backtest-ema-cross

Contributing

Contributions are welcome. Please read CONTRIBUTING.md first. Security issues should be reported as described in SECURITY.md.

License

BYTEX is licensed under the Apache License, Version 2.0. Third-party components are listed in THIRD-PARTY-NOTICES.md.

Disclaimer

BYTEX is software for building trading systems. It is not investment advice, and it does not guarantee any trading outcome. Trading financial instruments involves risk of loss. You are solely responsible for any strategy you run and any account you connect.

bytex (BYTEX-TRADE/bytex)

Searching Database…

886 ·GitHub
What is this?BYTEX is an open-source, event-driven algorithmic trading engine for .NET, written in C#. You write a trading strategy once and run the same code unchanged in backtesting, sandbox simulation, and live trading against real exchange accounts.
Is it a framework or a library?It's a framework: you write your strategy as a C# class using BYTEX's Strategy/Actor base classes, and the engine's single-threaded kernel drives the whole event lifecycle — there is no separate scripting layer or bindings.
How do I get it running?Right now you build it from source and reference the projects directly, since the Bytex.Cli NuGet package isn't published yet; your strategy class then runs inside a BacktestEngine, a sandbox, or a live TradingNode without modification.
Do I need anything besides .NET to build it?You need the .NET 10 SDK to build from source; Redis is only required if you want optional state persistence for a live trading node.
Is this ready for live trading today?Not fully — BYTEX is pre-release, its APIs can still change before 1.0, and the Binance/Bybit venue adapters are marked beta until they finish verification against live exchanges. Backtesting and sandbox trading (live data with simulated fills) are already fully functional.
Which exchanges can I trade on?BYTEX ships adapters for Binance (spot and USDS-M futures) and Bybit (spot and linear perpetuals), plus a Tardis adapter for historical data; new venues can be added through the adapter SDK without touching the engine.
Why does BYTEX avoid floating-point numbers for money?Prices, quantities, and balances are stored as fixed-point decimals with explicit precision instead of floats, which avoids rounding drift and keeps backtest results exactly reproducible.
What does sandbox mode actually do?Sandbox mode runs your strategy against live market data but executes simulated fills instead of real orders, so you can test under real-time conditions without risking an actual exchange account.
What can the bytex CLI do?The bytex CLI runs backtests and live trading nodes from JSON configuration files, loading strategies by type name from plugin assemblies so one CLI binary can run any strategy; it also manages the Parquet data catalog.
Size
1.9 MB
Stars
886
Age
1mo
Commits · 90 Days