From c2d0095c1ac45a69ef70791d77cc316146c920f3 Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Wed, 2 Sep 2026 08:01:44 -0400 Subject: [PATCH 1/5] feat(release): 1.5.2 NuGet SEO metadata + report watermark + README FAQ - csproj: Version 1.5.2, keyword-rich Description + expanded PackageTags (backtesting, crypto, pair-trading, mean-reversion, algo-trading, strategy), new v1.5.2 release notes - backtest report: watermark block (Quant.Infra.Net v1.5.2 / GitHub / e-book) before 'done.' in QqqmDocWalkthrough; MCP RunBacktestTool adds 'generatedBy' - README: bilingual FAQ with 5 long-tail keyword Q&As No functional code change; verified building (core, Runtime.Console, Mcp) and packing Quant.Infra.Net.1.5.2.nupkg/snupkg. --- README.md | 19 +++++++++++++++++++ .../Tools/RunBacktestTool.cs | 3 ++- .../QqqmDocWalkthrough.cs | 7 +++++++ src/Quant.Infra.Net/Quant.Infra.Net.csproj | 8 ++++---- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 90a4249..32fc1f3 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,25 @@ Set them in `appsettings.json` under `Orchestration:Parameters`, or pass them in --- +## ❓ FAQ — common questions & search keywords / 常见问题 + +**Q: How do I backtest crypto strategies in C#? / 怎么用 C# 回测加密货币策略?** +A: Use Quant.Infra.Net's backtest engine with the built-in Binance Futures data source. Define a strategy as a target-weight or signal function, feed it `Ohlcv` bars, and the `BacktestRunner` returns CAGR, Sharpe, Calmar, MaxDrawdown, WinRate and ProfitFactor. `用 Quant.Infra.Net 的回测引擎 + 内置币安合约数据源,把策略写成目标权重或信号函数,`BacktestRunner` 直接给出 CAGR / Sharpe / Calmar / 最大回撤 / 胜率 / 盈亏比。` See the 60-second example above. 见上面的 60 秒示例。 + +**Q: What's the best .NET library for pair trading? / .NET 做配对交易(pair trading)最好的库?** +A: Quant.Infra.Net ships pair-trading / statistical-arbitrage primitives: OLS spread regression, spread z-score and cointegration checks over OHLCV data, so you can build and backtest a pairs strategy without leaving C#. `内置配对交易 / 统计套利基础件:OLS 价差回归、价差 z-score、协整检验,直接在 C# 里完成配对策略的回测。` + +**Q: How do I connect Interactive Brokers from .NET? / 怎么用 .NET 接 Interactive Brokers(盈透)?** +A: Use the unified `IBrokerService` abstraction — Quant.Infra.Net wraps Interactive Brokers (via InterReact), Alpaca, Charles Schwab and Binance Futures behind one interface, so live and backtest code share the same call path. `用统一的 `IBrokerService` 接口:Quant.Infra.Net 把盈透(InterReact)、Alpaca、Charles Schwab、币安合约封装成同一接口,实盘与回测共用同一套调用。` + +**Q: Best .NET quantitative trading framework in 2026? / 2026 年最好的 .NET 量化交易框架?** +A: For C# developers who want a compact, self-hostable framework (not a hosted cloud like QuantConnect), Quant.Infra.Net gives you data → strategy → backtest → execution → notifications in a few NuGet packages you own and can extend. `对想用 C#、希望自托管(而非 QuantConnect 这类云端托管)的开发者,Quant.Infra.Net 用几个 NuGet 包就能串起 数据 → 策略 → 回测 → 执行 → 通知,且完全归你掌控、可自由扩展。` + +**Q: How do I backtest a C# mean-reversion strategy? / 怎么用 C# 回测均值回归策略?** +A: The QQQM reverse-MA200 DCA walkthrough in this repo is a working mean-reversion example: target weight = base ± add/trim around the SMA200, re-run it with your own thresholds and bars. `本仓库的 QQQM 反向 MA200 DCA 就是一个可运行的均值回归示例:目标权重 = 基准 ± 围绕 SMA200 的加/减系数,换成你自己的阈值和数据即可复跑。` + +--- + ## 🗒️ Changelog / 变更记录 | Date | Change / 变更 | diff --git a/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs b/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs index 869175b..075338c 100644 --- a/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs +++ b/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs @@ -107,7 +107,8 @@ public static async Task RunBacktest( totalCommissionUsd = m.TotalCommissionUsd }, trades = result.Trades.Count, - interpretation = Interpret(m) + interpretation = Interpret(m), + generatedBy = "Quant.Infra.Net v1.5.2 — github.com/memoryfraction/Quant.Infra.Net — e-book: amazon.com/dp/B0D7W89ZQD" }; return JsonSerializer.Serialize(payload, JsonOpts); diff --git a/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs b/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs index 935ec55..97d024b 100644 --- a/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs +++ b/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs @@ -245,7 +245,14 @@ public static async Task RunAsync() pltW.SavePng(weightPath, 960, 540); C.WriteLine($"chart written: {weightPath}"); + C.WriteLine(); + C.WriteLine("=========================================================="); + C.WriteLine(" Report generated by Quant.Infra.Net v1.5.2"); + C.WriteLine(" Code: github.com/memoryfraction/Quant.Infra.Net"); + C.WriteLine(" E-book: amazon.com/dp/B0D7W89ZQD"); + C.WriteLine("=========================================================="); C.WriteLine("done."); + return 0; } diff --git a/src/Quant.Infra.Net/Quant.Infra.Net.csproj b/src/Quant.Infra.Net/Quant.Infra.Net.csproj index 7a24d19..1b99503 100644 --- a/src/Quant.Infra.Net/Quant.Infra.Net.csproj +++ b/src/Quant.Infra.Net/Quant.Infra.Net.csproj @@ -6,15 +6,15 @@ $(NoWarn);CS0579 false false - 1.5.1 + 1.5.2 Quant.Infra.Net Rong (Rex) Fan Rong (Rex) Fan (c) 2024-2026 Rong (Rex) Fan. All rights reserved. - A .NET quantitative trading infrastructure library that lets you fetch data, run statistical analysis, execute trades, and send notifications with minimal code. Unified broker integrations (Binance Futures, Alpaca US Equity, Charles Schwab, Interactive Brokers via InterReact), built-in statistical analysis tools, notification services, and more. - dotnet;csharp;quantitative;trading;finance;binance;alpaca;schwab;interactive-brokers;analysis;statistics;notification + Quant.Infra.Net is a .NET quantitative trading and backtesting framework for C# developers who want to fetch market data, backtest strategies, run statistical analysis, execute live trades, and send notifications — all with minimal code. Backtest crypto strategies (Binance Futures) and US equity strategies (Alpaca, Charles Schwab, Interactive Brokers via InterReact) from one unified IBrokerService. Ships with a strategy pipeline, a backtest engine (CAGR, Sharpe, Calmar, MaxDrawdown, WinRate, ProfitFactor), pair-trading / mean-reversion tools (OLS spread regression, spread z-score), and notification services. The .NET quant framework for C# algo-trading: build, backtest, and deploy your own crypto and equity strategies in a few lines. + dotnet;csharp;quantitative;trading;finance;backtesting;backtest;backtest-engine;strategy;algo-trading;algorithmic-trading;crypto;cryptocurrency;binance;crypto-trading;pair-trading;mean-reversion;quant-framework;quant;execution;alpaca;schwab;interactive-brokers;ibbroker;analysis;statistics;notification;ohlc;ohlcv;signal https://memoryfraction.github.io/Quant.Infra.Net/ https://github.com/memoryfraction/Quant.Infra.Net.git git @@ -23,7 +23,7 @@ true snupkg false - v1.5.1 — Code_Standards.md compliance: added bilingual XML documentation to all public members, parameter validation audit, UTC time handling verified + v1.5.2 — Improved NuGet metadata: expanded keyword-rich description and tags (backtesting, crypto, pair-trading, mean-reversion, algo-trading, strategy, execution) for better NuGet search discoverability. No code change. 8b042025-ae24-4b48-b89b-12b7001ca6e7 From 051c1e14cfd12830ea0280a41ce2c2a5b239760f Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Wed, 2 Sep 2026 08:07:25 -0400 Subject: [PATCH 2/5] chore(release): bump to 1.5.3 - csproj: Version 1.5.2 -> 1.5.3, updated release notes - sync report watermark (console + MCP generatedBy) to v1.5.3 Stacked on 1.5.2 branch (SEO metadata + watermark + README FAQ). No functional code change; verified build (core, Runtime.Console, Mcp) 0 errors and packed Quant.Infra.Net.1.5.3.nupkg/snupkg. --- src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs | 2 +- src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs | 2 +- src/Quant.Infra.Net/Quant.Infra.Net.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs b/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs index 075338c..322dac4 100644 --- a/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs +++ b/src/Quant.Infra.Net.Mcp/Tools/RunBacktestTool.cs @@ -108,7 +108,7 @@ public static async Task RunBacktest( }, trades = result.Trades.Count, interpretation = Interpret(m), - generatedBy = "Quant.Infra.Net v1.5.2 — github.com/memoryfraction/Quant.Infra.Net — e-book: amazon.com/dp/B0D7W89ZQD" + generatedBy = "Quant.Infra.Net v1.5.3 — github.com/memoryfraction/Quant.Infra.Net — e-book: amazon.com/dp/B0D7W89ZQD" }; return JsonSerializer.Serialize(payload, JsonOpts); diff --git a/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs b/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs index 97d024b..c1b61aa 100644 --- a/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs +++ b/src/Quant.Infra.Net.Runtime.Console/QqqmDocWalkthrough.cs @@ -247,7 +247,7 @@ public static async Task RunAsync() C.WriteLine(); C.WriteLine("=========================================================="); - C.WriteLine(" Report generated by Quant.Infra.Net v1.5.2"); + C.WriteLine(" Report generated by Quant.Infra.Net v1.5.3"); C.WriteLine(" Code: github.com/memoryfraction/Quant.Infra.Net"); C.WriteLine(" E-book: amazon.com/dp/B0D7W89ZQD"); C.WriteLine("=========================================================="); diff --git a/src/Quant.Infra.Net/Quant.Infra.Net.csproj b/src/Quant.Infra.Net/Quant.Infra.Net.csproj index 1b99503..9422a09 100644 --- a/src/Quant.Infra.Net/Quant.Infra.Net.csproj +++ b/src/Quant.Infra.Net/Quant.Infra.Net.csproj @@ -6,7 +6,7 @@ $(NoWarn);CS0579 false false - 1.5.2 + 1.5.3 Quant.Infra.Net @@ -23,7 +23,7 @@ true snupkg false - v1.5.2 — Improved NuGet metadata: expanded keyword-rich description and tags (backtesting, crypto, pair-trading, mean-reversion, algo-trading, strategy, execution) for better NuGet search discoverability. No code change. + v1.5.3 — Follow-up to v1.5.2: version bump for next NuGet release. Retains the expanded SEO description/tags and report watermark introduced in v1.5.2. 8b042025-ae24-4b48-b89b-12b7001ca6e7 From d7e04951fb22fcf38d311c62c5556fff46a913d4 Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Wed, 2 Sep 2026 08:11:55 -0400 Subject: [PATCH 3/5] =?UTF-8?q?docs(readme):=20pain-first=20hook=20?= =?UTF-8?q?=E2=80=94=20list=204=20pain=20points,=20then=20Quant.Infra.Net?= =?UTF-8?q?=20as=20the=20answer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attention-scarce restructure: lead with the reader's pain (data keeps breaking, untrusted backtester, backtest≠live, every broker a rewrite), then position Quant.Infra.Net as the one-framework answer. Demo section retitled 'The answer, in a real backtest'. Bilingual. --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32fc1f3..dde9005 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,22 @@ --- -## 📈 See it work first / 先看一个真实结果 +## 🎯 Does this sound familiar? / 这些痛点,是不是也卡住过你? + +Building a trading system in .NET is usually not one problem — it's **four problems glued together with duct tape**: + +1. **Data keeps breaking.** Free feeds go stale, endpoints 404, the anti-bot wall moves — and your *strategy* is the one that suffers. 数据源三天两头抽风:免费接口过期、端点 404、反爬墙一挪,最后背锅的却是你的策略。 +2. **You can't trust your backtester.** Look-ahead bias, peeking at future bars, a hand-rolled loop that "works" in testing but behaves differently in live. 回测引擎不靠谱:前视偏差、偷看未来 bar、自己搓的循环"测试能过"却和实盘表现两码事。 +3. **Backtest and live are two codebases.** One works, the other doesn't, and you never know which to believe. 回测与实盘是两套代码:一个能跑、一个跑不了,你永远不知道信哪个。 +4. **Every broker is a rewrite.** Want to switch from Binance to Schwab or IB? Re-learn the SDK, re-test everything, re-shape your strategy. 每换一个券商就要重改:币安换嘉信/盈透,重学 SDK、重跑测试、重调策略。 + +**Quant.Infra.Net gives you the answer to all four — one framework, one interface.** You write the strategy *once*; data sources, brokers, and backtest↔live all swap by **config, not code**. +**Quant.Infra.Net 一次性解决这四个问题——一套框架、一个接口。** 你只写一次策略;数据源、券商、回测↔实盘都靠**改配置**切换,而不是改代码。 + +--- + +## ✅ The answer, in a real backtest / 解决方案:先看一个真实回测 + > **A real, reproducible backtest — not a mock.** The example below runs the bundled `QQQM reverse-MA200 DCA` strategy over **real QQQM daily closes (2020-12 → 2026-08)**, with the exact console output and equity curve from the actual run. Nothing is fabricated. > From 6627c3e66ad22953b9bcea4f38a5fc3b4d2cedec Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Wed, 2 Sep 2026 08:32:29 -0400 Subject: [PATCH 4/5] docs(readme): bump Core badge/table/chain/install 1.5.1 -> 1.5.3 Match the live packages page. Changelog entries keep the historical 1.5.1 record. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dde9005..5e40628 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Quant.Infra.Net -[![Build & Test](https://github.com/memoryfraction/Quant.Infra.Net/actions/workflows/ci.yml/badge.svg)](https://github.com/memoryfraction/Quant.Infra.Net/actions/workflows/ci.yml) [![.NET](https://img.shields.io/badge/.NET-8.0-blueviolet)](https://dotnet.microsoft.com/download/dotnet/8.0) [![Core](https://img.shields.io/badge/Core-1.5.1-blue.svg)](https://www.nuget.org/packages/Quant.Infra.Net) [![Runtime](https://img.shields.io/badge/Runtime-1.6.0-green.svg)](https://www.nuget.org/packages/Quant.Infra.Net.Runtime) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) +[![Build & Test](https://github.com/memoryfraction/Quant.Infra.Net/actions/workflows/ci.yml/badge.svg)](https://github.com/memoryfraction/Quant.Infra.Net/actions/workflows/ci.yml) [![.NET](https://img.shields.io/badge/.NET-8.0-blueviolet)](https://dotnet.microsoft.com/download/dotnet/8.0) [![Core](https://img.shields.io/badge/Core-1.5.3-blue.svg)](https://www.nuget.org/packages/Quant.Infra.Net) [![Runtime](https://img.shields.io/badge/Runtime-1.6.0-green.svg)](https://www.nuget.org/packages/Quant.Infra.Net.Runtime) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) > A one-stop .NET **framework** for quantitative trading: multi-source data ingestion, unified broker execution (Binance/IB/Schwab), real-time alerting, and built-in portfolio analytics — go from idea to backtest to paper to live by changing config and a strategy file, not your codebase. > @@ -193,12 +193,12 @@ The project is a **family of packages**. Most users only need the top one — it | Package | Version | What it gives you | |---------|---------|-------------------| -| [`Quant.Infra.Net`](https://www.nuget.org/packages/Quant.Infra.Net) | 1.5.1 | Core: data sources, broker & order execution, statistical analysis, portfolio analytics, notifications | +| [`Quant.Infra.Net`](https://www.nuget.org/packages/Quant.Infra.Net) | 1.5.3 | Core: data sources, broker & order execution, statistical analysis, portfolio analytics, notifications | | [`Quant.Infra.Net.Orchestration`](https://www.nuget.org/packages/Quant.Infra.Net.Orchestration) | 1.6.0 | Event-driven strategy pipeline: signal → risk → target position → execution → portfolio state | | [`Quant.Infra.Net.Backtest`](https://www.nuget.org/packages/Quant.Infra.Net.Backtest) | 1.6.0 | Event-driven (bar-by-bar) backtest engine with look-ahead-bias guards | | [`Quant.Infra.Net.Runtime`](https://www.nuget.org/packages/Quant.Infra.Net.Runtime) | 1.6.0 | Unified `RunMode` switch (Backtest/Paper/Testnet/Live) + one-file-per-strategy plugin convention — **recommended entry point** | -**Dependency chain / 依赖链:** `Runtime 1.6.0` → `Backtest 1.6.0` + `Orchestration 1.6.0` → `Quant.Infra.Net 1.5.1` +**Dependency chain / 依赖链:** `Runtime 1.6.0` → `Backtest 1.6.0` + `Orchestration 1.6.0` → `Quant.Infra.Net 1.5.31` ```bash dotnet new console -n MyQuantApp && cd MyQuantApp @@ -207,7 +207,7 @@ dotnet new console -n MyQuantApp && cd MyQuantApp dotnet add package Quant.Infra.Net.Runtime # ...or core only (data / broker / analysis / notifications, no strategy pipeline): -dotnet add package Quant.Infra.Net --version 1.5.1 +dotnet add package Quant.Infra.Net --version 1.5.3 ``` > **One `dotnet add package` on `Quant.Infra.Net.Runtime` installs the whole stack.** Add `Quant.Infra.Net` alone only if you need the building blocks without the strategy pipeline. From 409e511f0c4ca811551338f82869a13d09c4348d Mon Sep 17 00:00:00 2001 From: "THINKPAD_P14S\\rongf" Date: Wed, 2 Sep 2026 08:35:29 -0400 Subject: [PATCH 5/5] fix(ci): CodeQL build-mode log -> manual (v3 no longer supports log) - build-mode: log is rejected by codeql-action@v3; switch to 'manual' for C# (the manual mode lets the C# extractor read compiler output from the build). - Build the whole src/Quant.Infra.Net.sln and let the job FAIL on build error (removed continue-on-error: true which was masking real build failures). - Update comments to reflect manual build-mode. --- .github/workflows/codeql.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dec33c5..884bc4a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,5 +1,5 @@ # Code scanning (CodeQL) for C#/.NET — feeds GitHub's "Security and quality" tab. -# Follows the official .NET CodeQL setup (init -> dotnet build -> analyze in log mode). +# Follows the official .NET CodeQL setup (init manual -> dotnet build -> analyze). name: CodeQL on: @@ -34,12 +34,11 @@ jobs: uses: github/codeql-action/init@v3 with: languages: csharp - build-mode: log + build-mode: manual - # Emit a build so CodeQL (log mode) can extract C# dataflow from compiler output. + # Emit a build so the C# CodeQL extractor (manual build-mode) can capture compiler dataflow. - name: Build (for CodeQL extraction) run: dotnet build src/Quant.Infra.Net.sln -c Release - continue-on-error: true - name: Run CodeQL analyze uses: github/codeql-action/analyze@v3