mango-explorer/ShowRipeMarginAccounts.ipynb

133 lines
4.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"id": "identical-ivory",
"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",
"\n",
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gl/OpinionatedGeek%2Fmango-explorer/HEAD?filepath=ShowRipeMarginAccounts.ipynb) _🏃 To run this notebook press the ⏩ icon in the toolbar above._\n",
"\n",
"[🥭 Mango Markets](https://mango.markets/) support is available at: [Docs](https://docs.mango.markets/) | [Discord](https://discord.gg/67jySBhxrg) | [Twitter](https://twitter.com/mangomarkets) | [Github](https://github.com/blockworks-foundation) | [Email](mailto:hello@blockworks.foundation)"
]
},
{
"cell_type": "markdown",
"id": "express-bottom",
"metadata": {},
"source": [
"# 🥭 Show Ripe Margin Accounts\n",
"\n",
"This notebook tries to display information about all 'ripe' Mango Markets margin accounts. A 'ripe' margin account is one where the collateral ratio is less than the Initial Collateral Ratio but more than the Maintenance Collateral Ratio.\n",
"\n",
"It fetches the data from Solana, parses it, and then prints it.\n"
]
},
{
"cell_type": "markdown",
"id": "quantitative-natural",
"metadata": {},
"source": [
"## How To Use This Page\n",
"\n",
"Configure the `Context` for the `Group` you want to load, or just use as-is for the default `Group`.\n",
"\n",
"For example, to change to the _BTC_ETH_USDT_ `Group`, use:\n",
"```\n",
"default_context = default_context.new_from_group_name(\"BTC_ETH_USDT\")\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "sticky-button",
"metadata": {
"tags": [
"outputPrepend"
]
},
"outputs": [],
"source": [
"if __name__ == \"__main__\":\n",
" import mango\n",
"\n",
" group = mango.Group.load(mango.default_context)\n",
"\n",
" ripe_margin_accounts = mango.MarginAccount.load_ripe(mango.default_context, group)\n",
" print(f\"Fetched {len(ripe_margin_accounts)} ripe margin account(s).\")\n",
" print(*ripe_margin_accounts, sep=\"\\n\")\n"
]
}
],
"metadata": {
"kernelspec": {
"name": "python39464bit39b046140da4445497cec6b3acc85e88",
"display_name": "Python 3.9.4 64-bit"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
},
"metadata": {
"interpreter": {
"hash": "ac2eaa0ea0ebeafcc7822e65e46aa9d4f966f30b695406963e145ea4a91cd4fc"
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}