{"id":32364976,"url":"https://github.com/sxwei123/binance-dca-bot-ts","last_synced_at":"2026-05-17T19:35:26.392Z","repository":{"id":48969904,"uuid":"397591139","full_name":"sxwei123/binance-dca-bot-ts","owner":"sxwei123","description":"A Dollar Cost Averaging  bot for Binance. Implemented with Typescript","archived":false,"fork":false,"pushed_at":"2021-09-09T13:54:00.000Z","size":125,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-07-20T04:40:04.658Z","etag":null,"topics":["binance","dollar-cost-averaging","nodejs","trading-bot","trading-strategies","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/sxwei123.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}},"created_at":"2021-08-18T12:23:31.000Z","updated_at":"2023-07-20T04:40:04.659Z","dependencies_parsed_at":"2022-08-30T07:50:22.178Z","dependency_job_id":null,"html_url":"https://github.com/sxwei123/binance-dca-bot-ts","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/sxwei123/binance-dca-bot-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwei123%2Fbinance-dca-bot-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwei123%2Fbinance-dca-bot-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwei123%2Fbinance-dca-bot-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwei123%2Fbinance-dca-bot-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sxwei123","download_url":"https://codeload.github.com/sxwei123/binance-dca-bot-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwei123%2Fbinance-dca-bot-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33151898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["binance","dollar-cost-averaging","nodejs","trading-bot","trading-strategies","typescript"],"created_at":"2025-10-24T17:30:51.809Z","updated_at":"2026-05-17T19:35:26.387Z","avatar_url":"https://github.com/sxwei123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binance DCA Bot\n\nA DCA (Dollar Cost Averaging) Bot for Binance exchange.\nIf you enjoy DCA bots like the 3Commas' one and don't want to expose your Binance API keys to any third party, this bot is for you.\n\n## Current Limitations\n\n- Only support one trade pair\n- Only support LONG deal\n- Only one deal at a time\n\n## Configuration\n\n### Binance API key setup\n\nLogin your binance.com account and [generate an API key/secret pair](https://www.binance.com/en/support/faq/360002502072). Create a new JSON file called `config.json` under the root of this project. The content should be like this:\n\n```json\n{\n  \"binance\": {\n    \"apiKey\": \"YOUR_BINANCE_API_KEY\",\n    \"apiSecret\": \"YOUR_BINANCE_API_SECRET\"\n  },\n  \"dca\": {\n    \"pair\": \"ETHUSDT\",\n    \"strategy\": \"LONG\",\n    \"baseOrderSize\": \"20.0\",\n    \"safetyOrderSize\": \"40\",\n    \"startOrderType\": \"LIMIT\",\n    \"dealStartCondition\": \"ASAP\",\n    \"targetProfitPercentage\": 1.0,\n    \"maxSafetyTradesCount\": 8,\n    \"maxActiveSafetyTradesCount\": 8,\n    \"priceDeviationPercentage\": 0.5,\n    \"safetyOrderVolumeScale\": 1.1,\n    \"safetyOrderStepScale\": 1.55\n  }\n}\n```\n\nPut your api key and api secret into the `binance` configs and customize the `dca` configs.\n`dca` config explanation:\n\n| Config Name                | Description                                                                                                                                                                                                                                             |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| pair                       | The trading pair. The pair must be supported by binance. Check the availability [here](https://api.binance.com/api/v3/exchangeInfo)                                                                                                                     |\n| strategy                   | The trading strategy. Either `LONG` or `SHORT`. Current only `LONG` is supported                                                                                                                                                                        |\n| baseOrderSize              | The volume of the first order the bot will create when starting a new deal                                                                                                                                                                              |\n| safetyOrderSize            | The base safe order amount you are going to use to average the cost.                                                                                                                                                                                    |\n| startOrderType             | Order type the bot will use to start the first order. Either `LIMIT` or `MARKET`. Currently only `LIMIT` is supported                                                                                                                                   |\n| dealStartCondition         | When to start a new deal. Currently the bot will start new deal right after the previous deal gets closed                                                                                                                                               |\n| targetProfitPercentage     | The target profit percentage. For example, after 5 orders your average price is 1000, and the `targetProfitPercentage` is 1, the take profit (sell order) will be priced at 1010.                                                                       |\n| maxSafetyTradesCount       | The max no of safety orders the bot will place                                                                                                                                                                                                          |\n| maxActiveSafetyTradesCount | The max no of active safety buy orders. Not implemented yet. The bot will place all buy orders when the deal starts                                                                                                                                     |\n| priceDeviationPercentage   | The percentage difference in price to create the first Safety Order. All Safety Orders are calculated from the price the initial `baseOrderSize` was filled on the exchange account.                                                                    |\n| safetyOrderVolumeScale     | This value is used to multiply the amount of funds used by the last Safety Order that was created. Using a larger amount of funds for Safety Orders allows your bot to be more aggressive at Dollar Cost Averaging the price of the asset being traded. |\n| safetyOrderStepScale       | This value is used to multiply the Price Deviation percentage used by the last Safety Order placed on the exchange account.                                                                                                                             |\n\n## Pre calculation\n\nPrint the pre-calculated buy orders table by running script\n\n```sh\nyarn print-buy-orders\n```\n\n![Print Table](/screenshots/print-table.png?raw=true)\n\n## Run the bot\n\n### Node.js\n\nTested with node 14. Should work for node 12+.\n\n```sh\nyarn install\n\n# run directly from typescript source code\nyarn start\n\n# or run the javascript with pm2\nyarn serve\n```\n\n## TODOs\n\n- [ ] Do paper trading with Binance real data\n- [ ] implement maxActiveSafetyTradesCount\n- [ ] Add unit test and integration test\n- [ ] Add Dockerfile and docker-compose.yml\n- [ ] Handle websocket reconnection in case the device goes offline\n- [ ] Close deal manually\n- [ ] Monitor order status with REST apis\n- [ ] take account for trading fees\n- [ ] Handle partially filled orders\n- [ ] Add dockerfile and docker-compose file for easy deployment\n\n## Disclaimer\n\nUse at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwei123%2Fbinance-dca-bot-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsxwei123%2Fbinance-dca-bot-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwei123%2Fbinance-dca-bot-ts/lists"}