|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": null, |
| 5 | + "execution_count": 11, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [], |
8 | 8 | "source": [ |
9 | | - "import nibiru" |
| 9 | + "import nibiru\n", |
| 10 | + "\n", |
| 11 | + "import json" |
10 | 12 | ] |
11 | 13 | }, |
12 | 14 | { |
13 | 15 | "cell_type": "code", |
14 | | - "execution_count": null, |
| 16 | + "execution_count": 12, |
15 | 17 | "metadata": {}, |
16 | | - "outputs": [], |
| 18 | + "outputs": [ |
| 19 | + { |
| 20 | + "data": { |
| 21 | + "text/plain": [ |
| 22 | + "'0.20.0b5'" |
| 23 | + ] |
| 24 | + }, |
| 25 | + "execution_count": 12, |
| 26 | + "metadata": {}, |
| 27 | + "output_type": "execute_result" |
| 28 | + } |
| 29 | + ], |
17 | 30 | "source": [ |
18 | 31 | "nibiru.__version__" |
19 | 32 | ] |
20 | 33 | }, |
21 | 34 | { |
| 35 | + "attachments": {}, |
22 | 36 | "cell_type": "markdown", |
23 | 37 | "metadata": {}, |
24 | 38 | "source": [ |
|
40 | 54 | }, |
41 | 55 | { |
42 | 56 | "cell_type": "code", |
43 | | - "execution_count": null, |
| 57 | + "execution_count": 3, |
44 | 58 | "metadata": {}, |
45 | 59 | "outputs": [], |
46 | 60 | "source": [ |
47 | | - "network = nibiru.Network.devnet()" |
| 61 | + "network = nibiru.Network.testnet(1)" |
48 | 62 | ] |
49 | 63 | }, |
50 | 64 | { |
| 65 | + "attachments": {}, |
51 | 66 | "cell_type": "markdown", |
52 | 67 | "metadata": {}, |
53 | 68 | "source": [ |
|
56 | 71 | }, |
57 | 72 | { |
58 | 73 | "cell_type": "code", |
59 | | - "execution_count": null, |
| 74 | + "execution_count": 4, |
60 | 75 | "metadata": {}, |
61 | | - "outputs": [], |
| 76 | + "outputs": [ |
| 77 | + { |
| 78 | + "name": "stderr", |
| 79 | + "output_type": "stream", |
| 80 | + "text": [ |
| 81 | + "WARNING:root:The mnemonic used for the newly generated key is: \n", |
| 82 | + "coin cart alone walnut busy basket shiver october buddy lamp company diet nominee hover phrase acoustic forget repair intact noise assist mountain review win\n", |
| 83 | + "WARNING:root:Please write down this key, it will NOT be recoverable otherwise\n" |
| 84 | + ] |
| 85 | + } |
| 86 | + ], |
62 | 87 | "source": [ |
63 | 88 | "trader = nibiru.Sdk.authorize().with_network(network)" |
64 | 89 | ] |
65 | 90 | }, |
66 | 91 | { |
67 | 92 | "cell_type": "code", |
68 | | - "execution_count": null, |
| 93 | + "execution_count": 5, |
69 | 94 | "metadata": {}, |
70 | | - "outputs": [], |
| 95 | + "outputs": [ |
| 96 | + { |
| 97 | + "name": "stdout", |
| 98 | + "output_type": "stream", |
| 99 | + "text": [ |
| 100 | + "nibi17pz067rhcnyerjvn5lkzsf2ne3udtjmk7zjp3r\n" |
| 101 | + ] |
| 102 | + } |
| 103 | + ], |
71 | 104 | "source": [ |
72 | 105 | "print(trader.address)" |
73 | 106 | ] |
74 | 107 | }, |
75 | 108 | { |
| 109 | + "attachments": {}, |
76 | 110 | "cell_type": "markdown", |
77 | 111 | "metadata": {}, |
78 | 112 | "source": [ |
|
81 | 115 | }, |
82 | 116 | { |
83 | 117 | "cell_type": "code", |
84 | | - "execution_count": null, |
| 118 | + "execution_count": 17, |
85 | 119 | "metadata": {}, |
86 | | - "outputs": [], |
| 120 | + "outputs": [ |
| 121 | + { |
| 122 | + "name": "stdout", |
| 123 | + "output_type": "stream", |
| 124 | + "text": [ |
| 125 | + "[\n", |
| 126 | + " {\n", |
| 127 | + " \"id\": \"1\",\n", |
| 128 | + " \"address\": \"nibi1w00c7pqkr5z7ptewg5z87j2ncvxd88w43ug679\",\n", |
| 129 | + " \"poolParams\": {\n", |
| 130 | + " \"swapFee\": 0.01,\n", |
| 131 | + " \"exitFee\": 0.01,\n", |
| 132 | + " \"A\": \"0\"\n", |
| 133 | + " },\n", |
| 134 | + " \"poolAssets\": [\n", |
| 135 | + " {\n", |
| 136 | + " \"token\": {\n", |
| 137 | + " \"denom\": \"unibi\",\n", |
| 138 | + " \"amount\": \"16434695127\"\n", |
| 139 | + " },\n", |
| 140 | + " \"weight\": \"1073741824\"\n", |
| 141 | + " },\n", |
| 142 | + " {\n", |
| 143 | + " \"token\": {\n", |
| 144 | + " \"denom\": \"unusd\",\n", |
| 145 | + " \"amount\": \"2025755901517\"\n", |
| 146 | + " },\n", |
| 147 | + " \"weight\": \"1073741824\"\n", |
| 148 | + " }\n", |
| 149 | + " ],\n", |
| 150 | + " \"totalWeight\": \"2147483648\",\n", |
| 151 | + " \"totalShares\": {\n", |
| 152 | + " \"denom\": \"nibiru/pool/1\",\n", |
| 153 | + " \"amount\": \"16382308445118085345149\"\n", |
| 154 | + " }\n", |
| 155 | + " },\n", |
| 156 | + " {\n", |
| 157 | + " \"id\": \"2\",\n", |
| 158 | + " \"address\": \"nibi1vm70ju9n2laspspsh6fs2hu50z3qzf4m2emr0p\",\n", |
| 159 | + " \"poolParams\": {\n", |
| 160 | + " \"swapFee\": 0.01,\n", |
| 161 | + " \"exitFee\": 0.01,\n", |
| 162 | + " \"A\": \"10\",\n", |
| 163 | + " \"poolType\": \"STABLESWAP\"\n", |
| 164 | + " },\n", |
| 165 | + " \"poolAssets\": [\n", |
| 166 | + " {\n", |
| 167 | + " \"token\": {\n", |
| 168 | + " \"denom\": \"unusd\",\n", |
| 169 | + " \"amount\": \"336875701340\"\n", |
| 170 | + " },\n", |
| 171 | + " \"weight\": \"1073741824\"\n", |
| 172 | + " },\n", |
| 173 | + " {\n", |
| 174 | + " \"token\": {\n", |
| 175 | + " \"denom\": \"uusdt\",\n", |
| 176 | + " \"amount\": \"9586964043151\"\n", |
| 177 | + " },\n", |
| 178 | + " \"weight\": \"1073741824\"\n", |
| 179 | + " }\n", |
| 180 | + " ],\n", |
| 181 | + " \"totalWeight\": \"2147483648\",\n", |
| 182 | + " \"totalShares\": {\n", |
| 183 | + " \"denom\": \"nibiru/pool/2\",\n", |
| 184 | + " \"amount\": \"379679519187813492101905\"\n", |
| 185 | + " }\n", |
| 186 | + " }\n", |
| 187 | + "]\n" |
| 188 | + ] |
| 189 | + } |
| 190 | + ], |
87 | 191 | "source": [ |
88 | | - "trader.query.perp.params()" |
| 192 | + "print(json.dumps(trader.query.spot.pools(), indent=4))" |
89 | 193 | ] |
90 | 194 | }, |
91 | 195 | { |
92 | 196 | "cell_type": "code", |
93 | | - "execution_count": null, |
| 197 | + "execution_count": 20, |
94 | 198 | "metadata": {}, |
95 | | - "outputs": [], |
| 199 | + "outputs": [ |
| 200 | + { |
| 201 | + "name": "stdout", |
| 202 | + "output_type": "stream", |
| 203 | + "text": [ |
| 204 | + "{\n", |
| 205 | + " \"liquidity\": [\n", |
| 206 | + " {\n", |
| 207 | + " \"denom\": \"unibi\",\n", |
| 208 | + " \"amount\": \"16434695127\"\n", |
| 209 | + " },\n", |
| 210 | + " {\n", |
| 211 | + " \"denom\": \"unusd\",\n", |
| 212 | + " \"amount\": \"2025755901517\"\n", |
| 213 | + " }\n", |
| 214 | + " ]\n", |
| 215 | + "}\n" |
| 216 | + ] |
| 217 | + } |
| 218 | + ], |
96 | 219 | "source": [ |
97 | | - "trader.query.vpool.all_pools()" |
| 220 | + "print(json.dumps(trader.query.spot.total_pool_liquidity(1), indent=4))" |
98 | 221 | ] |
99 | 222 | }, |
100 | 223 | { |
101 | 224 | "cell_type": "code", |
102 | | - "execution_count": null, |
| 225 | + "execution_count": 19, |
103 | 226 | "metadata": {}, |
104 | | - "outputs": [], |
| 227 | + "outputs": [ |
| 228 | + { |
| 229 | + "name": "stdout", |
| 230 | + "output_type": "stream", |
| 231 | + "text": [ |
| 232 | + "{\n", |
| 233 | + " \"liquidity\": [\n", |
| 234 | + " {\n", |
| 235 | + " \"denom\": \"unibi\",\n", |
| 236 | + " \"amount\": \"16434695127\"\n", |
| 237 | + " },\n", |
| 238 | + " {\n", |
| 239 | + " \"denom\": \"unusd\",\n", |
| 240 | + " \"amount\": \"2362631602857\"\n", |
| 241 | + " },\n", |
| 242 | + " {\n", |
| 243 | + " \"denom\": \"uusdt\",\n", |
| 244 | + " \"amount\": \"9586964043151\"\n", |
| 245 | + " }\n", |
| 246 | + " ]\n", |
| 247 | + "}\n" |
| 248 | + ] |
| 249 | + } |
| 250 | + ], |
105 | 251 | "source": [ |
106 | | - "# Let's format the previous query\n", |
107 | | - "import json\n", |
108 | | - "print(json.dumps(trader.query.vpool.all_pools(), indent=4))" |
| 252 | + "print(json.dumps(trader.query.spot.total_liquidity(), indent=4))" |
109 | 253 | ] |
110 | 254 | }, |
111 | 255 | { |
| 256 | + "attachments": {}, |
112 | 257 | "cell_type": "markdown", |
113 | 258 | "metadata": {}, |
114 | 259 | "source": [ |
115 | 260 | "You can find the documentation on query you can execute on the official documentation website: https://nibiru-py.readthedocs.io/en/latest/nibiru.query_clients.html" |
116 | 261 | ] |
117 | 262 | }, |
118 | 263 | { |
| 264 | + "attachments": {}, |
119 | 265 | "cell_type": "markdown", |
120 | 266 | "metadata": {}, |
121 | 267 | "source": [] |
|
137 | 283 | "name": "python", |
138 | 284 | "nbconvert_exporter": "python", |
139 | 285 | "pygments_lexer": "ipython3", |
140 | | - "version": "3.10.4" |
| 286 | + "version": "3.8.16" |
141 | 287 | }, |
142 | 288 | "orig_nbformat": 4, |
143 | 289 | "vscode": { |
|
0 commit comments