Daily crypto portfolio rebalance alerts and Sheets log

By General Input

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.

Integrations

  • Massive
  • Google Sheets
  • Slack Bot

Type

Deterministic Code

Categories

  • Finance
  • Personal Productivity

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.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerA brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensStop cold emails to anyone with a live deal in PipedriveLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasoniMessage campaign console with pre-flight checks and delivery board