इसे छोड़कर कंटेंट पर जाएं

Quickstart

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

This walkthrough takes you from a fresh install to a running paper bot, a triggered limit refusal, a daily report, and an offline-verified signed record — with no broker account and no real money involved.

Install via pip (or unpack the standalone Go binary):

Terminal window
pip install geometer-markets
geometer-markets --version

Create a clean directory and run geometer-markets init:

Terminal window
mkdir paper-demo && cd paper-demo
geometer-markets init

Answer the four prompts:

  1. Broker: paper
  2. Limits: review the generic default caps, adjust any values you want, and confirm
  3. Target: local
  4. Language: python

Copy the printed gm_paper_... local key and export it in your shell:

Terminal window
export GEOMETER_GUARD_KEY="gm_paper_a1b2c3d4_your_generated_secret"

Keep note of the printed 64-character hex signer_pub_key as well.

Run the generated starter strategy (bot.py) offline against bundled synthetic bars:

Terminal window
geometer-markets backtest \
--strategy "python3 bot.py" \
--limits ./limits.json \
--data ./synthetic_niftybees_5m.jsonl

Run the exact same command a second time. Both runs print the identical SHA-256 backtest digest because the engine uses exact decimal math and a deterministic clock. Backtest uses the same risk gate and limits.json as live mode.

4. Start the local Order Guard in paper mode

Section titled “4. Start the local Order Guard in paper mode”

In one terminal window, start the Order Guard:

Terminal window
geometer-markets guard --data-dir .

The guard listens strictly on 127.0.0.1:7878 and connects to the local simulated paper venue. Confirm it is up:

Terminal window
curl -s http://127.0.0.1:7878/healthz
# {"status":"ok"}

5. Run the paper bot and watch a limit check

Section titled “5. Run the paper bot and watch a limit check”

In a second terminal (with GEOMETER_GUARD_KEY exported), start your starter bot in paper mode:

Terminal window
geometer-markets paper --strategy "python3 bot.py" --guard http://127.0.0.1:7878

Every target position from bot.py becomes a guarded order sent over http://127.0.0.1:7878/v1/orders.

You can also test a limit refusal directly using curl. The request below intentionally asks for an order value larger than the default max_order_value_inr (50000):

Terminal window
curl -s -X POST http://127.0.0.1:7878/v1/orders \
-H "Authorization: Bearer $GEOMETER_GUARD_KEY" \
-H "Content-Type: application/json" \
-d '{
"client_order_id": "demo_refusal_0001",
"account_id": "default",
"strategy_id": "example-bot",
"instrument": "NSE:NIFTYBEES",
"side": "buy",
"order_type": "limit",
"product": "delivery",
"quantity": "1000",
"price": "260.00"
}'

The guard refuses the order before it reaches the venue and responds with structured JSON naming the exact rule and a deterministic decision_id:

{
"refused": {
"code": "order_notional_cap",
"message": "Order value 260000 INR exceeds per-order limit 50000 INR.",
"limit": "order_notional_cap",
"decision_id": "dec_019b8c7d6e5f4a3b2c1d0e9f8a7b6c5d"
}
}

Both approved orders and refused decisions are written to your signed record.

Engage the stop switch from your terminal (this talks over the privileged local Unix socket guard-admin.sock, never the bot HTTP key):

Terminal window
geometer-markets kill --data-dir . --scope account --target default --mode no_new_risk --reason "quickstart drill"

Any new opening order sent with $GEOMETER_GUARD_KEY is now refused with stop_switch_active, while cancellations and risk-reducing orders remain allowed. A bot key can never clear this switch; only you at the terminal can re-arm it:

Terminal window
geometer-markets kill --data-dir . --scope account --target default --mode normal --reason "drill complete"

7. Generate the report and verify the record offline

Section titled “7. Generate the report and verify the record offline”

Write a checkpoint (the guard also writes checkpoints automatically at daily close, on stop-switch changes, and on clean shutdown), generate a local report, and verify the chain offline:

Terminal window
geometer-markets record checkpoint --data-dir . --account default --mode paper
geometer-markets report --data-dir . --account default --mode paper
geometer-markets verify ./records/default/paper --expect-key <your-64-hex-signer-pub-key>

geometer-markets verify exits 0 after checking canonical JSON, sequence continuity, every SHA-256 entry_hash and prev_hash, and every Ed25519 checkpoint signature. Change even one byte in records/default/paper/segments/*.jsonl and run verify again to watch it exit 1 with the exact failing sequence number.