Added warning disclaimer.

This commit is contained in:
Geoff Taylor 2021-04-15 10:59:04 +01:00
parent f950bed04f
commit 29798a4480
9 changed files with 243 additions and 129 deletions

View File

@ -2,12 +2,24 @@
"cells": [
{
"cell_type": "markdown",
"id": "identified-granny",
"id": "subject-surprise",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "prompt-daniel",
"metadata": {},
"source": [
"# 🥭 Classes\n",
"\n",
"High-level classes to interact with Mango Markets.\n",
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook contains high-level classes to interact with Mango Markets.\n",
"\n",
"These often depend on structure layouts in [Layouts](Layouts.ipynb).\n",
"\n",
@ -19,7 +31,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "limited-basis",
"id": "designed-panic",
"metadata": {},
"outputs": [],
"source": [
@ -41,7 +53,7 @@
},
{
"cell_type": "markdown",
"id": "detected-horror",
"id": "naval-protest",
"metadata": {},
"source": [
"# Version enum\n",
@ -52,7 +64,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "discrete-permission",
"id": "clean-quarterly",
"metadata": {},
"outputs": [],
"source": [
@ -67,7 +79,7 @@
},
{
"cell_type": "markdown",
"id": "funky-vision",
"id": "rubber-triumph",
"metadata": {},
"source": [
"# AccountInfo class"
@ -76,7 +88,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "orange-circular",
"id": "friendly-express",
"metadata": {},
"outputs": [],
"source": [
@ -131,7 +143,7 @@
},
{
"cell_type": "markdown",
"id": "african-neutral",
"id": "applicable-consortium",
"metadata": {},
"source": [
"# SerumAccountFlags class\n",
@ -142,7 +154,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "solar-discussion",
"id": "meaning-london",
"metadata": {},
"outputs": [],
"source": [
@ -184,7 +196,7 @@
},
{
"cell_type": "markdown",
"id": "refined-genius",
"id": "inappropriate-detective",
"metadata": {},
"source": [
"# MangoAccountFlags class\n",
@ -195,7 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "greatest-uruguay",
"id": "affecting-employer",
"metadata": {},
"outputs": [],
"source": [
@ -228,7 +240,7 @@
},
{
"cell_type": "markdown",
"id": "plastic-growth",
"id": "infectious-cowboy",
"metadata": {},
"source": [
"# Index class"
@ -237,7 +249,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "rocky-constraint",
"id": "directed-cutting",
"metadata": {},
"outputs": [],
"source": [
@ -263,7 +275,7 @@
},
{
"cell_type": "markdown",
"id": "brown-buffalo",
"id": "nervous-ladder",
"metadata": {},
"source": [
"# AggregatorConfig class"
@ -272,7 +284,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "gross-panic",
"id": "spread-territory",
"metadata": {},
"outputs": [],
"source": [
@ -304,7 +316,7 @@
},
{
"cell_type": "markdown",
"id": "professional-small",
"id": "lovely-treasury",
"metadata": {},
"source": [
"# Round class"
@ -313,7 +325,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "greater-trash",
"id": "frozen-andrew",
"metadata": {},
"outputs": [],
"source": [
@ -337,7 +349,7 @@
},
{
"cell_type": "markdown",
"id": "acting-basketball",
"id": "seasonal-proof",
"metadata": {},
"source": [
"# Answer class"
@ -346,7 +358,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "julian-terrain",
"id": "secondary-connection",
"metadata": {},
"outputs": [],
"source": [
@ -371,7 +383,7 @@
},
{
"cell_type": "markdown",
"id": "tough-wildlife",
"id": "rotary-texture",
"metadata": {},
"source": [
"# Aggregator class"
@ -380,7 +392,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "auburn-contents",
"id": "residential-standard",
"metadata": {},
"outputs": [],
"source": [
@ -446,7 +458,7 @@
},
{
"cell_type": "markdown",
"id": "induced-transfer",
"id": "conventional-floating",
"metadata": {},
"source": [
"# BasketTokenMetadata class\n"
@ -455,7 +467,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "western-heaven",
"id": "shaped-defense",
"metadata": {},
"outputs": [],
"source": [
@ -479,7 +491,7 @@
},
{
"cell_type": "markdown",
"id": "modern-lodging",
"id": "electoral-moses",
"metadata": {},
"source": [
"# MarketMetadata class"
@ -488,7 +500,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "metric-throw",
"id": "developmental-sunglasses",
"metadata": {},
"outputs": [],
"source": [
@ -516,7 +528,7 @@
},
{
"cell_type": "markdown",
"id": "adaptive-harvard",
"id": "compliant-magic",
"metadata": {},
"source": [
"# Group class"
@ -525,7 +537,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "catholic-garlic",
"id": "turkish-utilization",
"metadata": {},
"outputs": [],
"source": [
@ -643,7 +655,7 @@
},
{
"cell_type": "markdown",
"id": "advised-briefs",
"id": "entitled-lender",
"metadata": {},
"source": [
"# TokenAccount class"
@ -652,7 +664,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "specialized-middle",
"id": "defensive-massage",
"metadata": {},
"outputs": [],
"source": [
@ -684,7 +696,7 @@
},
{
"cell_type": "markdown",
"id": "funded-sharp",
"id": "multiple-bookmark",
"metadata": {},
"source": [
"# OpenOrders class\n"
@ -693,7 +705,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ordered-begin",
"id": "rough-start",
"metadata": {},
"outputs": [],
"source": [
@ -793,7 +805,7 @@
},
{
"cell_type": "markdown",
"id": "crucial-demonstration",
"id": "standard-advisory",
"metadata": {},
"source": [
"# BalanceSheet class"
@ -802,7 +814,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "strategic-aircraft",
"id": "reduced-chase",
"metadata": {},
"outputs": [],
"source": [
@ -838,7 +850,7 @@
},
{
"cell_type": "markdown",
"id": "starting-nutrition",
"id": "protective-timer",
"metadata": {},
"source": [
"# MarginAccount class\n"
@ -847,7 +859,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "agreed-incidence",
"id": "independent-pressing",
"metadata": {},
"outputs": [],
"source": [
@ -1015,7 +1027,7 @@
},
{
"cell_type": "markdown",
"id": "extended-listening",
"id": "foreign-diary",
"metadata": {},
"source": [
"# Running"
@ -1024,7 +1036,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "wired-andorra",
"id": "outside-library",
"metadata": {},
"outputs": [],
"source": [

View File

@ -2,18 +2,30 @@
"cells": [
{
"cell_type": "markdown",
"id": "periodic-education",
"id": "handy-minimum",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "upper-ethiopia",
"metadata": {},
"source": [
"# 🥭 Constants\n",
"\n",
"Some hard-coded values, all kept in one place."
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook contains some hard-coded values, all kept in one place, as well as the mechanism for loading the Mango `ids.json` file."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "recreational-fellowship",
"id": "weekly-surgeon",
"metadata": {},
"outputs": [],
"source": [
@ -25,7 +37,7 @@
},
{
"cell_type": "markdown",
"id": "marine-skiing",
"id": "employed-chapter",
"metadata": {},
"source": [
"## SYSTEM_PROGRAM_ADDRESS\n",
@ -36,7 +48,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "matched-variance",
"id": "driving-fever",
"metadata": {},
"outputs": [],
"source": [
@ -45,7 +57,7 @@
},
{
"cell_type": "markdown",
"id": "champion-advance",
"id": "electrical-philosophy",
"metadata": {},
"source": [
"## SOL_DECIMAL_DIVISOR decimal\n",
@ -56,7 +68,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "eastern-broadway",
"id": "current-mystery",
"metadata": {},
"outputs": [],
"source": [
@ -65,7 +77,7 @@
},
{
"cell_type": "markdown",
"id": "completed-saturn",
"id": "different-israeli",
"metadata": {},
"source": [
"## NUM_TOKENS\n",
@ -76,7 +88,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "rocky-adjustment",
"id": "driving-oakland",
"metadata": {},
"outputs": [],
"source": [
@ -85,7 +97,7 @@
},
{
"cell_type": "markdown",
"id": "suburban-negative",
"id": "sealed-clarity",
"metadata": {},
"source": [
"## NUM_MARKETS\n",
@ -96,7 +108,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bound-handling",
"id": "conceptual-function",
"metadata": {},
"outputs": [],
"source": [
@ -105,7 +117,7 @@
},
{
"cell_type": "markdown",
"id": "tough-difference",
"id": "prospective-vacation",
"metadata": {},
"source": [
"## MangoConstants\n",
@ -116,7 +128,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "blank-swaziland",
"id": "fiscal-delaware",
"metadata": {},
"outputs": [],
"source": [
@ -126,7 +138,7 @@
},
{
"cell_type": "markdown",
"id": "precious-climate",
"id": "adjustable-kitchen",
"metadata": {},
"source": [
"# Running\n",
@ -137,7 +149,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "forward-google",
"id": "secret-startup",
"metadata": {},
"outputs": [],
"source": [

View File

@ -2,18 +2,30 @@
"cells": [
{
"cell_type": "markdown",
"id": "ceramic-logic",
"id": "embedded-enlargement",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "unable-latin",
"metadata": {},
"source": [
"# 🥭 Context\n",
"\n",
"A `Context` object to manage Solana connection configuration and Mango groups."
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook contains a `Context` object to manage Solana connection configuration and Mango groups."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "roman-arrival",
"id": "suffering-camel",
"metadata": {},
"outputs": [],
"source": [
@ -32,7 +44,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "educational-investment",
"id": "difficult-october",
"metadata": {},
"outputs": [],
"source": [
@ -110,7 +122,7 @@
},
{
"cell_type": "markdown",
"id": "pointed-minimum",
"id": "narrative-missouri",
"metadata": {},
"source": [
"# default_context object\n",
@ -121,7 +133,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "advisory-workstation",
"id": "preliminary-reference",
"metadata": {},
"outputs": [],
"source": [
@ -140,7 +152,7 @@
},
{
"cell_type": "markdown",
"id": "disciplinary-shield",
"id": "incorporated-litigation",
"metadata": {},
"source": [
"# Running\n",
@ -151,7 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "welcome-hearing",
"id": "breeding-liberia",
"metadata": {},
"outputs": [],
"source": [

View File

@ -2,18 +2,30 @@
"cells": [
{
"cell_type": "markdown",
"id": "helpful-command",
"id": "inclusive-emerald",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "suitable-softball",
"metadata": {},
"source": [
"# 🥭 Decoder\n",
"\n",
"Some useful functions for decoding base64 and base58 data."
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook contains some useful functions for decoding base64 and base58 data."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "likely-gender",
"id": "analyzed-wheat",
"metadata": {},
"outputs": [],
"source": [
@ -26,7 +38,7 @@
},
{
"cell_type": "markdown",
"id": "ruled-percentage",
"id": "coordinated-services",
"metadata": {},
"source": [
"## decode_binary() function\n",
@ -45,7 +57,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "available-latvia",
"id": "infrared-george",
"metadata": {},
"outputs": [],
"source": [
@ -60,7 +72,7 @@
},
{
"cell_type": "markdown",
"id": "integrated-appendix",
"id": "rocky-scheme",
"metadata": {},
"source": [
"## encode_binary() function\n",
@ -71,7 +83,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "seven-buying",
"id": "included-archive",
"metadata": {},
"outputs": [],
"source": [
@ -81,7 +93,7 @@
},
{
"cell_type": "markdown",
"id": "automotive-eating",
"id": "coral-straight",
"metadata": {},
"source": [
"## encode_key() function\n",
@ -92,7 +104,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "minute-titanium",
"id": "hungry-microwave",
"metadata": {},
"outputs": [],
"source": [
@ -102,7 +114,7 @@
},
{
"cell_type": "markdown",
"id": "above-graduate",
"id": "affected-saint",
"metadata": {},
"source": [
"# Running\n",
@ -113,7 +125,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "deadly-norwegian",
"id": "western-power",
"metadata": {},
"outputs": [],
"source": [

View File

@ -2,12 +2,24 @@
"cells": [
{
"cell_type": "markdown",
"id": "tight-particular",
"id": "reliable-texture",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "chemical-episode",
"metadata": {},
"source": [
"# 🥭 Layouts\n",
"\n",
"Structure layouts to load the sometimes-opaque data blobs from Solana accounts.\n",
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook contains structure layouts to load the sometimes-opaque data blobs from Solana accounts.\n",
"\n",
"The idea is to have one data-encapsulating class (in [Classes](Classes.ipynb)) for each type, as well as one or more LAYOUT structures. So for example `Group` loads `GROUP` but in future will also be able to load `GROUP_V2`.\n",
"\n",
@ -21,7 +33,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "featured-exploration",
"id": "secret-substitute",
"metadata": {},
"outputs": [],
"source": [
@ -36,7 +48,7 @@
},
{
"cell_type": "markdown",
"id": "painted-citizenship",
"id": "focal-strength",
"metadata": {},
"source": [
"# Adapters\n",
@ -46,7 +58,7 @@
},
{
"cell_type": "markdown",
"id": "fuzzy-cambridge",
"id": "unexpected-sudan",
"metadata": {},
"source": [
"## DecimalAdapter class\n",
@ -57,7 +69,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "pretty-twenty",
"id": "multiple-hazard",
"metadata": {},
"outputs": [],
"source": [
@ -74,7 +86,7 @@
},
{
"cell_type": "markdown",
"id": "alternate-disposition",
"id": "smooth-natural",
"metadata": {},
"source": [
"## Float64Adapter class\n",
@ -90,7 +102,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "orange-router",
"id": "streaming-bones",
"metadata": {},
"outputs": [],
"source": [
@ -109,7 +121,7 @@
},
{
"cell_type": "markdown",
"id": "liberal-trout",
"id": "direct-david",
"metadata": {},
"source": [
"## PublicKeyAdapter\n",
@ -120,7 +132,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "tested-shame",
"id": "hydraulic-breed",
"metadata": {},
"outputs": [],
"source": [
@ -137,7 +149,7 @@
},
{
"cell_type": "markdown",
"id": "superb-consumer",
"id": "registered-findings",
"metadata": {},
"source": [
"## DatetimeAdapter\n",
@ -148,7 +160,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "express-duration",
"id": "minimal-myrtle",
"metadata": {},
"outputs": [],
"source": [
@ -167,7 +179,7 @@
},
{
"cell_type": "markdown",
"id": "several-child",
"id": "modern-franchise",
"metadata": {},
"source": [
"# SERUM_ACCOUNT_FLAGS\n",
@ -194,7 +206,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "indie-surgeon",
"id": "crude-webmaster",
"metadata": {},
"outputs": [],
"source": [
@ -215,7 +227,7 @@
},
{
"cell_type": "markdown",
"id": "acquired-republic",
"id": "mineral-queen",
"metadata": {},
"source": [
"# MANGO_ACCOUNT_FLAGS\n",
@ -240,7 +252,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "curious-thursday",
"id": "average-worse",
"metadata": {},
"outputs": [],
"source": [
@ -257,7 +269,7 @@
},
{
"cell_type": "markdown",
"id": "saved-conference",
"id": "communist-kuwait",
"metadata": {},
"source": [
"# INDEX\n",
@ -277,7 +289,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "acting-annotation",
"id": "demanding-state",
"metadata": {},
"outputs": [],
"source": [
@ -290,7 +302,7 @@
},
{
"cell_type": "markdown",
"id": "crazy-market",
"id": "polyphonic-dietary",
"metadata": {},
"source": [
"# AGGREGATOR_CONFIG\n",
@ -326,7 +338,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "atomic-senator",
"id": "effective-authority",
"metadata": {},
"outputs": [],
"source": [
@ -343,7 +355,7 @@
},
{
"cell_type": "markdown",
"id": "utility-accountability",
"id": "pharmaceutical-python",
"metadata": {},
"source": [
"# ROUND\n",
@ -362,7 +374,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "unlike-passage",
"id": "determined-transport",
"metadata": {},
"outputs": [],
"source": [
@ -375,7 +387,7 @@
},
{
"cell_type": "markdown",
"id": "essential-steal",
"id": "placed-quebec",
"metadata": {},
"source": [
"# ANSWER\n",
@ -395,7 +407,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "similar-result",
"id": "reflected-tackle",
"metadata": {},
"outputs": [],
"source": [
@ -409,7 +421,7 @@
},
{
"cell_type": "markdown",
"id": "macro-invention",
"id": "willing-preliminary",
"metadata": {},
"source": [
"# AGGREGATOR\n",
@ -436,7 +448,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "delayed-malpractice",
"id": "normal-rates",
"metadata": {},
"outputs": [],
"source": [
@ -453,7 +465,7 @@
},
{
"cell_type": "markdown",
"id": "protecting-finland",
"id": "premium-concrete",
"metadata": {},
"source": [
"# GROUP\n",
@ -499,7 +511,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "alpha-telescope",
"id": "stupid-consent",
"metadata": {},
"outputs": [],
"source": [
@ -530,7 +542,7 @@
},
{
"cell_type": "markdown",
"id": "expired-japan",
"id": "opponent-blackberry",
"metadata": {},
"source": [
"# TOKEN_ACCOUNT"
@ -539,7 +551,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cheap-birthday",
"id": "apart-period",
"metadata": {},
"outputs": [],
"source": [
@ -553,7 +565,7 @@
},
{
"cell_type": "markdown",
"id": "induced-latitude",
"id": "standing-journalism",
"metadata": {},
"source": [
"# OPEN_ORDERS\n",
@ -564,7 +576,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "animal-definition",
"id": "associate-commodity",
"metadata": {},
"outputs": [],
"source": [
@ -588,7 +600,7 @@
},
{
"cell_type": "markdown",
"id": "mature-banana",
"id": "armed-bidding",
"metadata": {},
"source": [
"# MARGIN_ACCOUNT\n",
@ -620,7 +632,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "lucky-wealth",
"id": "recent-interference",
"metadata": {},
"outputs": [],
"source": [
@ -637,7 +649,7 @@
},
{
"cell_type": "markdown",
"id": "clinical-subject",
"id": "tough-specific",
"metadata": {},
"source": [
"# Running"
@ -646,7 +658,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "soviet-information",
"id": "cosmetic-complaint",
"metadata": {},
"outputs": [],
"source": [

View File

@ -2,16 +2,34 @@
"cells": [
{
"cell_type": "markdown",
"id": "boring-principle",
"id": "surprising-klein",
"metadata": {},
"source": [
"# 🥭 Mango + Pandas 🐼🐼"
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "decimal-split",
"metadata": {},
"source": [
"# 🥭 Mango + Pandas 🐼🐼\n",
"\n",
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook loads margin account data into a Pandas `DataFrame`.\n",
"\n",
"The `DataFrame` is then queried for the total assets and liabilities, the Top 10 margin accounts with the most assets and the most liabilities, and then the Top 10 margin accounts closest to liquidation.\n",
"\n",
"The data remains in the `DataFrame` called `df` so you can easily add your own queries and analyses."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "expressed-creek",
"id": "geographic-constitutional",
"metadata": {},
"outputs": [],
"source": [
@ -68,7 +86,7 @@
},
{
"cell_type": "markdown",
"id": "rural-number",
"id": "boxed-leone",
"metadata": {},
"source": [
"# Total assets and liabilities"
@ -77,7 +95,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "optical-protocol",
"id": "comparable-threat",
"metadata": {},
"outputs": [],
"source": [
@ -89,7 +107,7 @@
},
{
"cell_type": "markdown",
"id": "hollow-smile",
"id": "vocational-possible",
"metadata": {},
"source": [
"# Top 10 margin accounts with most assets"
@ -98,7 +116,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "adopted-corrections",
"id": "handed-sussex",
"metadata": {},
"outputs": [],
"source": [
@ -107,7 +125,7 @@
},
{
"cell_type": "markdown",
"id": "executive-malawi",
"id": "brief-request",
"metadata": {},
"source": [
"# Top 10 margin accounts with most liabilities"
@ -116,7 +134,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "comparable-davis",
"id": "great-usage",
"metadata": {},
"outputs": [],
"source": [
@ -125,7 +143,7 @@
},
{
"cell_type": "markdown",
"id": "welsh-blake",
"id": "mysterious-madrid",
"metadata": {},
"source": [
"# Top 10 least collateralised margin accounts\n",
@ -136,7 +154,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "gothic-example",
"id": "welsh-piece",
"metadata": {},
"outputs": [],
"source": [

View File

@ -1,5 +1,12 @@
# 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](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gl/OpinionatedGeek%2Fmango-explorer/HEAD)
@ -8,9 +15,12 @@ This is the start of a project to explore and provide useful code for [Mango Mar
There are some notebook pages to explore Mango account structures for your own accounts.
The aim is also to have, at some point, a fully-functioning liquidator.
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.
The goal is not to be easy to use (although that would be nice!). The goal is to show you how the system works.
## 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
@ -55,7 +65,6 @@ Other notebooks are more user-oriented:
Still to come:
* More work on margin accounts and valuation
* Finding and showing liquidatable margin accounts
* A command-line tool to run a full liquidator
* 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](https://raw.githubusercontent.com/blockworks-foundation/mango-client-ts/main/src/ids.json) - it would be good if it could do without that.

View File

@ -2,11 +2,23 @@
"cells": [
{
"cell_type": "markdown",
"id": "sonic-somewhere",
"id": "vietnamese-transmission",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "aware-virgin",
"metadata": {},
"source": [
"# 🥭 Show All Accounts\n",
"\n",
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook tries to display information about all Mango margin accounts.\n",
"\n",
"It fetches the data from Solana, parses it, and then prints it.\n"
@ -14,7 +26,7 @@
},
{
"cell_type": "markdown",
"id": "addressed-society",
"id": "advance-cedar",
"metadata": {},
"source": [
"## How To Use This Page\n",
@ -25,7 +37,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "naked-notion",
"id": "instructional-wright",
"metadata": {},
"outputs": [],
"source": [
@ -102,4 +114,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}

View File

@ -2,11 +2,23 @@
"cells": [
{
"cell_type": "markdown",
"id": "acute-worker",
"id": "qualified-offset",
"metadata": {},
"source": [
"# ⚠ Warning\n",
"\n",
"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.\n"
]
},
{
"cell_type": "markdown",
"id": "threaded-quarter",
"metadata": {},
"source": [
"# 🥭 Show My Accounts\n",
"\n",
"_🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"This notebook tries to display information about all Mango margin accounts that belong to a specified account.\n",
"\n",
"It fetches the data from Solana, parses it, and then prints it.\n"
@ -14,7 +26,7 @@
},
{
"cell_type": "markdown",
"id": "blessed-concentration",
"id": "vital-quantity",
"metadata": {},
"source": [
"## How To Use This Page\n",
@ -25,7 +37,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "lonely-graham",
"id": "south-diving",
"metadata": {},
"outputs": [],
"source": [
@ -35,7 +47,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "prescription-basics",
"id": "vocal-congo",
"metadata": {},
"outputs": [],
"source": [
@ -43,6 +55,9 @@
"from Context import default_context\n",
"from Classes import AccountInfo, Group, MarginAccount\n",
"\n",
"if ACCOUNT_TO_LOOK_UP == \"\":\n",
" raise Exception(\"No account to look up - try setting the variable ACCOUNT_TO_LOOK_UP to an account public key.\")\n",
"\n",
"print(\"Context:\", default_context);\n",
"\n",
"root_account_key = PublicKey(ACCOUNT_TO_LOOK_UP)\n",