Backtest tool for Prosperity-3 trading competition, by team ADA Refactor.
Project description
How to use
-
pip install ada-prosperity3-backtest. Or, if you have already installed it, remember to upgrade frequently because the package is still in development, and there will be data update during the contest. -
The following commands can be used:
-
ada-prosperity3-backtest script.py --round x [--day y]This will run
script.pyfor you on roundxdayy.IfThe backtest tool should show you some information in the terminal.--dayis not specified, it will run on all days. [TODO]Currently, we only support round 0 day 0, which is the tutorial round.
-
After running, you should see a
ada_backtestfolder at the place you run the commandline, and inside there is alogfolder contaning backtest logs, which is compatible with the log output from the website, and ascriptfolder containing the script you run backtest on, with some additional comments at the beginning as a summary of the backtest result. The files are namedmmdd-HHMMSS-ffffff-hhhhhh.log/py, where mmdd is the month & date, HHMMSS is the hour, minute and second, ffffff is the microsecond, and hhhhhh is the hash of the script. -
Iterate your algorithm accordingly!
How it simulates
The backtest is based on the history prices and trades. For each timestamp, assume the timestamp is $t$, the following will happen:
- A
TradingStatewill be passed onto your trading algorithm. The state consists of:
-
Order depths based on the history prices at $t$.
-
Trades, both own trades and market trades, based on the trades simulated iat $t-1$.
-
Positions based on the position of the state at $t-1$, and the trades simulated at $t-1$.
-
And some other variables, also produced in the simulation.
-
Your
Trader.runwill be called. -
According to the response of your
Trader.run, for each product, the following will happen:
-
Your position and order quantity will be checked. If not satisfying the position limit, all orders will be canceled.
-
Your trades will try to match with the current order depth. Successful matches will result in immediate changes.
-
The history trades at $t$ will both try to match the current order depth and your orders, based on the price-time order. That is, we match the orders by price, and if at the same price both orders from
order_depthand your own order exist,order_depthwill be matched first because those orders are placed before you.
- During the simulation above, your own trades (happened in the current timestamp and ready to be passed to your algorithm for the next timestamp) are generated. The leftover trades from the next timestamp will be the market trades in the state passed to your algorithm in the next timestamp.
Pros and cons
The following are some pros and cons of this backtester.
Pros:
-
Strict price-order match of incoming trades, so that at the same price the market order depth will be first filled, then yours, simulating the situation that their orders have a higher priority than you.
-
Backup of your code, so that you know what to submit if you would like to rely on the metric of this backtester.
Cons:
-
Still in development, and not tested in real contests. This may lead to some instability.
-
The backtester may underestimate your performance, because you actively trading in the contest will likely trigger more trades with you, giving you more profit, or because of other reasons.
-
The backtester may also overestimate your performance, because of overfitting or other reasons.
TODO List
-
Generate log files that are compatible with the log files from the website backtest.
-
First part: lambda logs
-
Second part: Prices history
-
Third part: Trades history
-
-
Support running on all days at the same time.
-
Support data from Prosperity2 to test the usage at a larger scale.
-
Support conversions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ada_prosperity3_backtest-0.1.1.tar.gz.
File metadata
- Download URL: ada_prosperity3_backtest-0.1.1.tar.gz
- Upload date:
- Size: 49.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e55a661609843910a9ab0b2ff1b3f6465065981179f8b07c17a9a18ed013465
|
|
| MD5 |
860776f2479a4f29d88e423a3dc5373e
|
|
| BLAKE2b-256 |
0484b1a2e727829ee601d7a664b11b43f11141aba0fed5654aee04080dfa0511
|
File details
Details for the file ada_prosperity3_backtest-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ada_prosperity3_backtest-0.1.1-py3-none-any.whl
- Upload date:
- Size: 54.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e42f15af051445319cd3da90d0d97db9d826b0f9f0438ff2766a812ef9d1c58
|
|
| MD5 |
caa873063dddb4f4d1e6076137c5f43e
|
|
| BLAKE2b-256 |
d4cb924948b226048594433bccffc2c6f93e5b53f97b12d3c95096bce1055720
|