cAlgoKit 0.0.2

dotnet add package cAlgoKit --version 0.0.2
                    
NuGet\Install-Package cAlgoKit -Version 0.0.2
                    
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="cAlgoKit" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cAlgoKit" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="cAlgoKit" />
                    
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 cAlgoKit --version 0.0.2
                    
#r "nuget: cAlgoKit, 0.0.2"
                    
#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 cAlgoKit@0.0.2
                    
#: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=cAlgoKit&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=cAlgoKit&version=0.0.2
                    
Install as a Cake Tool

cAlgoKit

cTrader cBot 辅助库。

早期开发中,功能还在陆续添加。

安装

在机器人的 .csproj 里加上:

<PackageReference Include="cAlgoKit" Version="*" />

或者运行:

dotnet add package cAlgoKit

使用

机器人照常在 cTrader 里新建、直接继承 Robot,在 OnStart 里创建 AlgoKit,之后通过 Kit. 使用:

using cAlgoKit;

namespace cAlgo.Robots;

public partial class MyBot : Robot
{
    private AlgoKit Kit;

    protected override void OnStart()
    {
        Kit = new AlgoKit(this);
    }

    protected override void OnTick()
    {
        Kit.OnTick();
    }
}

Kit.OnTick() 会运行所有需要逐 tick 检查的功能,比如保本。

保本

// 默认规则:没有单独设规则的仓位都用它
Kit.DefaultBreakEven = BreakEven.ByPips(10, 1);          // 盈利 10 点后,止损移到开仓价 + 1 点
Kit.DefaultBreakEven = BreakEven.ByAmount(5, 1);         // 净盈利 5(账户货币)后,止损移到锁住净盈利 1 的位置
Kit.DefaultBreakEven = BreakEven.ByAmount(5, 1, "USD");  // 金额按 USD 计

// 开仓时单独设置
Kit.OpenPosition(TradeType.Buy, Kit.LotsToUnits(0.01), slPips: 20, breakEven: BreakEven.Off);

要求

  • cTrader 5.10 及以上,机器人目标框架为 net6.0 或 net10.0
  • 在 cTrader 里编译时,编译器选择 .NET SDK
  • 整个库按 C# 10 编写,cTrader 新建的机器人(net6.0 / C# 10)可以直接使用

许可证

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 is compatible.  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
0.0.2 101 10/29/2026
0.0.1 93 10/28/2026