Overview
The Go binary (novosky_go) is a compiled, dependency-free runtime of the NOVOSKY trading bot. It reads config.json and .env from disk at startup, but everything else β ML models, scalers, metadata, ml_config.json, strategy_params.json, and the license β is baked into the binary at build time.
What customers receive:
The repo includes
env.customer.example as a minimal template for the customer .env β it only contains the fields a customer needs (MT5 API, Telegram, optional AI assistant). The developer .env.example contains additional fields for HF Hub, Supabase, GitHub, and other owner-only services.
No Python, no models/ directory, no Hugging Face Hub, no pip install.
Prerequisites
Build flow
Every binary build follows the same two-step process.1
Pack embedded assets
Copy model files, configs, and optionally the license into This populates
internal/embedded/ for //go:embed:internal/embedded/models/ with all .onnx and scaler JSON files, plus ml_config.json and strategy_params.json.2
Build the binary
Running
config.json and .env from the same directory as the executable by default, or from --dir.
Embedded assets
Model files and configs are embedded at compile time using Goβs//go:embed. The scripts/pack_embedded.sh script copies files from the repo into internal/embedded/ before each build.
What is embedded
What stays on disk (user-editable)
Model format
The
leaves library is not used β it only supports LightGBM format v3, and trained models are v4. All models are converted to ONNX for Go inference.ONNX runtime library
The binary loadslibonnxruntime.so dynamically at startup.
Bundle into the binary (recommended for distribution)
Use the--bundle-ort flag and bundle_ort build tag to embed libonnxruntime.so directly into the binary (~22 MB extra). Customers need zero external files:
pack_embedded.sh --bundle-ort auto-discovers the .so from the Python onnxruntime pip package. Override with ONNXRUNTIME_LIB=/path/to/libonnxruntime.so if needed.
Standard build (unbundled)
In standard builds (nobundle_ort tag), the binary searches at startup:
ONNXRUNTIME_LIBenvironment variable- Same directory as the binary (
libonnxruntime.sonext tonovosky_go) - System
LD_LIBRARY_PATH - Pythonβs
onnxruntimepip package (auto-glob, dev convenience)
libonnxruntime.so next to novosky_go, or set ONNXRUNTIME_LIB in the customerβs .env.
License system
The license controls which MT5 account numbers can trade and until when. It is embedded in the binary at build time β customers cannot inspect or modify it.How it works
- Owner creates an
accounts.jsonwith MT5 account numbers and expiry dates - Owner runs
licgento produce a signedlicense.json - Owner runs
pack_embedded.sh --licenseto embed it - Owner builds
novosky_gowith the production key - Customer receives
novosky_goβ the license is inside the binary
License format
key + all account entries (sorted). Any edit to dates or accounts invalidates the signature β customers cannot extend their own license.
Omit "end" for an account entry to make it never expire.
Generating a license
licgen output:
License expiry behavior
When a customerβs license expires, the bot refuses to start:license.json with updated dates, run pack_embedded.sh --license, rebuild, and send the customer a new binary.
Dev builds
In dev builds (no-ldflags key), license validation is skipped automatically. The placeholder license.json ({}) committed to git is harmless β the bypass happens before the file is even read.
Post-retrain workflow
Aftermake train or python scripts/retrain.py:
1
Export scalers and regression models
2
Re-pack embedded assets
3
Rebuild binary
4
Verify
Ensemble and position ONNX files are auto-exported by the Python trainer. You only need to manually run the two export scripts for the risk and SLTP regression models.
Telegram commands
The Go binary supports the same Telegram commands as the Python bot:
Free-text messages (not commands) are routed to the AI assistant if
assistant.enabled is set in config.json.
AI assistant
The AI assistant is an OpenAI-compatible tool-calling agent configured via.env. It can query account status, list positions, close trades, fetch news, and run MT5 API calls directly.
AI_BASE_URL is not set, it defaults to GitHub Models. The model can be overridden per-account in config.json: