Skip to main content

Backtest tool for Prosperity-3 trading competition, by team ADA Refactor.

Reason this release was yanked:

buggy

Project description

How to use

  1. 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.

  2. The following commands can be used:

  • ada-prosperity3-backtest script.py --round x [--day y]

    This will run script.py for you on round x day y. If --day is not specified, it will run on all days. [TODO]The backtest tool should show you some information in the terminal.

    Currently, we only support round 0 day 0, which is the tutorial round.

  1. After running, you should see a ada_backtest folder at the place you run the commandline, and inside there is a log folder contaning backtest logs, which is compatible with the log output from the website, and a script folder containing the script you run backtest on, with some additional comments at the beginning as a summary of the backtest result. The files are named mmdd-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.

  2. 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:

  1. A TradingState will 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.

  1. Your Trader.run will be called.

  2. 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_depth and your own order exist, order_depth will be matched first because those orders are placed before you.

  1. 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:

  1. 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.

  2. Backup of your code, so that you know what to submit if you would like to rely on the metric of this backtester.

Cons:

  1. Still in development, and not tested in real contests. This may lead to some instability.

  2. 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.

  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ada_prosperity3_backtest-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ada_prosperity3_backtest-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file ada_prosperity3_backtest-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ada_prosperity3_backtest-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62d59e152af8393e87bf2634abfa0ce3ac0fa269ed74ae16facac509196ba628
MD5 7e5b1c8c7b173d893070ede792e67843
BLAKE2b-256 42e59192b7ddc72870dc591c6b3a4b38e2df6ba64914ad0ca249bf2263d1c598

See more details on using hashes here.

File details

Details for the file ada_prosperity3_backtest-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ada_prosperity3_backtest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f422b3779b95b75d27f69ea1dee6f54ade832714aeca035926b2200eba0bd45
MD5 0376e0d6035939cba56f3acb3530087c
BLAKE2b-256 0097027b49774682667e38b522273695bb6c9479a8454a76c1446c3b84997203

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page