{"id":16100030,"url":"https://github.com/fooock/dca-cefi","last_synced_at":"2025-08-09T20:25:04.565Z","repository":{"id":128382110,"uuid":"547951410","full_name":"fooock/dca-cefi","owner":"fooock","description":"Cryptocurrency bot to do DCA in more than 100 exchanges","archived":false,"fork":false,"pushed_at":"2022-10-12T17:30:04.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T05:56:57.468Z","etag":null,"topics":["ccxt","crypto-bot","crypto-exchanges","cryptocurrency","dca","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fooock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-10-08T16:25:14.000Z","updated_at":"2024-04-05T12:06:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddc8a252-3c36-4ec3-ab1c-367c08c6f0ea","html_url":"https://github.com/fooock/dca-cefi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fdca-cefi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fdca-cefi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fdca-cefi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fdca-cefi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fooock","download_url":"https://codeload.github.com/fooock/dca-cefi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415826,"owners_count":20935384,"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","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":["ccxt","crypto-bot","crypto-exchanges","cryptocurrency","dca","python"],"created_at":"2024-10-09T18:44:48.721Z","updated_at":"2025-04-05T23:33:33.073Z","avatar_url":"https://github.com/fooock.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptocurrency `DCA` bot\n\n\u003eDollar cost averaging bot for centralized exchanges.\n\nThis is a simple script to buy fixed amounts of some cryptocurrency assets in your preferred\nexchanges. It supports any exchange available in [`CCXT`](https://github.com/ccxt/ccxt) (more than 100). \nYou can run multiple strategies using the same bot.\n\nA strategy is a file where we define the list of buy actions our bot is going to execute. See for example\nthe file [`strategy.yaml`](strategy.yaml) for more information. As a summary, each strategy will \ncontain the following info:\n\n| Field        \t| Description                                                        \t|\n|--------------\t|--------------------------------------------------------------------\t|\n| `amount`     \t| This is the maximum amount our bot will buy per asset and exchange \t|\n| `base_asset` \t| The asset we are going to use as a base currency                   \t|\n| `assets`     \t| List of cryptocurrencies to buy                                       |\n| `exchanges`  \t| List of exchanges used to buy assets                               \t|\n| `period`  \t  | The period where this strategy should be executed. `monthly`, `weekly` or `daily` |\n\n#### Features\n\n* Supports more than 100 exchanges.\n* Buy multiple cryptocurrencies at once.\n* You can be notified when no funds are available in the exchange by implementing the [`on_balance_no_available_callback`](https://github.com/fooock/dca-cefi/blob/main/dca.py#L249) method.\n* You can implement your own logic to know when to create buy orders by implementing the [`should_create_buy_order_callback`](https://github.com/fooock/dca-cefi/blob/main/dca.py#L260) method.\n* Be notified when an order is created by implementing the [`on_order_created_callback`](https://github.com/fooock/dca-cefi/blob/main/dca.py#L275)  method.\n* The script is flexible enough to be run by hand, Docker, cronjob, or whatever you want.\n* Execute buy orders when the period is met.\n* Save all executed buy orders from all exchanges in a file called `orders.json`.\n\n## Install\n\nThe best way to run this script is by using Docker. Just pull the image and run it with \nyour own strategy and exchange keys:\n\n```sh\ndocker pull fooock/dca-cefi:latest\ndocker run -v $(pwd):/app:ro fooock/dca-cefi --strategy strategy.yaml --keys keys.yaml --test\n```\n\n\u003eIt is super important to mount the directory where your strategy and keys are located.\n\u003eThe `--test` flag is only used in sandbox environments when the exchange supports it.\n\n## How it works?\n\nSee the following strategy file as an example to undestand better the bot functionality:\n\n\u003eYou can use the [Binance Sandbox](https://testnet.binance.vision/) to test this script.\n\n```yaml\nstrategy:\n  # Strategy 1\n  - amount: 50\n    period: monthly\n    base_asset: usdt\n    assets:\n      - btc\n      - eth\n    exchanges:\n      - binance\n  # Strategy 2\n  - amount: 20\n    period: weekly\n    base_asset: busd\n    assets:\n      - btc\n    exchanges:\n      - bitso\n```\n\nOur bot will execute two strategies in paralell.\n\n\u003eNote that our strategy will interact with two exchanges, so we need to create the required API keys and\n\u003esecrets to be able to recover information from our account.\n\nDefining the strategy period doesn't mean the script will execute automatically during that period. It is your responsibility\nto configure the script and how it will be executed. The `period` is just a measure to avoid buying the\nasset when is not required (and avoid emptying your account `base_asset` balance by mistake).\n\n#### Strategy one:\n\n| Field        \t| Value                                                        \t|\n|--------------\t|--------------------------------------------------------------------\t|\n| `amount`     \t| `50` \t|\n| `base_asset` \t| `USDT`                   \t|\n| `assets`     \t| `BTC`, `ETH`                                       |\n| `exchanges`  \t| `binance`                              \t|\n| `period`  \t| `monthly`                              \t|\n\nThis first strategy will use a total of `100 USDT` to buy `BTC` and `ETH` from Binance (`50` each one)\neach month.\n\n#### Strategy two:\n\n| Field        \t| Value                                                        \t|\n|--------------\t|--------------------------------------------------------------------\t|\n| `amount`     \t| `20` \t|\n| `base_asset` \t| `BUSD`                   \t|\n| `assets`     \t| `BTC`                                       |\n| `exchanges`  \t| `bitso`                              \t|\n| `period`  \t| `weekly`                              \t|\n\nThis second strategy will use a total of `20 BUSD` to buy `BTC` from Bitso each week. \n\n## Exchange keys\n\nTo be able to create orders in the selected exchanges you need to create your API keys and secrets. This\nis something that needs to be kept private, that's why you need to define it in a separate file from the strategy.\nBased on the exchange, the method can be different, so check your Exchange documentation.\n\nIn order to define the keys used by the exchanges we need to define it using a predefined format, the\nexchange name as a key and `apiKey` and `secret` with the values provided by the exchange. For example:\n\n```yaml\nbinance:\n  apiKey: dead\n  secret: beef\n```\n\n## Donate\n\nIf you want to be a supporter, you can use this address in any EVM network to send me donations `0x63335aA5efbfB9D591B047354DBb012ce1CAfc0A`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffooock%2Fdca-cefi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffooock%2Fdca-cefi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffooock%2Fdca-cefi/lists"}