{"id":27101398,"url":"https://github.com/focela/futures-guard","last_synced_at":"2025-09-14T06:46:01.103Z","repository":{"id":285128201,"uuid":"927232052","full_name":"focela/futures-guard","owner":"focela","description":"An intelligent risk management tool for Binance Futures. Automatically places Stop Loss and Take Profit orders based on dynamic profit levels. Keeps your trades safe and your profits locked.","archived":false,"fork":false,"pushed_at":"2025-04-13T16:27:55.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T06:46:00.667Z","etag":null,"topics":["binance","bot","crypto","futures","risk-management","stop-loss","take-profit"],"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/focela.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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-02-04T16:14:00.000Z","updated_at":"2025-04-13T16:27:58.000Z","dependencies_parsed_at":"2025-03-29T18:24:38.783Z","dependency_job_id":"f9cf5e02-ed41-4fdd-91e3-6865cc54f2fa","html_url":"https://github.com/focela/futures-guard","commit_stats":null,"previous_names":["focela/futures-guard"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/focela/futures-guard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focela%2Ffutures-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focela%2Ffutures-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focela%2Ffutures-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focela%2Ffutures-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/focela","download_url":"https://codeload.github.com/focela/futures-guard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focela%2Ffutures-guard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275071556,"owners_count":25400398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["binance","bot","crypto","futures","risk-management","stop-loss","take-profit"],"created_at":"2025-04-06T14:36:46.685Z","updated_at":"2025-09-14T06:46:01.083Z","avatar_url":"https://github.com/focela.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Futures Guard\n\nA robust, automated position manager for Binance Futures trading with configurable stop-loss and take-profit orders.\n\n## Features\n\n- **Automated Position Management**: Monitors and manages your open Binance futures positions\n- **Dynamic Stop-Loss Levels**: Adjusts stop-loss based on profit thresholds\n- **Take-Profit Automation**: Sets take-profit orders at configurable levels\n- **Risk Management**: Calculates risk/reward ratios for each position\n- **Real-time Notifications**: Sends detailed position updates via Telegram\n- **Containerized Deployment**: Ready-to-use Docker configuration\n\n## Requirements\n\n- Go 1.24+\n- Binance Futures account with API access\n- Telegram bot for notifications (optional but recommended)\n\n## Installation\n\n### Local Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/focela/futures-guard.git\n   cd futures-guard\n   ```\n\n2. Install dependencies:\n   ```bash\n   go mod download\n   ```\n\n3. Build the application:\n   ```bash\n   go build -o futures-guard main.go\n   ```\n\n4. Configure your environment (see Configuration section)\n\n5. Run the application:\n   ```bash\n   ./futures-guard\n   ```\n\n### Docker Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/focela/futures-guard.git\n   cd futures-guard\n   ```\n\n2. Create your `.env` file based on `.env.example`\n\n3. Start with Docker Compose:\n   ```bash\n   docker-compose up -d\n   ```\n\n## Configuration\n\nCreate a `.env` file in the project root based on the provided `.env.example`:\n\n```\n# Binance API credentials\n# Required for accessing the Binance Futures API\nBINANCE_API_KEY=your_binance_api_key_here\nBINANCE_API_SECRET=your_binance_api_secret_here\n\n# Telegram notification settings\n# Required for sending position updates and alerts\nTELEGRAM_BOT_TOKEN=your_telegram_bot_token_here\nTELEGRAM_CHAT_ID=your_telegram_chat_id_here\n\n# Trading configuration\n# Controls the risk management behavior of the bot\n# Default stop-loss percentage if no other conditions are met (e.g., 1.0)\nDEFAULT_SL_PERCENT=1.0\n# Fixed take-profit percentage (e.g., 3.0)\nTP_PERCENT=3.0\n# When true, uses stop-loss based on fixed profit calculation\n# When false, uses stop-loss based on current market price\nSL_FIXED=true\n```\n\n### Configuration Parameters\n\n| Parameter | Description | Default |\n|-----------|-------------|---------|\n| `BINANCE_API_KEY` | Your Binance API key | (Required) |\n| `BINANCE_API_SECRET` | Your Binance API secret | (Required) |\n| `TELEGRAM_BOT_TOKEN` | Telegram bot token for notifications | (Optional) |\n| `TELEGRAM_CHAT_ID` | Telegram chat ID to receive notifications | (Optional) |\n| `DEFAULT_SL_PERCENT` | Default stop-loss percentage | 1.0 |\n| `TP_PERCENT` | Take-profit percentage | 3.0 |\n| `SL_FIXED` | Use fixed SL calculation when true | true |\n\n## Usage\n\n### Running Manually\n\nRun the application directly:\n\n```bash\n./futures-guard\n```\n\n### Setting Up as a Service\n\nFor production use, it's recommended to set up the application as a system service or using a process manager like `systemd` or `supervisor`.\n\n#### Using Cron\n\nYou can also run the application as a scheduled task using cron:\n\n```\n# Run every minute\n* * * * * cd /path/to/futures-guard \u0026\u0026 ./futures-guard \u003e /path/to/logfile.log 2\u003e\u00261\n```\n\n### Using Docker\n\nStart the containerized application:\n\n```bash\ndocker-compose up -d\n```\n\nView logs:\n\n```bash\ndocker-compose logs -f\n```\n\nStop the application:\n\n```bash\ndocker-compose down\n```\n\n## How It Works\n\n1. The bot connects to Binance Futures API using your credentials\n2. It fetches all your open positions\n3. For each position, it:\n    - Calculates current profit/loss\n    - Determines appropriate stop-loss level based on profit thresholds\n    - Sets take-profit orders according to configuration\n    - Sends position details via Telegram\n4. The process repeats when you run the bot again (recommended to run periodically via cron or as a service)\n\n### Stop-Loss Calculation\n\nThe bot uses a tiered approach to stop-loss:\n- For positions with lower profits, it maintains tighter stop-loss\n- As profit increases, stop-loss levels are moved to lock in more profit\n- The exact calculation depends on whether `SL_FIXED` is true or false\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocela%2Ffutures-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffocela%2Ffutures-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocela%2Ffutures-guard/lists"}