Go to file
Geoff Taylor f392174e10 Added Binder link to header of all notebooks.
This is so that anyone viewing a notebook on GitLab has an easy way to launch and run it.
2021-04-17 17:47:17 +01:00
bin Initial import. 2021-04-14 16:51:39 +01:00
meta/startup Initial import. 2021-04-14 16:51:39 +01:00
.dockerignore Initial import. 2021-04-14 16:51:39 +01:00
.envrc Initial import. 2021-04-14 16:51:39 +01:00
.gitignore Initial import. 2021-04-14 16:51:39 +01:00
Classes.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
Constants.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
Context.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
Decoder.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
Dockerfile Initial import. 2021-04-14 16:51:39 +01:00
LICENSE Initial import. 2021-04-14 16:51:39 +01:00
Layouts.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
Pandas.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
README.md Added warning disclaimer. 2021-04-15 10:59:04 +01:00
ShowAllAccounts.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
ShowMyAccounts.ipynb Added Binder link to header of all notebooks. 2021-04-17 17:47:17 +01:00
ids.json Initial import. 2021-04-14 16:51:39 +01:00
requirements.txt Initial import. 2021-04-14 16:51:39 +01:00

README.md

Mango Explorer

⚠ Warning

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Introduction

I am not yet confident in the figures and calculations. Please don't rely on this code yet!

Run these notebooks on Binder: Binder

This is the start of a project to explore and provide useful code for Mango Markets.

There are some notebook pages to explore Mango account structures for your own accounts.

The goal is not to be easy to use (although that would be nice!). The goal is to show you how the system works and allow you to use some simeple code to interact with it.

Running the notebooks

Most notebooks are currently 'runnable' - if you open them in your browser and press the 'fast-forward' button () on the toolbar

Show your Mango margin accounts

To try this out, go to the Show My Accounts page and enter your public key. (Note: I know you're running untrusted code, but it can't do much if you only give it your public key.)

Show all Mango margin accounts

To try this out, go to the Show All Accounts page and run the code.

Load all margin accounts into a Pandas DataFrame

To try this out, go to the Pandas page and run the code.

Pandas is a data analysis and manipulation tool and it's useful for sorting and slicing large data sets.

The Pandas page can currently show you:

  • The total assets and liabilities currently in Mango Markets margin accounts.
  • The top ten margin accounts with the most assets.
  • The top ten margin accounts with the most liabilities.
  • The top ten margin accounts with the lowest collateralisation.

Structure of this project

The code is (nearly) all Python in Jupyter Notebooks.

Some notebooks are more code files than useful notebooks themselves (although being able to easily run the code is still a boon):

  • The Layouts notebook contains the low-level Python data structures for interpreting raw Solana program data.
  • The Classes notebook contains higher-level classes for loading and working with that data.

Other notebooks are more user-oriented:

  • Show My Accounts to show data pertaining to a single Mango Markets margin account.
  • Show All Accounts to show data for all Mango Markets margin accounts.
  • Pandas to load data into a Pandas DataFrame to allow for further manipulation and analysis.

TODO

Still to come:

  • More work on margin accounts and valuation
  • Finding and showing liquidatable margin accounts
  • Performance of code that loads all margin accounts is much too slow and needs to be improved.
  • The notebooks use hard-coded data from the Mango Client - it would be good if it could do without that.

Don't hold your breath waiting for these!

Support

You can contact me @OpinionatedGeek on Twitter.