state_persistence

Automate per-tick Alpaca paper trading state snapshots with daily and weekly rollups.

2|4|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/khoks/ClaudeTrading --skill state-persistence-khoks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state_persistence
Source: https://github.com/khoks/ClaudeTrading/tree/main/.claude/skills/state_persistence
Command: npx skills add https://github.com/khoks/ClaudeTrading --skill state-persistence-khoks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) components.

What problem does it solve?

Autonomous paper trading systems generate state data (account balances, positions, executed actions) on every tick, but manually saving, aggregating, and cleaning up this data is error-prone and time-consuming, risking lost trading history and cluttered local storage.

Core Features & Use Cases

  • Per-Tick Snapshots: Automatically saves a full snapshot of Alpaca account state, positions, and trading actions for every master_trading tick.
  • Automated Rollups: Aggregates daily tick snapshots into daily rollups and weekly daily rollups into weekly summaries for easy performance tracking.
  • Configurable Pruning: Automatically removes per-tick snapshots older than a configurable retention window to save disk space, with all data stored locally in gitignored directories for operator privacy.
  • Use Case: For anyone running an autonomous Alpaca paper trading system, this skill ensures no trading state is lost, performance metrics are aggregated automatically, and old snapshots are cleaned up without manual work.

Quick Start

Invoke the state_persistence skill at the end of each master_trading tick to automatically save the current trading state, generate applicable daily and weekly rollups, and prune outdated snapshots.

Frequently Asked Questions about state_persistence

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I save Alpaca paper trading state automatically on every tick?

To automate trading state snapshots for Alpaca paper trading, you can use a script that saves account state, positions, and executed actions per tick, eliminating manual state persistence work.

What is the best way to aggregate per-tick trading data into daily and weekly rollups?

Automated rollups aggregate per-tick trading snapshots into daily summaries, and further aggregate those daily rollups into weekly summaries for easy performance tracking in autonomous trading workflows.

Does this state persistence approach work with Alpaca paper trading accounts?

Yes, this approach works with Alpaca paper trading by capturing account balances, open positions, and executed actions on every master_trading tick and storing them locally.

How do I automatically prune stale trading snapshots to save disk space?

Configurable pruning automatically removes per-tick trading snapshots older than a specified retention window, conserving disk space while keeping all state data stored locally.

Do I need jq to run these trading snapshot and rollup scripts?

Yes, jq is required as a dependency to parse and process the JSON trading state data when creating snapshots, generating rollups, and pruning stale files.

Where are Alpaca trading snapshots stored to protect operator privacy?

All trading snapshots, rollups, and pruned state data are stored locally in gitignored directories to protect operator privacy and prevent sensitive trading history from being committed.