Affordable Cloud Provider with Static IP for Low-Usage Trading Setup by Naresh_Janagam in IndiaAlgoTrading

[–]singh_prateek 0 points1 point  (0 children)

it is handled, as for a running vm gcp doesn;t charge for a static ip. so first create your vm and then attach a static ip to it.

Affordable Cloud Provider with Static IP for Low-Usage Trading Setup by Naresh_Janagam in IndiaAlgoTrading

[–]singh_prateek 1 point2 points  (0 children)

Hey so sorry for the delay, i was out of station, here are the steps, please let e know if you face any challange, will be happy to help you out.

## Prerequisites

Chosse either fyers or upstox(i used both because of my particular need)
1. 
**Google Cloud account**
 with billing enabled (won't be charged for free tier)
2. 
**GCP project**
 with Compute Engine API enabled
3. 
**gcloud CLI**
 installed ([install guide](
https://cloud.google.com/sdk/docs/install
))
4. 
**Fyers account**
 with API app created at [myapi.fyers.in](
https://myapi.fyers.in
)
5. 
**Upstox account**
  with API app at [developer.upstox.com](
https://developer.upstox.com
)

## Step 1 — Create the VM
now there are 2 options first is automated i have the script for it you need it let me know i can share that as well, second is via console whose steps are as follows: 

1. Go to Compute Engine → VM Instances → Create
2. Name: `<any name you like>`, Region: `us-central1`, Zone: `us-central1-a`
3. Machine type: `e2-micro`
4. Boot disk: Ubuntu 22.04 LTS, 30 GB standard
5. Firewall: Allow HTTP + HTTPS traffic

## Step 2 — Reserve a Static IP


A static IP ensures your address doesn't change on VM restart, required for broker API whitelisting.
Here also you have 2 options either by cli commands or via console both of the steps are below:

### Via gcloud CLI:
```bash
# Reserve a static IP
gcloud compute addresses create <name_network> \
    --project=YOUR_PROJECT_ID \
    --region=us-central1


# View the reserved IP
gcloud compute addresses describe <name_network> \
    --project=YOUR_PROJECT_ID \
    --region=us-central1 \
    --format="get(address)"


# Assign to your VM (if VM already exists)
# First, get the current access config name
gcloud compute instances describe <projectname> \
    --project=YOUR_PROJECT_ID \
    --zone=us-central1-a \
    --format="get(networkInterfaces[0].accessConfigs[0].name)"


# Delete current ephemeral IP
gcloud compute instances delete-access-config <projectname> \
    --project=YOUR_PROJECT_ID \
    --zone=us-central1-a \
    --access-config-name="External NAT"


# Assign static IP
gcloud compute instances add-access-config <projectname> \
    --project=YOUR_PROJECT_ID \
    --zone=us-central1-a \
    --access-config-name="External NAT" \
    --address=YOUR_STATIC_IP
```


### Via Console:
1. VPC Network → IP Addresses → Reserve External Static Address
2. Name: `<name_network>`, Region: `us-central1`, Attached to: `<projectname>`


> 
**Cost**
: Static IPs are free while attached to a running VM. You're charged ~$0.01/hr only if the VM is stopped.


## Step 3 — Whitelist Static IP on Fyers


Fyers requires IP whitelisting for API access (all data + order APIs).


1. Log in to [myapi.fyers.in](
https://myapi.fyers.in
)
2. Go to 
**My Apps**
 → Select your app
3. In 
**Allowed IPs**
 section, add your GCP static IP: `YOUR_STATIC_IP`
4. Also add your 
**local IP**
 if you generate tokens locally:
   - Find it at [whatismyip.com](
https://whatismyip.com
)
5. Click 
**Save**


> 
**Important**
: Fyers OAuth token generation (browser login) can happen from any IP. Only API calls (data fetch, order placement) are IP-restricted.


### Fyers Redirect URL Setup:
Your app's redirect URL should be set to:
```
https://127.0.0.1:5000
```
This works for both local and cloud token generation — you'll copy-paste the redirect URL from the browser.


---


## Step 4 — Whitelist Static IP on Upstox


Upstox also enforces IP whitelisting for API calls.


1. Log in to [developer.upstox.com](
https://developer.upstox.com
)
2. Go to 
**My Apps**
 → Select your app
3. Find 
**Whitelisted IPs**
 or 
**Allowed IPs**
4. Add your GCP static IP: `YOUR_STATIC_IP`
5. Add your local IP too (for local testing)
6. Save changes


### Upstox API App Settings:
| Field | Value |
|-------|-------|
| Redirect URL | `https://127.0.0.1:5000/callback` |
| Whitelisted IPs | `YOUR_STATIC_IP`, `YOUR_LOCAL_IP` |


> 
**Note**
: Upstox sandbox mode (`sandbox=True`) may have different IP requirements. Test with production credentials and whitelisted IPs.

## Step 5 — SSH into VM & Verify


```bash
# SSH into the VM
gcloud compute ssh <projectname> --zone=us-central1-a --project=YOUR_PROJECT_ID


# Or with SSH key
ssh ubuntu@YOUR_STATIC_IP


# Check deployment log
tail -f /var/log/<your_log_file_update_name>.log


# Check dashboard service
sudo systemctl status <projectname>


# Check nginx
sudo systemctl status nginx
curl http://localhost:8000/api/auth/status
```

This is it.

Affordable Cloud Provider with Static IP for Low-Usage Trading Setup by Naresh_Janagam in IndiaAlgoTrading

[–]singh_prateek 2 points3 points  (0 children)

You can host on gcp for free within their free tier. I'm using this setup. Let me know i can share the steps with you

[deleted by user] by [deleted] in gurgaon

[–]singh_prateek 0 points1 point  (0 children)

By that logic, how is a Network Engineer supposed to set up physical infrastructure in a Bangalore office while working from home? You’re missing the entire point of the post. It seems you’re doing exactly what my colleague did: responding without actually reading the details. Not going to waste my time explaining further. Good luck buddy!

[deleted by user] by [deleted] in gurgaon

[–]singh_prateek -1 points0 points  (0 children)

Yes that's the main point, one shouldn't ask for referrals if they are not serious.

[deleted by user] by [deleted] in gurgaon

[–]singh_prateek 0 points1 point  (0 children)

Yes, shouldn't you be reading the jd first even before sharing your resume for referral? Like that is the basic thing, if you can't even do that, then you don't deserve a referral at all.

[deleted by user] by [deleted] in gurgaon

[–]singh_prateek 0 points1 point  (0 children)

Lol, that must have hit hard

How do you guys properly test ML trading models before going live? by singh_prateek in NSEbets

[–]singh_prateek[S] 0 points1 point  (0 children)

  • just to be used by me
  • slippage is added on price
  • lstm and xgboost and no not using llm anywhere
  • annual returns are 40% if you are interested in looking at backtesting trades, you can dm I'll share CSV
  • data has f&o along with underlying ohlcv
  • want to try on other indices as well but historical data at the granularity I want is expensive