Created
May 13, 2022 16:00
-
-
Save cvauclair/7625acf1ee9ab23ec62f378580270178 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from subgrounds.subgrounds import Subgrounds\n", | |
| "\n", | |
| "sg = Subgrounds()\n", | |
| "traderjoe = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange')" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<div>\n", | |
| "<style scoped>\n", | |
| " .dataframe tbody tr th:only-of-type {\n", | |
| " vertical-align: middle;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe tbody tr th {\n", | |
| " vertical-align: top;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe thead th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>pairs_name</th>\n", | |
| " <th>pairs_hourData_date</th>\n", | |
| " <th>pairs_hourData_reserveUSD</th>\n", | |
| " <th>pairs_hourData_volumeUSD</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>WAVAX-AZOT</td>\n", | |
| " <td>1640127600</td>\n", | |
| " <td>6.853671e-02</td>\n", | |
| " <td>135.597649</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>WAVAX-CORK</td>\n", | |
| " <td>1648432800</td>\n", | |
| " <td>2.435276e+00</td>\n", | |
| " <td>0.000000</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>WAVAX-CORK</td>\n", | |
| " <td>1648425600</td>\n", | |
| " <td>2.902809e+04</td>\n", | |
| " <td>24.110151</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>WAVAX-CORK</td>\n", | |
| " <td>1648422000</td>\n", | |
| " <td>2.906234e+04</td>\n", | |
| " <td>24.924910</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>WAVAX-CORK</td>\n", | |
| " <td>1648393200</td>\n", | |
| " <td>2.766184e+04</td>\n", | |
| " <td>4051.162292</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>5</th>\n", | |
| " <td>SGX-WAVAX</td>\n", | |
| " <td>1647993600</td>\n", | |
| " <td>4.784549e+00</td>\n", | |
| " <td>39.692602</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>6</th>\n", | |
| " <td>SGX-WAVAX</td>\n", | |
| " <td>1647975600</td>\n", | |
| " <td>3.102367e-15</td>\n", | |
| " <td>171779.721973</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>7</th>\n", | |
| " <td>SGX-WAVAX</td>\n", | |
| " <td>1647972000</td>\n", | |
| " <td>3.390346e+05</td>\n", | |
| " <td>129805.104159</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>8</th>\n", | |
| " <td>SGX-WAVAX</td>\n", | |
| " <td>1647968400</td>\n", | |
| " <td>3.346531e+05</td>\n", | |
| " <td>70153.928797</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>9</th>\n", | |
| " <td>SGX-WAVAX</td>\n", | |
| " <td>1647964800</td>\n", | |
| " <td>2.056567e+05</td>\n", | |
| " <td>2645.607188</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>10</th>\n", | |
| " <td>WGMI-WAVAX</td>\n", | |
| " <td>1643734800</td>\n", | |
| " <td>4.103091e-01</td>\n", | |
| " <td>0.000627</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>11</th>\n", | |
| " <td>WGMI-WAVAX</td>\n", | |
| " <td>1636898400</td>\n", | |
| " <td>5.395632e-01</td>\n", | |
| " <td>0.000000</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>12</th>\n", | |
| " <td>WGMI-WAVAX</td>\n", | |
| " <td>1636869600</td>\n", | |
| " <td>1.286517e+03</td>\n", | |
| " <td>12.387509</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>13</th>\n", | |
| " <td>WGMI-WAVAX</td>\n", | |
| " <td>1636855200</td>\n", | |
| " <td>1.229928e+03</td>\n", | |
| " <td>585.256183</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>14</th>\n", | |
| " <td>WGMI-WAVAX</td>\n", | |
| " <td>1636851600</td>\n", | |
| " <td>1.856106e+03</td>\n", | |
| " <td>741.835575</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>15</th>\n", | |
| " <td>MRSP-WAVAX</td>\n", | |
| " <td>1648098000</td>\n", | |
| " <td>1.946288e-01</td>\n", | |
| " <td>820.942430</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>16</th>\n", | |
| " <td>MRSP-WAVAX</td>\n", | |
| " <td>1648033200</td>\n", | |
| " <td>1.642326e+03</td>\n", | |
| " <td>4.236580</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>17</th>\n", | |
| " <td>MRSP-WAVAX</td>\n", | |
| " <td>1648029600</td>\n", | |
| " <td>1.201483e+05</td>\n", | |
| " <td>209940.375204</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>18</th>\n", | |
| " <td>WEB3-WAVAX</td>\n", | |
| " <td>1644598800</td>\n", | |
| " <td>1.433659e-01</td>\n", | |
| " <td>0.000000</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>19</th>\n", | |
| " <td>WEB3-WAVAX</td>\n", | |
| " <td>1644584400</td>\n", | |
| " <td>7.306449e+03</td>\n", | |
| " <td>170.622693</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>20</th>\n", | |
| " <td>WEB3-WAVAX</td>\n", | |
| " <td>1644580800</td>\n", | |
| " <td>6.981127e+03</td>\n", | |
| " <td>108.563160</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>21</th>\n", | |
| " <td>MOON-WAVAX</td>\n", | |
| " <td>1647428400</td>\n", | |
| " <td>1.458300e-02</td>\n", | |
| " <td>221.509123</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>22</th>\n", | |
| " <td>MOON-WAVAX</td>\n", | |
| " <td>1647360000</td>\n", | |
| " <td>4.357886e+02</td>\n", | |
| " <td>10.101222</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>23</th>\n", | |
| " <td>MOON-WAVAX</td>\n", | |
| " <td>1647352800</td>\n", | |
| " <td>4.067626e+02</td>\n", | |
| " <td>158375.504790</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>24</th>\n", | |
| " <td>MOON-WAVAX</td>\n", | |
| " <td>1647349200</td>\n", | |
| " <td>1.496111e+05</td>\n", | |
| " <td>43694.451793</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>25</th>\n", | |
| " <td>WAVAX-PNPL</td>\n", | |
| " <td>1647536400</td>\n", | |
| " <td>1.231884e-02</td>\n", | |
| " <td>101.133121</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>26</th>\n", | |
| " <td>WAVAX-PNPL</td>\n", | |
| " <td>1647442800</td>\n", | |
| " <td>1.785982e+02</td>\n", | |
| " <td>0.000000</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>27</th>\n", | |
| " <td>WAVAX-PNPL</td>\n", | |
| " <td>1647439200</td>\n", | |
| " <td>1.471443e+05</td>\n", | |
| " <td>17.715049</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>28</th>\n", | |
| " <td>WAVAX-PNPL</td>\n", | |
| " <td>1647435600</td>\n", | |
| " <td>1.470320e+05</td>\n", | |
| " <td>129449.916623</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>29</th>\n", | |
| " <td>WAVAX-PNPL</td>\n", | |
| " <td>1647432000</td>\n", | |
| " <td>1.467385e+05</td>\n", | |
| " <td>20498.166359</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>30</th>\n", | |
| " <td>SCR-WAVAX</td>\n", | |
| " <td>1637038800</td>\n", | |
| " <td>2.367309e-02</td>\n", | |
| " <td>0.000000</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>31</th>\n", | |
| " <td>SCR-WAVAX</td>\n", | |
| " <td>1636995600</td>\n", | |
| " <td>4.010205e+03</td>\n", | |
| " <td>50.811984</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>32</th>\n", | |
| " <td>WAVAX-SHIB</td>\n", | |
| " <td>1648526400</td>\n", | |
| " <td>5.864251e-02</td>\n", | |
| " <td>740.544034</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>33</th>\n", | |
| " <td>WAVAX-SHIB</td>\n", | |
| " <td>1648411200</td>\n", | |
| " <td>1.343841e+03</td>\n", | |
| " <td>86589.403411</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>34</th>\n", | |
| " <td>WAVAX-SHIB</td>\n", | |
| " <td>1648407600</td>\n", | |
| " <td>7.641150e+04</td>\n", | |
| " <td>72315.121979</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " pairs_name pairs_hourData_date pairs_hourData_reserveUSD \\\n", | |
| "0 WAVAX-AZOT 1640127600 6.853671e-02 \n", | |
| "1 WAVAX-CORK 1648432800 2.435276e+00 \n", | |
| "2 WAVAX-CORK 1648425600 2.902809e+04 \n", | |
| "3 WAVAX-CORK 1648422000 2.906234e+04 \n", | |
| "4 WAVAX-CORK 1648393200 2.766184e+04 \n", | |
| "5 SGX-WAVAX 1647993600 4.784549e+00 \n", | |
| "6 SGX-WAVAX 1647975600 3.102367e-15 \n", | |
| "7 SGX-WAVAX 1647972000 3.390346e+05 \n", | |
| "8 SGX-WAVAX 1647968400 3.346531e+05 \n", | |
| "9 SGX-WAVAX 1647964800 2.056567e+05 \n", | |
| "10 WGMI-WAVAX 1643734800 4.103091e-01 \n", | |
| "11 WGMI-WAVAX 1636898400 5.395632e-01 \n", | |
| "12 WGMI-WAVAX 1636869600 1.286517e+03 \n", | |
| "13 WGMI-WAVAX 1636855200 1.229928e+03 \n", | |
| "14 WGMI-WAVAX 1636851600 1.856106e+03 \n", | |
| "15 MRSP-WAVAX 1648098000 1.946288e-01 \n", | |
| "16 MRSP-WAVAX 1648033200 1.642326e+03 \n", | |
| "17 MRSP-WAVAX 1648029600 1.201483e+05 \n", | |
| "18 WEB3-WAVAX 1644598800 1.433659e-01 \n", | |
| "19 WEB3-WAVAX 1644584400 7.306449e+03 \n", | |
| "20 WEB3-WAVAX 1644580800 6.981127e+03 \n", | |
| "21 MOON-WAVAX 1647428400 1.458300e-02 \n", | |
| "22 MOON-WAVAX 1647360000 4.357886e+02 \n", | |
| "23 MOON-WAVAX 1647352800 4.067626e+02 \n", | |
| "24 MOON-WAVAX 1647349200 1.496111e+05 \n", | |
| "25 WAVAX-PNPL 1647536400 1.231884e-02 \n", | |
| "26 WAVAX-PNPL 1647442800 1.785982e+02 \n", | |
| "27 WAVAX-PNPL 1647439200 1.471443e+05 \n", | |
| "28 WAVAX-PNPL 1647435600 1.470320e+05 \n", | |
| "29 WAVAX-PNPL 1647432000 1.467385e+05 \n", | |
| "30 SCR-WAVAX 1637038800 2.367309e-02 \n", | |
| "31 SCR-WAVAX 1636995600 4.010205e+03 \n", | |
| "32 WAVAX-SHIB 1648526400 5.864251e-02 \n", | |
| "33 WAVAX-SHIB 1648411200 1.343841e+03 \n", | |
| "34 WAVAX-SHIB 1648407600 7.641150e+04 \n", | |
| "\n", | |
| " pairs_hourData_volumeUSD \n", | |
| "0 135.597649 \n", | |
| "1 0.000000 \n", | |
| "2 24.110151 \n", | |
| "3 24.924910 \n", | |
| "4 4051.162292 \n", | |
| "5 39.692602 \n", | |
| "6 171779.721973 \n", | |
| "7 129805.104159 \n", | |
| "8 70153.928797 \n", | |
| "9 2645.607188 \n", | |
| "10 0.000627 \n", | |
| "11 0.000000 \n", | |
| "12 12.387509 \n", | |
| "13 585.256183 \n", | |
| "14 741.835575 \n", | |
| "15 820.942430 \n", | |
| "16 4.236580 \n", | |
| "17 209940.375204 \n", | |
| "18 0.000000 \n", | |
| "19 170.622693 \n", | |
| "20 108.563160 \n", | |
| "21 221.509123 \n", | |
| "22 10.101222 \n", | |
| "23 158375.504790 \n", | |
| "24 43694.451793 \n", | |
| "25 101.133121 \n", | |
| "26 0.000000 \n", | |
| "27 17.715049 \n", | |
| "28 129449.916623 \n", | |
| "29 20498.166359 \n", | |
| "30 0.000000 \n", | |
| "31 50.811984 \n", | |
| "32 740.544034 \n", | |
| "33 86589.403411 \n", | |
| "34 72315.121979 " | |
| ] | |
| }, | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "pairs = traderjoe.Query.pairs(\n", | |
| " where={\n", | |
| " 'name_contains': 'WAVAX'\n", | |
| " },\n", | |
| " first=10\n", | |
| ")\n", | |
| "\n", | |
| "day_data = pairs.hourData(\n", | |
| " orderBy=traderjoe.PairHourData.date,\n", | |
| " orderDirection='desc',\n", | |
| " first=10\n", | |
| ")\n", | |
| "\n", | |
| "sg.query_df([\n", | |
| " pairs.name,\n", | |
| " day_data.date,\n", | |
| " day_data.reserveUSD,\n", | |
| " day_data.volumeUSD\n", | |
| "])" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "interpreter": { | |
| "hash": "2e9857869ef893fe3089fdeac74fc6a0e858b27488cc856a7fd4035853dadec4" | |
| }, | |
| "kernelspec": { | |
| "display_name": "Python 3.10.4 ('subgrounds-6wgS1ogI-py3.10')", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "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.10.4" | |
| }, | |
| "orig_nbformat": 4 | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment