Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change surplus based tests to use new data from orderbook #91

Merged
merged 6 commits into from
Jan 16, 2024

Conversation

fhenneke
Copy link
Contributor

@fhenneke fhenneke commented Dec 15, 2023

This PR addresses #90 for the competition surplus test and combinatorial auction test.

The main changes are:

  • Order information is fetched from the orderbook orders endpoint.
  • Execution data is obtained via the new data in the solver competition endpoint.
  • Fees and costs are not explicitly part of the test anymore.

Before, information on trades (order data and order execution) were read from calldata. For non-winning solutions this is not possible anymore. For the winning solution it is still possible. But due to changes to the ordering of orders in the competition data, it was not easy for me to reconstruct the link from uid to trade. Thus, all information is not obtained through the orderbook api.

In principle, information on fees for non-winning solutions could be computed from clearing prices in combination with effective buy and sell amount. This is not done here since fees do not matter for surplus. Also clearing prices are not yet part of the data in the competition endpoint.
Information on costs for non-winning solutions is and will not available. A test of the form fees >= costs had to be removed due to that.

The old code had a "bug" where only one execution per solver was studied. This is fixed now and the test should work correctly with solvers submitting multiple solutions. The fix required changing the data format for alternative solutions from a dict to a list

@fhenneke fhenneke requested a review from harisang December 15, 2023 11:53
@fhenneke fhenneke marked this pull request as ready for review December 19, 2023 13:34
@fhenneke fhenneke changed the title Change surplus test to use new data from orderbook Change surplus based tests to use new data from orderbook Dec 19, 2023
1) get bare response from orderbook api for a given uid
2) use order data from api and execution data from competition endpoint
   to create a Trade object
- uses new orderbook methods to obtain order data
- execution data is read from competition data. before it was read from
  calldata. the latter is not possible anymore for non-winning
  solutions.
- a check on fees being smaller than costs was removed. this might
  introduce a bit of noise. but the data on costs is not available with
  the new data format.
- `trade_alt_dict` was renamed to `trade_alt_list` and the type was
  changed from a dict to a list. this allows for the case of solvers
  submitting multiple solutions.
- removes dependence on web3 api. that api was used before for simple
  access to order information. since it is not easy to link that to uids
  and since the ordering in the competition data changed compared to the
  ordering in the call data, it became easiest to just query the order
  endpoint.
-
still need to find a better example settlement
it is used in two tests and only depends on the orderbook api at the moment.
- use `get_uid_trader` from `orderbook_api`
- remove dependency on web3api
- add more type information, which is required due to some function
  returning `Type | None` now
- remove using objective instead of surplus in case of small objective
  (the objective is not available from the competition endpoint anymore)
- remove old tests which used old competition data format
which were not really used and resulted in linter error
@fhenneke fhenneke force-pushed the new_competition_format branch from 289eb90 to d47e8b2 Compare December 30, 2023 09:59
@harisang
Copy link
Contributor

Although I still haven't done a proper review, I am approving since I am the blocking factor here, and let's see if there are any issues when this starts running (in any case, it will not really break anything at the current state of things).

@harisang harisang merged commit ec49411 into main Jan 16, 2024
4 checks passed
@harisang harisang deleted the new_competition_format branch January 16, 2024 09:00
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants