HermesTrade 1.0.0

dotnet add package HermesTrade --version 1.0.0
                    
NuGet\Install-Package HermesTrade -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HermesTrade" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HermesTrade" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="HermesTrade" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HermesTrade --version 1.0.0
                    
#r "nuget: HermesTrade, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HermesTrade@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HermesTrade&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=HermesTrade&version=1.0.0
                    
Install as a Cake Tool

HermesTrade

NuGet NuGet Downloads License: MIT Email LinkedIn

A production-ready .NET 8 backtesting engine for trading strategies on cryptocurrencies and other financial instruments.

Features

  • Candle-by-candle backtest loop via BacktestEngine
  • Flexible IStrategy interface - bring your own logic
  • Built-in RSI indicator via IIndicatorService
  • Yahoo Finance data provider with local file cache
  • Portfolio state tracking (open position, cash, trades)
  • Performance metrics: net profit, win rate, max drawdown, Sharpe ratio
  • Fully configurable via BacktestConfig

Installation

dotnet add package HermesTrade

Quick Start

using HermesTrade.Configuration;
using HermesTrade.Engine;
using HermesTrade.Strategies;
using HermesTrade.Data;
using Microsoft.Extensions.Logging;

var config = new BacktestConfig
{
    Symbol         = "BTC-USD",
    Start          = new DateTimeOffset(2024, 1, 1, 0, 0, 0, TimeSpan.Zero),
    End            = new DateTimeOffset(2024, 12, 31, 0, 0, 0, TimeSpan.Zero),
    InitialCapital = 10_000m,
    CommissionRate = 0.001m
};

using var httpClient = new HttpClient();
var logger   = LoggerFactory.Create(b => b.AddConsole()).CreateLogger<YahooFinanceDataProvider>();
var cache    = new FileCacheService();
var provider = new YahooFinanceDataProvider(httpClient, cache, logger);
var strategy = new SimpleStrategyExample(oversoldThreshold: 30m, overboughtThreshold: 70m);

var engine = new BacktestEngine();
var result = await engine.RunAsync(config, provider, strategy);

Console.WriteLine($"Net Profit : {result.NetProfit:C}");
Console.WriteLine($"Return     : {result.ReturnPct:P2}");
Console.WriteLine($"Win Rate   : {result.WinRate:P2}");
Console.WriteLine($"Sharpe     : {result.SharpeRatio:F2}");

Implementing a Custom Strategy

public class MyStrategy : IStrategy
{
    public void Initialize(IEnumerable<Candle> history) { }

    public Signal Evaluate(StrategyContext context)
    {
        var rsi    = context.Indicators.RSI;
        var hasPos = context.Portfolio.HasOpenPosition;

        if (rsi < 25 && !hasPos) return Signal.Buy;
        if (rsi > 75 &&  hasPos) return Signal.Sell;

        return Signal.Hold;
    }
}

Key Types

Type Description
BacktestEngine Runs the backtest loop
BacktestConfig Symbol, dates, capital, commission
IStrategy Interface for your strategy
StrategyContext Candle + indicators + portfolio on each tick
IMarketDataProvider Interface for custom data sources
YahooFinanceDataProvider Fetches OHLCV data from Yahoo Finance
FileCacheService Persists downloaded data locally
SimpleStrategyExample Reference RSI strategy
BacktestResult Trades, profit, drawdown, Sharpe

Requirements

  • .NET 8 or later

License

MIT (c) 2025 HermesTrader

Author

Gerardo Tous Vallespir

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 133 3/26/2026