{"id":31252353,"url":"https://github.com/agrawal-rohit/futon","last_synced_at":"2025-09-23T06:17:13.520Z","repository":{"id":49413815,"uuid":"371819613","full_name":"agrawal-rohit/futon","owner":"agrawal-rohit","description":"Create automated crypto bots that trade for you while you sleep","archived":false,"fork":false,"pushed_at":"2024-01-28T21:44:21.000Z","size":44352,"stargazers_count":8,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-15T19:27:40.782Z","etag":null,"topics":["backtesting-engine","cryptocurrency","stock-analysis","trading-bot","trading-strategy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agrawal-rohit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"agrawal-rohit"}},"created_at":"2021-05-28T21:13:22.000Z","updated_at":"2023-03-10T09:01:22.000Z","dependencies_parsed_at":"2022-09-11T15:02:45.245Z","dependency_job_id":null,"html_url":"https://github.com/agrawal-rohit/futon","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/agrawal-rohit/futon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrawal-rohit%2Ffuton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrawal-rohit%2Ffuton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrawal-rohit%2Ffuton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrawal-rohit%2Ffuton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agrawal-rohit","download_url":"https://codeload.github.com/agrawal-rohit/futon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrawal-rohit%2Ffuton/sbom","scorecard":{"id":171117,"data":{"date":"2025-08-11","repo":{"name":"github.com/agrawal-rohit/futon","commit":"b03ee888bee1be3ea168add7600b99229cce95ad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:88: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:86: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:99: update your workflow using https://app.stepsecurity.io/secureworkflow/agrawal-rohit/futon/release.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:51","Warn: pipCommand not pinned by hash: .github/workflows/release.yml:43","Warn: pipCommand not pinned by hash: .github/workflows/release.yml:95","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   3 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":0,"reason":"59 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2023-120 / GHSA-45c4-8wx5-qw6w","Warn: Project is vulnerable to: PYSEC-2024-24 / GHSA-5h86-8mv2-jq9f","Warn: Project is vulnerable to: GHSA-5m98-qgg9-wh84","Warn: Project is vulnerable to: GHSA-7gpw-8wmc-pm8g","Warn: Project is vulnerable to: GHSA-8495-4g3g-x7pr","Warn: Project is vulnerable to: PYSEC-2024-26 / GHSA-8qpw-xqxj-h4r2","Warn: Project is vulnerable to: GHSA-9548-qrrj-x5pj","Warn: Project is vulnerable to: PYSEC-2023-246 / GHSA-gfw2-4jvh-wgfg","Warn: Project is vulnerable to: GHSA-pjjw-qhg8-p2p9","Warn: Project is vulnerable to: PYSEC-2023-250 / GHSA-q3qx-c6g2-7pw2","Warn: Project is vulnerable to: PYSEC-2023-251 / GHSA-qvrw-v9rv-5rjx","Warn: Project is vulnerable to: PYSEC-2023-247 / GHSA-xx9p-xxvh-7g8j","Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2024-230 / GHSA-248v-346w-9cwc","Warn: Project is vulnerable to: PYSEC-2022-42986 / GHSA-43fp-rhv2-5gv8","Warn: Project is vulnerable to: PYSEC-2023-135 / GHSA-xqr8-7jwr-rhp7","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: GHSA-gmj6-6f8f-6699","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: GHSA-6p56-wp2h-9hxr","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq","Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3","Warn: Project is vulnerable to: GHSA-4fx9-vc88-q2xc","Warn: Project is vulnerable to: PYSEC-2021-331 / GHSA-7534-mm45-c74v","Warn: Project is vulnerable to: PYSEC-2023-227 / GHSA-8ghj-p4vj-mr35","Warn: Project is vulnerable to: PYSEC-2022-10 / GHSA-8vj2-vxx3-667w","Warn: Project is vulnerable to: PYSEC-2021-317 / GHSA-98vv-pw6r-q6q4","Warn: Project is vulnerable to: PYSEC-2022-168 / GHSA-9j59-75qj-795w","Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr","Warn: Project is vulnerable to: PYSEC-2022-42979 / GHSA-m2vv-5vj5-2hm7","Warn: Project is vulnerable to: PYSEC-2022-8 / GHSA-pw3c-h7wp-cvhx","Warn: Project is vulnerable to: PYSEC-2022-9 / GHSA-xrcv-f9gm-v42c","Warn: Project is vulnerable to: PYSEC-2023-175","Warn: Project is vulnerable to: PYSEC-2022-6 / GHSA-qc9x-gjcv-465w","Warn: Project is vulnerable to: PYSEC-2023-117 / GHSA-mrwq-x4v8-fh7p","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: GHSA-753j-mpmx-qq6g","Warn: Project is vulnerable to: GHSA-7cx3-6m66-7c5m","Warn: Project is vulnerable to: GHSA-8w49-h785-mj3c","Warn: Project is vulnerable to: PYSEC-2023-75 / GHSA-hj3f-6gcp-jg8j","Warn: Project is vulnerable to: GHSA-qppv-j76h-2rpx","Warn: Project is vulnerable to: GHSA-w235-7p84-xx57","Warn: Project is vulnerable to: GHSA-g7vv-2v7x-gj9p","Warn: Project is vulnerable to: PYSEC-2022-25 / GHSA-fh56-85cw-5pq6","Warn: Project is vulnerable to: GHSA-fm67-cv37-96ff","Warn: Project is vulnerable to: GHSA-wpqr-jcpx-745r","Warn: Project is vulnerable to: OSV-2021-955","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f","Warn: Project is vulnerable to: PYSEC-2024-187 / GHSA-rqc4-2hc7-8c8v","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T16:29:23.613Z","repository_id":49413815,"created_at":"2025-08-16T16:29:23.613Z","updated_at":"2025-08-16T16:29:23.613Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276425168,"owners_count":25640214,"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-22T02:00:08.972Z","response_time":79,"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":["backtesting-engine","cryptocurrency","stock-analysis","trading-bot","trading-strategy"],"created_at":"2025-09-23T06:17:11.602Z","updated_at":"2025-09-23T06:17:13.510Z","avatar_url":"https://github.com/agrawal-rohit.png","language":"Python","funding_links":["https://github.com/sponsors/agrawal-rohit"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg width=\"341\" alt=\"Logo\" src=\"https://user-images.githubusercontent.com/29514438/122650855-bd657b00-d152-11eb-8296-1407f832bd91.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"GitHub Workflow Status\" src=\"https://img.shields.io/github/workflow/status/agrawal-rohit/futon/Build\"\u003e\n\u003c!-- \u003cimg alt=\"PyPI - Status\" src=\"https://img.shields.io/pypi/status/futon\"\u003e --\u003e\n\u003c!-- \u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/agrawal-rohit/futon\"\u003e --\u003e\n\u003cimg alt=\"Codacy coverage\" src=\"https://img.shields.io/codacy/coverage/9102daf9ad9546dbbec1cb26a339e0e5\"\u003e\n\u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/futon\"\u003e\n\u003cimg alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/futon\"\u003e\n\u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/futon\"\u003e\n\u003cimg alt=\"Codacy grade\" src=\"https://img.shields.io/codacy/grade/9102daf9ad9546dbbec1cb26a339e0e5\"\u003e\n\u003cimg alt=\"Licence\" src=\"https://img.shields.io/github/license/agrawal-rohit/futon\"\u003e\n\u003cimg alt=\"Contributions\" src=\"https://img.shields.io/badge/contributions-welcome-orange\"\u003e\n\u003c/p\u003e\n\n# Installation\n\n```shell\n$ pip install futon\n```\n\n# Usage\n\n## Step 1: Initialize a data provider\n\nA data provider refers to a source from where an instruments historical data can be fetched. Currently, **Binance** is the only supported provider (more are being added actively)\n\n```python\nfrom futon.data.providers import Binance\n\n# Add your developer API keys here\napi_key = '\u003cAPI KEY\u003e'\nsecret_key = '\u003cAPI SECRET\u003e'\n\nbinance = Binance(api_key, secret_key)\n```\n\n## Step 2: Choose an instrument\n\n```python\ncoin = futon.instruments.Crypto(base_asset = 'DOGE',\n                                quote_asset = 'USDT',\n                                provider = binance,\n                                interval = '30-min',\n                                start_date = '2021-05-01 00:00:00')\n```\n\nWhen you initialize an instrument, historical data for the instrument is downloaded by _default_\n\nIf you're a chart guy, then you can create an interactive OHLCV chart right in your jupyter notebook:\n\n```python\nfrom bokeh.io import output_notebook, show, push_notebook\noutput_notebook()\n\ncoin.plot_candles()\n```\n\n![Candlestick Plot](imgs/candlestick_plot.png)\n\n## Step 3: Create a trading strategy\n\n```python\nfrom futon.strategy import TradingStrategy\n\nclass MACDCrossover(TradingStrategy):\n\n    # Runs only once before trading has started\n    def setup(self):\n        # Initialize the indicators you want to use here\n        self.macd = futon.indicators.MACD(fastperiod = 6,\n                                            slowperiod = 18,\n                                            signalperiod = 5,\n                                            plot_separately = True)\n\n        # \n        self.indicators = [self.macd]\n\n    # Live trading logic\n    def logic(self, account, lookback):\n        today = lookback.iloc[-1]\n\n        macd_today, signal_today, _ = self.macd.lookback[-1]\n        macd_yest, signal_yest, _ = self.macd.lookback[-2]\n\n        # Buying\n        buy_signal = (macd_today \u003e signal_today) and (macd_yest \u003c signal_yest)\n        if buy_signal:\n            entry_price   = today.close\n            entry_capital = account.buying_power\n            account.buy(entry_capital=entry_capital, entry_price=entry_price)\n\n        # Selling\n        sell_signal = (macd_today \u003c signal_today) and (macd_yest \u003e signal_yest)\n\n        if sell_signal:\n            percent = 1\n            exit_price = today.close\n            account.sell(percent=percent, current_price=exit_price)\n\nstrat = MACDCrossover(coin)\n```\n\n## Step 4: Run a backtest on historical data\n\n```python\nstrat.backtest(start_date = '2021-06-1 00:00:00', commision = 0.001, show_trades = True)\n```\n\n**Output**\n\n    Performing backtest from: 01 June, 2021 (00:00:00) to 21 June, 2021 (16:00:00)\n\n    -------------- Results ----------------\n\n    Relative Returns: -2.55%\n    Relative Profit: -25.49\n\n    Strategy     : -36.4%\n    Net Profit   : -363.96\n\n    Buy and Hold : -33.85%\n    Net Profit   : -338.47\n\n    Buys        : 75\n    Sells        : 75\n    --------------------\n    Total Trades : 150\n\n    ---------------------------------------\n\n![Backtest Plot](imgs/backtest.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrawal-rohit%2Ffuton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrawal-rohit%2Ffuton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrawal-rohit%2Ffuton/lists"}