Latenode

Fully automate stock trading by syncing Alpaca and Google Sheets

This template reads daily stock sentiment scores from Google Sheets, picks the top tickers, and rebalances an Alpaca account through JavaScript.

It sells positions that fell off the list, buys the names that remain, then writes order ids back to the sheet. Connect Google Sheets. Put the Alpaca API key and secret in that JavaScript node. Start with Alpaca paper trading until the orders look right.

Updated Sep 16, 2026Est. run: 21sEst. cost: $0.0013
How Latenode estimates time and cost

Latenode bills workflow runtime in CPU seconds. The first 10,000 CPU seconds are free each month, then usage follows pay-as-you-go CPU-second pricing. Plug-and-Play (PnP) AI nodes are billed separately—each PnP token is $1 USD, charged pay-as-you-go at vendor cost plus a small processing fee, with no API keys required.

Full pricing — how CPU seconds work →

Workflow preview

What this template does

  • Turns a Sheets sentiment list into Alpaca buy and sell orders
  • Reads scores from Google Sheets on a weekday schedule
  • Places the rebalance from JavaScript with keys in that node
  • Writes order ids back to the sheet

How it works

1
Trigger

Run on a weekday schedule

The scenario starts on weekdays at the time you choose, such as 4:45 PM US Eastern.

2
Action

Read sentiment scores

Google Sheets returns the daily ticker scores you already write from research.

3
Logic

Rebalance on Alpaca

JavaScript keeps the top tickers, loads Alpaca account and positions, sells names that dropped off, and buys the rest. Put the Alpaca API key and secret in that JavaScript node.

4
Action

Log orders in Sheets

Google Sheets records ticker, side, quantity, and Alpaca order id for the run.

Setup guide

1

Connect Google Sheets

Add a Google Sheets connection. Use one tab for daily sentiment scores and another tab for the order log.

2

Put Alpaca keys in JavaScript

In JavaScript, call the Alpaca trading API for account, open positions, sell orders, and buy orders. Store the Alpaca API key and secret in that node. Use paper trading first.

3

Set the weekday schedule

Add a schedule for weekdays at the time you want to rebalance, such as 4:45 PM US Eastern.

4

Map scores and log orders

Read the sentiment tab, pick how many top tickers to hold, send the Alpaca orders, then append the order log. Run once by hand and confirm paper fills before you leave it on.

Requirements

A Google Sheet with daily ticker sentiment scores
Alpaca API key and secret stored in the JavaScript node
An Alpaca paper or live trading account
A weekday schedule

FAQ

Common questions about this template

Each run uses credits on your Latenode plan. We charge for processing time (1 credit = 30 seconds). Your actual cost depends on your plan and how long the run takes. See pricing plans for plans and how credits work.