asset-ledger-tracker
A utility for monitoring cryptocurrency and stock holdings, calculating metrics such as weighted average acquisition cost, current market valuation, and realized/unrealized gains or losses. Features include persistent storage via SQLite and utility functions for data import/export.
Author

contre95
Quick Info
Actions
Tags
📈 Asset Ledger Tracker (Controtto Rewritten)
This is a self-hosted portfolio performance analysis tool, engineered using Go and HTMX, deliberately excluding client-side JavaScript. It persistently stores transaction records in an SQLite database to furnish comprehensive financial metrics, including: * Calculated Average Acquisition Price * Real-time Asset Valuation * Complete Transaction Chronology * Data Migration Capabilities (Import/Export, view sample: ./public/assets/export_USDT_ARS.csv) * Profit and Loss (P&L) Reporting
To resolve asset market rates, the application interfaces with four primary external pricing services (see implementation in source: code directory):
* Binance - Public endpoint, requires zero authentication.
* BingX - Public endpoint, requires zero authentication.
* Alpha Vantage - Suitable for equities; free access but subject to stringent request throttling. (Key retrieval required; set environment variable CONTROTTO_AVANTAGE_TOKEN)
* Tiingo - Supports equities, digital assets, and foreign exchange. (Account setup/token generation; set environment variable CONTROTTO_TIINGO_TOKEN)
Live Demonstration
An interactive demonstration instance is accessible at demo.contre.io; please note that the underlying data store is purged hourly.
https://github.com/user-attachments/assets/28bf8782-6118-47c0-a94b-085e1a7045b2
All operational parameters are managed via the .env configuration file, supplied as environment variables. Critical variables include CONTROTTO_PORT for network binding and CONTROTTO_DB_PATH for storage location.
sh
Dependency resolution
go mod tidy
Initialize configuration
mv .env.example .env
Load environment variables into the current shell session
export $(grep -v '^#' .env | grep -v '^$' | xargs)
Execution Instructions
sh go run ./cmd/main.go # Use 'go build ./cmd/main.go' for a standalone binary
Development Environment Setup
sh go install github.com/cosmtrek/air@latest # Acquire the 'air' reloading tool air -c air.toml # Start the live-reloading server
Then access the service at [localhost:3000]
Containerized Deployment (Podman/Docker)
A pre-built container image is published to Docker Hub: Container Registry Link. If utilizing Docker instead of Podman, substitute podman with docker in the command below.
sh mkdir data podman container run --rm -p 8000:8000 -v $(pwd)/data:/data contre95/controtto
Running Verification Suites
sh go test -cover ./...
Observed Output Structure:
? controtto/cmd [no test files]
? controtto/src/app/managing [no test files]
? controtto/src/domain/pnl [no test files]
? controtto/src/gateways/markets [no test files]
? controtto/src/gateways/sqlite [no test files]
? controtto/src/presenters [no test files]
ok controtto/src/app/querying 0.003s coverage: 40.7% of statements
Outstanding Development Tasks (TODO List)
- Enhance unit and integration test coverage.
- Implement standardized wrappers for metrics emission and structured logging.
- Integrate an Account abstraction layer to track aggregate net worth figures.
- Refactor presentation layer: retire existing CSS in favor of utilizing the Tailwind CDN combined with a dedicated
style.cssfile for overrides.
