Skip to content

Commit

Permalink
backtester: shared exchange level funding, decimal implementation (th…
Browse files Browse the repository at this point in the history
…rasher-corp#783)

* Better designed backtester funding concept

* Fleshes out funding concepts further to allow two funding types

* Adds types, finishes adding to portfolio and adds to exchange

* Fixes a bug to reveal another

* Fixes issues with purchasing

* A partial conversion to using decimal.decimal for the backtester

* Further decimal rollout. Can compile and output report

* More cleanup

* Fix rendering and initial funds issue.

* Adds new concept for trading using the exchange level funding to see what happens

* Fixes a bug in funding not being found

* New strat config to test RSI and discover issues

* Can run with pairs that contain 0 funding

* Finally fixes the arrangement to share funds

* Adds testing and funding transfer

* end of day

* More comments, more tests!

* Improves item comparisons and completes testing

* Initial attempt at new strategy which utilisies shared funding and transfers

* end of day broken

* Chronological output. Fixes output bug where multi currency.

* End of day commit

* Fixes bug where events were being overwritten in a simultaneous context

* Begins transitioning from portfolio holdings to funding holdings. Am I doing the right thing

* End of day run around

* Likely fix for holding calculations

* Improvement to template. Improvement to holdings

* DARK MODE. Report upgrades. Even handling with funds. Fix output

* Output funding to cmd

* Add new trasnferred funds "side"

* Fixing test run 1

* Test updates

* Test updating

* More test fixing

* Fixes portfolio tests

* More test fixes

* Fixes remaining tests and lints

* Fixes currencystatistics tests. Adds decimal math implementations

* Fixes hilarious bug where there could only be on holding

* Adds funding support for config. Minor fixes

* Adds documentation

* Finishes config builder support for funding

* Logs inexact conversions, updates tests. adds config validation

* The quest to understand a new funding bug begins. New strategy

* Fixes bug where wrong funding was retrieved. Expands t2b2 strat

* End of the day commit. Gotta revert the nulldecimal stuff

* Fixes tests, adds extra funding transfer feature

* Fixes initial total values, tries to add a grand total value

* Rebase fixes, documentation updates, tests for strategy

* Swaps the err statement for tests. Regenerates tests. Math warnings

* Attempts to solve Live data problems. Fixes volume

* Fixes live data missing

* can trade at any interval. skip volume sizing. volume colours.

* config regen. display fixes

* test fixes, lint fixes

* Anti-funky errors

* docs

* Rmbad

* docs

* docs update

* Simplifies err handling. Updates readmes. Data type checks

* docs. new field initial-base-funds. comment errs. config test coverage

* minMaxing

* testfix

* Fixes fee calculation, re-bans minMax being equal

* Crazy concepts to attempt to solve totals. Addresses nits

* Adds in totals calculation for exchange level funding.Uses external API

In future, this will be replaced by proper pricing supplied by the same
exchange that is requested. This is an unknown price

* rm dollar signs in cmd and report. rm bad error. fix chart decimal. padding

* re-run docs post merge

* Fixes oopsie for fee parsing

Co-authored-by: Adrian Gallagher <[email protected]>

Co-authored-by: Adrian Gallagher <[email protected]>
  • Loading branch information
gloriousCode and thrasher- authored Sep 27, 2021
1 parent 5dfbbf8 commit adf7659
Show file tree
Hide file tree
Showing 123 changed files with 7,943 additions and 3,335 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ dackroyd | https://github.com/dackroyd
cranktakular | https://github.com/cranktakular
woshidama323 | https://github.com/woshidama323
yangrq1018 | https://github.com/yangrq1018
TaltaM | https://github.com/TaltaM
crackcomm | https://github.com/crackcomm
azhang | https://github.com/azhang
andreygrehov | https://github.com/andreygrehov
bretep | https://github.com/bretep
Christian-Achilli | https://github.com/Christian-Achilli
MarkDzulko | https://github.com/MarkDzulko
TaltaM | https://github.com/TaltaM
gam-phon | https://github.com/gam-phon
cornelk | https://github.com/cornelk
if1live | https://github.com/if1live
lozdog245 | https://github.com/lozdog245
tk42 | https://github.com/tk42
mshogin | https://github.com/mshogin
herenow | https://github.com/herenow
mshogin | https://github.com/mshogin
soxipy | https://github.com/soxipy
tk42 | https://github.com/tk42
daniel-cohen | https://github.com/daniel-cohen
DirectX | https://github.com/DirectX
frankzougc | https://github.com/frankzougc
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ Binaries will be published once the codebase reaches a stable condition.
|User|Contribution Amount|
|--|--|
| [thrasher-](https://github.com/thrasher-) | 658 |
| [shazbert](https://github.com/shazbert) | 222 |
| [shazbert](https://github.com/shazbert) | 223 |
| [gloriousCode](https://github.com/gloriousCode) | 190 |
| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 88 |
| [xtda](https://github.com/xtda) | 47 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 22 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 23 |
| [Rots](https://github.com/Rots) | 15 |
| [vazha](https://github.com/vazha) | 15 |
| [ermalguni](https://github.com/ermalguni) | 14 |
Expand All @@ -156,25 +156,26 @@ Binaries will be published once the codebase reaches a stable condition.
| [vadimzhukck](https://github.com/vadimzhukck) | 10 |
| [140am](https://github.com/140am) | 8 |
| [marcofranssen](https://github.com/marcofranssen) | 8 |
| [lrascao](https://github.com/lrascao) | 6 |
| [lrascao](https://github.com/lrascao) | 7 |
| [dackroyd](https://github.com/dackroyd) | 5 |
| [cranktakular](https://github.com/cranktakular) | 5 |
| [woshidama323](https://github.com/woshidama323) | 3 |
| [yangrq1018](https://github.com/yangrq1018) | 3 |
| [TaltaM](https://github.com/TaltaM) | 3 |
| [crackcomm](https://github.com/crackcomm) | 3 |
| [azhang](https://github.com/azhang) | 2 |
| [andreygrehov](https://github.com/andreygrehov) | 2 |
| [bretep](https://github.com/bretep) | 2 |
| [Christian-Achilli](https://github.com/Christian-Achilli) | 2 |
| [MarkDzulko](https://github.com/MarkDzulko) | 2 |
| [TaltaM](https://github.com/TaltaM) | 2 |
| [gam-phon](https://github.com/gam-phon) | 2 |
| [cornelk](https://github.com/cornelk) | 2 |
| [if1live](https://github.com/if1live) | 2 |
| [lozdog245](https://github.com/lozdog245) | 2 |
| [tk42](https://github.com/tk42) | 2 |
| [mshogin](https://github.com/mshogin) | 2 |
| [herenow](https://github.com/herenow) | 2 |
| [mshogin](https://github.com/mshogin) | 2 |
| [soxipy](https://github.com/soxipy) | 2 |
| [tk42](https://github.com/tk42) | 2 |
| [daniel-cohen](https://github.com/daniel-cohen) | 1 |
| [DirectX](https://github.com/DirectX) | 1 |
| [frankzougc](https://github.com/frankzougc) | 1 |
Expand Down
10 changes: 7 additions & 3 deletions backtester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,28 @@ An event-driven backtesting tool to test and iterate trading strategies using hi
- CSV data import
- Database data import
- Proof of concept live data running
- Shopspring decimal implementation to track stats more accurately
- Can run strategies against multiple cryptocurrencies
- Can run strategies that can assess multiple currencies simultaneously to make complex decisions
- Dollar cost strategy implementation
- RSI strategy implementation
- Dollar cost strategy example strategies
- RSI example strategy
- MFI example strategy
- Rules customisation via config `.strat` files
- Strategy config builder application
- Strategy customisation without requiring recompilation. For example, customising RSI high, low and length values via config `.strat` files.
- Report generation
- Portfolio manager to help size orders based on config rules, risk and candle volume
- Order manager to place orders with customisable slippage estimator
- Helpful statistics to help determine whether a strategy was effective
- Compliance manager to keep snapshots of every transaction and their changes at every interval
- Exchange level funding allows funding to be shared across multiple currency pairs and to allow for complex strategy design
- Fund transfer. At a strategy level, transfer funds between exchanges to allow for complex strategy design

## Planned Features
We welcome pull requests on any feature for the Backtester! We will be especially appreciative of any contribution towards the following planned features:

| Feature | Description |
|---------|-------------|
| Add quote-based portfolio funding feature | Funds are currently currency-pair based which is helpful for running the same strategy against many pairs simultaneously. This feature would allow for shared funding pool for an overarching strategy |
| Add backtesting support for futures asset types | Spot trading is currently the only supported asset type. Futures trading greatly expands the Backtester's potential |
| Example futures pairs trading strategy | Providing a basic example will allow for esteemed traders to build and customise their own |
| Save Backtester results to database | This will allow for easier comparison of results over time |
Expand Down
Loading

0 comments on commit adf7659

Please sign in to comment.