Inspiration
We are deeply inspired by multi-agent RL and economics.
What it does
Solve a realistic market economy in terms of equilibrium measures, in a non-cooperative game using ML. Typically RL solves global cooperative reward, but what if agents are competing? This introduces challenges for us. We adapt Saleforce-AI's ai-economist framework to adjust to solve for market equilibrium via established game playing AI from Deepmind's open_spiel.
How we built it
- Python, Tensorflow
- ai-economist (Salesforce Research)
- OpenSpiel (Deepmind)
Challenges we ran into
Problem: The algorithm for matching offers is not optimal, as it doesn’t execute the highest possible number of deals
The best idea in the auction, which is used in the original paper (the highest bid matched with the smallest offer), is that the offerors who are willing to get the smallest amount of money, and the bidder willing to pay the most significant amount, are both rewarded. It would seem somehow unfair if someone who is only ready to pay 10 for something gets it and someone prepared to pay 100 doesn’t. Where it fails is if, for example, 2 offers ask for 10 and 20, and there are 2 bids for 20 and 10. Here is the time to mention that an offer is a minimum amount the seller is willing to accept, and the bid is the maximum amount the buyer is willing to spend. In this case, I just mentioned that the algorithm would match the highest bid (20) with the lowest ask (10). However, after that, there is no way to match the person asking for 20 with the person ready to pay a maximum of 10.
My solution to this problem is the following: Firstly, we order the list of asks and bids in ascending order. Then we start comparing the smallest “ask” with every element of the “bid” list until we reach one where the “bid” is higher than the “ask”, which is a potential deal. Then we proceed with the following “ask” and do the same thing, however, starting from the “bid” with an index 1 higher than the index of the “bid” that was matched in the last prospective deal. After doing this for every “ask”, we have the number of deals that can be done ( as a matter of fact, that is the highest possible number of deals). I called these “prospective” deals because if we execute them, it could be the case that the highest “bid” doesn’t get a match. For example: bids: 10 20 30 asks: 9 19 Using my method, the 10 “bid” will be matched with the 9 “ask,” and the 20 “bid” will be matched with the 19 “ask,” which would leave the 30 “bid” without a deal. As we previously mentioned, our goal is for the highest “bid” and the lowest “ask” to always be matched. Therefore, we will match the highest “ask” that could be matched for a prospective deal with the highest “bid”. After that, do the same for the second largest "ask" and the corresponding "bid".
Accomplishments that we're proud of
- A better equality score eq(x) and Social Welfare Factor (swf).
- Better strategy to run economies on crypto exchanges.
What's next for MarketSolver
A blueprint for the future of crypto and AI.
Built With
- ai-economist
- open-spiel
- python
Log in or sign up for Devpost to join the conversation.