{"id":31005974,"url":"https://github.com/btschwertfeger/infinity-grid","last_synced_at":"2026-04-19T02:01:27.869Z","repository":{"id":312811104,"uuid":"1045645269","full_name":"btschwertfeger/infinity-grid","owner":"btschwertfeger","description":"Multi-Exchange Infinity Grid Trading Bot for Crypto Assets","archived":false,"fork":false,"pushed_at":"2026-04-15T13:24:22.000Z","size":2030,"stargazers_count":19,"open_issues_count":7,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-04-15T14:30:39.877Z","etag":null,"topics":["bitcoin","cryptocurrencies","dca","exchange-api","grid-trading","hodl","infinity-grid","python","trading","trading-algorithm","trading-bot","trading-services","trading-strategies"],"latest_commit_sha":null,"homepage":"https://infinity-grid.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btschwertfeger.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":"CITATION","codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","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-08-27T13:55:40.000Z","updated_at":"2026-04-15T11:20:37.000Z","dependencies_parsed_at":"2025-09-02T07:07:53.534Z","dependency_job_id":"bb68053a-36c4-4e0d-bf40-72f97bbd8b77","html_url":"https://github.com/btschwertfeger/infinity-grid","commit_stats":null,"previous_names":["btschwertfeger/infinity-grid"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/btschwertfeger/infinity-grid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2Finfinity-grid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2Finfinity-grid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2Finfinity-grid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2Finfinity-grid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btschwertfeger","download_url":"https://codeload.github.com/btschwertfeger/infinity-grid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2Finfinity-grid/sbom","scorecard":{"id":1236775,"data":{"date":"2025-09-02T06:41:26Z","repo":{"name":"github.com/btschwertfeger/infinity-grid","commit":"2d75383463d83f23b5f0ffb773a72569420daf54"},"scorecard":{"version":"v5.2.1","commit":"ab2f6e92482462fe66246d9e32f642855a691dc1"},"score":5.3,"checks":[{"name":"Dependency-Update-Tool","score":10,"reason":"update tool detected","details":["Info: detected update tool: Dependabot: .github/dependabot.yaml:1"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dependency-update-tool"}},{"name":"Maintained","score":0,"reason":"project was created within the last 90 days. Please review its contents carefully","details":["Warn: Repository was created within the last 90 days."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#maintained"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: .github/SECURITY.md:1","Info: Found linked content: .github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/SECURITY.md:1","Info: Found text in security policy: .github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#security-policy"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/_codeql.yaml:21","Info: jobLevel 'contents' permission set to 'read': .github/workflows/_codeql.yaml:22","Info: jobLevel 'contents' permission set to 'read': .github/workflows/_docker_publish.yaml:29","Info: topLevel 'contents' permission set to 'read': .github/workflows/_build.yaml:24","Info: topLevel 'contents' permission set to 'read': .github/workflows/_build_doc.yaml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/_build_docker.yaml:15","Info: topLevel 'contents' permission set to 'read': .github/workflows/_codecov.yaml:27","Warn: topLevel 'security-events' permission set to 'write': .github/workflows/_codeql.yaml:14","Info: topLevel 'actions' permission set to 'read': .github/workflows/_codeql.yaml:12","Info: topLevel 'contents' permission set to 'read': .github/workflows/_codeql.yaml:13","Warn: no topLevel permission defined: .github/workflows/_docker_publish.yaml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/_pre_commit.yaml:16","Info: topLevel permissions set to 'read-all': .github/workflows/_pypi_publish.yaml:19","Info: topLevel permissions set to 'read-all': .github/workflows/_pypi_test_publish.yaml:19","Info: topLevel 'contents' permission set to 'read': .github/workflows/_test.yaml:23","Warn: no topLevel permission defined: .github/workflows/cicd.yaml:1","Warn: topLevel 'contents' permission set to 'write': .github/workflows/dependabot_auto_merge.yaml:18","Info: topLevel permissions set to 'read-all': .github/workflows/scorecard.yaml:19","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":7,"reason":"dependency not pinned by hash detected -- score normalized to 7","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/_build.yaml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_build.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_build.yaml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_build.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_build_doc.yaml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_build_doc.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_build_docker.yaml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_build_docker.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_codecov.yaml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_codecov.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/_codecov.yaml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_codecov.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_docker_publish.yaml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_docker_publish.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/_docker_publish.yaml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_docker_publish.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/_test.yaml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/btschwertfeger/infinity-grid/_test.yaml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:19: pin your Docker image by updating python:3.13-slim-bookworm to python:3.13-slim-bookworm@sha256:9b8102b7b3a61db24fe58f335b526173e5aeaaf7d13b2fbfb514e20f84f5e386","Warn: pipCommand not pinned by hash: Dockerfile:9-15","Warn: pipCommand not pinned by hash: Dockerfile:24-45","Info:  22 out of  25 GitHub-owned GitHubAction dependencies pinned","Info:  22 out of  28 third-party GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#license"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-29gw-9793-fvw7","Warn: Project is vulnerable to: PYSEC-2015-24 / GHSA-4vwq-x64q-j4cj","Warn: Project is vulnerable to: PYSEC-2017-46 / GHSA-66gw-5xpf-gfp5","Warn: Project is vulnerable to: PYSEC-2015-25 / GHSA-92mr-v722-f48m","Warn: Project is vulnerable to: PYSEC-2022-12 / GHSA-pq7m-3gw7-gq5x","Warn: Project is vulnerable to: PYSEC-2017-47","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":9,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 5 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#sast"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: 'stale review dismissal' is disabled on branch 'master'","Warn: branch 'master' does not require approvers","Warn: codeowners review is not required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: 'up-to-date branches' is disabled on branch 'master'","Info: status check found to merge onto on branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#signed-releases"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#packaging"}},{"name":"Contributors","score":10,"reason":"project has 3 contributing companies or organizations -- score normalized to 10","details":["Info: found contributions from: ProjectPepperHSB, conda-forge, cslab"],"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#contributors"}},{"name":"CI-Tests","score":8,"reason":"5 out of 6 merged PRs checked by a CI test -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#ci-tests"}}]},"last_synced_at":"2025-09-02T07:11:07.866Z","repository_id":312811104,"created_at":"2025-09-02T07:11:07.866Z","updated_at":"2025-09-02T07:11:07.866Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["bitcoin","cryptocurrencies","dca","exchange-api","grid-trading","hodl","infinity-grid","python","trading","trading-algorithm","trading-bot","trading-services","trading-strategies"],"created_at":"2025-09-13T02:02:56.309Z","updated_at":"2026-04-19T02:01:27.860Z","avatar_url":"https://github.com/btschwertfeger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eMulti-Exchange Infinity Grid Trading Algorithm\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub](https://badgen.net/badge/icon/github?icon=github\u0026label)](https://github.com/btschwertfeger/infinity-grid)\n[![Generic\nbadge](https://img.shields.io/badge/python-3.11+-blue.svg)](https://shields.io/)\n[![Downloads](https://static.pepy.tech/personalized-badge/infinity-grid?period=total\u0026units=abbreviation\u0026left_color=grey\u0026right_color=orange\u0026left_text=downloads)](https://pepy.tech/project/infinity-grid)\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Typing](https://img.shields.io/badge/typing-mypy-informational)](https://mypy-lang.org/)\n[![CI/CD](https://github.com/btschwertfeger/infinity-grid/actions/workflows/cicd.yaml/badge.svg?branch=master)](https://github.com/btschwertfeger/infinity-grid/actions/workflows/cicd.yaml)\n[![codecov](https://codecov.io/gh/btschwertfeger/infinity-grid/branch/master/badge.svg)](https://app.codecov.io/gh/btschwertfeger/infinity-grid)\n\n[![OpenSSF\nScoreCard](https://img.shields.io/ossf-scorecard/github.com/btschwertfeger/infinity-grid?label=openssf%20scorecard\u0026style=flat)](https://securityscorecards.dev/viewer/?uri=github.com/btschwertfeger/infinity-grid)\n[![OpenSSF Best\nPractices](https://www.bestpractices.dev/projects/9956/badge)](https://www.bestpractices.dev/projects/9956)\n\n[![release](https://shields.io/github/release-date/btschwertfeger/infinity-grid)](https://github.com/btschwertfeger/infinity-grid/releases)\n[![release](https://img.shields.io/pypi/v/infinity-grid)](https://pypi.org/project/infinity-grid/)\n[![Documentation Status Stable](https://readthedocs.org/projects/infinity-grid/badge/?version=stable)](https://infinity-grid.readthedocs.io/en/stable)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17034315.svg)](https://doi.org/10.5281/zenodo.17034315)\n\n[![Telegram](https://img.shields.io/badge/Join_our_community-Telegram-blue?logo=telegram\u0026logoColor=whiteg)](https://t.me/mx_infinity_grid)\n[![Running instance](https://img.shields.io/badge/Preview_a_running_instance-Telegram-blue?logo=telegram\u0026logoColor=whiteg)](https://t.me/mx_infinity_grid/3)\n\n\u003c/div\u003e\n\n\u003e ⚠️ **Disclaimer**: This software was initially designed for private use only.\n\u003e Please note that this project is independent and not endorsed by any of the\n\u003e supported exchanges including Kraken or Payward Ltd. Users should be aware\n\u003e that they are using third-party software, and the authors of this project are\n\u003e not responsible for any issues, losses, or risks associated with its usage.\n\u003e **The supported exchanges and their parent companies are in no way associated\n\u003e with the authors of this package and documentation.**\n\u003e\n\u003e _There is no guarantee that this software will work flawlessly at this or later\n\u003e times. Of course, no responsibility is taken for possible profits or losses.\n\u003e This software probably has some errors in it, so use it at your own risk. Also\n\u003e no one should be motivated or tempted to invest assets in speculative forms of\n\u003e investment. By using this software you release the author(s) from any\n\u003e liability regarding the use of this software._\n\nThe infinity-grid is a trading algorithm that uses grid trading strategies that\nplaces buy and sell orders in a grid-like manner, while following the principle\nof buying low and selling high. It is designed for trading cryptocurrencies,\nstocks, and derivatives on various exchanges, initially only supporting\n[Kraken](https://pro.kraken.com) Spot exchange with plans to expand to other\nmajor exchanges, is written in Python and currently uses the\n[python-kraken-sdk](https://github.com/btschwertfeger/python-kraken-sdk) library\nto interact with the Kraken API, with additional exchange adapters planned.\n\nThe algorithm requires a PostgreSQL or SQLite database and is designed to be run\nin a container. The algorithm can be configured to use different\ntrading strategies, such as GridHODL, GridSell, SWING, and cDCA. While the\nverbosity levels of logging provide useful insights into the algorithms's\nbehavior, the custom notification channels such as Telegram can be used to\nreceive updates on the algorithms's activity.\n\nNote: This project is the successor of the\n[kraken-infinity-grid](https://github.com/btschwertfeger/kraken-infinity-grid).\n\n**Documentation:**\n\n- https://infinity-grid.readthedocs.io/en/latest/\n- https://infinity-grid.readthedocs.io/en/stable/\n\n**PnL Calculator (for tax purposes):**\n\n- Kraken: https://github.com/btschwertfeger/kraken-pnl-calculator\n\n**Product Support Matrix:**\n\n| Exchange                                              | Status  |\n| ----------------------------------------------------- | ------- |\n| [Binance](https://binance.com)                        | Planned |\n| [Coinbase](https://binance.com)                       | Planned |\n| [Kraken](https://pro.kraken.com) (Crypto and xStocks) | ✅      |\n| Other ideas? Issues and PRs are welcome!              | 💡      |\n\n## 📑 Table of Contents\n\n- [📚 Fundamental Concepts](#-fundamental-concepts)\n  - [📈 The Core Idea: Grid Trading](#-the-core-idea-grid-trading)\n  - [📊 Key Elements of Grid Trading](#-key-elements-of-grid-trading)\n  - [📉 Risk Management and Reinvestment](#-risk-management-and-reinvestment)\n- [📊 Available Strategies](#-available-strategies)\n  - [`GridHODL`](#gridhodl)\n  - [`GridSell`](#gridsell)\n  - [`SWING`](#swing)\n  - [`cDCA`](#cdca)\n- [🚀 Setup](#-setup)\n  - [Preparation](#preparation)\n  - [Running the Algorithm](#running-the-algorithm)\n- [🛠 Configuration](#-configuration)\n- [📡 Monitoring](#-monitoring)\n- [🚨 Troubleshooting](#-troubleshooting)\n- [📈 Backtesting](#-backtesting)\n- [📝 Versioning](#-versioning)\n\n## 📚 Fundamental concepts\n\n`infinity-grid` is a sophisticated trading algorithm designed for\nautomated cryptocurrency trading using a grid strategy. This approach is\nparticularly effective in volatile markets, where frequent price fluctuations\nallow for consistent profit opportunities through structured buying and selling\npatterns.\n\n### 📈 The core idea: Grid trading\n\nAt its essence, grid trading aims to capitalize on market volatility by setting\na series of buy and sell orders at predefined intervals. The algorithm operates\nwithin a \"grid\" of prices, purchasing assets when prices dip and selling them as\nprices rise. This systematic approach helps in capturing small gains repeatedly,\nleveraging the natural oscillations in market prices.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cfigure\u003e\n    \u003cimg\n    src=\"doc/_static/images/grid_trading_visualized.png?raw=true\"\n    alt=\"Buying low and selling high in high-volatile markets\"\n    style=\"background-color: white; border-radius: 7px\"\u003e\n    \u003cfigcaption\u003eFigure 1: Buying low and selling high in high-volatile markets\u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\n_All currency pairs mentioned here are for illustrative purposes only._\n\n### 📊 Key Elements of Grid Trading\n\n1. **Intervals**: Unlike fully static systems, `infinity-grid` uses fixed\n   intervals that shift up or down based on price movements, ensuring continuous\n   trading and avoids manual interactions. This flexibility is crucial for\n   maintaining profitability in diverse market environments.\n\n2. **Volatility Advantage**: High volatility is a friend to grid traders. The\n   more the price oscillates, the more opportunities arise to buy low and sell\n   high. The algorithm thrives in such conditions, with each price movement\n   potentially triggering a profitable trade.\n\n3. **Consistent Position Sizing**: Each trade involves a consistent volume in\n   terms of the quote currency (e.g., $100 per trade). This uniformity\n   simplifies the management of trades and helps in maintaining a balanced\n   portfolio.\n\n### 📉 Risk Management and Reinvestment\n\n1. **Risk Mitigation**: The algorithm inherently incorporates risk management by\n   spreading investments across multiple price levels and maintaining almost\n   consistent trade sizes. This diversification reduces the impact of adverse\n   market movements on the overall portfolio.\n\n2. **Reinvestment Mechanism**: Accumulated profits can be reinvested, enhancing\n   the trading capital and potential returns. The algorithm automatically\n   adjusts buy and and places sell orders to reflect the increased capital, thus\n   compounding growth over time.\n\n## 📊 Available strategies\n\nEach of the following strategies is designed to leverage different aspects of\nmarket behavior, providing flexibility and adaptability to traders depending on\ntheir risk tolerance, market outlook, and investment goals.\n\n### `GridHODL`\n\nThe _GridHODL_ strategy operates on a predefined grid system where buy and sell\norders are placed at fixed intervals below and above the current market price,\nrespectively. This strategy is designed to capitalize on market fluctuations by\nbuying low and selling high, ensuring gradual accumulation of the base currency\nover time.\n\nTechnical Breakdown:\n\n- **Order Placement**: The algorithm dynamically adjusts $n$ buy orders below\n  the current market price. For example, with a 4% interval, if the current BTC\n  price is $50,000, the first buy order is set at $48,000, the second at\n  $46,080, and so on.\n- **Execution**: Upon execution of a buy order, a corresponding sell order is\n  immediately placed at 4% above the purchase price respecting a fixed quote\n  volume. This creates a cycle of continuous buying and selling, with each cycle\n  aiming to yield a small portion in the base currency.\n- **Accumulation**: Unlike traditional trading strategies, GridHODL is designed\n  to accumulate the base currency gradually. Each buy order slightly increases\n  the holdings, while the fixed order size in terms of quote currency (e.g.,\n  $100) ensures consistent exposure.\n\nThis strategy is particularly effective in sideways, slightly, and high volatile\nmarkets, where frequent price oscillations allow for regular execution of the\ngrid orders. Accumulating the base currency over time can lead to significant\ngains, especially when prices rise after a long accumulation phase.\n\n### `GridSell`\n\nThe _GridSell_ is a complementary approach to `GridHODL`, focusing on\nliquidating the purchased base currency in each trade cycle to realize immediate\nprofits. The key distinction is that each sell order matches the total quantity\nbought in the preceding buy order.\n\nTechnical Breakdown:\n\n- **Order Logic**: For every buy order executed (e.g., purchasing $100 worth of\n  BTC at $48,000), a sell order is placed for the entire amount of BTC acquired\n  at a 4% higher price. This ensures that each trade cycle results in a complete\n  turnover of the base currency.\n- **Profit Realization**: The strategy ensures that profits are locked in at\n  each cycle, reducing the need for long-term accumulation or holding. It is\n  particularly suitable for traders who prioritize short-term gains over base\n  currency accumulation.\n- **Risk Mitigation**: By liquidating the entire bought amount, the GridSell\n  strategy minimizes exposure to prolonged market downturns, ensuring that the\n  trader consistently realizes profits without holding onto assets for extended\n  periods.\n\n### `SWING`\n\nThe _SWING_ strategy builds upon `GridHODL` but introduces a mechanism to\ncapitalize on significant upward price movements by selling accumulated base\ncurrency at higher levels.\n\nTechnical Breakdown:\n\n- **Market Adaptation**: This strategy tracks the highest buy price within a\n  defined range (e.g., $40,000 to $80,000). If the market price exceeds this\n  range (e.g., rises to $83,200), the algorithm initiates sell orders at\n  predefined intervals (e.g., 4% above the highest buy price).\n- **Sell Execution**: Unlike `GridHODL`, which focuses on buying and selling in\n  cycles, SWING starts selling accumulated base currency once the price\n  surpasses the highest recorded buy price. This ensures that profits are\n  captured during bullish market trends.\n- **Continuous Accumulation**: Even as it initiates sell orders above the\n  highest buy price, the algorithm continues to place buy orders below it,\n  ensuring that base currency accumulation continues during market dips.\n- **Profit Maximization**: This dual approach allows traders to benefit from\n  both upward trends (through sell orders) and downward corrections (through\n  continued accumulation).\n\n\u003e ⚠️ It also starts selling the already existing base currency above the current\n\u003e price. This should be kept in mind when choosing this strategy.\n\n### `cDCA`\n\nThe _cDCA_ (Custom Dollar-Cost Averaging) strategy diverges from traditional DCA\nby incorporating dynamic interval adjustments to optimize long-term accumulation\nof the base currency.\n\nTechnical Breakdown:\n\n- **Fixed Interval Purchases**: Unlike time-based DCA, cDCA places buy orders at\n  fixed percentage intervals (e.g., every 4% price movement) rather than at\n  regular time intervals. This ensures that purchases are made in response to\n  market movements rather than arbitrary time frames.\n- **No Sell Orders**: cDCA focuses purely on accumulation. It consistently buys\n  the base currency (e.g., $100 worth of BTC) at each interval without placing\n  corresponding sell orders, banking on long-term price appreciation.\n- **Adaptive Buy Orders**: The algorithm adapts to rising prices by shifting buy\n  orders upward rather than letting them fall out of scope. For instance, if the\n  price exceeds $60,000, new buy orders are placed at 4% intervals below this\n  new level, maintaining relevance in the current market context.\n- **Long-Term Growth**: This strategy is ideal for traders with a long-term\n  investment horizon, aiming to build a significant position in the base\n  currency over time, with the expectation of future price increases.\n\n\u003ca name=\"setup\"\u003e\u003c/a\u003e\n\n## 🚀 Setup\n\n\u003ca name=\"preparation\"\u003e\u003c/a\u003e\n\n### Preparation\n\nBefore installing and running the `infinity-grid` algorithm, you need to make\nsure to fully understand the available trading strategies and their\nconfiguration. Avoid running the algorithm with real money before you are\nconfident in the algorithm's behavior and performance!\n\nDepending on the used exchange, different preparatory steps might be needed. In\nthe following, the steps for use with the Kraken Crypto Asset Exchange are\nshown:\n\n1. In order to trade at the [Kraken Crypto Asset\n   Exchange](https://pro.kraken.com), you need to generate API keys for the\n   Kraken exchange (see [How to create an API\n   key](https://support.kraken.com/hc/en-us/articles/360000919966-How-to-create-an-API-key)).\n   Make sure to generate keys with the required permissions for trading and\n   querying orders:\n\n\u003cdiv align=\"center\"\u003e\n  \u003cfigure\u003e\n    \u003cimg\n    src=\"doc/_static/images/kraken_api_key_permissions.png?raw=true\"\n    alt=\"Required API key permissions\"\n    style=\"background-color: white; border-radius: 7px\"\u003e\n    \u003cfigcaption\u003eFigure 2: Required API key permissions\u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\n2. [optional] The algorithm leverages Telegram Bots to send notifications about\n   the current state of the algorithm. We need two, one for the notifications\n   about the algorithm's state and trades and one for notifications about\n   errors.\n   - Create two bots, name as you wish via: https://telegram.me/BotFather.\n   - Start the chat with both new Telegram bots and write any message to ensure\n     that the chat ID is available in the next step.\n   - Get the bot token from the BotFather and access\n     `https://api.telegram.org/bot\u003cyour bot token here\u003e/getUpdates` to receive\n     your chat ID.\n   - Save the chat IDs as well as the bot tokens for both of them, we'll need\n     them later.\n\n### Running the algorithm\n\nThe repository of the\n[`infinity-grid`](https://github.com/btschwertfeger/infinity-grid)\ncontains a `docker-compose.yaml` file that can be used to run the algorithm\nusing Docker Compose. This file also provides a default configuration for the\nPostgreSQL database. To run the algorithm, ensure the required environment\nvariables are set and start the containers using:\n\n```bash\ndocker compose up -d\n```\n\n## 🛠 Configuration\n\nThe most important configuration options are shown in the table below. The\ninfinity-grid leverages [click](https://click.palletsprojects.com/en/stable)'s\n`auto_envvar_prefix` to map environment variables to command-line options,\nflags, and inputs. The complete list of options available can be obtained by\nrunning `infinity-grid --help` or `infinity-grid run --help`.\n\n| Variable                               | Type               | Description                                                                                                                                                                                                                                                                                                    |\n| -------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `INFINITY_GRID_API_PUBLIC_KEY`         | `str`              | The API public key provided by the exchange.                                                                                                                                                                                                                                                                   |\n| `INFINITY_GRID_API_SECRET_KEY`         | `str`              | The API secret key provided by the exchange.                                                                                                                                                                                                                                                                   |\n| `INFINITY_GRID_RUN_EXCHANGE`           | `str`              | The exchange to trade on.                                                                                                                                                                                                                                                                                      |\n| `INFINITY_GRID_RUN_NAME`               | `str`              | The name of the instance. Can be any name that is used to differentiate between instances of the infinity-grid.                                                                                                                                                                                                |\n| `INFINITY_GRID_RUN_USERREF`            | `int`              | A reference number to identify the algorithms's orders. This can be a timestamp or any integer number. **Use different userref's for different algorithms!**                                                                                                                                                   |\n| `INFINITY_GRID_BOT_VERBOSE`            | `int`/(`-v`,`-vv`) | Enable verbose logging.                                                                                                                                                                                                                                                                                        |\n| `INFINITY_GRID_RUN_BASE_CURRENCY`      | `str`              | The base currency e.g., `BTC` or `AVAX`.                                                                                                                                                                                                                                                                       |\n| `INFINITY_GRID_RUN_QUOTE_CURRENCY`     | `str`              | The quote currency e.g., `USD` or `EUR`.                                                                                                                                                                                                                                                                       |\n| `INFINITY_GRID_RUN_AMOUNT_PER_GRID`    | `float`            | The amount to use per grid interval e.g., `100` (USD).                                                                                                                                                                                                                                                         |\n| `INFINITY_GRID_RUN_INTERVAL`           | `float`            | The interval between orders e.g., `0.04` to have 4 % intervals.                                                                                                                                                                                                                                                |\n| `INFINITY_GRID_RUN_N_OPEN_BUY_ORDERS`  | `int`              | The number of concurrent open buy orders e.g., `5`. The number of always open buy positions specifies how many buy positions should be open at the same time. If the interval is defined to 2%, a number of 5 open buy positions ensures that a rapid price drop of almost 10% that can be caught immediately. |\n| `INFINITY_GRID_RUN_MAX_INVESTMENT`     | `str`              | The maximum investment amount, e.g. `1000` USD.                                                                                                                                                                                                                                                                |\n| `INFINITY_GRID_RUN_FEE`                | `float`            | A custom fee percentage, e.g. `0.0026` for 0.26 % fee.                                                                                                                                                                                                                                                         |\n| `INFINITY_GRID_RUN_STRATEGY`           | `str`              | The trading strategy (e.g., `GridHODL`, `GridSell`, `SWING`, or `cDCA`).                                                                                                                                                                                                                                       |\n| `INFINITY_GRID_RUN_DRY_RUN`            | `bool`             | Enable dry-run mode (no actual trades).                                                                                                                                                                                                                                                                        |\n| `INFINITY_GRID_RUN_SKIP_PRICE_TIMEOUT` | `bool`             | Skip checking if there was a price update in the last 10 minutes. By default, the bot will exit if no recent price data is available. This might be useful for assets that aren't traded that often.                                                                                                           |\n| `INFINITY_GRID_RUN_TELEGRAM_TOKEN`     | `str`              | The Telegram bot token for notifications.                                                                                                                                                                                                                                                                      |\n| `INFINITY_GRID_RUN_TELEGRAM_CHAT_ID`   | `str`              | The Telegram chat ID for notifications.                                                                                                                                                                                                                                                                        |\n| `INFINITY_GRID_RUN_TELEGRAM_THREAD_ID` | `str`              | The Telegram thread ID for notifications.                                                                                                                                                                                                                                                                      |\n| `INFINITY_GRID_RUN_DB_USER`            | `str`              | The PostgreSQL database user.                                                                                                                                                                                                                                                                                  |\n| `INFINITY_GRID_RUN_DB_NAME`            | `str`              | The PostgreSQL database name.                                                                                                                                                                                                                                                                                  |\n| `INFINITY_GRID_RUN_DB_PASSWORD`        | `str`              | The PostgreSQL database password.                                                                                                                                                                                                                                                                              |\n| `INFINITY_GRID_RUN_DB_HOST`            | `str`              | The PostgreSQL database host.                                                                                                                                                                                                                                                                                  |\n| `INFINITY_GRID_RUN_DB_PORT`            | `int`              | The PostgreSQL database port.                                                                                                                                                                                                                                                                                  |\n| `INFINITY_GRID_RUN_SQLITE_FILE`        | `str`              | The path to a local SQLite database file, e.g., `/path/to/sqlite.db`, will be created if it does not exist. If a SQLite database is used, the PostgreSQL database configuration is ignored.                                                                                                                    |\n\n\u003ca name=\"monitoring\"\u003e\u003c/a\u003e\n\n## 📡 Monitoring\n\nTrades as well as open positions can be monitored at the exchanges', where they\ncan also be managed. Keep in mind that canceling via UI is possible, but placing\norders that the algorithm will manage is not possible, as it only manages orders\nthat it has placed, e.g. for the Kraken Crypto Asset exchange at\nhttps://pro.kraken.com.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cfigure\u003e\n    \u003cimg\n    src=\"doc/_static/images/kraken_dashboard.png?raw=true\"\n    alt=\"Required API key permissions\"\n    style=\"background-color: white; border-radius: 7px\"\u003e\n    \u003cfigcaption\u003eFigure 3: Monitoring orders via Kraken's web UI\u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\nAdditionally, the algorithm can be configured to send notifications regarding\nthe current state of the algorithm via Telegram Bots (see\n[Preparation](#preparation)).\n\n\u003cdiv align=\"center\"\u003e\n  \u003cfigure\u003e\n    \u003cimg\n    src=\"doc/_static/images/telegram_update.png?raw=true\"\n    alt=\"Required API key permissions\"\n    style=\"background-color: white; border-radius: 7px; height: 500px\"\u003e\n    \u003cfigcaption\u003eFigure 4: Monitoring orders and trades via Telegram\u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\n## 🚨 Troubleshooting\n\n- Only use release versions of the `infinity-grid` algorithm. The `master` and\n  other branches might contain unstable code! Also pin the the dependencies used\n  in order to avoid unexpected behavior.\n- Check the **permissions of your API keys** and the required permissions on the\n  respective endpoints of your chosen exchange.\n- If you get some Cloudflare or **rate limit errors**, please check your tier\n  level on your exchange and maybe apply for a higher rank if required.\n- **Use different API keys for different algorithms**, because the nonce\n  calculation is based on timestamps and a sent nonce must always be the highest\n  nonce ever sent of that API key. Having multiple algorithms using the same\n  keys will result in invalid nonce errors.\n- Exchanges often have **maintenance windows**. Please check the status page of\n  your exchange for more information.\n- When encountering errors like \"Could not find order '...'. Retry 3/3 ...\",\n  this might be due to the **exchange API being slow**. The algorithm will retry\n  the request up to three times before raising an exception. If the order is\n  still not available, just restart the algorithm - or let this be handled by\n  Docker compose to restart the container automatically. Then the order will\n  most probably be found.\n- Always use unique user reference keys/numbers for each trading bot instance.\n  The algorithm will know what orders to handle based on passed user reference\n  numbers and selected trading pair.\n\n## 📈 Backtesting\n\nThere are currently no backtesting mechanisms implemented. This will be added\nsoon.\n\n\u003ca name=\"versioning\"\u003e\u003c/a\u003e\n\n## 📝 Versioning\n\nThis project follows the principles of [semantic\nversioning](https://semver.org/) (`v\u003cMajor\u003e.\u003cMinor\u003e.\u003cPatch\u003e`). Here's what each\npart signifies:\n\n- **Major**: This denotes significant changes that may introduce new features or\n  modify existing ones. It's possible for these changes to be breaking, meaning\n  backward compatibility is not guaranteed. To avoid unexpected behavior, it's\n  advisable to specify at least the major version when pinning dependencies.\n- **Minor**: This level indicates additions of new features or extensions to\n  existing ones. Typically, these changes do not break existing implementations.\n- **Patch**: Here, you'll find bug fixes, documentation updates, and changes\n  related to continuous integration (CI). These updates are intended to enhance\n  stability and reliability without altering existing functionality.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtschwertfeger%2Finfinity-grid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtschwertfeger%2Finfinity-grid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtschwertfeger%2Finfinity-grid/lists"}