Skip to content

Crypto-Finance/CoinLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coinlog

Go Report Card License: GPL v3 Go Version

An automated trading journal CLI for cryptocurrency traders. Import trades directly from exchanges, annotate them with your own insights, and analyze your performance — all from the terminal.

Overview

coinlog bridges the gap between exchange data and trader self-awareness. It pulls your trade history via exchange APIs, stores everything locally in SQLite, and lets you enrich each trade with manual notes, emotion tags, and setup descriptions. The result: a personal trading journal that combines hard data with human context.

Features

Feature Description
Exchange Import Pull trades from Bybit (more exchanges planned) with pagination and rate limiting
Local Storage All data lives in a local SQLite database — no cloud dependency
Trade Annotation Add entry/exit rationale, setup notes, emotion tags, and lessons learned
Trade Listing View trades in a formatted table with symbol and limit filtering
Performance Stats Win rate, P&L, max drawdown, R-multiples, streaks, expectancy, profit factor
Duplicate Detection Safely re-run imports without creating duplicate entries
Pure Go No CGO required — uses modernc.org/sqlite for a fully portable binary
Decimal Precision Financial calculations use shopspring/decimal to avoid floating-point errors

Installation

Prerequisites

  • Go 1.26 or later

Build from Source

git clone https://github.com/Crypto-Finance/CoinLog.git
cd CoinLog
make build

The binary will be available at ./bin/coinlog.

Full Build Pipeline

make all       # fmt + vet + test + build

Run Directly

go run ./cmd/coinlog --help

Quick Start

# 1. Configure your exchange credentials
cat > ~/.coinlog.yaml << 'EOF'
exchange:
  bybit:
    api_key: "your-api-key"
    api_secret: "your-api-secret"
EOF

# 2. Import trades for a symbol
coinlog import --exchange bybit --symbol BTCUSDT

# 3. Annotate a trade with your notes
coinlog annotate --id 1

# 4. List recent trades
coinlog list --symbol BTCUSDT --limit 20

# 5. View your trading statistics
coinlog stats --symbol BTCUSDT

Configuration

coinlog reads configuration from ~/.coinlog.yaml.

# Database path (optional — defaults to ~/.coinlog.db)
db_path: "~/.coinlog.db"

# Exchange credentials
exchange:
  bybit:
    api_key: "your-api-key"
    api_secret: "your-api-secret"
Field Required Description
db_path No Path to the SQLite database file
exchange.bybit.api_key Yes (for import) Bybit API key
exchange.bybit.api_secret Yes (for import) Bybit API secret

Commands

Command Description Flags
import Import trades from an exchange --exchange, --symbol
annotate Add manual annotations to a trade --id
list Display trades in a formatted table --symbol, --limit
stats Show trading performance statistics --symbol

Examples

# Import all BTCUSDT trades from Bybit
coinlog import --exchange bybit --symbol BTCUSDT

# Annotate trade with ID 42
coinlog annotate --id 42

# List the 50 most recent ETHUSDT trades
coinlog list --symbol ETHUSDT --limit 50

# Show stats for all symbols
coinlog stats

Project Structure

coinlog/
├── cmd/coinlog/          # CLI entry point
├── internal/
│   ├── core/             # Domain models and interfaces (exchange, journal, stats)
│   ├── infra/            # External implementations (Bybit API, SQLite repository)
│   ├── service/          # Application services (import, annotate, list, stats)
│   └── ui/               # User interface (table display, annotation collection, styles)
├── pkg/config/           # Configuration loading
├── testhelper/           # Test utilities (trade builder pattern)
├── Makefile              # Build automation
└── go.mod

Architecture

The project follows a clean architecture pattern:

  cmd → service → core ← infra
                  ↑
                 ui
  • core — Domain models and port interfaces (no external dependencies)
  • infra — Adapters for external systems (exchange APIs, database)
  • service — Application logic that orchestrates core and infra
  • ui — Terminal presentation layer
  • cmd — CLI wiring and flag parsing

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Run the full build pipeline (make all)
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Running Tests

go test ./...

License

This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.

About

A Trading Journal for Crypto Traders.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors