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

[Draft] One example for disregarded utlitity optimization #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

josojo
Copy link
Contributor

@josojo josojo commented Sep 27, 2019

This Pr is not intended to be merged. Rather showing current work.

This PR contains a nasty example, showing how a manipulated orderbook could force market orders to be settled at their worst price using a fakeToken.

The output of the script is:


solution_expected_best_one.json
price 0.997002999001
Total utility: 0.97101096102
Total utility with disregarded util: -8799.12906907
Total utility for only S1 token: 0.97002999001

solution_best_disregarded_utility.json
price 0.907182909001
Total utility: 0.890816044491
Total utility with disregarded util: -267.463268901
Total utility for only S1 token: 0.071816982162

solution_expected_best_one_with_FT_to_null.json
price 0.997002999001
Total utility: 0.97101096102
Total utility with disregarded util: -99799.1290691
Total utility for only S1 token: 0.97002999001

It shows clearly that the additional market order from the FakeToken to the market-order BuyToken generates high disregarded utility for the expected best solution.

If the price of the FakeToken is set to zero, we need to have huge buyOrders buying the FakeToken, which would then have also a very high negative utility.

Hence the optimal solution would, in this case, be around a price 0.9 and hence exploit the market order.


testplan:
A test case (the one from dex-contracts) has been added, but to make it proper code, we would have to add much more and I don't know whether it is worth the effort...

@bh2smith
Copy link
Contributor

I think that this code should be merged and remain in a list of examples right here in the master branch of dex research. Is there any reason why it shouldn't? I don't see the benefit of leaving an open PR indefinitely if we want the information to be here.

This is really great work!

Copy link
Contributor

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this can be moved into the batch_auctions folder in a subdirectory called examples!

@josojo
Copy link
Contributor Author

josojo commented Sep 27, 2019

If we want to keep it, I have to clean it up more... Let's see what the other opinions are

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants