{"id":28270642,"url":"https://github.com/happydasch/btoandav20","last_synced_at":"2025-08-03T21:32:57.130Z","repository":{"id":54935226,"uuid":"123475227","full_name":"happydasch/btoandav20","owner":"happydasch","description":"Support for Oanda-V20 API in backtrader","archived":false,"fork":false,"pushed_at":"2022-11-02T14:38:17.000Z","size":198,"stargazers_count":135,"open_issues_count":1,"forks_count":53,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-15T14:34:39.666Z","etag":null,"topics":["backtrader","oanda","oanda-api","oanda-web-trading","oandapyv20"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/happydasch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"liberapay":"happydasch"}},"created_at":"2018-03-01T18:22:26.000Z","updated_at":"2025-05-25T09:52:24.000Z","dependencies_parsed_at":"2023-01-20T21:05:49.819Z","dependency_job_id":null,"html_url":"https://github.com/happydasch/btoandav20","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/happydasch/btoandav20","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happydasch%2Fbtoandav20","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happydasch%2Fbtoandav20/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happydasch%2Fbtoandav20/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happydasch%2Fbtoandav20/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happydasch","download_url":"https://codeload.github.com/happydasch/btoandav20/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happydasch%2Fbtoandav20/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268617203,"owners_count":24279226,"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-08-03T02:00:12.545Z","response_time":2577,"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":["backtrader","oanda","oanda-api","oanda-web-trading","oandapyv20"],"created_at":"2025-05-20T17:20:18.052Z","updated_at":"2025-08-03T21:32:57.085Z","avatar_url":"https://github.com/happydasch.png","language":"Python","funding_links":["https://liberapay.com/happydasch"],"categories":[],"sub_categories":[],"readme":"# btoandav20\n\nSupport for Oanda-V20 API in backtrader\n\n**This  integration is still under development and may have some issues, use it for live trading at your own risk!**\n\n## What is it\n\n**btoandav20** is a package to integrate OANDA into [backtrader](https://www.backtrader.com/).\nIt uses the [v20](http://developer.oanda.com/rest-live-v20/introduction/) API of OANDA. It can be used with demo or live account.\nWe highly recommend to have a specific account to use backtrader with OANDA. You should not trade manually on the same account if you wish to use backtrader.\n\n**It includes all necessary utilities to backtest or do live trading:**\n\n* Store\n* Broker\n* Data Feeds\n* Sizers\n* Commissions\n\n**Available features:**\n\n* Accessing oandav20 API\n* Streaming prices\n* Streaming events\n* Get *unlimited* history prices for backtesting\n* Replay functionality for backtesting\n* Replace pending orders\n* Possibility to load existing positions from the OANDA account\n* Reconnects on broken connections and after timeouts, also backfills data after a timeout or disconnect occurred\n\n* **Support different type of orders:**\n  * Order.Market\n  * Order.Limit\n  * Order.Stop\n  * Order.StopTrail (by using brackets)\n  * Bracket orders are supported by using the takeprofit and stoploss order members and creating internally simulated orders.\n\n* **4 different OandaV20 Sizers:**\n  * OandaV20PercentSizer - returns position size which matches the percent amount of total cash\n  * OandaV20CashSizer - return position size which matches the cash amount\n  * OandaV20RiskPercentSizer - returns position size which matches the total risk in percent of total amount (max stop loss)\n  * OandaV2\n  0RiskCashSizer - returns position size which matches the total risk in percent of total amount (max stop loss)\n\n* **4 different backtest Sizers:**\n  * OandaV20BacktestPercentSizer - returns position size which matches the percent amount of total cash\n  * OandaV20BacktestCashSizer - return position size which matches the cash amount\n  * OandaV20BacktestRiskPercentSizer - returns position size which matches the total risk in percent of total amount (max pips)\n  * OandaV20BacktestRiskCashSizer - returns position size which matches the total risk in percent of total amount (max pips)\n\n## Order Types\n\nbtoandav20 supports Market, Limit and Stop orders. Other order types, like StopTrail need to be created using brackets.\n\n### StopTrail order\n\norderexec: bt.Order.Stop\n\nstopexec: bt.Order.StopTrail\n\n### Changing StopTrail order\n\nTo change a StopTrail order the stopside or takeside needs to be canceled and a new order with the order type StopTrail needs to be created.\n\nAlso an oref of the original order needs to be provided, when creating this order.\nThe order needs to go into the opposing direction.\n\n**StopTrail example:**\n\nProvide the stoptrail in stopargs with trailamount or trailpercent\n\n* o, ostop, olimit = buy_bracket(exectype=bt.Order.Stop, stopexec=bt.Order.StopTrail, stopargs={\"trailamount\": xxx or \"trailpercent\": yyy} limitexec=None)\n\nCreate new trailing stop for parent order\n\n* self.sell(exectype=bt.Order.StopTrail, trailamount=xxx or trailpercent=yyy, replace=ostop.ref)\n\n## Dependencies\n\n* python 3.6\n* ``Backtrader`` (tested with version 1.9.61.122)\n* ``pyyaml`` (tested with version 3.13)\n* ``v20`` (tested with version 3.0.25) (\u003chttps://github.com/oanda/v20-python/releases\u003e)\n\n## Installation\n\nThe following steps have been tested on Mac OS High Sierra and Ubuntu 16 and 18.\n\n1. Install backtrader ``pip install backtrader[plotting]`` (\u003chttps://www.backtrader.com/docu/installation.html\u003e)\n2. Install btoandav20 ``pip install git+https://github.com/happydasch/btoandav20``\n   or with ``pipenv install git+https://github.com/happydasch/btoandav20#egg=btoandav20``\n\n3. Import ``btoandav20`` into your script: ``import btoandav20`` (this is considering your script is at the root of your folder)\n\n**You can then access the different parts such as:**\n\n*Live:*\n\n* Store: ``btoandav20.stores.OandaV20Store``\n* Data Feed: ``btoandav20.feeds.OandaV20Data``\n* Broker: ``btoandav20.brokers.OandaV20Broker``\n* Sizers:\n  * ``btoandav20.sizers.OandaV20PercentSizer``\n  * ``btoandav20.sizers.OandaV20CashSizer``\n  * ``btoandav20.sizers.OandaV20RiskPercentSizer``\n  * ``btoandav20.sizers.OandaV20RiskCashSizer``\n\n*Backtesting:*\n\n* Sizers:\n  * ``btoandav20.sizers.ForexPercentSizer``\n  * ``btoandav20.sizers.ForexCashSizer``\n  * ``btoandav20.sizers.ForexRiskPercentSizer``\n  * ``btoandav20.sizers.ForexRiskCashSizer``\n* Commissioninfo: ``btoandav20.commissions.OandaV20CommInfoBacktest``\n\nIf you encounter an issue during installation, please check this url first: \u003chttps://community.backtrader.com/topic/1570/oanda-data-feed/\u003e and create a new issue if this doesn't solve it.\n\n## Getting Started\n\nSee the [example](examples) folder for more detailed explanation on how to use it.\n\n## Contribute\n\nWe are looking for contributors: if you are interested to join us please contact us.\n\n## Sponsoring\n\nIf you want to support the development of btoandav20, consider to support this project.\n\n* BTC: 39BJtPgUv6UMjQvjguphN7kkjQF65rgMMF\n* ETH: 0x06d6f3134CD679d05AAfeA6e426f55805f9B395D\n* \u003chttps://liberapay.com/happydasch\u003e\n\n## License\n\nAll code is based on backtrader oandastore which is released under GNU General Public License Version 3 by Daniel Rodriguez\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappydasch%2Fbtoandav20","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappydasch%2Fbtoandav20","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappydasch%2Fbtoandav20/lists"}