Repository navigation
Backups Export and Import
Stockbar has three ways to protect and move your data. They do different jobs:
| What | For | Includes | Where |
|---|---|---|---|
| Daily backups | Undoing a mistake, recovering holdings | Your holdings | Backups screen, Settings → Advanced → Backups |
| Export & Import | Moving to another Mac, keeping a full copy | Settings and API keys, optionally your portfolio database | Settings → Advanced → Export & Import |
| Backup scripts | Recovery from outside the app | Defaults, database, settings file, cache |
Scripts/ in the repository |
Keychain credentials are not included in daily backups or the scripts. Only an export holds your keys (see below).
Stockbar makes one automatic backup per day while it is running. The files are plain JSON listing your holdings, so store them privately. They are in ~/Library/Application Support/Stockbar/Backups/ and named portfolio_backup_*.json.
The Backups screen shows Last Backup, Saved Backups and Kept For, with:
- Back Up Now: makes a backup immediately.
- Restore from Backup…: see below.
- View Backups: opens the backup folder in Finder.
- Keep Backups For: 7, 14, 30 (the default) or 90 days. Whatever the setting, the newest five backups are always kept.
The same controls are in Settings → Advanced → Backups. Make a backup before large portfolio changes, before linking Trading 212, and before upgrading from 2.x.
- Choose Restore from Backup…. The sheet lists your backups.
- Choose Preview on one to see what it holds: the stocks, their units and average cost, and a count.
- Choose Restore and confirm. This replaces your current portfolio with the backup. A copy of the current portfolio is saved first, so you can restore that one if you change your mind.
Restoring is safer in 3.x than before: backups are Folync-aware and keep more fields, and older backups still restore.
Use this to move Stockbar to another Mac, or to keep a full copy that includes your keys.
- Go to Settings → Advanced → Export & Import and choose Export….
- Choose what to Include:
- Settings & Keys: your preferences plus the FMP, Twelve Data, Trading 212 and Folync keys.
- Everything: those, plus your portfolio database. Its estimated size is shown first.
- Choose a password of at least 8 characters, then Export… and pick a place to save the
.stockbarexportfile.
The file is encrypted with AES-256-GCM under your password. It contains your API keys, so keep both the file and the password safe.
The Python environment, the interpreter path, window positions and caches are not exported. Set up Stockbar's Python again on the new Mac when asked.
- On the new Mac, choose Import… and pick the file.
- Enter the password and choose Continue.
- Stockbar checks the whole file first and shows This File Contains: the settings, the keys, and the portfolio database if it is included.
- Choose Import…, then Import and Replace to confirm.
What happens next:
- Keys that are not in the file stay as they are.
- Stockbar backs up your portfolio before replacing it, and rolls back on any failure.
- It offers to relaunch afterwards; the live database stays read-only until Stockbar has relaunched.
For recovery from outside the app, two scripts keep the files that hold your preferences and history. See the scripts README for the full text.
-
Quit Stockbar first. The scripts refuse to run while it is running, so the database and its
-wal/-shmfiles are copied as one consistent set. They never stop the app for you. -
bash Scripts/backup_stockbar_data.shwritesstockbar_complete_backup_YYYY-MM-DD_HHMMSSunder~/Library/Application Support/Stockbar/Backups/. A backup may holdUserDefaults.plist,StockbarDataModel.sqlite(with its sidecar files),.stockbar_config.json, the quote cache and aMANIFEST.txt. -
bash Scripts/restore_stockbar_data.sh <backup folder name>asks for an explicityes, first saves your current data to aStockbarDataModel_pre_restore_*directory (and aborts if it cannot), then restores. - Existing backups are never deleted automatically.
- Keychain items are not covered by either script, so credentials must be handled separately.
- Privacy and Security for what is stored where.
- Troubleshooting if a restore or import does not go as expected.
Home · Installation · Troubleshooting · FAQ · Release History · Source · Report an issue
This wiki describes Stockbar 3.8.2.
Using Stockbar
- Installation
- Getting Started
- Menu Bar
- Main Window
- Portfolio and Holdings
- Alerts
- Charts and Analytics
Data sources
Reference
- Settings Reference
- Updates and Channels
- Backups, Export and Import
- Privacy and Security
- Troubleshooting
- FAQ
- Release History
Developers