{"id":47275988,"url":"https://github.com/bmf-san/gogocoin","last_synced_at":"2026-04-01T16:40:42.232Z","repository":{"id":344111183,"uuid":"1065862764","full_name":"bmf-san/gogocoin","owner":"bmf-san","description":"bitFlyer取引所向けの暗号通貨取引ボット","archived":false,"fork":false,"pushed_at":"2026-03-23T12:18:36.000Z","size":2032,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-24T09:53:14.436Z","etag":null,"topics":["bitflyer","criptocurrency","go","golang","trade-bot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmf-san.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-28T15:22:41.000Z","updated_at":"2026-03-23T12:18:25.000Z","dependencies_parsed_at":"2026-03-23T15:01:54.080Z","dependency_job_id":null,"html_url":"https://github.com/bmf-san/gogocoin","commit_stats":null,"previous_names":["bmf-san/gogocoin"],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/bmf-san/gogocoin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmf-san%2Fgogocoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmf-san%2Fgogocoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmf-san%2Fgogocoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmf-san%2Fgogocoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmf-san","download_url":"https://codeload.github.com/bmf-san/gogocoin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmf-san%2Fgogocoin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitflyer","criptocurrency","go","golang","trade-bot"],"created_at":"2026-03-15T18:00:42.141Z","updated_at":"2026-04-01T16:40:42.225Z","avatar_url":"https://github.com/bmf-san.png","language":"Go","readme":"# gogocoin\n\n[![CI](https://github.com/bmf-san/gogocoin/actions/workflows/ci.yml/badge.svg)](https://github.com/bmf-san/gogocoin/actions/workflows/ci.yml)\n[![Release](https://github.com/bmf-san/gogocoin/actions/workflows/release.yml/badge.svg)](https://github.com/bmf-san/gogocoin/actions/workflows/release.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bmf-san/gogocoin)](https://goreportcard.com/report/github.com/bmf-san/gogocoin)\n[![GitHub license](https://img.shields.io/github/license/bmf-san/gogocoin)](https://github.com/bmf-san/gogocoin/blob/main/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/bmf-san/gogocoin.svg)](https://github.com/bmf-san/gogocoin/releases)\n\nAutomated cryptocurrency trading bot for the bitFlyer exchange.\n\n\u003cimg src=\"./docs/assets/icon.png\" alt=\"gogocoin\" title=\"gogocoin\" width=\"100px\"\u003e\n\nThis logo was created by [gopherize.me](https://gopherize.me/gopher/c3ef0a34f257bb18ea3b9b5a3ada0b1a0573e431).\n\n## Overview\n\ngogocoin is an automated trading bot for the bitFlyer cryptocurrency exchange, written in Go. It executes trades using an EMA-based scalping strategy with configurable trade frequency.\n\n### Features\n\n- **Pluggable strategy architecture**: Implement the `pkg/strategy.Strategy` interface to plug in your own trading strategy\n- Bundled default strategy: EMA crossover + RSI filter scalping strategy\n- Risk management (take-profit, stop-loss, daily trade limit, cooldown)\n- Web UI for starting and stopping trading\n- Real-time market data ingestion and analysis via WebSocket\n- Real-time monitoring dashboard (`http://localhost:8080`)\n- Data persistence with SQLite\n- Automatic trade data cleanup (configurable via `retention_days`)\n- Structured logging with level and category filtering\n- 24/7 operation support (idempotent, restart-safe)\n\n### Screenshot\n\n![gogocoin Dashboard](./docs/assets/screenshot-dashboard.png)\n\n### Tech Stack\n\n- **Language**: Go 1.23+ (development: Go 1.25.0)\n- **Dependencies**: Minimal (go-bitflyer-api-client + yaml.v3 + sqlite3 only)\n- **Architecture**: Layered modular architecture\n- **Public API** (`pkg/`): `pkg/engine.Run()` + `pkg/strategy.Strategy` interface allow strategy injection from external repositories. Stable, semantically versioned API\n- **Database**: SQLite (lightweight, embedded, no external DB required)\n  - Retention: configurable via `retention_days` (default: 1 day)\n  - Historical data: accessible via bitFlyer\n- **Concurrency**: Asynchronous workers via Goroutines + Channels\n- **Transport**: WebSocket (real-time) + REST API (Web UI)\n- **Logging**: Structured logging based on the standard `log/slog` package\n  - High-frequency log filtering (DEBUG level and `data` category)\n  - DB index optimization (`timestamp DESC`)\n- **Performance optimizations**:\n  - Balance cache (60s TTL, ~90% reduction in API calls)\n  - ~98% reduction in 429 errors\n  - Deadlock-safe design\n- **Deployment**: Single binary with embedded web assets\n- **Quality assurance**:\n  - Static analysis with golangci-lint\n  - Unit tests across multiple packages\n  - Layered modular architecture\n  - Type safety via Go's type system\n  - Proper error handling\n\n## Disclaimer\n\n**Important: Please read carefully.**\n\n**This software is provided for informational and development purposes only and does not constitute financial advice or investment recommendations. Cryptocurrency trading carries significant risk and you may lose your entire investment.**\n\n**Actual trading results vary greatly depending on market conditions, configuration, and timing. Past backtesting or simulation results do not guarantee future performance.**\n\n**The author accepts no responsibility for any losses or damages arising from the use of this software. Use it at your own discretion and risk.**\n\n**This library is not affiliated with bitFlyer in any way. Please review each API provider's terms of service before use.**\n\n**This library is provided \"as is\" with no warranties regarding accuracy, completeness, or future compatibility.**\n\n## Quick Start\n\ngogocoin can be used in two ways.\n\n### A. Use as a library (recommended)\n\nInstall gogocoin via `go get` and integrate it into your own repository. You can implement and plug in your own trading strategy.\n\n```bash\ngo get github.com/bmf-san/gogocoin@latest\n```\n\nA working sample is available in the `example/` directory. See [Using the example directory](#using-the-example-directory) for details.\n\n### B. Try quickly with Docker (for testing and development)\n\n\u003e **Note**: The binary built this way has no strategy registered and cannot execute real trades. It is intended for testing and development purposes only.\n\n#### Prerequisites\n\n- Docker and Docker Compose\n- bitFlyer API key (obtain from the [API settings page](https://bitflyer.com/en-jp/api))\n\n\u003e For local development without Docker, Go 1.25.0 or higher is required.\n\n#### Setup\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/bmf-san/gogocoin.git\ncd gogocoin\n\n# 2. Configure environment variables\ncp .env.example .env\n# Edit .env and set your API keys\n\n# 3. Create the config file\nmake init\n\n# 4. Start\nmake up\n\n# 5. Open the Web UI\nopen http://localhost:8080\n```\n\n#### Example .env file\n\n```bash\nBITFLYER_API_KEY=your_actual_api_key_here\nBITFLYER_API_SECRET=your_actual_api_secret_here\n```\n\n**⚠️ Warning**: This bot supports live trading only. It uses real funds — review your configuration carefully before use.\n\n#### Container management\n\n```bash\nmake logs     # View logs\nmake down     # Stop\nmake restart  # Restart\nmake rebuild  # Rebuild\n```\n\n## Using the example directory\n\n`example/` is a fully working sample showing how to use gogocoin as a library. It serves as a starting point for building your own repository.\n\n### Structure\n\n```\nexample/\n├── cmd/\n│   └── main.go                  # Entry point (registers strategy via blank import)\n├── strategy/scalping/\n│   ├── params.go                # Strategy parameter definitions\n│   ├── strategy.go              # Strategy implementation (EMA + RSI + cooldown)\n│   └── register.go              # Auto-registration via init()\n├── configs/\n│   └── config.example.yaml      # Config file template\n├── go.mod                       # Independent Go module\n└── Makefile                     # build / run shortcuts\n```\n\n### Running the example\n\n```bash\ncd example\n\n# 1. Create the config file\ncp configs/config.example.yaml configs/config.yaml\n# Edit configs/config.yaml and set your API keys\n\n# 2. Run\nexport BITFLYER_API_KEY=your_key\nexport BITFLYER_API_SECRET=your_secret\nmake run\n# or: go run ./cmd/\n```\n\n### Adapting to your own repository\n\nCopy `example/` as-is to use as your own repository, or follow the pattern below.\n\n**1. Create `go.mod`**\n\n```bash\ngo mod init github.com/yourname/your-bot\ngo get github.com/bmf-san/gogocoin@latest\n```\n\n**2. Implement your strategy and register it via `init()`**\n\n```go\n// strategy/scalping/register.go\npackage scalping\n\nimport \"github.com/bmf-san/gogocoin/pkg/strategy\"\n\nfunc init() {\n    strategy.Register(\"scalping\", func() strategy.Strategy {\n        return NewDefault()\n    })\n}\n```\n\n**3. Blank import in `main.go`**\n\n```go\nimport (\n    \"github.com/bmf-san/gogocoin/pkg/engine\"\n    _ \"github.com/yourname/your-bot/strategy/scalping\" // triggers init()\n)\n\nfunc main() {\n    engine.Run(ctx, engine.WithConfigPath(\"./configs/config.yaml\"))\n}\n```\n\n\u003e Reference implementation: [bmf-san/my-gogocoin](https://github.com/bmf-san/my-gogocoin)\n\n## Documentation\n\n| Document | Description |\n|---|---|\n| [docs/CONFIG.md](docs/CONFIG.md) | Configuration reference |\n| [docs/STRATEGY.md](docs/STRATEGY.md) | Trading strategy reference (pluggable architecture overview and bundled strategies) |\n| [docs/DESIGN_DOC.md](docs/DESIGN_DOC.md) | Architecture design document (**how to implement a custom strategy** § 5) |\n| [docs/DATA_MANAGEMENT.md](docs/DATA_MANAGEMENT.md) | Data management reference |\n| [docs/openapi.yaml](docs/openapi.yaml) | API specification (OpenAPI 3.1) |\n\n## Web UI\n\nMonitor trading activity in real time in your browser: `http://localhost:8080`\n\nYou can also start and stop trading from the Web UI.\n\n## Operations\n\n### Recommended practices\n\n1. Persist `./data/` via a Docker volume (already configured)\n2. Restart roughly once a week for stability\n3. Use log level `info` in production (`debug` for development only)\n\n### Troubleshooting\n\n- View logs: `make logs` or `docker compose logs -f`\n- Check DB: `ls -lh ./data/gogocoin.db`\n- Restart container: `make restart`\n\n## Development\n\n### Local development\n\n```bash\n# Install dependencies\nmake deps\n\n# Install dev tools (golangci-lint, oapi-codegen, etc.)\nmake install-tools\n\n# Run tests\nmake test\n\n# Check coverage\nmake test-coverage\n\n# Format code\nmake fmt\n\n# Run linter\nmake lint\n\n# Run via Docker\nmake up\n\n```\n\n### API code generation\n\nWhen you modify `docs/openapi.yaml`, regenerate the code with `oapi-codegen` and commit it.\n\n```bash\n# Regenerate api.gen.go\nmake generate\n\n```\n\n\u003e `internal/api/api.gen.go` is an auto-generated file. Do not edit it directly — always update it via `make generate`.\n\u003e The CI `codegen` job verifies that the spec and generated code are in sync.\n\n## Related\n\n- [example/](example/) — Working sample for using gogocoin as a library (in this repository)\n- [bmf-san/my-gogocoin](https://github.com/bmf-san/my-gogocoin) — Example production repository using gogocoin\n- [gogocoin-vps-template](https://github.com/bmf-san/gogocoin-vps-template) — Template for deploying to a VPS (ConoHa, etc.) with systemd + GitHub Actions\n\n## Contributing\n\nSee [CONTRIBUTING.md](.github/CONTRIBUTING.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmf-san%2Fgogocoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmf-san%2Fgogocoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmf-san%2Fgogocoin/lists"}