Add Linux-native cTrader cBot build/run scaffold
Build cBots in C# and compile them to .algo entirely on Linux via the official cTrader.Automate NuGet package + 'dotnet build' — no Windows and no cTrader desktop app. Run/backtest headless through Spotware's official cTrader console Docker image. Includes: - src/SampleCBot: example SMA-crossover cBot (SDK-style net6.0 class library) - scripts/install-dotnet.sh: root-free local .NET SDK install (~/.dotnet) - scripts/build.sh: dotnet build -> dist/<ProjectName>.algo, with a workaround for cTrader.Automate naming the .algo after the project's parent folder - scripts/run-console.sh: wrapper over ghcr.io/spotware/ctrader-console - docs/research-findings.md: sourced research; .algo verified as a proprietary 'algo'-magic container (not a ZIP); build verified end to end on Linux
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Run / backtest a compiled .algo headlessly using Spotware's OFFICIAL cTrader CLI
|
||||
# Docker image — no cTrader desktop GUI, no Windows. Available since cTrader 5.4.
|
||||
#
|
||||
# This is a thin wrapper: it mounts your built .algo files (dist/) into the
|
||||
# container at /mnt/Robots and forwards all arguments to the cTrader console.
|
||||
#
|
||||
# Discover the exact subcommands/flags for your image version first:
|
||||
#
|
||||
# ./scripts/run-console.sh --help
|
||||
#
|
||||
# Then backtest or run, e.g. (flag names follow the container's --help output):
|
||||
#
|
||||
# ./scripts/run-console.sh backtest --robot SmaCrossOverBot.algo \
|
||||
# --symbol EURUSD --period h1 --start 2024-01-01 --end 2024-06-01 \
|
||||
# --balance 10000
|
||||
#
|
||||
# Live trading additionally needs cTrader ID credentials passed to the console.
|
||||
#
|
||||
# Official image + documented commands:
|
||||
# https://github.com/spotware/ctrader-console-docker
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
IMAGE="${CTRADER_CONSOLE_IMAGE:-ghcr.io/spotware/ctrader-console:latest}"
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "docker not found — install Docker to run the cTrader console image." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker pull "$IMAGE"
|
||||
|
||||
exec docker run --rm -it \
|
||||
-v "$REPO_ROOT/dist:/mnt/Robots" \
|
||||
"$IMAGE" "$@"
|
||||
Reference in New Issue
Block a user