Skip to content

Static IPv6 address

This content is not available in your language yet.

Under India’s retail algorithmic trading framework (effective 1 April 2026), API order placement requests to Indian brokers must originate from a static IP address registered by the trader with their broker. Exchanges allow at most one change of that registered static IP per calendar week.

Geometer Markets handles provisioning, fail-closed socket binding, weekly change protection, and pre-live verification on your own cloud account or Linux server.

Direct socket binding (fail-closed, no local proxy)

Section titled “Direct socket binding (fail-closed, no local proxy)”

When self-hosted, the Order Guard does not run a local proxy daemon such as Squid. Instead, each broker account uses a dedicated HTTP transport whose dialer sets LocalAddr directly to your configured static IP:

  • IPv6 static addresses dial strictly over tcp6.
  • IPv4 static addresses dial strictly over tcp4.
  • Fail-closed: if the configured static IP is missing from the host’s network interfaces or cannot bind, order requests fail immediately with egress_bind_failed. The guard never falls back silently to an ephemeral interface address.
  • Recorded on every order: every order entry in your signed hash chain stores the exact source_ip bound on the socket.
  • Read-only market data routes (quotes, instruments, historical candles) do not require static IP registration at brokers.

Option 1: Provision a Mumbai VM on Google Cloud

Section titled “Option 1: Provision a Mumbai VM on Google Cloud”

If you have the gcloud CLI installed and signed in to your own Google Cloud project, one command sets up a minimal trading host in asia-south1 (Mumbai):

Terminal window
geometer-markets address create --gcp --project my-trading-project

What address create --gcp provisions in your own Google Cloud project:

  1. A dual-stack VPC subnet in asia-south1 with external IPv6 enabled.
  2. A reserved static external IPv6 address, kept independent of the VM lifecycle so rebuilding or upgrading the VM retains the exact same address without spending a weekly broker IP change.
  3. A minimal compute VM sized for the Order Guard.
  4. Firewall rules allowing zero public ingress to the guard port (7878); SSH management and loopback tunneling are allowed strictly through Google Cloud Identity-Aware Proxy (IAP).
  5. geometer-markets guard installed and configured as a hardened systemd service under a dedicated non-root user.

When provisioning finishes, the CLI prints your reserved static IPv6 address. Paste that address into the static IP field in your broker’s developer console yourself — Geometer never asks for your broker portal password.

If you already run a Linux server or VPS with a static IPv6 (or IPv4) address assigned to its network interface, bind the guard to it directly:

Terminal window
geometer-markets address use 2400:1a00:b010::42

address use verifies that the address is a valid global unicast IP present on a local network interface before saving it and recording an address_change entry in your signed chain.

Connect from your laptop via IAP / SSH tunnel

Section titled “Connect from your laptop via IAP / SSH tunnel”

Because the Order Guard listens only on 127.0.0.1:7878 on your Mumbai VM with no public port open, connect from your local workstation over an authenticated tunnel:

Terminal window
geometer-markets connect --gcp --project my-trading-project --instance geometer-guard

This forwards your local 127.0.0.1:7878 to the VM’s 127.0.0.1:7878 over IAP SSH. Your local Python bot or MCP client can then talk to http://127.0.0.1:7878 as if the guard were local while every live broker order leaves from your Mumbai VM’s static IPv6 address.

If you forward to a different local port, pass --allow-forwarded-port <port> so the guard accepts only explicitly permitted forwarded ports.

The weekly change rule (Monday–Sunday IST)

Section titled “The weekly change rule (Monday–Sunday IST)”

Indian exchanges permit at most one static IP change per calendar week (measured Monday 00:00:00 IST through Sunday 23:59:59 IST).

To prevent accidental mid-week lockouts:

  • Every address activation or change is recorded in local SQLite (address_history) with its IST timestamp and ISO week (YYYY-Www), and appended as an address_change entry in your signed chain.
  • Before replacing an active address, the CLI prints the current address, the new address, and a reminder of the weekly restriction.
  • If a change has already occurred in the current Monday–Sunday IST calendar week, address create and address use refuse the second change by default.
  • If you genuinely need to override (for instance, you corrected a typo before ever pasting the earlier address into your broker console), pass --i-understand-the-broker-may-refuse. The override is recorded as override_used: true in the signed record.

IPv4 fallback for brokers without IPv6 (such as Fyers)

Section titled “IPv4 fallback for brokers without IPv6 (such as Fyers)”

Not every Indian broker publishes an IPv6 (AAAA) DNS record for its order API. In particular, api.fyers.in and api-t1.fyers.in are IPv4-only.

Each broker’s reference data specifies whether IPv6 is supported. When you configure a broker marked IPv4-only (such as Fyers):

  • geometer-markets address create provisions a reserved static IPv4 address instead of IPv6.
  • The CLI explicitly states the reason and notes that cloud providers charge a recurring fee for static IPv4 addresses.
  • The broker transport binds strictly over tcp4 to that reserved IPv4 address.

See the broker table in Brokers and daily sessions for each broker’s IPv6 status.

Verify your address before live trading (address check)

Section titled “Verify your address before live trading (address check)”

Run address check in two stages before placing any real orders:

Terminal window
# Stage 1: verify outgoing source IP against an echo endpoint (safe anywhere)
geometer-markets address check
# Stage 2: verify that your broker's order gateway accepts the registered IP
geometer-markets address check --broker zerodha
  1. Stage 1 (egress check): connects through the exact bound HTTP transport to an IP-echo service, confirms the observed remote IP matches your configured static IP byte-for-byte, and verifies that a mismatched IP family fails closed.
  2. Stage 2 (broker acceptance probe): submits a 1-unit limit buy on a liquid index ETF at a price below the day’s lower circuit band. Because order placement is gated on the static IP before price validation, an unregistered IP produces a broker IP rejection, whereas an accepted IP produces a harmless price-band rejection. If a broker ever accepts the probe order instead of rejecting it, the guard cancels it immediately and flags the probe method as unsafe for that broker. The probe outcome is logged in your signed address_change entry.