Get Your Static IP & Verify It¶
Claim a dedicated static IPv6 and confirm your egress IP actually changes.
Part 00 of 20 in the ServLoci algo/options trading notebook series — full index in notebooks/README.md.
Setup¶
# Get your dedicated static IPv6 + SOCKS5 credentials free:
# https://comm.servloci.in/register (or /auth/google?free=1 for an instant trial)
# Your api_key / api_secret pair shows up in the portal after signup:
# https://comm.servloci.in/user
!pip install -q "requests[socks]"
!curl -sL https://comm.servloci.in/sdk/servloci.py -o servloci.py
import os
from servloci import ServLoci
SERVLOCI_API_KEY = os.environ.get("SERVLOCI_API_KEY", "dhan:1000000001") # broker:client_id
SERVLOCI_API_SECRET = os.environ.get("SERVLOCI_API_SECRET", "") # from the portal — leave blank to run this notebook in demo mode
sl = None
if SERVLOCI_API_SECRET:
sl = ServLoci(api_key=SERVLOCI_API_KEY, api_secret=SERVLOCI_API_SECRET)
print("ServLoci configured:", sl.host, sl.port)
else:
print("SERVLOCI_API_SECRET not set — running in demo mode (no live proxy calls).")
Claim a dedicated static IPv6, then verify your egress IP actually changes when you route through it — this is the IP you'll whitelist with your broker.
import requests
direct_ip = requests.get("https://api.ipify.org?format=json", timeout=8).json()["ip"]
print("Direct egress IP (Colab's own — NOT yours):", direct_ip)
if sl:
proxied_ip = sl.session().get("https://api.ipify.org?format=json", timeout=8).json()["ip"]
print("Proxied egress IP (whitelist THIS with your broker):", proxied_ip)
assert proxied_ip != direct_ip, "expected the proxy to change the egress IP"
else:
print("Set SERVLOCI_API_SECRET above (get it free at https://comm.servloci.in/register), then re-run this cell.")
Next: whitelist the printed IPv6 in your broker's API console (see notebooks 02-05 for the per-broker steps), then move on to the SDK quickstart.
Next: ServLoci SDK Quickstart »
Try the concepts above interactively: Options Strategy Builder · Docs · Get your static IP