Daily crypto portfolio rebalance alerts and Sheets log
Every weekday at 8am ET, check your crypto holdings against target allocations, log a snapshot to Google Sheets, and ping Slack only when rebalancing is needed.
Build me a code-based workflow that checks my crypto portfolio for allocation drift every weekday morning, logs a daily snapshot to Google Sheets, and pings Slack only when something actually needs rebalancing.
Trigger: cron, every weekday (Monday through Friday) at 8:00am America/New_York.
Inputs the workflow should expect (configured once at setup time):
- A Google Sheets spreadsheet ID.
- The holdings tab name (default "Holdings") with three columns: symbol, amount held, target percent. Symbols use Massive's crypto ticker format with the X: prefix, for example X:BTCUSD, X:ETHUSD, X:SOLUSD.
- The history tab name (default "History") with columns: date, symbol, price, value, current percent, target percent, drift.
- A Slack channel ID for rebalance alerts.
- A drift threshold in percentage points (default 5).
Flow:
1. Use Google Sheets Get Values to read all holdings rows from the holdings tab.
2. For each holding, call Massive Get Crypto Snapshot for that ticker to fetch the current price. Remember crypto tickers on Massive require the X: prefix (e.g. X:BTCUSD).
3. For each holding compute current dollar value as amount times price. Sum all current values to get total portfolio value. Compute current percent as current value divided by total portfolio value times 100. Compute drift as current percent minus target percent.
4. Append one row per holding to the history tab via Google Sheets Append Values, with today's date (yyyy-mm-dd), symbol, price, current value, current percent, target percent, and drift. This builds a longitudinal record automatically.
5. Identify any holdings whose absolute drift exceeds the threshold. If at least one holding exceeds the threshold, send a single consolidated Slack message via the slackbot integration's Send a Message operation that lists overweight holdings with the dollar amount to sell to return each to target, lists underweight holdings with the dollar amount to buy to return each to target, and shows total portfolio value and the run date.
6. If every holding is within tolerance, skip the Slack message entirely. The history rows should still be appended so the daily snapshot is preserved.
Implementation notes:
- Use the slackbot integration (bot token) for posting the alert, not the user-OAuth slack integration. This is a one-way workflow notification, not a message that should appear authored by a specific person.
- All buy/sell dollar amounts should be rounded to the nearest whole dollar.
- If Get Crypto Snapshot returns no price for a symbol, append the history row with a blank price field and include that symbol in a "needs attention" section of the Slack message so the user can investigate.
Additional information
What does this prompt do?
- Reads your holdings tab in Google Sheets each weekday morning and pulls live prices for every coin.
- Calculates how far each holding has drifted from its target percentage of the portfolio.
- Appends one row per holding to a history tab so you build a clean record of prices, values, and allocations over time.
- Only pings Slack when something actually needs rebalancing, with the exact buy or sell dollar amount to bring each holding back to target.
What do I need to use this?
- A Massive account with an API key (the free plan works for small portfolios).
- A Google account and a sheet with one tab for your holdings and one tab for history.
- A Slack workspace and a channel where rebalance alerts should land.
How can I customize it?
- Change the schedule, for example run it daily, only on Mondays, or twice a day instead of every weekday morning.
- Raise or lower the drift threshold that triggers a Slack alert. The default is 5 percentage points.
- Pick which Slack channel receives the alerts and tweak the message format to match how your team likes to read updates.
Frequently asked questions
Will this actually trade for me?
What happens on days when nothing needs rebalancing?
Can I track tokens beyond the major coins?
How is the drift number calculated?
Where does my portfolio data live?
Stop eyeballing your crypto allocation every morning.
Connect Massive, Google Sheets, and Slack once, and Geni checks your portfolio every weekday at 8am and tells you exactly what to rebalance.