{"id":13510776,"url":"https://github.com/blankly-finance/blankly","last_synced_at":"2025-04-25T14:28:39.313Z","repository":{"id":37234423,"uuid":"346106128","full_name":"blankly-finance/blankly","owner":"blankly-finance","description":"🚀 💸  Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.","archived":false,"fork":false,"pushed_at":"2024-12-30T20:20:29.000Z","size":2563,"stargazers_count":2278,"open_issues_count":31,"forks_count":279,"subscribers_count":44,"default_branch":"main","last_synced_at":"2025-04-24T02:13:50.149Z","etag":null,"topics":["algotrading","binance","blankly","bot","bot-framework","bots","coinbase","crypto","cryptocurrency","framework","investment","platform","python","stocks","trading","trading-bot","trading-strategies"],"latest_commit_sha":null,"homepage":"https://package.blankly.finance","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blankly-finance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"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}},"created_at":"2021-03-09T18:33:22.000Z","updated_at":"2025-04-24T01:24:13.000Z","dependencies_parsed_at":"2023-12-23T04:21:30.839Z","dependency_job_id":"95d8dee4-0977-4ebe-af2e-4b6963b5a279","html_url":"https://github.com/blankly-finance/blankly","commit_stats":{"total_commits":1469,"total_committers":22,"mean_commits":66.77272727272727,"dds":0.5847515316541865,"last_synced_commit":"7fe1976b9db9132e798ba82b84b0522d18747dd7"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blankly-finance%2Fblankly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blankly-finance%2Fblankly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blankly-finance%2Fblankly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blankly-finance%2Fblankly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blankly-finance","download_url":"https://codeload.github.com/blankly-finance/blankly/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546096,"owners_count":21448262,"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":["algotrading","binance","blankly","bot","bot-framework","bots","coinbase","crypto","cryptocurrency","framework","investment","platform","python","stocks","trading","trading-bot","trading-strategies"],"created_at":"2024-08-01T02:01:53.653Z","updated_at":"2025-04-24T02:13:54.383Z","avatar_url":"https://github.com/blankly-finance.png","language":"Python","funding_links":[],"categories":["Python","Backtesting \u0026 Trading","Curated List","bot"],"sub_categories":["Books","Trading Frameworks (support backtesting and live trading)"],"readme":"\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n   \u003cimg style=\"margin: 0 auto; padding-bottom: 15px; padding-top: 30px\" width=70%\" src=\"https://firebasestorage.googleapis.com/v0/b/blankly-6ada5.appspot.com/o/blankly-github-logo.png?alt=media\u0026token=8f436cd2-3d28-432c-867a-afef780f4260\"\u003e\n\u003c/div\u003e\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cb\u003e💨  Rapidly build and deploy quantitative models for stocks, crypto, and forex  🚀\u003c/b\u003e\n\u003c/div\u003e\n\u003cbr /\u003e\n\n\n\u003cp align=\"center\"\u003e\n   \u003ca target=\"_blank\" href=\"https://sonarcloud.io/dashboard?id=Blankly-Finance_Blankly\"\u003e\u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=Blankly-Finance_Blankly\u0026metric=sqale_rating\"\u003e\u003c/a\u003e\n   \u003ca target=\"_blank\" href=\"https://sonarcloud.io/dashboard?id=Blankly-Finance_Blankly\"\u003e\u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=Blankly-Finance_Blankly\u0026metric=alert_status\"\u003e\u003c/a\u003e\n   \u003ca target=\"_blank\" href=\"https://github.com/Blankly-Finance/Blankly/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/Blankly-Finance/Blankly/actions/workflows/test.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e \u003cbr\u003e\n   \u003ca target=\"_blank\" href=\"https://static.pepy.tech/badge/blankly\"\u003e\u003cimg src=\"https://static.pepy.tech/badge/blankly\"\u003e\u003c/a\u003e\n   \u003ca target=\"_blank\" href=\"https://github.com/Blankly-Finance/Blankly/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/pypi/l/blankly?color=gree\"\u003e\u003c/a\u003e\n   \u003ca target=\"_blank\" href=\"https://github.com/Blankly-Finance/Blankly/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/blankly-finance/blankly?style=social\"\u003e\u003c/a\u003e\n   \u003ca target=\"_blank\" href=\"https://discord.gg/XWcmy7Y9bb\"\u003e\u003cimg src=\"https://img.shields.io/discord/821563936297451530.svg?color=7289da\u0026label=Blankly%20Discord\u0026logo=discord\u0026style=flat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca target=\"_blank\" href=\"https://docs.blankly.finance\"\u003eView Docs\u003c/a\u003e\n    ·\n    \u003ca target=\"_blank\" href=\"https://blankly.finance\"\u003eOur Website\u003c/a\u003e\n    ·\n    \u003ca target=\"_blank\" href=\"https://blankly.substack.com\"\u003eJoin Our Newsletter\u003c/a\u003e\n    ·\n    \u003ca href=\"#quickstart\"\u003eGetting Started\u003c/a\u003e\n  \u003c/p\u003e\n\n---\n\n## Why Blankly? \n\nBlankly is an ecosystem for algotraders enabling anyone to build, monetize and scale their trading algorithms for stocks, crypto, futures or forex. The same code can be backtested, paper traded, sandbox tested and run live by simply changing a single line. Develop locally then deploy, iterate and share using the blankly platform.\n\nThe blankly package is designed to be **extremely precise** in both simulation and live trading. **The engineering considerations for highly accurate simulation are described [here](blankly/BACKTESTING_ENGINEERING.md)**\n\nGetting started is easy - just `pip install blankly` and `blankly init`.\n\nCheck out our [website](https://blankly.finance) and our [docs](https://docs.blankly.finance).\n\n\u003cdiv align=\"center\"\u003e\n\u003ca target=\"_blank\" href=\"https://youtu.be/pcm0h63rhUU\"\u003e\u003cimg src=\"https://firebasestorage.googleapis.com/v0/b/blankly-6ada5.appspot.com/o/github%2Fbuild_a_bot_readme_thumbnail.jpg?alt=media\u0026token=a9dd030a-805c-447f-a970-2bc8e1815662\" style=\"border-radius:10px; width: 50%\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n---------\n\n### Trade Stocks, Crypto, Futures, and Forex\n\n```python\nfrom blankly import Alpaca, CoinbasePro\n\nstocks = Alpaca()\ncrypto = CoinbasePro()\nfutures = BinanceFutures()\n\n# Easily perform the same actions across exchanges \u0026 asset types\nstocks.interface.market_order('AAPL', 'buy', 1)\ncrypto.interface.market_order('BTC-USD', 'buy', 1)\n# Full futures feature set\nfutures.interface.get_hedge_mode()\n```\n\n### Backtest your trades, events, websockets, and custom data\n\n```python\nimport blankly\n\"\"\"\nThis example shows how backtest over tweets\n\"\"\"\n\nclass TwitterBot(blankly.Model):\n    def main(self, args):\n        while self.has_data:\n            self.backtester.value_account()\n            self.sleep('1h')\n\n    def event(self, type_: str, data: str):\n        # Now check if it's a tweet about Tesla\n        if 'tsla' in data.lower() or 'gme' in data.lower():\n            # Buy, sell or evaluate your portfolio\n            pass\n\n\nif __name__ == \"__main__\":\n    exchange = blankly.Alpaca()\n    model = TwitterBot(exchange)\n\n    # Add the tweets json here\n    model.backtester.add_custom_events(blankly.data.JsonEventReader('./tweets.json'))\n    # Now add some underlying prices at 1 month\n    model.backtester.add_prices('TSLA', '1h', start_date='3/20/22', stop_date='4/15/22')\n\n    # Backtest or run live\n    print(model.backtest(args=None, initial_values={'USD': 10000}))\n\n```\n\n**Check out alternative data examples [here](https://docs.blankly.finance/examples/model-framework)**\n\n#### Accurate Backtest Holdings\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca\u003e\u003cimg src=\"https://firebasestorage.googleapis.com/v0/b/blankly-6ada5.appspot.com/o/github%2FScreen%20Shot%202022-04-17%20at%202.37.58%20PM.png?alt=media\u0026token=d5738617-e197-4da2-850d-8fbbfda05275\" style=\"border-radius:10px\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\n### Go Live in One Line\n\nSeamlessly run your model live!\n\n```python\n# Just turn this\nstrategy.backtest(to='1y')\n# Into this\nstrategy.start()\n```\n\nDates, times, and scheduling adjust on the backend to make the experience instant.\n\n## Quickstart\n\n### Installation\n\n1. First install Blankly using `pip`. Blankly is hosted on [PyPi](https://pypi.org/project/Blankly/).\n\n```bash\n$ pip install blankly\n```\n\n2. Next, just run:\n```bash\n$ blankly init\n```\nThis will initialize your working directory.\n\nThe command will create the files `keys.json`, `settings.json`, `backtest.json`, `blankly.json` and an example script called `bot.py`.\n\nIf you don't want to use our `init` command, you can find the same files in the `examples` folder under [`settings.json`](https://github.com/Blankly-Finance/Blankly/blob/main/examples/settings.json) and [`keys_example.json`](https://github.com/Blankly-Finance/Blankly/blob/main/examples/keys_example.json)\n\n3. From there, **insert your API keys** from your exchange into the generated `keys.json` file or take advantage of the CLI keys prompt.\n\nMore information can be found on our [docs](https://docs.blankly.finance)\n\n### Directory format\n\nThe working directory format should have *at least* these files:\n```\nproject/\n   |-bot.py\n   |-keys.json\n   |-settings.json\n```\n\n#### Additional Info\n\nMake sure you're using a supported version of python. The module is currently tested on these versions:\n\n- Python 3.7\n- Python 3.8\n- Python 3.9\n- Python 3.10\n\nFor more info, and ways to do more advanced things, check out our [getting started docs](https://docs.blankly.finance).\n\n## Supported Exchanges\n\n| Exchange            | Live Trading | Websockets | Paper Trading | Backtesting |\n| ------------------- |--------------| ---------- |--------------| ----------- |\n| Coinbase Pro        | 🟢           | 🟢          | 🟢           | 🟢           |\n| Binance             | 🟢           | 🟢          | 🟢           | 🟢           |\n| Alpaca              | 🟢           | 🟢          | 🟢           | 🟢           |\n| OANDA               | 🟢           |  | 🟢           | 🟢           |\n| FTX                 | 🟢           | 🟢          | 🟢           | 🟢           |\n| KuCoin              | 🟢           | 🟢        | 🟢           | 🟢           |\n| Binance Futures | 🟢 | 🟢 | 🟢 | 🟢 |\n| FTX Futures | 🟡 | 🟡 | 🟢 | 🟢 |\n| Okx | 🟢 | 🟢 | 🟢 | 🟢 |\n| Kraken              | 🟡           | 🟡          | 🟡           | 🟡           |\n| Keyless Backtesting |              |            |              | 🟢           |\n| TD Ameritrade       | 🔴           | 🔴          | 🔴           | 🔴           |\n| Webull              | 🔴           | 🔴          | 🔴           | 🔴           |\n| Robinhood           | 🔴           | 🔴          | 🔴           | 🔴           |\n\n\n🟢  = working\n\n🟡  = in development, some or most features are working\n\n🔴  = planned but not yet in development\n\n## RSI Example\n\nWe have a pre-built cookbook examples that implement strategies such as RSI, MACD, and the Golden Cross found in our [examples](https://docs.blankly.finance/examples/golden-cross).\n\nOther Info\n\n### Subscribe to our news!\nhttps://blankly.substack.com/p/coming-soon\n\n### Bugs\n\nPlease report any bugs or issues on the GitHub's Issues page.\n\n### Disclaimer \n\nTrading is risky. We are not responsible for losses incurred using this software, software fitness for any particular purpose, or responsibility for any issues or bugs.\nThis is free software.\n\n### Contributing\n\nIf you would like to support the project, pull requests are welcome.\n\n### Licensing \n\n**Blankly** is distributed under the [**LGPL License**](https://www.gnu.org/licenses/lgpl-3.0.en.html). See the [LICENSE](/LICENSE) for more details.\n\nNew updates every day 💪.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://firebasestorage.googleapis.com/v0/b/blankly-6ada5.appspot.com/o/github%2Fblanklybots.png?alt=media\u0026token=005728b0-5f49-476d-968a-07fe0683ca09\" style=\"border-radius:10px; width: 30%\"\u003e\n\u003c/div\u003e\nArt by DALL·E 2 - \"Robots playfully trading stocks synthwave\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblankly-finance%2Fblankly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblankly-finance%2Fblankly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblankly-finance%2Fblankly/lists"}