Nero v1 – Trading Bot Script with Strategy (for Alpaca.markets)

4 weeks ago 14

We usually post about books, but today we’re switching gears: here’s a long-term trading bot with full how-to guide so you can start the year by automating your stock trades.

Nero v1 is a simple, rule-based momentum pullback bot you can run on Alpaca 24/7 from a cheap cloud VM. It scans a watchlist, waits for an “uptrend + pullback” setup, then places a bracket order with an ATR-based stop loss and take profit. The goal is boring execution with consistent risk control, not “AI magic.”

Why Nero v1?

2016-01-01 – 2026-01-01 Period:

  • Starting Value: $10,000
  • Final Value: $83,807 ✅
  • Return: +738.1% ✅
  • Win Rate: 43.6% ✅
  • Max Drawdown: 33.3% ✅
  • Total Trades: 250

What Exactly is included in the Gumroad package?

  • nero-v1.py (the bot)
  • backtest-nero-v1.py (you can test the strategy on historical data)
  • config.yaml (includes your Alpaca.market credentials)

What Nero v1 actually does

Nero v1 loops forever, but it only tries to trade while the market is open by checking Alpaca’s market clock. When markets are closed, it prints a countdown to the next open.

Under the hood, it:

  • Pulls recent 1-minute bars from Alpaca
  • Calculates indicators
  • Checks if there is already a position
  • If a setup appears, sizes the trade based on account equity and volatility
  • Submits a bracket order (market entry + stop loss + take profit)

How it works with Alpaca

Alpaca.markets provides:

  • The brokerage account (paper or live)
  • A market clock endpoint so you can check open/close state

Nero v1 connects using API keys loaded from config.yaml (you need to insert your own during setup).

What you need before setup?

A quick checklist:

  • Part 1: An Alpaca account (paper is fine to start)
  • Part 2: A Google Cloud VM (Ubuntu/Linux) with Python 3.9+ and required libraries
  • Part 3: Upload the bot script to your Google Cloud VM and start it

Part 1: Create an Alpaca account and generate API keys

Create your Alpaca account (Trading API account), then go to your Alpaca dashboard and generate API keys. Alpaca’s docs point you to the dashboard API Keys section where you can generate new keys and save them.

Important detail: paper trading (no money needed) and live trading (using real money) use different API keys, and the paper environment has its own endpoint.

You need to save these details into config.yaml next to your bot script.

Paper trading endpoint

Many setups use https://paper-api.alpaca.markets for paper trading. The official docs note that the endpoint is shown in your paper dashboard and differs from live.

If you switch to a live account, the endpoint URL will change to https://api.alpaca.markets.

Configure Nero v1 to connect to Alpaca

Nero v1 reads credentials from config.yaml. The script expects these fields: API_KEY, API_SECRET, BASE_URL.

The config.yaml template is included in the download package. Example:

API_KEY: "YOUR_KEY_ID" API_SECRET: "YOUR_SECRET" BASE_URL: "https://paper-api.alpaca.markets"

Part 2: A Google Cloud VM (Ubuntu/Linux) with Python 3.9+ and required libraries

Create an Ubuntu e2-micro VM in Google Cloud

Open Google Cloud Console → Compute Engine → VM instances → Create instance.

Set these options:

Name
nero-v1-bot (or anything you like)

Region / Zone
Pick a region close to you. If you’re cost-optimizing, you can pick regions where the free-tier e2-micro is available.

Machine type
E2 → e2-micro (low cost, good enough for a single lightweight trading bot)

Boot disk
Click Change
Operating system: Ubuntu
Version: Ubuntu 24.04 LTS (or 22.04 LTS)

Both are fine and include Python 3.9+ out of the box.

Firewall
You do not need HTTP/HTTPS for this bot. Leave “Allow HTTP traffic” and “Allow HTTPS traffic” unchecked unless you know you need them.

Click Create.

Open SSH in the browser

In the VM instances list, click SSH → Open in browser window. This is where you’ll run all commands below.

Install dependencies first (before you upload files)

sudo apt update sudo apt -y upgrade sudo apt -y install python3 python3-pip git screen

Install Python libraries

Your script imports: alpaca_trade_api, pandas, pandas_ta, and yaml (PyYAML).

Install them for your user:

pip3 install --user --upgrade pip pip3 install --user alpaca-trade-api pandas pandas_ta pyyaml

Part 3: Upload the bot script

Upload nero-v1.py and config.yaml (with your inserted API credentials) into your home directory. There is an Upload File button on the top-right part of your SSH-in-browser.

Run once (foreground)

From home:

cd ~ python3 nero-v1.py

If it connects successfully, you’ll see it load config, connect to Alpaca, then start scanning and making moves based on its strategy (or it will show the market-closed countdown).

Stop it with Ctrl + C.

Run 24/7 using screen (no tmux, no venv)

Start a named screen session:

cd ~ screen -S nero

Now start the bot:

python3 nero-v1.py

Detach screen (keep it running):
Press Ctrl + A, then D.

Your bot keeps running even if you close the SSH tab.

Reconnect later

SSH into the VM again, then:

screen -ls screen -r nero

If it says it’s attached (can happen after disconnects), force reattach:

screen -d -r nero

Note: This method will only stop the script/bot when you reboot the VM on Google Cloud.

Get Nero v1 here.

Read Entire Article