Since you are developing an algo trading system (with Python, real-time LTP & volume, training model etc.), having a stable IP is favourable. Here are the recommended steps:
Choose a network environment with a fixed public IP
If you are running your system from home/office broadband, contact your ISP and ask for a static public IP plan (not dynamic) so your outbound traffic always bears the same IP.
Alternatively, host your trading backend on a cloud VM/instance and allocate a reserved/public static IP (e.g., on AWS, Google Cloud, Azure, DigitalOcean).
Ensure all your API traffic (to m.Stock) originates from that single public IP (or a small set of whitelisted IPs if allowed).
This helps with order-flow consistency, whitelisting, and regulatory compliance (algo trading, low latency, etc.).
Contact m.Stock / your account manager / API onboarding team
Ask: “Do you support whitelisting static IPs for API requests (especially order execution)?”
Provide your static IP(s) and ask them to register that IP so that your server traffic is permitted.
Confirm if they allow secondary/back-up IPs in case you move to another server or have failover.
Ask if there is any minimum latency requirement or region preference (for low latency algo trading).
Keep documentation of the IP registration (date, IP, account, scope of usage etc).
Configure your trading backend to use that IP and secure the path
In your Python/pyqt/automation stack you build, ensure that all outbound API calls go out via the static IP (i.e., your server’s main NIC/public interface).
Make sure that you are not accidentally using some proxy or NAT that changes the public IP.
Use environment variables (as you already do) to store API key/secret etc. Eg:
MSTOCK_API_KEY=your_key
MSTOCK_API_SECRET=your_secret
MSTOCK_STATIC_IP=xx.xx.xx.xx
When deploying, monitor your server’s public IP occasionally (e.g., via curl https://ipinfo.io/ip) to confirm it hasn’t changed.
Test order-placement and error handling
Before going live with your model (scalping, volume/LTP based) test placing orders via API from your static IP.
If you get “IP not allowed” or “unauthorised source” type errors, you’ll know the static IP needs to be registered with m.Stock.
Add logic in your code to log API errors (especially authentication or network errors) and if needed alert you when the IP has changed unexpectedly.
Maintain & document your setup
Ensure the static IP remains unchanged (if your plan changes with ISP, or you shift cloud provider, update m.Stock).
Keep track of any modifications: e.g., if you shift to a different server/IP, contact m.Stock to update whitelisting.
For your algo system (you mentioned continuous learning, daily retraining), downtime due to IP mismatch would hurt — so plan for redundancy if possible.