diff --git a/docs/cookbook.rst b/docs/cookbook.rst index de35df1..dbfafbd 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -19,7 +19,7 @@ ERC20 total_supply history .. image:: images/getting_started1.png -.. code:: +.. code:: # data from web3cat.data import ERC20Data @@ -46,10 +46,10 @@ ERC20 total_supply history for many tokens .. image:: images/getting_started2.png -.. code:: +.. code:: # data - + from web3cat.data import ERC20Data dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)] d_dai = ERC20Data(token="DAI", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) @@ -60,6 +60,23 @@ ERC20 total_supply history for many tokens .. image:: images/getting_started2_2.png +Many charts on one axis +----------------------- + +.. code:: + + from web3cat.view import View + from datetime import datetime + + v = View(y_axis_name="Total supply (USD)", start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \ + .total_supply(token="DAI") \ + .total_supply(token="USDC") \ + .chainlink_prices(token="DAI", base_token = "USD", y_axis_name = "USD Price") \ + .chainlink_prices(token="USDC", base_token = "USD", y_axis_name = "USD Price") + v.show() + +.. image:: images/getting_started2_3.png + ERC20 total_supply and price history ------------------------------------ @@ -85,7 +102,7 @@ ERC20 total_supply and price history dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)] d = ChainlinkData(tokens = ["WETH", "USDC"], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) - d.prices("WETH", "USDC", dates) + d.prices("WETH", "USDC", dates) .. image:: images/getting_started3_2.png @@ -149,11 +166,11 @@ Portfolio data breakdown by tokens base_tokens = ["USDC", "WETH"] v = View().portfolio_by_token( - addresses = addresses, - tokens = tokens, - base_token = "USDC", - start=datetime(2022, 6, 1), - end=datetime(2022, 7, 1), + addresses = addresses, + tokens = tokens, + base_token = "USDC", + start=datetime(2022, 6, 1), + end=datetime(2022, 7, 1), numpoints=10 ) v.show() @@ -165,11 +182,11 @@ Portfolio data breakdown by tokens from web3cat.data import PortfolioData d = PortfolioData( - tokens=tokens, - base_tokens=base_tokens, - addresses=addresses, - start=datetime(2022, 6, 1), - end=datetime(2022, 7, 1), + tokens=tokens, + base_tokens=base_tokens, + addresses=addresses, + start=datetime(2022, 6, 1), + end=datetime(2022, 7, 1), numpoints=10 ) d.breakdown_by_token("USDC") @@ -195,11 +212,11 @@ Portfolio data breakdown by addresses base_tokens = ["USDC", "WETH"] v = View().portfolio_by_address( - addresses = addresses, - tokens = tokens, - base_token = "USDC", - start=datetime(2022, 6, 1), - end=datetime(2022, 7, 1), + addresses = addresses, + tokens = tokens, + base_token = "USDC", + start=datetime(2022, 6, 1), + end=datetime(2022, 7, 1), numpoints=10 ) v.show() @@ -211,11 +228,11 @@ Portfolio data breakdown by addresses from web3cat.data import PortfolioData d = PortfolioData( - tokens=tokens, - base_tokens=base_tokens, - addresses=addresses, - start=datetime(2022, 6, 1), - end=datetime(2022, 7, 1), + tokens=tokens, + base_tokens=base_tokens, + addresses=addresses, + start=datetime(2022, 6, 1), + end=datetime(2022, 7, 1), numpoints=10 ) d.breakdown_by_address("USDC") diff --git a/docs/images/getting_started2_3.png b/docs/images/getting_started2_3.png new file mode 100644 index 0000000..108d232 Binary files /dev/null and b/docs/images/getting_started2_3.png differ diff --git a/examples/cookbook/cookbook.ipynb b/examples/cookbook/cookbook.ipynb index 216f5cd..7f84d59 100644 --- a/examples/cookbook/cookbook.ipynb +++ b/examples/cookbook/cookbook.ipynb @@ -1,2036 +1,2110 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "966e0e64-cc96-4501-827a-cd74827ef849", - "metadata": {}, - "outputs": [], - "source": [ - "import os, sys\n", - "sys.path.insert(1, os.path.join(sys.path[0], \"../..\"))" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "c15a4487-5622-4962-b4e9-f9306fe74965", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - " \n", - " Loading BokehJS ...\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function now() {\n", - " return new Date();\n", - " }\n", - "\n", - " const force = true;\n", - "\n", - " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", - " root._bokeh_onload_callbacks = [];\n", - " root._bokeh_is_loading = undefined;\n", - " }\n", - "\n", - "const JS_MIME_TYPE = 'application/javascript';\n", - " const HTML_MIME_TYPE = 'text/html';\n", - " const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n", - " const CLASS_NAME = 'output_bokeh rendered_html';\n", - "\n", - " /**\n", - " * Render data to the DOM node\n", - " */\n", - " function render(props, node) {\n", - " const script = document.createElement(\"script\");\n", - " node.appendChild(script);\n", - " }\n", - "\n", - " /**\n", - " * Handle when an output is cleared or removed\n", - " */\n", - " function handleClearOutput(event, handle) {\n", - " const cell = handle.cell;\n", - "\n", - " const id = cell.output_area._bokeh_element_id;\n", - " const server_id = cell.output_area._bokeh_server_id;\n", - " // Clean up Bokeh references\n", - " if (id != null && id in Bokeh.index) {\n", - " Bokeh.index[id].model.document.clear();\n", - " delete Bokeh.index[id];\n", - " }\n", - "\n", - " if (server_id !== undefined) {\n", - " // Clean up Bokeh references\n", - " const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n", - " cell.notebook.kernel.execute(cmd_clean, {\n", - " iopub: {\n", - " output: function(msg) {\n", - " const id = msg.content.text.trim();\n", - " if (id in Bokeh.index) {\n", - " Bokeh.index[id].model.document.clear();\n", - " delete Bokeh.index[id];\n", - " }\n", - " }\n", - " }\n", - " });\n", - " // Destroy server and session\n", - " const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n", - " cell.notebook.kernel.execute(cmd_destroy);\n", - " }\n", - " }\n", - "\n", - " /**\n", - " * Handle when a new output is added\n", - " */\n", - " function handleAddOutput(event, handle) {\n", - " const output_area = handle.output_area;\n", - " const output = handle.output;\n", - "\n", - " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n", - " if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n", - " return\n", - " }\n", - "\n", - " const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", - "\n", - " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n", - " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n", - " // store reference to embed id on output_area\n", - " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", - " }\n", - " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", - " const bk_div = document.createElement(\"div\");\n", - " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", - " const script_attrs = bk_div.children[0].attributes;\n", - " for (let i = 0; i < script_attrs.length; i++) {\n", - " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n", - " toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n", - " }\n", - " // store reference to server id on output_area\n", - " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", - " }\n", - " }\n", - "\n", - " function register_renderer(events, OutputArea) {\n", - "\n", - " function append_mime(data, metadata, element) {\n", - " // create a DOM node to render to\n", - " const toinsert = this.create_output_subarea(\n", - " metadata,\n", - " CLASS_NAME,\n", - " EXEC_MIME_TYPE\n", - " );\n", - " this.keyboard_manager.register_events(toinsert);\n", - " // Render to node\n", - " const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", - " render(props, toinsert[toinsert.length - 1]);\n", - " element.append(toinsert);\n", - " return toinsert\n", - " }\n", - "\n", - " /* Handle when an output is cleared or removed */\n", - " events.on('clear_output.CodeCell', handleClearOutput);\n", - " events.on('delete.Cell', handleClearOutput);\n", - "\n", - " /* Handle when a new output is added */\n", - " events.on('output_added.OutputArea', handleAddOutput);\n", - "\n", - " /**\n", - " * Register the mime type and append_mime function with output_area\n", - " */\n", - " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", - " /* Is output safe? */\n", - " safe: true,\n", - " /* Index of renderer in `output_area.display_order` */\n", - " index: 0\n", - " });\n", - " }\n", - "\n", - " // register the mime type if in Jupyter Notebook environment and previously unregistered\n", - " if (root.Jupyter !== undefined) {\n", - " const events = require('base/js/events');\n", - " const OutputArea = require('notebook/js/outputarea').OutputArea;\n", - "\n", - " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", - " register_renderer(events, OutputArea);\n", - " }\n", - " }\n", - " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", - " root._bokeh_timeout = Date.now() + 5000;\n", - " root._bokeh_failed_load = false;\n", - " }\n", - "\n", - " const NB_LOAD_WARNING = {'data': {'text/html':\n", - " \"
\\n\"+\n", - " \"

\\n\"+\n", - " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", - " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", - " \"

\\n\"+\n", - " \"\\n\"+\n", - " \"\\n\"+\n", - " \"from bokeh.resources import INLINE\\n\"+\n", - " \"output_notebook(resources=INLINE)\\n\"+\n", - " \"\\n\"+\n", - " \"
\"}};\n", - "\n", - " function display_loaded() {\n", - " const el = document.getElementById(\"1001\");\n", - " if (el != null) {\n", - " el.textContent = \"BokehJS is loading...\";\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " if (el != null) {\n", - " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n", - " }\n", - " } else if (Date.now() < root._bokeh_timeout) {\n", - " setTimeout(display_loaded, 100)\n", - " }\n", - " }\n", - "\n", - " function run_callbacks() {\n", - " try {\n", - " root._bokeh_onload_callbacks.forEach(function(callback) {\n", - " if (callback != null)\n", - " callback();\n", - " });\n", - " } finally {\n", - " delete root._bokeh_onload_callbacks\n", - " }\n", - " console.debug(\"Bokeh: all callbacks have finished\");\n", - " }\n", - "\n", - " function load_libs(css_urls, js_urls, callback) {\n", - " if (css_urls == null) css_urls = [];\n", - " if (js_urls == null) js_urls = [];\n", - "\n", - " root._bokeh_onload_callbacks.push(callback);\n", - " if (root._bokeh_is_loading > 0) {\n", - " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", - " return null;\n", - " }\n", - " if (js_urls == null || js_urls.length === 0) {\n", - " run_callbacks();\n", - " return null;\n", - " }\n", - " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", - " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", - "\n", - " function on_load() {\n", - " root._bokeh_is_loading--;\n", - " if (root._bokeh_is_loading === 0) {\n", - " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", - " run_callbacks()\n", - " }\n", - " }\n", - "\n", - " function on_error(url) {\n", - " console.error(\"failed to load \" + url);\n", - " }\n", - "\n", - " for (let i = 0; i < css_urls.length; i++) {\n", - " const url = css_urls[i];\n", - " const element = document.createElement(\"link\");\n", - " element.onload = on_load;\n", - " element.onerror = on_error.bind(null, url);\n", - " element.rel = \"stylesheet\";\n", - " element.type = \"text/css\";\n", - " element.href = url;\n", - " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", - " document.body.appendChild(element);\n", - " }\n", - "\n", - " for (let i = 0; i < js_urls.length; i++) {\n", - " const url = js_urls[i];\n", - " const element = document.createElement('script');\n", - " element.onload = on_load;\n", - " element.onerror = on_error.bind(null, url);\n", - " element.async = false;\n", - " element.src = url;\n", - " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", - " document.head.appendChild(element);\n", - " }\n", - " };\n", - "\n", - " function inject_raw_css(css) {\n", - " const element = document.createElement(\"style\");\n", - " element.appendChild(document.createTextNode(css));\n", - " document.body.appendChild(element);\n", - " }\n", - "\n", - " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n", - " const css_urls = [];\n", - "\n", - " const inline_js = [ function(Bokeh) {\n", - " Bokeh.set_log_level(\"info\");\n", - " },\n", - "function(Bokeh) {\n", - " }\n", - " ];\n", - "\n", - " function run_inline_js() {\n", - " if (root.Bokeh !== undefined || force === true) {\n", - " for (let i = 0; i < inline_js.length; i++) {\n", - " inline_js[i].call(root, root.Bokeh);\n", - " }\n", - "if (force === true) {\n", - " display_loaded();\n", - " }} else if (Date.now() < root._bokeh_timeout) {\n", - " setTimeout(run_inline_js, 100);\n", - " } else if (!root._bokeh_failed_load) {\n", - " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", - " root._bokeh_failed_load = true;\n", - " } else if (force !== true) {\n", - " const cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n", - " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n", - " }\n", - " }\n", - "\n", - " if (root._bokeh_is_loading === 0) {\n", - " console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", - " run_inline_js();\n", - " } else {\n", - " load_libs(css_urls, js_urls, function() {\n", - " console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n", - " run_inline_js();\n", - " });\n", - " }\n", - "}(window));" - ], - "application/vnd.bokehjs_load.v0+json": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n const NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n const el = document.getElementById(\"1001\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\nif (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n const cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from bokeh.io import output_notebook\n", - "\n", - "output_notebook()" - ] - }, - { - "cell_type": "markdown", - "id": "46a3fc1e-22c8-48db-badd-37eac6630a24", - "metadata": {}, - "source": [ - "## ERC20 total_supply history" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "263eae15-4a38-48df-a4d2-d53d3b4b3ac9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"b5081995-7f31-439f-9717-870d286def57\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1012\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1015\"},{\"id\":\"1019\"},{\"id\":\"1063\"}],\"extra_y_ranges\":{\"Total Supply (DAI)\":{\"id\":\"1034\"}},\"height\":400,\"left\":[{\"id\":\"1016\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1040\"}],\"title\":{\"id\":\"1042\"},\"toolbar\":{\"id\":\"1025\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1004\"},\"x_scale\":{\"id\":\"1008\"},\"y_range\":{\"id\":\"1006\"},\"y_scale\":{\"id\":\"1010\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1051\"},{\"id\":\"1052\"},{\"id\":\"1053\"},{\"id\":\"1054\"},{\"id\":\"1055\"},{\"id\":\"1056\"},{\"id\":\"1057\"},{\"id\":\"1058\"},{\"id\":\"1059\"},{\"id\":\"1060\"},{\"id\":\"1061\"},{\"id\":\"1062\"}]},\"id\":\"1013\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"axis_label\":\"Total Supply (DAI)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1032\"},\"group\":null,\"major_label_policy\":{\"id\":\"1045\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1017\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1016\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1032\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"ResetTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1042\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1038\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1017\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"Selection\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1036\"},\"glyph\":{\"id\":\"1037\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1039\"},\"nonselection_glyph\":{\"id\":\"1038\"},\"view\":{\"id\":\"1041\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1040\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1036\"}},\"id\":\"1041\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{\"end\":6991187911.750372,\"start\":5913637621.211409},\"id\":\"1034\",\"type\":\"Range1d\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1051\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis\":{\"id\":\"1016\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Line\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1052\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1047\"},\"group\":null,\"major_label_policy\":{\"id\":\"1048\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1013\"}},\"id\":\"1012\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1064\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1063\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"1022\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"AllLabels\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (DAI)\"},\"renderers\":[{\"id\":\"1040\"}]},\"id\":\"1064\",\"type\":\"LegendItem\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1058\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1056\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1062\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{\"tools\":[{\"id\":\"1020\"},{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"}]},\"id\":\"1025\",\"type\":\"Toolbar\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1053\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1054\",\"type\":\"DaysTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[6356967497.890762,6364934649.422396,6379797792.442471,6386615501.526691,6392405533.643571,6390611665.838041,6398258268.606213,6408784638.984876,6421836001.511718,6431736266.912669,6430396636.829009,6422909322.914442,6426152296.016416,6429815695.539608,6417774281.679432,6423394661.681578,6453141152.12594,6431646468.512369,6441917692.704989,6448839533.57255,6456301410.684096,6497258946.293305,6499444527.104263,6486320029.447839,6534877063.116443,6549289610.09979,6554884756.318319,6571907900.391269,6574878210.972765,6579250893.85401,6582839695.864539,6580438213.208079,6589137276.040197,6658274201.667021,6650957598.127004,6634536168.236113,6585698447.872364,6613104896.481943,6595995981.175662,6581182799.28903,6583138237.226998,6585466207.973809,6490846958.577853,6502682513.437105,6389960763.804107,6371025690.164766,6357209630.333568,6416833341.923558,6371088049.776331,6338965937.301879,6260908983.377477,6337944717.093331,6302160268.442526,6209319502.271979,6254800283.363329,6267740017.798262,6356920461.144691,6365376908.903307,6373664815.076807,6346059612.690147,6284483284.352605,6275110811.9771,6289568857.766864,6282255424.201239,6276707766.907315,6281899826.252139,6283733274.580786,6269013973.445624,6285255911.614891,6291181174.090234,6318427809.137272,6316492815.330228,6316002641.074398,6332854283.668871,6350066575.303977,6326838129.413195,6325875336.189344,6329732259.88656,6329812555.483136,6325208366.329371,6330165634.073638,6332654121.336827,6337016010.063661,6344371834.706901,6343043161.494389,6317624905.818079,6318744738.328617,6305218241.443946,6313386366.250676,6334038819.35618,6327577492.958534,6306217586.978034,6273296179.225146,6250595574.153788,6255050333.369556,6249614051.694564,6333608576.0757675,6321468220.627065,6324596014.414679,6319643548.182701,6319643548.182701]},\"selected\":{\"id\":\"1050\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1036\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1055\",\"type\":\"DaysTicker\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1039\",\"type\":\"Line\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1057\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1061\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1059\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"PanTool\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1060\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1012\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1015\",\"type\":\"Grid\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"b5081995-7f31-439f-9717-870d286def57\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"a8cd073b-caa3-49ae-9563-1382494835fe\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "1003" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "# visualization\n", - "\n", - "v = View(token=\"DAI\", start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", - " .total_supply()\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "288a79de-d699-4585-a785-b1bceed2f2d2", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "shape: (5, 4)\n", - "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 6.3570e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 6.4861e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 6.3625e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 6.3035e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 6.3196e9 │\n", - "└────────────┴─────────────────────┴──────────────┴──────────────┘\n" - ] - } - ], - "source": [ - "from web3cat.data import ERC20Data\n", - "d = ERC20Data(token=\"DAI\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "print(d.total_supply([datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]))\n" - ] - }, - { - "cell_type": "markdown", - "id": "7f5ec10b-3527-4701-9612-997a4458cf03", - "metadata": {}, - "source": [ - "## ERC20 total_supply history for many tokens" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "7d21580f-77d9-4d4b-b954-7310f883008e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"874f9d0c-11ef-4488-9a34-5ec3949a76c1\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1200\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1203\"},{\"id\":\"1207\"},{\"id\":\"1251\"}],\"extra_y_ranges\":{\"Total Supply (DAI)\":{\"id\":\"1222\"},\"Total Supply (USDC)\":{\"id\":\"1256\"}},\"height\":400,\"left\":[{\"id\":\"1204\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1228\"},{\"id\":\"1263\"}],\"right\":[{\"id\":\"1257\"}],\"title\":{\"id\":\"1230\"},\"toolbar\":{\"id\":\"1213\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1192\"},\"x_scale\":{\"id\":\"1196\"},\"y_range\":{\"id\":\"1194\"},\"y_scale\":{\"id\":\"1198\"}},\"id\":\"1191\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis_label\":\"Total Supply (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1254\"},\"group\":null,\"major_label_policy\":{\"id\":\"1270\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1269\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1257\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1235\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1225\",\"type\":\"Line\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1254\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1247\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1252\"},{\"id\":\"1290\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1251\",\"type\":\"Legend\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1260\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1277\",\"type\":\"Selection\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1245\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1248\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1230\",\"type\":\"Title\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1226\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1194\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1237\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1212\",\"type\":\"SaveTool\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1227\",\"type\":\"Line\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1244\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1249\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1224\"},\"glyph\":{\"id\":\"1225\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1227\"},\"nonselection_glyph\":{\"id\":\"1226\"},\"view\":{\"id\":\"1229\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1228\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[45717933372.29955,45796596212.89955,45820738122.02956,45699069171.309555,45847656244.669556,45830334486.31955,45808217272.49955,45767953200.63955,45773030860.43955,45759885521.79955,45676863349.96955,45747045438.849556,45739403408.85955,45733946091.54955,45721314704.089554,45713037923.20956,45651474178.67955,45754039307.379555,45653239070.059555,45645394434.43955,45412695842.78955,45392643199.32955,45454671794.21955,45443961403.089554,45523019279.809555,45519781830.27956,45552236447.54955,45440842460.17955,45374642602.239555,45424799196.82955,45494484223.57955,45512496662.06956,45452405993.059555,45520523189.60955,45557831404.04955,45600938755.65955,45605494923.339554,45626424249.03955,45686424249.03955,45722348089.03955,45778020821.72955,45867202840.13956,44991923063.86955,45610367414.57955,45651908175.70956,45513911656.47955,45422169960.20956,45452414806.29955,45573200329.99955,45716301404.85955,45679169506.81956,45816745248.72955,45901833481.629555,46016133096.29955,46010186122.31955,46223796701.56955,46411224609.809555,46436905164.86955,46457052719.90955,46500723966.61955,46579916155.03955,46575719898.22955,46834723881.70956,46994027355.739555,46993904379.50955,47052974753.95956,46999992890.879555,46851471311.52956,46880821159.27956,46977344659.86955,46968381825.02956,47015963910.82955,47131535467.699554,47025826738.78955,47051850508.89955,46912027635.129555,46817056705.35955,46815258696.169556,46850687299.31955,46965858737.849556,46930963626.99955,47003035999.79955,46990661976.32955,46990662076.32955,46990628483.13955,46986626748.00955,46983031443.24955,46975294081.52955,46935169638.03955,46854344000.52956,46759438017.07955,46772318097.63956,46703329464.419556,46724318897.20956,46720248310.199554,46755457862.68955,46783632868.90955,46768298100.56956,46747543148.739555,46714595691.25955,46714621321.25955]},\"selected\":{\"id\":\"1277\"},\"selection_policy\":{\"id\":\"1276\"}},\"id\":\"1259\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1250\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"1211\",\"type\":\"ResetTool\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1243\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1276\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1241\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1240\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1198\",\"type\":\"LinearScale\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (DAI)\"},\"renderers\":[{\"id\":\"1228\"}]},\"id\":\"1252\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1238\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1196\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1236\",\"type\":\"AllLabels\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1235\"},\"group\":null,\"major_label_policy\":{\"id\":\"1236\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1201\"}},\"id\":\"1200\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1239\"},{\"id\":\"1240\"},{\"id\":\"1241\"},{\"id\":\"1242\"},{\"id\":\"1243\"},{\"id\":\"1244\"},{\"id\":\"1245\"},{\"id\":\"1246\"},{\"id\":\"1247\"},{\"id\":\"1248\"},{\"id\":\"1249\"},{\"id\":\"1250\"}]},\"id\":\"1201\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1200\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1203\",\"type\":\"Grid\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1239\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"axis_label\":\"Total Supply (DAI)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1220\"},\"group\":null,\"major_label_policy\":{\"id\":\"1233\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1205\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1204\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1262\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1205\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1204\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1207\",\"type\":\"Grid\"},{\"attributes\":{\"tools\":[{\"id\":\"1208\"},{\"id\":\"1209\"},{\"id\":\"1210\"},{\"id\":\"1211\"},{\"id\":\"1212\"}]},\"id\":\"1213\",\"type\":\"Toolbar\"},{\"attributes\":{\"end\":6991187911.750372,\"start\":5913637621.211409},\"id\":\"1222\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1269\",\"type\":\"BasicTicker\"},{\"attributes\":{\"end\":49488112241.08453,\"start\":42849450537.01862},\"id\":\"1256\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1208\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1270\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1209\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1246\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (USDC)\"},\"renderers\":[{\"id\":\"1263\"}]},\"id\":\"1290\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1192\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1259\"}},\"id\":\"1264\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1261\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null},\"id\":\"1210\",\"type\":\"HoverTool\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1220\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1242\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1233\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"1224\"}},\"id\":\"1229\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1259\"},\"glyph\":{\"id\":\"1260\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1262\"},\"nonselection_glyph\":{\"id\":\"1261\"},\"view\":{\"id\":\"1264\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1263\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[6356967497.890762,6364934649.422396,6379797792.442471,6386615501.526691,6392405533.643571,6390611665.838041,6398258268.606213,6408784638.984876,6421836001.511718,6431736266.912669,6430396636.829009,6422909322.914442,6426152296.016416,6429815695.539608,6417774281.679432,6423394661.681578,6453141152.12594,6431646468.512369,6441917692.704989,6448839533.57255,6456301410.684096,6497258946.293305,6499444527.104263,6486320029.447839,6534877063.116443,6549289610.09979,6554884756.318319,6571907900.391269,6574878210.972765,6579250893.85401,6582839695.864539,6580438213.208079,6589137276.040197,6658274201.667021,6650957598.127004,6634536168.236113,6585698447.872364,6613104896.481943,6595995981.175662,6581182799.28903,6583138237.226998,6585466207.973809,6490846958.577853,6502682513.437105,6389960763.804107,6371025690.164766,6357209630.333568,6416833341.923558,6371088049.776331,6338965937.301879,6260908983.377477,6337944717.093331,6302160268.442526,6209319502.271979,6254800283.363329,6267740017.798262,6356920461.144691,6365376908.903307,6373664815.076807,6346059612.690147,6284483284.352605,6275110811.9771,6289568857.766864,6282255424.201239,6276707766.907315,6281899826.252139,6283733274.580786,6269013973.445624,6285255911.614891,6291181174.090234,6318427809.137272,6316492815.330228,6316002641.074398,6332854283.668871,6350066575.303977,6326838129.413195,6325875336.189344,6329732259.88656,6329812555.483136,6325208366.329371,6330165634.073638,6332654121.336827,6337016010.063661,6344371834.706901,6343043161.494389,6317624905.818079,6318744738.328617,6305218241.443946,6313386366.250676,6334038819.35618,6327577492.958534,6306217586.978034,6273296179.225146,6250595574.153788,6255050333.369556,6249614051.694564,6333608576.0757675,6321468220.627065,6324596014.414679,6319643548.182701,6319643548.182701]},\"selected\":{\"id\":\"1238\"},\"selection_policy\":{\"id\":\"1237\"}},\"id\":\"1224\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"1191\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"874f9d0c-11ef-4488-9a34-5ec3949a76c1\",\"root_ids\":[\"1191\"],\"roots\":{\"1191\":\"48a5b4e4-fa63-4901-bed6-ba097ab88118\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "1191" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "# visualization\n", - "\n", - "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", - " .total_supply(token=\"DAI\") \\\n", - " .total_supply(token=\"USDC\")\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "c8d04f06-bf18-4d9d-ae45-d94aed3de444", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "shape: (5, 4)\n", - "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 6.3570e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 6.4861e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 6.3625e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 6.3035e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 6.3196e9 │\n", - "└────────────┴─────────────────────┴──────────────┴──────────────┘\n", - "shape: (5, 4)\n", - "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 4.5718e10 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 4.5474e10 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 4.5413e10 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 4.6984e10 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 4.6715e10 │\n", - "└────────────┴─────────────────────┴──────────────┴──────────────┘\n" - ] - } - ], - "source": [ - "from web3cat.data import ERC20Data\n", - "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", - "d_dai = ERC20Data(token=\"DAI\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "d_usdc = ERC20Data(token=\"USDC\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "\n", - "print(d_dai.total_supply(dates))\n", - "print(d_usdc.total_supply(dates))\n" - ] - }, - { - "cell_type": "markdown", - "id": "dbd9e42c-78ca-4ff7-bb22-cbcb87b4a7a7", - "metadata": {}, - "source": [ - "## ERC20 total supply and price" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "b5f49fb9-cfd7-41e5-b6a4-2c2d607289ea", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"07b00a13-c3bd-45d7-9a86-7da00dc45da8\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1471\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1474\"},{\"id\":\"1478\"},{\"id\":\"1522\"}],\"extra_y_ranges\":{\"Total Supply (USDC)\":{\"id\":\"1493\"},\"WETH / USDC price\":{\"id\":\"1527\"}},\"height\":400,\"left\":[{\"id\":\"1475\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1499\"},{\"id\":\"1534\"}],\"right\":[{\"id\":\"1528\"}],\"title\":{\"id\":\"1501\"},\"toolbar\":{\"id\":\"1484\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1463\"},\"x_scale\":{\"id\":\"1467\"},\"y_range\":{\"id\":\"1465\"},\"y_scale\":{\"id\":\"1469\"}},\"id\":\"1462\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1547\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1523\"},{\"id\":\"1561\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1522\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1465\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[1934.5644468210671,1934.8428212236142,1940.9481528540323,1837.55583394018,1818.2540778185944,1825.1840912834787,1824.504077050756,1836.6380006077459,1823.9066792948583,1749.0249728656213,1760.5730604829973,1752.871100069749,1772.1512229311622,1775.4355116855895,1789.5596623795152,1790.9071611451827,1807.1263970149655,1805.103944608851,1884.0419431990217,1910.0471271774052,1860.146373808301,1748.0518280998567,1750.201624457503,1804.907851086414,1826.9040764837287,1804.4085148888194,1792.997124310726,1792.1546490626404,1797.0537473891745,1794.1209127601464,1793.6854291086463,1790.7978897695068,1743.8083965117441,1669.5120439780112,1672.7736131934032,1601.5792103948029,1535.9899846860924,1536.9022632264823,1467.42077228938,1534.2107686684644,1461.1531130175854,1320.2808854911634,1211.5335401938519,1261.145118878155,1165.3597933527399,1181.3733629737035,1222.8956754543615,1220.5054025695056,1032.1696523569403,1115.7429895893301,1225.0627678628541,1171.4002430755452,1087.9569694608406,1107.8205532403556,1087.1667005430104,1093.41622874398,1079.2225045513878,1077.397363819512,987.8949655670659,981.9268053062092,993.8856291457759,965.9430158357367,1030.30312766216,1128.607173176179,1063.2089384419626,1124.971172922527,1107.8379976178605,1125.6898298186507,1151.705615556345,1160.7004801208748,1117.3844706645157,1073.8750151352576,1098.2742541852874,1056.4609958184144,1083.2232495018454,1115.6577277649947,1132.7756679776523,1148.9872111406773,1166.3285932454744,1205.0454945802906,1223.408881948483,1228.5089189747516,1185.642612576056,1242.0540577805064,1242.6538363767725,1224.4363983785427,1240.8990292081392,1219.797321322923,1220.7169730827234,1190.5803849894394,1172.2101008535333,1223.9330855159446,1187.5551464115247,1142.1201223794096,1124.7165204655814,1117.8087841920285,1113.2752416916974,1086.498012163296,1029.9652369702337,1014.2260774038264,1014.2260774038264]},\"selected\":{\"id\":\"1548\"},\"selection_policy\":{\"id\":\"1547\"}},\"id\":\"1530\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1508\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1511\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1540\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1463\",\"type\":\"DataRange1d\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1491\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1509\",\"type\":\"Selection\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1497\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1532\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1541\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1521\",\"type\":\"YearsTicker\"},{\"attributes\":{\"end\":49488112241.08453,\"start\":42849450537.01862},\"id\":\"1493\",\"type\":\"Range1d\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1498\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1476\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"WETH / USDC price\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1525\"},\"group\":null,\"major_label_policy\":{\"id\":\"1541\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1540\"},\"y_range_name\":\"WETH / USDC price\"},\"id\":\"1528\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"Total Supply (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1491\"},\"group\":null,\"major_label_policy\":{\"id\":\"1504\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1476\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1475\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1469\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1467\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1506\"},\"group\":null,\"major_label_policy\":{\"id\":\"1507\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1472\"}},\"id\":\"1471\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1495\"},\"glyph\":{\"id\":\"1496\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1498\"},\"nonselection_glyph\":{\"id\":\"1497\"},\"view\":{\"id\":\"1500\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1499\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1533\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1471\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1474\",\"type\":\"Grid\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1520\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1479\",\"type\":\"PanTool\"},{\"attributes\":{\"axis\":{\"id\":\"1475\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1478\",\"type\":\"Grid\"},{\"attributes\":{\"tools\":[{\"id\":\"1479\"},{\"id\":\"1480\"},{\"id\":\"1481\"},{\"id\":\"1482\"},{\"id\":\"1483\"}]},\"id\":\"1484\",\"type\":\"Toolbar\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1510\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1504\",\"type\":\"AllLabels\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1510\"},{\"id\":\"1511\"},{\"id\":\"1512\"},{\"id\":\"1513\"},{\"id\":\"1514\"},{\"id\":\"1515\"},{\"id\":\"1516\"},{\"id\":\"1517\"},{\"id\":\"1518\"},{\"id\":\"1519\"},{\"id\":\"1520\"},{\"id\":\"1521\"}]},\"id\":\"1472\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1519\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1518\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1480\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"callback\":null},\"id\":\"1481\",\"type\":\"HoverTool\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1512\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[45717933372.29955,45796596212.89955,45820738122.02956,45699069171.309555,45847656244.669556,45830334486.31955,45808217272.49955,45767953200.63955,45773030860.43955,45759885521.79955,45676863349.96955,45747045438.849556,45739403408.85955,45733946091.54955,45721314704.089554,45713037923.20956,45651474178.67955,45754039307.379555,45653239070.059555,45645394434.43955,45412695842.78955,45392643199.32955,45454671794.21955,45443961403.089554,45523019279.809555,45519781830.27956,45552236447.54955,45440842460.17955,45374642602.239555,45424799196.82955,45494484223.57955,45512496662.06956,45452405993.059555,45520523189.60955,45557831404.04955,45600938755.65955,45605494923.339554,45626424249.03955,45686424249.03955,45722348089.03955,45778020821.72955,45867202840.13956,44991923063.86955,45610367414.57955,45651908175.70956,45513911656.47955,45422169960.20956,45452414806.29955,45573200329.99955,45716301404.85955,45679169506.81956,45816745248.72955,45901833481.629555,46016133096.29955,46010186122.31955,46223796701.56955,46411224609.809555,46436905164.86955,46457052719.90955,46500723966.61955,46579916155.03955,46575719898.22955,46834723881.70956,46994027355.739555,46993904379.50955,47052974753.95956,46999992890.879555,46851471311.52956,46880821159.27956,46977344659.86955,46968381825.02956,47015963910.82955,47131535467.699554,47025826738.78955,47051850508.89955,46912027635.129555,46817056705.35955,46815258696.169556,46850687299.31955,46965858737.849556,46930963626.99955,47003035999.79955,46990661976.32955,46990662076.32955,46990628483.13955,46986626748.00955,46983031443.24955,46975294081.52955,46935169638.03955,46854344000.52956,46759438017.07955,46772318097.63956,46703329464.419556,46724318897.20956,46720248310.199554,46755457862.68955,46783632868.90955,46768298100.56956,46747543148.739555,46714595691.25955,46714621321.25955]},\"selected\":{\"id\":\"1509\"},\"selection_policy\":{\"id\":\"1508\"}},\"id\":\"1495\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1515\",\"type\":\"DaysTicker\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1525\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1507\",\"type\":\"AllLabels\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (USDC)\"},\"renderers\":[{\"id\":\"1499\"}]},\"id\":\"1523\",\"type\":\"LegendItem\"},{\"attributes\":{\"end\":2037.995560496734,\"start\":919.9457293673682},\"id\":\"1527\",\"type\":\"Range1d\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1513\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1506\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1531\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1483\",\"type\":\"SaveTool\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1516\",\"type\":\"DaysTicker\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1501\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1548\",\"type\":\"Selection\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1496\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1530\"}},\"id\":\"1535\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1482\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"WETH / USDC price\"},\"renderers\":[{\"id\":\"1534\"}]},\"id\":\"1561\",\"type\":\"LegendItem\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1514\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1517\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1530\"},\"glyph\":{\"id\":\"1531\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1533\"},\"nonselection_glyph\":{\"id\":\"1532\"},\"view\":{\"id\":\"1535\"},\"y_range_name\":\"WETH / USDC price\"},\"id\":\"1534\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1495\"}},\"id\":\"1500\",\"type\":\"CDSView\"}],\"root_ids\":[\"1462\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"07b00a13-c3bd-45d7-9a86-7da00dc45da8\",\"root_ids\":[\"1462\"],\"roots\":{\"1462\":\"e87904eb-fa27-47f9-9d56-fee7da85f9f3\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "1462" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "# visualization\n", - "\n", - "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", - " .total_supply(token = \"USDC\") \\\n", - " .chainlink_prices(token=\"WETH\", base_token = \"USDC\")\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "b58e23c8-90e8-4b1a-8daa-cc64751d27b7", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "shape: (5, 4)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
\n", - "timestamp\n", - "\n", - "date\n", - "\n", - "block_number\n", - "\n", - "price\n", - "
\n", - "u64\n", - "\n", - "datetime[μs]\n", - "\n", - "u64\n", - "\n", - "f64\n", - "
\n", - "1654027190\n", - "\n", - "2022-05-31 23:59:50\n", - "\n", - "14880658\n", - "\n", - "1934.564447\n", - "
\n", - "1654631987\n", - "\n", - "2022-06-07 23:59:47\n", - "\n", - "14922671\n", - "\n", - "1859.267306\n", - "
\n", - "1655236792\n", - "\n", - "2022-06-14 23:59:52\n", - "\n", - "14963567\n", - "\n", - "1203.750861\n", - "
\n", - "1655841600\n", - "\n", - "2022-06-22 00:00:00\n", - "\n", - "15003956\n", - "\n", - "1125.700139\n", - "
\n", - "1656619189\n", - "\n", - "2022-06-30 23:59:49\n", - "\n", - "15052211\n", - "\n", - "1014.226077\n", - "
\n", - "
" - ], - "text/plain": [ - "shape: (5, 4)\n", - "┌────────────┬─────────────────────┬──────────────┬─────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ price │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪═════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 1934.564447 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 1859.267306 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 1203.750861 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 1125.700139 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 1014.226077 │\n", - "└────────────┴─────────────────────┴──────────────┴─────────────┘" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# data\n", - "\n", - "from web3cat.data import ChainlinkData\n", - "\n", - "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", - "d = ChainlinkData(tokens = [\"WETH\", \"USDC\"], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "d.prices(\"WETH\", \"USDC\", dates)" - ] - }, - { - "cell_type": "markdown", - "id": "d2a5334b-36b6-4b45-a28d-afec0a998e27", - "metadata": {}, - "source": [ - "## ERC20 and ETH balances" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "a2a2728b-48d8-475d-8f92-a756da03b46d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"b69a50bd-2104-4b8d-9f42-97a8e48507ae\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1767\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1770\"},{\"id\":\"1774\"},{\"id\":\"1818\"}],\"extra_y_ranges\":{\"Balance (ETH)\":{\"id\":\"1897\"},\"Balance (WBTC)\":{\"id\":\"1823\"}},\"height\":400,\"left\":[{\"id\":\"1771\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1795\"},{\"id\":\"1828\"},{\"id\":\"1864\"},{\"id\":\"1902\"}],\"right\":[{\"id\":\"1858\"}],\"title\":{\"id\":\"1797\"},\"toolbar\":{\"id\":\"1780\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1759\"},\"x_scale\":{\"id\":\"1763\"},\"y_range\":{\"id\":\"1761\"},\"y_scale\":{\"id\":\"1765\"}},\"id\":\"1758\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1919\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1794\",\"type\":\"Line\"},{\"attributes\":{\"end\":66886.04229508953},\"id\":\"1823\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1765\",\"type\":\"LinearScale\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]},\"selected\":{\"id\":\"1805\"},\"selection_policy\":{\"id\":\"1804\"}},\"id\":\"1791\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1761\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1920\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1840\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1839\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1791\"},\"glyph\":{\"id\":\"1792\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1794\"},\"nonselection_glyph\":{\"id\":\"1793\"},\"view\":{\"id\":\"1796\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"1795\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"format\":\"0.00a\"},\"id\":\"1787\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1759\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1791\"}},\"id\":\"1796\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1879\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1800\",\"type\":\"AllLabels\"},{\"attributes\":{\"tools\":[{\"id\":\"1775\"},{\"id\":\"1776\"},{\"id\":\"1777\"},{\"id\":\"1778\"},{\"id\":\"1779\"}]},\"id\":\"1780\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1880\",\"type\":\"Selection\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5 balance (ETH)\"},\"renderers\":[{\"id\":\"1902\"}]},\"id\":\"1933\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1870\",\"type\":\"BasicTicker\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d balance (WBTC)\"},\"renderers\":[{\"id\":\"1795\"}]},\"id\":\"1819\",\"type\":\"LegendItem\"},{\"attributes\":{\"source\":{\"id\":\"1824\"}},\"id\":\"1829\",\"type\":\"CDSView\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1825\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1802\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1861\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042]},\"selected\":{\"id\":\"1880\"},\"selection_policy\":{\"id\":\"1879\"}},\"id\":\"1860\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1797\",\"type\":\"Title\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]},\"selected\":{\"id\":\"1920\"},\"selection_policy\":{\"id\":\"1919\"}},\"id\":\"1898\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1792\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1901\",\"type\":\"Line\"},{\"attributes\":{\"axis_label\":\"Balance (ETH)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1855\"},\"group\":null,\"major_label_policy\":{\"id\":\"1871\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1870\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"1858\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[25978.11414452,25977.11414452,25977.11414452,25984.747880040002,25986.766357970002,25986.766357970002,25986.766357970002,25987.88956331,25987.88956331,25986.88956331,25986.582445480002,25991.29432471,25992.48448436,25987.61925161,25992.16065222,25992.16065222,25991.05114679,25991.826676790002,25992.03192661,25992.03192661,25992.38844007,25993.13491805,26123.13491805,26127.880530550003,26130.09742635,26137.462487,26137.462487,26137.462487,26137.462487,26138.462487,26138.365787000002,26135.12618259,26134.33154554,26135.95637579,26134.64132248,26134.64132248,25124.8436666,25124.8436666,26281.348347720002,26240.66688632,26238.15878895,25966.75329657,29644.71468453,28435.30186199,30365.19325906,30378.013279990002,30421.193075080002,30407.85239898,30406.685058450006,30210.219633630008,30204.696894180008,30205.392294180005,30199.424683820005,30191.743590430007,30187.776904260005,30205.517158500006,57754.777651070006,57743.52134107,57619.61929483,58004.35997902001,63700.99266199002,63556.69681145002,63550.849119480015,63553.39761774002,63553.830750280016,63548.194321570016,63546.92211846002,63547.49951117003,63547.756468090025,63546.90229388002,63543.38517712003,63543.09944764002,63542.09944764002,63537.562293890034,63537.562293890034,63537.562293890034,63531.36602319003,63658.696591080035,63658.696591080035,63658.696591080035,63658.696591080035,63658.696591080035,57917.85856731003,57918.46796521003,57923.96223555003,57923.96223555003,57922.66223555003,57922.273237140034,57922.273237140034,57924.11378264003,57845.90186654003,57845.90186654003,57827.17418462003,57827.17418462003,57815.462998330026,57815.44729311003,57788.65109002002,57775.52887440003,57774.61878628003,57785.27637600002,57785.27637600002]},\"selected\":{\"id\":\"1840\"},\"selection_policy\":{\"id\":\"1839\"}},\"id\":\"1824\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1899\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1824\"},\"glyph\":{\"id\":\"1825\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1827\"},\"nonselection_glyph\":{\"id\":\"1826\"},\"view\":{\"id\":\"1829\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"1828\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1793\",\"type\":\"Line\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1815\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"end\":231497.37289677645},\"id\":\"1897\",\"type\":\"Range1d\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1814\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1816\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1812\",\"type\":\"DaysTicker\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1819\"},{\"id\":\"1853\"},{\"id\":\"1893\"},{\"id\":\"1933\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1818\",\"type\":\"Legend\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1810\",\"type\":\"DaysTicker\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1827\",\"type\":\"Line\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1809\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1779\",\"type\":\"SaveTool\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1808\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1803\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1817\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"1778\",\"type\":\"ResetTool\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1811\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1813\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1826\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null},\"id\":\"1777\",\"type\":\"HoverTool\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1807\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1775\",\"type\":\"PanTool\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1806\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1776\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1900\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1898\"},\"glyph\":{\"id\":\"1899\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1901\"},\"nonselection_glyph\":{\"id\":\"1900\"},\"view\":{\"id\":\"1903\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"1902\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1898\"}},\"id\":\"1903\",\"type\":\"CDSView\"},{\"attributes\":{\"format\":\"0.00a\"},\"id\":\"1855\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5 balance (WBTC)\"},\"renderers\":[{\"id\":\"1828\"}]},\"id\":\"1853\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1772\",\"type\":\"BasicTicker\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d balance (ETH)\"},\"renderers\":[{\"id\":\"1864\"}]},\"id\":\"1893\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"1771\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1774\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1860\"},\"glyph\":{\"id\":\"1861\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1863\"},\"nonselection_glyph\":{\"id\":\"1862\"},\"view\":{\"id\":\"1865\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"1864\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"Balance (WBTC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1787\"},\"group\":null,\"major_label_policy\":{\"id\":\"1800\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1772\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"1771\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1871\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"1860\"}},\"id\":\"1865\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1805\",\"type\":\"Selection\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1862\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1767\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1770\",\"type\":\"Grid\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1863\",\"type\":\"Line\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1806\"},{\"id\":\"1807\"},{\"id\":\"1808\"},{\"id\":\"1809\"},{\"id\":\"1810\"},{\"id\":\"1811\"},{\"id\":\"1812\"},{\"id\":\"1813\"},{\"id\":\"1814\"},{\"id\":\"1815\"},{\"id\":\"1816\"},{\"id\":\"1817\"}]},\"id\":\"1768\",\"type\":\"DatetimeTicker\"},{\"attributes\":{},\"id\":\"1804\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1763\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1802\"},\"group\":null,\"major_label_policy\":{\"id\":\"1803\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1768\"}},\"id\":\"1767\",\"type\":\"DatetimeAxis\"}],\"root_ids\":[\"1758\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"b69a50bd-2104-4b8d-9f42-97a8e48507ae\",\"root_ids\":[\"1758\"],\"roots\":{\"1758\":\"ef6b2e6c-2466-4ebd-8422-336053a8e47b\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "1758" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "# visualization\n", - "\n", - "addresses = [\n", - " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", - " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", - "]\n", - "\n", - "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", - " .balance(token = \"WBTC\", address = addresses) \\\n", - " .balance(token = \"ETH\", address = addresses)\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "7219deb2-7e4c-4fd2-b077-444c67b5caf8", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "shape: (10, 5)\n", - "┌────────────┬─────────────────────┬──────────────┬────────────────────────────────┬───────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ address ┆ balance │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ str ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪════════════════════════════════╪═══════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0x78605df79524164911c144801f41 ┆ 200748.938473 │\n", - "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", - "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0x78605df79524164911c144801f41 ┆ 200748.938473 │\n", - "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", - "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0x78605df79524164911c144801f41 ┆ 220473.688473 │\n", - "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", - "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0x78605df79524164911c144801f41 ┆ 220473.688473 │\n", - "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", - "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", - "└────────────┴─────────────────────┴──────────────┴────────────────────────────────┴───────────────┘\n", - "shape: (10, 5)\n", - "┌────────────┬─────────────────────┬──────────────┬─────────────────────────────────┬──────────────┐\n", - "│ timestamp ┆ date ┆ block_number ┆ address ┆ balance │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ u64 ┆ str ┆ f64 │\n", - "╞════════════╪═════════════════════╪══════════════╪═════════════════════════════════╪══════════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", - "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 25978.114145 │\n", - "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", - "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 26127.880531 │\n", - "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", - "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 63546.902294 │\n", - "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", - "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 57785.276376 │\n", - "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", - "└────────────┴─────────────────────┴──────────────┴─────────────────────────────────┴──────────────┘\n" - ] - } - ], - "source": [ - "from web3cat.data import ERC20Data, EtherData\n", - "\n", - "addresses = [\n", - " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", - " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", - "]\n", - "\n", - "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", - "e_data = EtherData(start = datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "u_data = ERC20Data(token=\"WBTC\", address_filter=addresses, start = datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", - "\n", - "print(e_data.balances(addresses, dates))\n", - "print(u_data.balances(addresses, dates))" - ] - }, - { - "cell_type": "markdown", - "id": "8d5f4e7b-54f5-4223-bd86-368051b58d6b", - "metadata": {}, - "source": [ - "## Portfolio by token breakdown" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "d1a413bf-56c6-4df7-8d23-afca09d7b4d6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"8536765c-03fb-42b3-a48b-bb80c41297e1\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"2188\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"2191\"},{\"id\":\"2195\"},{\"id\":\"2264\"}],\"extra_y_ranges\":{\"Balance (USDC)\":{\"id\":\"2227\"}},\"height\":400,\"left\":[{\"id\":\"2192\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"2241\"},{\"id\":\"2271\"},{\"id\":\"2302\"},{\"id\":\"2335\"}],\"title\":{\"id\":\"2243\"},\"toolbar\":{\"id\":\"2201\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"2180\"},\"x_scale\":{\"id\":\"2184\"},\"y_range\":{\"id\":\"2182\"},\"y_scale\":{\"id\":\"2186\"}},\"id\":\"2179\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2196\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2197\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"callback\":null},\"id\":\"2198\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2199\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2200\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2228\"}},\"y2\":{\"expr\":{\"id\":\"2229\"}}},\"id\":\"2239\",\"type\":\"VArea\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\"]},\"id\":\"2231\",\"type\":\"Stack\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"2260\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"2282\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2316\"},\"selection_policy\":{\"id\":\"2315\"}},\"id\":\"2297\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\"]},\"id\":\"2232\",\"type\":\"Stack\"},{\"attributes\":{\"source\":{\"id\":\"2266\"}},\"id\":\"2272\",\"type\":\"CDSView\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\",\"WBTC (USDC)\"]},\"id\":\"2235\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2266\"},\"glyph\":{\"id\":\"2268\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2270\"},\"name\":\"WETH (USDC)\",\"nonselection_glyph\":{\"id\":\"2269\"},\"view\":{\"id\":\"2272\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2271\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"2262\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"2255\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"2261\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2230\"}},\"y2\":{\"expr\":{\"id\":\"2231\"}}},\"id\":\"2269\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2246\",\"type\":\"AllLabels\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2230\"}},\"y2\":{\"expr\":{\"id\":\"2231\"}}},\"id\":\"2270\",\"type\":\"VArea\"},{\"attributes\":{\"label\":{\"value\":\"WETH (USDC)\"},\"renderers\":[{\"id\":\"2271\"}]},\"id\":\"2296\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"2283\",\"type\":\"Selection\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\"]},\"id\":\"2233\",\"type\":\"Stack\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"2256\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"2184\",\"type\":\"LinearScale\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\"]},\"id\":\"2229\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"2182\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2228\"}},\"y2\":{\"expr\":{\"id\":\"2229\"}}},\"id\":\"2240\",\"type\":\"VArea\"},{\"attributes\":{\"tools\":[{\"id\":\"2196\"},{\"id\":\"2197\"},{\"id\":\"2198\"},{\"id\":\"2199\"},{\"id\":\"2200\"}]},\"id\":\"2201\",\"type\":\"Toolbar\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"2257\",\"type\":\"DaysTicker\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"2254\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"2258\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"2251\",\"type\":\"Selection\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"2243\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2250\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2180\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2249\",\"type\":\"AllLabels\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"2208\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"2193\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2232\"}},\"y2\":{\"expr\":{\"id\":\"2233\"}}},\"id\":\"2299\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2232\"}},\"y2\":{\"expr\":{\"id\":\"2233\"}}},\"id\":\"2300\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2232\"}},\"y2\":{\"expr\":{\"id\":\"2233\"}}},\"id\":\"2301\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2248\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"2252\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2236\"},\"glyph\":{\"id\":\"2238\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2240\"},\"name\":\"USDC (USDC)\",\"nonselection_glyph\":{\"id\":\"2239\"},\"view\":{\"id\":\"2242\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2241\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2297\"},\"glyph\":{\"id\":\"2299\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2301\"},\"name\":\"ETH (USDC)\",\"nonselection_glyph\":{\"id\":\"2300\"},\"view\":{\"id\":\"2303\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2302\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"label\":{\"value\":\"ETH (USDC)\"},\"renderers\":[{\"id\":\"2302\"}]},\"id\":\"2329\",\"type\":\"LegendItem\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"2253\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"source\":{\"id\":\"2297\"}},\"id\":\"2303\",\"type\":\"CDSView\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"2252\"},{\"id\":\"2253\"},{\"id\":\"2254\"},{\"id\":\"2255\"},{\"id\":\"2256\"},{\"id\":\"2257\"},{\"id\":\"2258\"},{\"id\":\"2259\"},{\"id\":\"2260\"},{\"id\":\"2261\"},{\"id\":\"2262\"},{\"id\":\"2263\"}]},\"id\":\"2189\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2234\"}},\"y2\":{\"expr\":{\"id\":\"2235\"}}},\"id\":\"2332\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2228\"}},\"y2\":{\"expr\":{\"id\":\"2229\"}}},\"id\":\"2238\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2315\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2316\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2186\",\"type\":\"LinearScale\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\"]},\"id\":\"2234\",\"type\":\"Stack\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2248\"},\"group\":null,\"major_label_policy\":{\"id\":\"2249\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2189\"}},\"id\":\"2188\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2251\"},\"selection_policy\":{\"id\":\"2250\"}},\"id\":\"2236\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\"]},\"id\":\"2230\",\"type\":\"Stack\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2283\"},\"selection_policy\":{\"id\":\"2282\"}},\"id\":\"2266\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2230\"}},\"y2\":{\"expr\":{\"id\":\"2231\"}}},\"id\":\"2268\",\"type\":\"VArea\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"2265\"},{\"id\":\"2296\"},{\"id\":\"2329\"},{\"id\":\"2364\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"2264\",\"type\":\"Legend\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"2259\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2234\"}},\"y2\":{\"expr\":{\"id\":\"2235\"}}},\"id\":\"2334\",\"type\":\"VArea\"},{\"attributes\":{\"axis\":{\"id\":\"2188\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2191\",\"type\":\"Grid\"},{\"attributes\":{\"axis\":{\"id\":\"2192\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2195\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2234\"}},\"y2\":{\"expr\":{\"id\":\"2235\"}}},\"id\":\"2333\",\"type\":\"VArea\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2351\"},\"selection_policy\":{\"id\":\"2350\"}},\"id\":\"2330\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"Balance (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2208\"},\"group\":null,\"major_label_policy\":{\"id\":\"2246\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2193\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2192\",\"type\":\"LinearAxis\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2330\"},\"glyph\":{\"id\":\"2332\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2334\"},\"name\":\"WBTC (USDC)\",\"nonselection_glyph\":{\"id\":\"2333\"},\"view\":{\"id\":\"2336\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2335\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[]},\"id\":\"2228\",\"type\":\"Stack\"},{\"attributes\":{\"label\":{\"value\":\"WBTC (USDC)\"},\"renderers\":[{\"id\":\"2335\"}]},\"id\":\"2364\",\"type\":\"LegendItem\"},{\"attributes\":{\"source\":{\"id\":\"2330\"}},\"id\":\"2336\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2351\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2350\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2263\",\"type\":\"YearsTicker\"},{\"attributes\":{\"source\":{\"id\":\"2236\"}},\"id\":\"2242\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"USDC (USDC)\"},\"renderers\":[{\"id\":\"2241\"}]},\"id\":\"2265\",\"type\":\"LegendItem\"},{\"attributes\":{\"end\":1801553261.405254},\"id\":\"2227\",\"type\":\"Range1d\"}],\"root_ids\":[\"2179\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"8536765c-03fb-42b3-a48b-bb80c41297e1\",\"root_ids\":[\"2179\"],\"roots\":{\"2179\":\"d88d2d4a-b86e-42cf-b557-9c148ab7da59\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "2179" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "addresses = [\n", - " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", - " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", - " \"0x8EB8a3b98659Cce290402893d0123abb75E3ab28\"\n", - "]\n", - "tokens = [\"USDC\", \"WETH\", \"ETH\", \"WBTC\"]\n", - "base_tokens = [\"USDC\", \"WETH\"]\n", - "\n", - "v = View().portfolio_by_token(\n", - " addresses = addresses, \n", - " tokens = tokens, \n", - " base_token = \"USDC\", \n", - " start=datetime(2022, 6, 1), \n", - " end=datetime(2022, 7, 1), \n", - " numpoints=10\n", - ")\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "aac60dae-6519-4d2a-80ee-6bc517cb0eea", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "shape: (11, 8)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
\n", - "timestamp\n", - "\n", - "date\n", - "\n", - "block_number\n", - "\n", - "USDC (USDC)\n", - "\n", - "WETH (USDC)\n", - "\n", - "WBTC (USDC)\n", - "\n", - "ETH (USDC)\n", - "\n", - "total\n", - "
\n", - "u64\n", - "\n", - "datetime[μs]\n", - "\n", - "u64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "
\n", - "1654027190\n", - "\n", - "2022-05-31 23:59:50\n", - "\n", - "14880658\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "8.2152e8\n", - "\n", - "3.8836e8\n", - "\n", - "1.3788e9\n", - "
\n", - "1654295514\n", - "\n", - "2022-06-04 02:31:54\n", - "\n", - "14899719\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "7.7452e8\n", - "\n", - "3.5890e8\n", - "\n", - "1.3024e9\n", - "
\n", - "1654575284\n", - "\n", - "2022-06-07 08:14:44\n", - "\n", - "14918780\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "7.6863e8\n", - "\n", - "3.5272e8\n", - "\n", - "1.2903e9\n", - "
\n", - "1654855382\n", - "\n", - "2022-06-10 14:03:02\n", - "\n", - "14937841\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "7.8022e8\n", - "\n", - "3.5470e8\n", - "\n", - "1.3038e9\n", - "
\n", - "1655136999\n", - "\n", - "2022-06-13 20:16:39\n", - "\n", - "14956902\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "6.7600e8\n", - "\n", - "2.5226e8\n", - "\n", - "1.0972e9\n", - "
\n", - "1655421669\n", - "\n", - "2022-06-17 03:21:09\n", - "\n", - "14975963\n", - "\n", - "1.68928317e8\n", - "\n", - "0.0\n", - "\n", - "6.1157e8\n", - "\n", - "2.1152e8\n", - "\n", - "9.9202e8\n", - "
\n", - "1655705057\n", - "\n", - "2022-06-20 10:04:17\n", - "\n", - "14995024\n", - "\n", - "1.90639384e8\n", - "\n", - "0.0\n", - "\n", - "1.2706e9\n", - "\n", - "2.3698e8\n", - "\n", - "1.6982e9\n", - "
\n", - "1656005754\n", - "\n", - "2022-06-23 21:35:54\n", - "\n", - "15014085\n", - "\n", - "1.90639384e8\n", - "\n", - "0.0\n", - "\n", - "1.2840e9\n", - "\n", - "2.4114e8\n", - "\n", - "1.7158e9\n", - "
\n", - "1656313716\n", - "\n", - "2022-06-27 11:08:36\n", - "\n", - "15033146\n", - "\n", - "1.90639384e8\n", - "\n", - "0.0\n", - "\n", - "1.2303e9\n", - "\n", - "2.6879e8\n", - "\n", - "1.6897e9\n", - "
\n", - "1656619133\n", - "\n", - "2022-06-30 23:58:53\n", - "\n", - "15052207\n", - "\n", - "1.90639384e8\n", - "\n", - "0.0\n", - "\n", - "1.0898e9\n", - "\n", - "2.2361e8\n", - "\n", - "1.5040e9\n", - "
\n", - "1656619189\n", - "\n", - "2022-06-30 23:59:49\n", - "\n", - "15052211\n", - "\n", - "1.90639384e8\n", - "\n", - "0.0\n", - "\n", - "1.0898e9\n", - "\n", - "2.2361e8\n", - "\n", - "1.5040e9\n", - "
\n", - "
" - ], - "text/plain": [ - "shape: (11, 8)\n", - "┌────────────┬────────────┬────────────┬───────────┬───────────┬───────────┬────────────┬──────────┐\n", - "│ timestamp ┆ date ┆ block_numb ┆ USDC ┆ WETH ┆ WBTC ┆ ETH (USDC) ┆ total │\n", - "│ --- ┆ --- ┆ er ┆ (USDC) ┆ (USDC) ┆ (USDC) ┆ --- ┆ --- │\n", - "│ u64 ┆ datetime[μ ┆ --- ┆ --- ┆ --- ┆ --- ┆ f64 ┆ f64 │\n", - "│ ┆ s] ┆ u64 ┆ f64 ┆ f64 ┆ f64 ┆ ┆ │\n", - "╞════════════╪════════════╪════════════╪═══════════╪═══════════╪═══════════╪════════════╪══════════╡\n", - "│ 1654027190 ┆ 2022-05-31 ┆ 14880658 ┆ 1.6892831 ┆ 0.0 ┆ 8.2152e8 ┆ 3.8836e8 ┆ 1.3788e9 │\n", - "│ ┆ 23:59:50 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654295514 ┆ 2022-06-04 ┆ 14899719 ┆ 1.6892831 ┆ 0.0 ┆ 7.7452e8 ┆ 3.5890e8 ┆ 1.3024e9 │\n", - "│ ┆ 02:31:54 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654575284 ┆ 2022-06-07 ┆ 14918780 ┆ 1.6892831 ┆ 0.0 ┆ 7.6863e8 ┆ 3.5272e8 ┆ 1.2903e9 │\n", - "│ ┆ 08:14:44 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654855382 ┆ 2022-06-10 ┆ 14937841 ┆ 1.6892831 ┆ 0.0 ┆ 7.8022e8 ┆ 3.5470e8 ┆ 1.3038e9 │\n", - "│ ┆ 14:03:02 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656005754 ┆ 2022-06-23 ┆ 15014085 ┆ 1.9063938 ┆ 0.0 ┆ 1.2840e9 ┆ 2.4114e8 ┆ 1.7158e9 │\n", - "│ ┆ 21:35:54 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656313716 ┆ 2022-06-27 ┆ 15033146 ┆ 1.9063938 ┆ 0.0 ┆ 1.2303e9 ┆ 2.6879e8 ┆ 1.6897e9 │\n", - "│ ┆ 11:08:36 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619133 ┆ 2022-06-30 ┆ 15052207 ┆ 1.9063938 ┆ 0.0 ┆ 1.0898e9 ┆ 2.2361e8 ┆ 1.5040e9 │\n", - "│ ┆ 23:58:53 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 ┆ 15052211 ┆ 1.9063938 ┆ 0.0 ┆ 1.0898e9 ┆ 2.2361e8 ┆ 1.5040e9 │\n", - "│ ┆ 23:59:49 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", - "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴────────────┴──────────┘" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from web3cat.data import PortfolioData\n", - "\n", - "d = PortfolioData(\n", - " tokens=tokens, \n", - " base_tokens=base_tokens, \n", - " addresses=addresses, \n", - " start=datetime(2022, 6, 1), \n", - " end=datetime(2022, 7, 1), \n", - " numpoints=10\n", - ")\n", - "d.breakdown_by_token(\"USDC\")" - ] - }, - { - "cell_type": "markdown", - "id": "fa2b90e6-8b8a-4141-b33f-185ea83a0b48", - "metadata": {}, - "source": [ - "## Portfolio by address breakdown" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "068124a3-9f91-4365-8126-fbe7b15eb56e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "(function(root) {\n", - " function embed_document(root) {\n", - " const docs_json = {\"fae5e8cb-1c92-401c-b46c-2087c4cdd708\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"2636\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"2639\"},{\"id\":\"2643\"},{\"id\":\"2706\"}],\"extra_y_ranges\":{\"Balance (USDC)\":{\"id\":\"2671\"}},\"height\":400,\"left\":[{\"id\":\"2640\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"2683\"},{\"id\":\"2713\"},{\"id\":\"2744\"}],\"title\":{\"id\":\"2685\"},\"toolbar\":{\"id\":\"2649\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"2628\"},\"x_scale\":{\"id\":\"2632\"},\"y_range\":{\"id\":\"2630\"},\"y_scale\":{\"id\":\"2634\"}},\"id\":\"2627\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2632\",\"type\":\"LinearScale\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"2703\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"2693\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2725\",\"type\":\"Selection\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2725\"},\"selection_policy\":{\"id\":\"2724\"}},\"id\":\"2708\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"2707\"},{\"id\":\"2738\"},{\"id\":\"2771\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"2706\",\"type\":\"Legend\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"2697\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"2699\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"2704\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2674\"}},\"y2\":{\"expr\":{\"id\":\"2675\"}}},\"id\":\"2710\",\"type\":\"VArea\"},{\"attributes\":{\"label\":{\"value\":\"0x8eb8...ab28\"},\"renderers\":[{\"id\":\"2713\"}]},\"id\":\"2738\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2678\"},\"glyph\":{\"id\":\"2680\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2682\"},\"name\":\"0x78605df79524164911c144801f41e9811b7db73d\",\"nonselection_glyph\":{\"id\":\"2681\"},\"view\":{\"id\":\"2684\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2683\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2674\"}},\"y2\":{\"expr\":{\"id\":\"2675\"}}},\"id\":\"2712\",\"type\":\"VArea\"},{\"attributes\":{\"source\":{\"id\":\"2739\"}},\"id\":\"2745\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2647\",\"type\":\"ResetTool\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\"]},\"id\":\"2674\",\"type\":\"Stack\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2676\"}},\"y2\":{\"expr\":{\"id\":\"2677\"}}},\"id\":\"2742\",\"type\":\"VArea\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d\"},\"renderers\":[{\"id\":\"2683\"}]},\"id\":\"2707\",\"type\":\"LegendItem\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"2656\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"2628\",\"type\":\"DataRange1d\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"2700\",\"type\":\"DaysTicker\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2758\"},\"selection_policy\":{\"id\":\"2757\"}},\"id\":\"2739\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\"]},\"id\":\"2673\",\"type\":\"Stack\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"2696\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"axis\":{\"id\":\"2636\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2639\",\"type\":\"Grid\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\",\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\"]},\"id\":\"2677\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"2634\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2672\"}},\"y2\":{\"expr\":{\"id\":\"2673\"}}},\"id\":\"2682\",\"type\":\"VArea\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2690\"},\"group\":null,\"major_label_policy\":{\"id\":\"2691\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2637\"}},\"id\":\"2636\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2674\"}},\"y2\":{\"expr\":{\"id\":\"2675\"}}},\"id\":\"2711\",\"type\":\"VArea\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2708\"},\"glyph\":{\"id\":\"2710\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2712\"},\"name\":\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\",\"nonselection_glyph\":{\"id\":\"2711\"},\"view\":{\"id\":\"2714\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2713\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2676\"}},\"y2\":{\"expr\":{\"id\":\"2677\"}}},\"id\":\"2743\",\"type\":\"VArea\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"2694\"},{\"id\":\"2695\"},{\"id\":\"2696\"},{\"id\":\"2697\"},{\"id\":\"2698\"},{\"id\":\"2699\"},{\"id\":\"2700\"},{\"id\":\"2701\"},{\"id\":\"2702\"},{\"id\":\"2703\"},{\"id\":\"2704\"},{\"id\":\"2705\"}]},\"id\":\"2637\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\"]},\"id\":\"2675\",\"type\":\"Stack\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"2701\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2693\"},\"selection_policy\":{\"id\":\"2692\"}},\"id\":\"2678\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2688\",\"type\":\"AllLabels\"},{\"attributes\":{\"end\":1801553261.405254},\"id\":\"2671\",\"type\":\"Range1d\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5\"},\"renderers\":[{\"id\":\"2744\"}]},\"id\":\"2771\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"2757\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2672\"}},\"y2\":{\"expr\":{\"id\":\"2673\"}}},\"id\":\"2680\",\"type\":\"VArea\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"2694\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2676\"}},\"y2\":{\"expr\":{\"id\":\"2677\"}}},\"id\":\"2741\",\"type\":\"VArea\"},{\"attributes\":{\"axis\":{\"id\":\"2640\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2643\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2724\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2645\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2705\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"2692\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"tools\":[{\"id\":\"2644\"},{\"id\":\"2645\"},{\"id\":\"2646\"},{\"id\":\"2647\"},{\"id\":\"2648\"}]},\"id\":\"2649\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2690\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{},\"id\":\"2691\",\"type\":\"AllLabels\"},{\"attributes\":{\"callback\":null},\"id\":\"2646\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2758\",\"type\":\"Selection\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2739\"},\"glyph\":{\"id\":\"2741\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2743\"},\"name\":\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\",\"nonselection_glyph\":{\"id\":\"2742\"},\"view\":{\"id\":\"2745\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2744\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"Balance (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2656\"},\"group\":null,\"major_label_policy\":{\"id\":\"2688\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2641\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2640\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2672\"}},\"y2\":{\"expr\":{\"id\":\"2673\"}}},\"id\":\"2681\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2648\",\"type\":\"SaveTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"2685\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2630\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fields\":[]},\"id\":\"2672\",\"type\":\"Stack\"},{\"attributes\":{\"source\":{\"id\":\"2678\"}},\"id\":\"2684\",\"type\":\"CDSView\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"2695\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"2644\",\"type\":\"PanTool\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\"]},\"id\":\"2676\",\"type\":\"Stack\"},{\"attributes\":{\"source\":{\"id\":\"2708\"}},\"id\":\"2714\",\"type\":\"CDSView\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"2702\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"2641\",\"type\":\"BasicTicker\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"2698\",\"type\":\"DaysTicker\"}],\"root_ids\":[\"2627\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", - " const render_items = [{\"docid\":\"fae5e8cb-1c92-401c-b46c-2087c4cdd708\",\"root_ids\":[\"2627\"],\"roots\":{\"2627\":\"dac58a55-d760-42d8-8988-64251806e786\"}}];\n", - " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " embed_document(root);\n", - " } else {\n", - " let attempts = 0;\n", - " const timer = setInterval(function(root) {\n", - " if (root.Bokeh !== undefined) {\n", - " clearInterval(timer);\n", - " embed_document(root);\n", - " } else {\n", - " attempts++;\n", - " if (attempts > 100) {\n", - " clearInterval(timer);\n", - " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", - " }\n", - " }\n", - " }, 10, root)\n", - " }\n", - "})(window);" - ], - "application/vnd.bokehjs_exec.v0+json": "" - }, - "metadata": { - "application/vnd.bokehjs_exec.v0+json": { - "id": "2627" - } - }, - "output_type": "display_data" - } - ], - "source": [ - "from web3cat.view import View\n", - "from datetime import datetime\n", - "\n", - "addresses = [\n", - " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", - " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", - " \"0x8EB8a3b98659Cce290402893d0123abb75E3ab28\"\n", - "]\n", - "tokens = [\"USDC\", \"WETH\", \"ETH\", \"WBTC\"]\n", - "base_tokens = [\"USDC\", \"WETH\"]\n", - "\n", - "v = View().portfolio_by_address(\n", - " addresses = addresses, \n", - " tokens = tokens, \n", - " base_token = \"USDC\", \n", - " start=datetime(2022, 6, 1), \n", - " end=datetime(2022, 7, 1), \n", - " numpoints=10\n", - ")\n", - "v.show()" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "7f3ad2ad-b8e2-4c97-8dff-161c9537192d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "shape: (11, 7)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
\n", - "timestamp\n", - "\n", - "date\n", - "\n", - "block_number\n", - "\n", - "0x78605df79524164911c144801f41e9811b7db73d\n", - "\n", - "0x8eb8a3b98659cce290402893d0123abb75e3ab28\n", - "\n", - "0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\n", - "\n", - "total\n", - "
\n", - "u64\n", - "\n", - "datetime[μs]\n", - "\n", - "u64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "\n", - "f64\n", - "
\n", - "1654027190\n", - "\n", - "2022-05-31 23:59:50\n", - "\n", - "14880658\n", - "\n", - "5.5729e8\n", - "\n", - "0.0\n", - "\n", - "8.2152e8\n", - "\n", - "1.3788e9\n", - "
\n", - "1654295514\n", - "\n", - "2022-06-04 02:31:54\n", - "\n", - "14899719\n", - "\n", - "5.2783e8\n", - "\n", - "0.0\n", - "\n", - "7.7452e8\n", - "\n", - "1.3024e9\n", - "
\n", - "1654575284\n", - "\n", - "2022-06-07 08:14:44\n", - "\n", - "14918780\n", - "\n", - "5.2164e8\n", - "\n", - "0.0\n", - "\n", - "7.6863e8\n", - "\n", - "1.2903e9\n", - "
\n", - "1654855382\n", - "\n", - "2022-06-10 14:03:02\n", - "\n", - "14937841\n", - "\n", - "5.2363e8\n", - "\n", - "0.0\n", - "\n", - "7.8022e8\n", - "\n", - "1.3038e9\n", - "
\n", - "1655136999\n", - "\n", - "2022-06-13 20:16:39\n", - "\n", - "14956902\n", - "\n", - "4.2118e8\n", - "\n", - "0.0\n", - "\n", - "6.7600e8\n", - "\n", - "1.0972e9\n", - "
\n", - "1655421669\n", - "\n", - "2022-06-17 03:21:09\n", - "\n", - "14975963\n", - "\n", - "3.8045e8\n", - "\n", - "0.0\n", - "\n", - "6.1157e8\n", - "\n", - "9.9202e8\n", - "
\n", - "1655705057\n", - "\n", - "2022-06-20 10:04:17\n", - "\n", - "14995024\n", - "\n", - "4.2762e8\n", - "\n", - "0.0\n", - "\n", - "1.2706e9\n", - "\n", - "1.6982e9\n", - "
\n", - "1656005754\n", - "\n", - "2022-06-23 21:35:54\n", - "\n", - "15014085\n", - "\n", - "4.3178e8\n", - "\n", - "0.0\n", - "\n", - "1.2840e9\n", - "\n", - "1.7158e9\n", - "
\n", - "1656313716\n", - "\n", - "2022-06-27 11:08:36\n", - "\n", - "15033146\n", - "\n", - "4.5942e8\n", - "\n", - "0.0\n", - "\n", - "1.2303e9\n", - "\n", - "1.6897e9\n", - "
\n", - "1656619133\n", - "\n", - "2022-06-30 23:58:53\n", - "\n", - "15052207\n", - "\n", - "4.1425e8\n", - "\n", - "0.0\n", - "\n", - "1.0898e9\n", - "\n", - "1.5040e9\n", - "
\n", - "1656619189\n", - "\n", - "2022-06-30 23:59:49\n", - "\n", - "15052211\n", - "\n", - "4.1425e8\n", - "\n", - "0.0\n", - "\n", - "1.0898e9\n", - "\n", - "1.5040e9\n", - "
\n", - "
" - ], - "text/plain": [ - "shape: (11, 7)\n", - "┌────────────┬─────────────────────┬──────────┬──────────┬─────┬──────────┬──────────┐\n", - "│ timestamp ┆ date ┆ block_nu ┆ 0x78605d ┆ 0x8 ┆ 0xbf72da ┆ total │\n", - "│ --- ┆ --- ┆ mber ┆ f7952416 ┆ eb8 ┆ 2bd84c51 ┆ --- │\n", - "│ u64 ┆ datetime[μs] ┆ --- ┆ 4911c144 ┆ a3b ┆ 70618fbe ┆ f64 │\n", - "│ ┆ ┆ u64 ┆ 801f41e9 ┆ 986 ┆ 5914b0ec ┆ │\n", - "│ ┆ ┆ ┆ 811b7db7 ┆ 59c ┆ a9638d5e ┆ │\n", - "│ ┆ ┆ ┆ 3d ┆ ce2 ┆ b5 ┆ │\n", - "│ ┆ ┆ ┆ --- ┆ 904 ┆ --- ┆ │\n", - "│ ┆ ┆ ┆ f64 ┆ 028 ┆ f64 ┆ │\n", - "│ ┆ ┆ ┆ ┆ 93d ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ 012 ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ 3ab ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ b75 ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ e3a ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ b28 ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ --- ┆ ┆ │\n", - "│ ┆ ┆ ┆ ┆ f64 ┆ ┆ │\n", - "╞════════════╪═════════════════════╪══════════╪══════════╪═════╪══════════╪══════════╡\n", - "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 5.5729e8 ┆ 0.0 ┆ 8.2152e8 ┆ 1.3788e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654295514 ┆ 2022-06-04 02:31:54 ┆ 14899719 ┆ 5.2783e8 ┆ 0.0 ┆ 7.7452e8 ┆ 1.3024e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654575284 ┆ 2022-06-07 08:14:44 ┆ 14918780 ┆ 5.2164e8 ┆ 0.0 ┆ 7.6863e8 ┆ 1.2903e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1654855382 ┆ 2022-06-10 14:03:02 ┆ 14937841 ┆ 5.2363e8 ┆ 0.0 ┆ 7.8022e8 ┆ 1.3038e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656005754 ┆ 2022-06-23 21:35:54 ┆ 15014085 ┆ 4.3178e8 ┆ 0.0 ┆ 1.2840e9 ┆ 1.7158e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656313716 ┆ 2022-06-27 11:08:36 ┆ 15033146 ┆ 4.5942e8 ┆ 0.0 ┆ 1.2303e9 ┆ 1.6897e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619133 ┆ 2022-06-30 23:58:53 ┆ 15052207 ┆ 4.1425e8 ┆ 0.0 ┆ 1.0898e9 ┆ 1.5040e9 │\n", - "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", - "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 4.1425e8 ┆ 0.0 ┆ 1.0898e9 ┆ 1.5040e9 │\n", - "└────────────┴─────────────────────┴──────────┴──────────┴─────┴──────────┴──────────┘" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from web3cat.data import PortfolioData\n", - "\n", - "d = PortfolioData(\n", - " tokens=tokens, \n", - " base_tokens=base_tokens, \n", - " addresses=addresses, \n", - " start=datetime(2022, 6, 1), \n", - " end=datetime(2022, 7, 1), \n", - " numpoints=10\n", - ")\n", - "d.breakdown_by_address(\"USDC\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e80f9e6-48cf-4524-867c-8ce325c7e821", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "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.6" - } + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "966e0e64-cc96-4501-827a-cd74827ef849", + "metadata": {}, + "outputs": [], + "source": [ + "import os, sys\n", + "sys.path.insert(1, os.path.join(sys.path[0], \"../..\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "c15a4487-5622-4962-b4e9-f9306fe74965", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " \n", + " Loading BokehJS ...\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function now() {\n", + " return new Date();\n", + " }\n", + "\n", + " const force = true;\n", + "\n", + " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", + " root._bokeh_onload_callbacks = [];\n", + " root._bokeh_is_loading = undefined;\n", + " }\n", + "\n", + "const JS_MIME_TYPE = 'application/javascript';\n", + " const HTML_MIME_TYPE = 'text/html';\n", + " const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n", + " const CLASS_NAME = 'output_bokeh rendered_html';\n", + "\n", + " /**\n", + " * Render data to the DOM node\n", + " */\n", + " function render(props, node) {\n", + " const script = document.createElement(\"script\");\n", + " node.appendChild(script);\n", + " }\n", + "\n", + " /**\n", + " * Handle when an output is cleared or removed\n", + " */\n", + " function handleClearOutput(event, handle) {\n", + " const cell = handle.cell;\n", + "\n", + " const id = cell.output_area._bokeh_element_id;\n", + " const server_id = cell.output_area._bokeh_server_id;\n", + " // Clean up Bokeh references\n", + " if (id != null && id in Bokeh.index) {\n", + " Bokeh.index[id].model.document.clear();\n", + " delete Bokeh.index[id];\n", + " }\n", + "\n", + " if (server_id !== undefined) {\n", + " // Clean up Bokeh references\n", + " const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n", + " cell.notebook.kernel.execute(cmd_clean, {\n", + " iopub: {\n", + " output: function(msg) {\n", + " const id = msg.content.text.trim();\n", + " if (id in Bokeh.index) {\n", + " Bokeh.index[id].model.document.clear();\n", + " delete Bokeh.index[id];\n", + " }\n", + " }\n", + " }\n", + " });\n", + " // Destroy server and session\n", + " const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n", + " cell.notebook.kernel.execute(cmd_destroy);\n", + " }\n", + " }\n", + "\n", + " /**\n", + " * Handle when a new output is added\n", + " */\n", + " function handleAddOutput(event, handle) {\n", + " const output_area = handle.output_area;\n", + " const output = handle.output;\n", + "\n", + " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n", + " if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n", + " return\n", + " }\n", + "\n", + " const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", + "\n", + " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n", + " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n", + " // store reference to embed id on output_area\n", + " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", + " }\n", + " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", + " const bk_div = document.createElement(\"div\");\n", + " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", + " const script_attrs = bk_div.children[0].attributes;\n", + " for (let i = 0; i < script_attrs.length; i++) {\n", + " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n", + " toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n", + " }\n", + " // store reference to server id on output_area\n", + " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", + " }\n", + " }\n", + "\n", + " function register_renderer(events, OutputArea) {\n", + "\n", + " function append_mime(data, metadata, element) {\n", + " // create a DOM node to render to\n", + " const toinsert = this.create_output_subarea(\n", + " metadata,\n", + " CLASS_NAME,\n", + " EXEC_MIME_TYPE\n", + " );\n", + " this.keyboard_manager.register_events(toinsert);\n", + " // Render to node\n", + " const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", + " render(props, toinsert[toinsert.length - 1]);\n", + " element.append(toinsert);\n", + " return toinsert\n", + " }\n", + "\n", + " /* Handle when an output is cleared or removed */\n", + " events.on('clear_output.CodeCell', handleClearOutput);\n", + " events.on('delete.Cell', handleClearOutput);\n", + "\n", + " /* Handle when a new output is added */\n", + " events.on('output_added.OutputArea', handleAddOutput);\n", + "\n", + " /**\n", + " * Register the mime type and append_mime function with output_area\n", + " */\n", + " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", + " /* Is output safe? */\n", + " safe: true,\n", + " /* Index of renderer in `output_area.display_order` */\n", + " index: 0\n", + " });\n", + " }\n", + "\n", + " // register the mime type if in Jupyter Notebook environment and previously unregistered\n", + " if (root.Jupyter !== undefined) {\n", + " const events = require('base/js/events');\n", + " const OutputArea = require('notebook/js/outputarea').OutputArea;\n", + "\n", + " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", + " register_renderer(events, OutputArea);\n", + " }\n", + " }\n", + " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", + " root._bokeh_timeout = Date.now() + 5000;\n", + " root._bokeh_failed_load = false;\n", + " }\n", + "\n", + " const NB_LOAD_WARNING = {'data': {'text/html':\n", + " \"
\\n\"+\n", + " \"

\\n\"+\n", + " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", + " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", + " \"

\\n\"+\n", + " \"\\n\"+\n", + " \"\\n\"+\n", + " \"from bokeh.resources import INLINE\\n\"+\n", + " \"output_notebook(resources=INLINE)\\n\"+\n", + " \"\\n\"+\n", + " \"
\"}};\n", + "\n", + " function display_loaded() {\n", + " const el = document.getElementById(\"1001\");\n", + " if (el != null) {\n", + " el.textContent = \"BokehJS is loading...\";\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " if (el != null) {\n", + " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n", + " }\n", + " } else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(display_loaded, 100)\n", + " }\n", + " }\n", + "\n", + " function run_callbacks() {\n", + " try {\n", + " root._bokeh_onload_callbacks.forEach(function(callback) {\n", + " if (callback != null)\n", + " callback();\n", + " });\n", + " } finally {\n", + " delete root._bokeh_onload_callbacks\n", + " }\n", + " console.debug(\"Bokeh: all callbacks have finished\");\n", + " }\n", + "\n", + " function load_libs(css_urls, js_urls, callback) {\n", + " if (css_urls == null) css_urls = [];\n", + " if (js_urls == null) js_urls = [];\n", + "\n", + " root._bokeh_onload_callbacks.push(callback);\n", + " if (root._bokeh_is_loading > 0) {\n", + " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", + " return null;\n", + " }\n", + " if (js_urls == null || js_urls.length === 0) {\n", + " run_callbacks();\n", + " return null;\n", + " }\n", + " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", + " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", + "\n", + " function on_load() {\n", + " root._bokeh_is_loading--;\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", + " run_callbacks()\n", + " }\n", + " }\n", + "\n", + " function on_error(url) {\n", + " console.error(\"failed to load \" + url);\n", + " }\n", + "\n", + " for (let i = 0; i < css_urls.length; i++) {\n", + " const url = css_urls[i];\n", + " const element = document.createElement(\"link\");\n", + " element.onload = on_load;\n", + " element.onerror = on_error.bind(null, url);\n", + " element.rel = \"stylesheet\";\n", + " element.type = \"text/css\";\n", + " element.href = url;\n", + " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " for (let i = 0; i < js_urls.length; i++) {\n", + " const url = js_urls[i];\n", + " const element = document.createElement('script');\n", + " element.onload = on_load;\n", + " element.onerror = on_error.bind(null, url);\n", + " element.async = false;\n", + " element.src = url;\n", + " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", + " document.head.appendChild(element);\n", + " }\n", + " };\n", + "\n", + " function inject_raw_css(css) {\n", + " const element = document.createElement(\"style\");\n", + " element.appendChild(document.createTextNode(css));\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n", + " const css_urls = [];\n", + "\n", + " const inline_js = [ function(Bokeh) {\n", + " Bokeh.set_log_level(\"info\");\n", + " },\n", + "function(Bokeh) {\n", + " }\n", + " ];\n", + "\n", + " function run_inline_js() {\n", + " if (root.Bokeh !== undefined || force === true) {\n", + " for (let i = 0; i < inline_js.length; i++) {\n", + " inline_js[i].call(root, root.Bokeh);\n", + " }\n", + "if (force === true) {\n", + " display_loaded();\n", + " }} else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(run_inline_js, 100);\n", + " } else if (!root._bokeh_failed_load) {\n", + " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", + " root._bokeh_failed_load = true;\n", + " } else if (force !== true) {\n", + " const cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n", + " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n", + " }\n", + " }\n", + "\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", + " run_inline_js();\n", + " } else {\n", + " load_libs(css_urls, js_urls, function() {\n", + " console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n", + " run_inline_js();\n", + " });\n", + " }\n", + "}(window));" + ], + "application/vnd.bokehjs_load.v0+json": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n const NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n const el = document.getElementById(\"1001\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\nif (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n const cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from bokeh.io import output_notebook\n", + "\n", + "output_notebook()" + ] + }, + { + "cell_type": "markdown", + "id": "46a3fc1e-22c8-48db-badd-37eac6630a24", + "metadata": {}, + "source": [ + "## ERC20 total_supply history" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "263eae15-4a38-48df-a4d2-d53d3b4b3ac9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"a572c77a-26ce-40aa-b9eb-f5d964f58a0f\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1012\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1015\"},{\"id\":\"1019\"},{\"id\":\"1063\"}],\"extra_y_ranges\":{\"Total Supply (DAI)\":{\"id\":\"1034\"}},\"height\":400,\"left\":[{\"id\":\"1016\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1040\"}],\"title\":{\"id\":\"1042\"},\"toolbar\":{\"id\":\"1025\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1004\"},\"x_scale\":{\"id\":\"1008\"},\"y_range\":{\"id\":\"1006\"},\"y_scale\":{\"id\":\"1010\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"tools\":[{\"id\":\"1020\"},{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"}]},\"id\":\"1025\",\"type\":\"Toolbar\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1061\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1051\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1059\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1060\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{\"end\":6991187911.750372,\"start\":5913637621.211409},\"id\":\"1034\",\"type\":\"Range1d\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1055\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1057\",\"type\":\"DaysTicker\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1052\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1058\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1054\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1062\",\"type\":\"YearsTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1056\",\"type\":\"DaysTicker\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1064\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1063\",\"type\":\"Legend\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"Selection\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1039\",\"type\":\"Line\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1053\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"callback\":null},\"id\":\"1022\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1032\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[6356967497.890762,6364934649.422396,6379797792.442471,6386615501.526691,6392405533.643571,6390611665.838041,6398258268.606213,6408784638.984876,6421836001.511718,6431736266.912669,6430396636.829009,6422909322.914442,6426152296.016416,6429815695.539608,6417774281.679432,6423394661.681578,6453141152.12594,6431646468.512369,6441917692.704989,6448839533.57255,6456301410.684096,6497258946.293305,6499444527.104263,6486320029.447839,6534877063.116443,6549289610.09979,6554884756.318319,6571907900.391269,6574878210.972765,6579250893.85401,6582839695.864539,6580438213.208079,6589137276.040197,6658274201.667021,6650957598.127004,6634536168.236113,6585698447.872364,6613104896.481943,6595995981.175662,6581182799.28903,6583138237.226998,6585466207.973809,6490846958.577853,6502682513.437105,6389960763.804107,6371025690.164766,6357209630.333568,6416833341.923558,6371088049.776331,6338965937.301879,6260908983.377477,6337944717.093331,6302160268.442526,6209319502.271979,6254800283.363329,6267740017.798262,6356920461.144691,6365376908.903307,6373664815.076807,6346059612.690147,6284483284.352605,6275110811.9771,6289568857.766864,6282255424.201239,6276707766.907315,6281899826.252139,6283733274.580786,6269013973.445624,6285255911.614891,6291181174.090234,6318427809.137272,6316492815.330228,6316002641.074398,6332854283.668871,6350066575.303977,6326838129.413195,6325875336.189344,6329732259.88656,6329812555.483136,6325208366.329371,6330165634.073638,6332654121.336827,6337016010.063661,6344371834.706901,6343043161.494389,6317624905.818079,6318744738.328617,6305218241.443946,6313386366.250676,6334038819.35618,6327577492.958534,6306217586.978034,6273296179.225146,6250595574.153788,6255050333.369556,6249614051.694564,6333608576.0757675,6321468220.627065,6324596014.414679,6319643548.182701,6319643548.182701]},\"selected\":{\"id\":\"1050\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1036\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1017\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1016\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1042\",\"type\":\"Title\"},{\"attributes\":{\"axis_label\":\"Total Supply (DAI)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1032\"},\"group\":null,\"major_label_policy\":{\"id\":\"1045\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1017\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1016\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"AllLabels\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (DAI)\"},\"renderers\":[{\"id\":\"1040\"}]},\"id\":\"1064\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"1012\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1015\",\"type\":\"Grid\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1051\"},{\"id\":\"1052\"},{\"id\":\"1053\"},{\"id\":\"1054\"},{\"id\":\"1055\"},{\"id\":\"1056\"},{\"id\":\"1057\"},{\"id\":\"1058\"},{\"id\":\"1059\"},{\"id\":\"1060\"},{\"id\":\"1061\"},{\"id\":\"1062\"}]},\"id\":\"1013\",\"type\":\"DatetimeTicker\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1038\",\"type\":\"Line\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1047\"},\"group\":null,\"major_label_policy\":{\"id\":\"1048\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1013\"}},\"id\":\"1012\",\"type\":\"DatetimeAxis\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1036\"},\"glyph\":{\"id\":\"1037\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1039\"},\"nonselection_glyph\":{\"id\":\"1038\"},\"view\":{\"id\":\"1041\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1040\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1036\"}},\"id\":\"1041\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"a572c77a-26ce-40aa-b9eb-f5d964f58a0f\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"55365ba6-fc15-4fc2-b467-e94a647afa39\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "1003" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "# visualization\n", + "\n", + "v = View(token=\"DAI\", start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", + " .total_supply()\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "288a79de-d699-4585-a785-b1bceed2f2d2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "shape: (5, 4)\n", + "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", + "│ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 6.3570e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 6.4861e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 6.3625e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 6.3035e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 6.3196e9 │\n", + "└────────────┴─────────────────────┴──────────────┴──────────────┘\n" + ] + } + ], + "source": [ + "from web3cat.data import ERC20Data\n", + "d = ERC20Data(token=\"DAI\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "print(d.total_supply([datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]))\n" + ] + }, + { + "cell_type": "markdown", + "id": "7f5ec10b-3527-4701-9612-997a4458cf03", + "metadata": {}, + "source": [ + "## ERC20 total_supply history for many tokens" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "7d21580f-77d9-4d4b-b954-7310f883008e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"3964bf66-ba85-4d55-b968-ed339b233f8c\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1200\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1203\"},{\"id\":\"1207\"},{\"id\":\"1251\"}],\"extra_y_ranges\":{\"Total Supply (DAI)\":{\"id\":\"1222\"},\"Total Supply (USDC)\":{\"id\":\"1256\"}},\"height\":400,\"left\":[{\"id\":\"1204\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1228\"},{\"id\":\"1263\"}],\"right\":[{\"id\":\"1257\"}],\"title\":{\"id\":\"1230\"},\"toolbar\":{\"id\":\"1213\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1192\"},\"x_scale\":{\"id\":\"1196\"},\"y_range\":{\"id\":\"1194\"},\"y_scale\":{\"id\":\"1198\"}},\"id\":\"1191\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1238\",\"type\":\"Selection\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1248\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (DAI)\"},\"renderers\":[{\"id\":\"1228\"}]},\"id\":\"1252\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1250\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"1269\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1235\"},\"group\":null,\"major_label_policy\":{\"id\":\"1236\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1201\"}},\"id\":\"1200\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1230\",\"type\":\"Title\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1243\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1233\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1237\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1244\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1249\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1239\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1200\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1203\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1276\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1205\",\"type\":\"BasicTicker\"},{\"attributes\":{\"tools\":[{\"id\":\"1208\"},{\"id\":\"1209\"},{\"id\":\"1210\"},{\"id\":\"1211\"},{\"id\":\"1212\"}]},\"id\":\"1213\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1209\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1236\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1260\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1192\",\"type\":\"DataRange1d\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1252\"},{\"id\":\"1290\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1251\",\"type\":\"Legend\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1259\"},\"glyph\":{\"id\":\"1260\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1262\"},\"nonselection_glyph\":{\"id\":\"1261\"},\"view\":{\"id\":\"1264\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1263\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1220\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1246\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1254\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1211\",\"type\":\"ResetTool\"},{\"attributes\":{\"end\":6991187911.750372,\"start\":5913637621.211409},\"id\":\"1222\",\"type\":\"Range1d\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1225\",\"type\":\"Line\"},{\"attributes\":{\"axis_label\":\"Total Supply (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1254\"},\"group\":null,\"major_label_policy\":{\"id\":\"1270\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1269\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1257\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1259\"}},\"id\":\"1264\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1226\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null},\"id\":\"1210\",\"type\":\"HoverTool\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1262\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1277\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1212\",\"type\":\"SaveTool\"},{\"attributes\":{\"end\":49488112241.08453,\"start\":42849450537.01862},\"id\":\"1256\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1194\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1227\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1208\",\"type\":\"PanTool\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1241\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[45717933372.29955,45796596212.89955,45820738122.02956,45699069171.309555,45847656244.669556,45830334486.31955,45808217272.49955,45767953200.63955,45773030860.43955,45759885521.79955,45676863349.96955,45747045438.849556,45739403408.85955,45733946091.54955,45721314704.089554,45713037923.20956,45651474178.67955,45754039307.379555,45653239070.059555,45645394434.43955,45412695842.78955,45392643199.32955,45454671794.21955,45443961403.089554,45523019279.809555,45519781830.27956,45552236447.54955,45440842460.17955,45374642602.239555,45424799196.82955,45494484223.57955,45512496662.06956,45452405993.059555,45520523189.60955,45557831404.04955,45600938755.65955,45605494923.339554,45626424249.03955,45686424249.03955,45722348089.03955,45778020821.72955,45867202840.13956,44991923063.86955,45610367414.57955,45651908175.70956,45513911656.47955,45422169960.20956,45452414806.29955,45573200329.99955,45716301404.85955,45679169506.81956,45816745248.72955,45901833481.629555,46016133096.29955,46010186122.31955,46223796701.56955,46411224609.809555,46436905164.86955,46457052719.90955,46500723966.61955,46579916155.03955,46575719898.22955,46834723881.70956,46994027355.739555,46993904379.50955,47052974753.95956,46999992890.879555,46851471311.52956,46880821159.27956,46977344659.86955,46968381825.02956,47015963910.82955,47131535467.699554,47025826738.78955,47051850508.89955,46912027635.129555,46817056705.35955,46815258696.169556,46850687299.31955,46965858737.849556,46930963626.99955,47003035999.79955,46990661976.32955,46990662076.32955,46990628483.13955,46986626748.00955,46983031443.24955,46975294081.52955,46935169638.03955,46854344000.52956,46759438017.07955,46772318097.63956,46703329464.419556,46724318897.20956,46720248310.199554,46755457862.68955,46783632868.90955,46768298100.56956,46747543148.739555,46714595691.25955,46714621321.25955]},\"selected\":{\"id\":\"1277\"},\"selection_policy\":{\"id\":\"1276\"}},\"id\":\"1259\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1224\"},\"glyph\":{\"id\":\"1225\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1227\"},\"nonselection_glyph\":{\"id\":\"1226\"},\"view\":{\"id\":\"1229\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1228\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1198\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1235\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"axis_label\":\"Total Supply (DAI)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1220\"},\"group\":null,\"major_label_policy\":{\"id\":\"1233\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1205\"},\"y_range_name\":\"Total Supply (DAI)\"},\"id\":\"1204\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1224\"}},\"id\":\"1229\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1270\",\"type\":\"AllLabels\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1245\",\"type\":\"DaysTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[6356967497.890762,6364934649.422396,6379797792.442471,6386615501.526691,6392405533.643571,6390611665.838041,6398258268.606213,6408784638.984876,6421836001.511718,6431736266.912669,6430396636.829009,6422909322.914442,6426152296.016416,6429815695.539608,6417774281.679432,6423394661.681578,6453141152.12594,6431646468.512369,6441917692.704989,6448839533.57255,6456301410.684096,6497258946.293305,6499444527.104263,6486320029.447839,6534877063.116443,6549289610.09979,6554884756.318319,6571907900.391269,6574878210.972765,6579250893.85401,6582839695.864539,6580438213.208079,6589137276.040197,6658274201.667021,6650957598.127004,6634536168.236113,6585698447.872364,6613104896.481943,6595995981.175662,6581182799.28903,6583138237.226998,6585466207.973809,6490846958.577853,6502682513.437105,6389960763.804107,6371025690.164766,6357209630.333568,6416833341.923558,6371088049.776331,6338965937.301879,6260908983.377477,6337944717.093331,6302160268.442526,6209319502.271979,6254800283.363329,6267740017.798262,6356920461.144691,6365376908.903307,6373664815.076807,6346059612.690147,6284483284.352605,6275110811.9771,6289568857.766864,6282255424.201239,6276707766.907315,6281899826.252139,6283733274.580786,6269013973.445624,6285255911.614891,6291181174.090234,6318427809.137272,6316492815.330228,6316002641.074398,6332854283.668871,6350066575.303977,6326838129.413195,6325875336.189344,6329732259.88656,6329812555.483136,6325208366.329371,6330165634.073638,6332654121.336827,6337016010.063661,6344371834.706901,6343043161.494389,6317624905.818079,6318744738.328617,6305218241.443946,6313386366.250676,6334038819.35618,6327577492.958534,6306217586.978034,6273296179.225146,6250595574.153788,6255050333.369556,6249614051.694564,6333608576.0757675,6321468220.627065,6324596014.414679,6319643548.182701,6319643548.182701]},\"selected\":{\"id\":\"1238\"},\"selection_policy\":{\"id\":\"1237\"}},\"id\":\"1224\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1239\"},{\"id\":\"1240\"},{\"id\":\"1241\"},{\"id\":\"1242\"},{\"id\":\"1243\"},{\"id\":\"1244\"},{\"id\":\"1245\"},{\"id\":\"1246\"},{\"id\":\"1247\"},{\"id\":\"1248\"},{\"id\":\"1249\"},{\"id\":\"1250\"}]},\"id\":\"1201\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1240\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1261\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1196\",\"type\":\"LinearScale\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1242\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1247\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (USDC)\"},\"renderers\":[{\"id\":\"1263\"}]},\"id\":\"1290\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"1204\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1207\",\"type\":\"Grid\"}],\"root_ids\":[\"1191\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"3964bf66-ba85-4d55-b968-ed339b233f8c\",\"root_ids\":[\"1191\"],\"roots\":{\"1191\":\"7596687c-5594-4686-8361-6eac5ae8fee7\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "1191" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "# visualization\n", + "\n", + "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", + " .total_supply(token=\"DAI\") \\\n", + " .total_supply(token=\"USDC\")\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c8d04f06-bf18-4d9d-ae45-d94aed3de444", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "shape: (5, 4)\n", + "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", + "│ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 6.3570e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 6.4861e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 6.3625e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 6.3035e9 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 6.3196e9 │\n", + "└────────────┴─────────────────────┴──────────────┴──────────────┘\n", + "shape: (5, 4)\n", + "┌────────────┬─────────────────────┬──────────────┬──────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ total_supply │\n", + "│ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪══════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 4.5718e10 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 4.5474e10 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 4.5413e10 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 4.6984e10 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 4.6715e10 │\n", + "└────────────┴─────────────────────┴──────────────┴──────────────┘\n" + ] + } + ], + "source": [ + "from web3cat.data import ERC20Data\n", + "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", + "d_dai = ERC20Data(token=\"DAI\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "d_usdc = ERC20Data(token=\"USDC\", address_filter = [], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "\n", + "print(d_dai.total_supply(dates))\n", + "print(d_usdc.total_supply(dates))\n" + ] + }, + { + "cell_type": "markdown", + "id": "daca4fcf-5022-4432-97c9-5b386ce5646b", + "metadata": {}, + "source": [ + "## Many charts on one axis" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "e66101e6-3839-4c84-bdb5-d6e847937bb6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"8ac9d0e3-e4ec-4016-a981-edfbb8a0515f\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1471\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1474\"},{\"id\":\"1478\"},{\"id\":\"1522\"}],\"extra_y_ranges\":{\"Total supply (USD)\":{\"id\":\"1527\"},\"USD Price\":{\"id\":\"1601\"}},\"height\":400,\"left\":[{\"id\":\"1475\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1499\"},{\"id\":\"1532\"},{\"id\":\"1568\"},{\"id\":\"1606\"}],\"right\":[{\"id\":\"1562\"}],\"title\":{\"id\":\"1501\"},\"toolbar\":{\"id\":\"1484\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1463\"},\"x_scale\":{\"id\":\"1467\"},\"y_range\":{\"id\":\"1465\"},\"y_scale\":{\"id\":\"1469\"}},\"id\":\"1462\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1496\",\"type\":\"Line\"},{\"attributes\":{\"axis_label\":\"USD Price\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1559\"},\"group\":null,\"major_label_policy\":{\"id\":\"1575\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1574\"},\"y_range_name\":\"USD Price\"},\"id\":\"1562\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1480\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[6356967497.890762,6364934649.422396,6379797792.442471,6386615501.526691,6392405533.643571,6390611665.838041,6398258268.606213,6408784638.984876,6421836001.511718,6431736266.912669,6430396636.829009,6422909322.914442,6426152296.016416,6429815695.539608,6417774281.679432,6423394661.681578,6453141152.12594,6431646468.512369,6441917692.704989,6448839533.57255,6456301410.684096,6497258946.293305,6499444527.104263,6486320029.447839,6534877063.116443,6549289610.09979,6554884756.318319,6571907900.391269,6574878210.972765,6579250893.85401,6582839695.864539,6580438213.208079,6589137276.040197,6658274201.667021,6650957598.127004,6634536168.236113,6585698447.872364,6613104896.481943,6595995981.175662,6581182799.28903,6583138237.226998,6585466207.973809,6490846958.577853,6502682513.437105,6389960763.804107,6371025690.164766,6357209630.333568,6416833341.923558,6371088049.776331,6338965937.301879,6260908983.377477,6337944717.093331,6302160268.442526,6209319502.271979,6254800283.363329,6267740017.798262,6356920461.144691,6365376908.903307,6373664815.076807,6346059612.690147,6284483284.352605,6275110811.9771,6289568857.766864,6282255424.201239,6276707766.907315,6281899826.252139,6283733274.580786,6269013973.445624,6285255911.614891,6291181174.090234,6318427809.137272,6316492815.330228,6316002641.074398,6332854283.668871,6350066575.303977,6326838129.413195,6325875336.189344,6329732259.88656,6329812555.483136,6325208366.329371,6330165634.073638,6332654121.336827,6337016010.063661,6344371834.706901,6343043161.494389,6317624905.818079,6318744738.328617,6305218241.443946,6313386366.250676,6334038819.35618,6327577492.958534,6306217586.978034,6273296179.225146,6250595574.153788,6255050333.369556,6249614051.694564,6333608576.0757675,6321468220.627065,6324596014.414679,6319643548.182701,6319643548.182701]},\"selected\":{\"id\":\"1509\"},\"selection_policy\":{\"id\":\"1508\"}},\"id\":\"1495\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1479\",\"type\":\"PanTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1501\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1482\",\"type\":\"ResetTool\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1515\",\"type\":\"DaysTicker\"},{\"attributes\":{\"callback\":null},\"id\":\"1481\",\"type\":\"HoverTool\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1517\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1483\",\"type\":\"SaveTool\"},{\"attributes\":{\"tools\":[{\"id\":\"1479\"},{\"id\":\"1480\"},{\"id\":\"1481\"},{\"id\":\"1482\"},{\"id\":\"1483\"}]},\"id\":\"1484\",\"type\":\"Toolbar\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1511\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1506\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1520\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[1.00189376,0.99997529,1.001,0.99988636,1.001,1.00051723,1.00054626,1.00058212,1.001,1.002,1.00114207,1.002,1.00154291,1.001,1.00147096,1.00173854,1.0008659,1.00192922,1.00091735,1.00035588,1.00031415,1.00068141,1.00080396,1.00002706,1.00020206,1.00099625,1.001,1.00128074,1.00000399,1.00069875,1.001,1.000961,1.00323339,1.001,1.00131392,1.00052707,1.00199515,1.00220753,1.00134884,1.00035661,1.00151057,1.00024244,1.00099905,1.00182452,1.0014114,1.00112096,1.00017501,1.00058675,0.99985402,1.00017409,1.00004704,1.0011826,0.99990079,1.00026928,1.00064956,1.00119096,1.00016346,1.00084645,1.0005329,1.00081165,1.00022172,1.000328,1.001,1.00058267,1.00087924,1.00056871,1.0,1.00065134,1.00062485,1.00073602,1.00153889,1.001,1.00023624,1.0,0.99991811,1.00078514,1.0008136,1.0,1.00080986,1.00053449,1.00170313,1.00075609,1.00126061,1.0012617,1.001,1.002,1.00062003,1.00101311,1.00055899,1.00036979,0.99993406,1.00066517,1.00051139,1.0,1.00021872,1.002,1.00070073,1.001,1.00060657,1.00055398,1.00055398]},\"selected\":{\"id\":\"1584\"},\"selection_policy\":{\"id\":\"1583\"}},\"id\":\"1564\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1624\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1575\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1623\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1566\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[1.00035516,1.00035516,1.00035516,1.00023883,1.00023883,1.00023883,1.00068168,1.00068168,1.00068168,1.0002993,1.0002993,1.0002993,1.00021656,1.00021656,1.00021656,1.00021656,1.00053241,1.00053241,1.00053241,1.0003994,1.0003994,1.0003994,1.0003278,1.0003278,1.0003278,1.0003278,1.00059837,1.00059837,1.00059837,1.00095606,1.00095606,1.00095606,1.0005,1.0005,1.0005,1.0005,1.00042396,1.00042396,1.00042396,1.00071648,1.00071648,1.00071648,1.000352,1.000352,1.000352,1.00038787,1.00038787,1.00038787,1.00038787,1.000512,1.000512,1.000512,1.0009935,1.0009935,1.0009935,1.00042012,1.00042012,1.00042012,1.00042012,1.00025912,1.00025912,1.00025912,1.0005972,1.0005972,1.0005972,1.00005906,1.00005906,1.00005906,1.00005906,1.00014814,1.00014814,1.00014814,1.00076398,1.00076398,1.00076398,1.000011,1.000011,1.000011,1.000011,0.99999274,0.99999274,0.99999274,1.0002993,1.0002993,1.0002993,1.00019895,1.00019895,1.00019895,1.00024458,1.00024458,1.00024458,1.00024458,1.00036763,1.00036763,1.00036763,1.00014503,1.00014503,1.00014503,1.00097403,1.00097403,1.00097403]},\"selected\":{\"id\":\"1624\"},\"selection_policy\":{\"id\":\"1623\"}},\"id\":\"1602\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"DAI / USD price\"},\"renderers\":[{\"id\":\"1568\"}]},\"id\":\"1597\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1574\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1584\",\"type\":\"Selection\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1510\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1567\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1583\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1513\",\"type\":\"DaysTicker\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1512\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1516\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1518\",\"type\":\"MonthsTicker\"},{\"attributes\":{},\"id\":\"1508\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1509\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1521\",\"type\":\"YearsTicker\"},{\"attributes\":{\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1565\",\"type\":\"Line\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1519\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1529\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1528\"},\"glyph\":{\"id\":\"1529\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1531\"},\"nonselection_glyph\":{\"id\":\"1530\"},\"view\":{\"id\":\"1533\"},\"y_range_name\":\"Total supply (USD)\"},\"id\":\"1532\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[45717933372.29955,45796596212.89955,45820738122.02956,45699069171.309555,45847656244.669556,45830334486.31955,45808217272.49955,45767953200.63955,45773030860.43955,45759885521.79955,45676863349.96955,45747045438.849556,45739403408.85955,45733946091.54955,45721314704.089554,45713037923.20956,45651474178.67955,45754039307.379555,45653239070.059555,45645394434.43955,45412695842.78955,45392643199.32955,45454671794.21955,45443961403.089554,45523019279.809555,45519781830.27956,45552236447.54955,45440842460.17955,45374642602.239555,45424799196.82955,45494484223.57955,45512496662.06956,45452405993.059555,45520523189.60955,45557831404.04955,45600938755.65955,45605494923.339554,45626424249.03955,45686424249.03955,45722348089.03955,45778020821.72955,45867202840.13956,44991923063.86955,45610367414.57955,45651908175.70956,45513911656.47955,45422169960.20956,45452414806.29955,45573200329.99955,45716301404.85955,45679169506.81956,45816745248.72955,45901833481.629555,46016133096.29955,46010186122.31955,46223796701.56955,46411224609.809555,46436905164.86955,46457052719.90955,46500723966.61955,46579916155.03955,46575719898.22955,46834723881.70956,46994027355.739555,46993904379.50955,47052974753.95956,46999992890.879555,46851471311.52956,46880821159.27956,46977344659.86955,46968381825.02956,47015963910.82955,47131535467.699554,47025826738.78955,47051850508.89955,46912027635.129555,46817056705.35955,46815258696.169556,46850687299.31955,46965858737.849556,46930963626.99955,47003035999.79955,46990661976.32955,46990662076.32955,46990628483.13955,46986626748.00955,46983031443.24955,46975294081.52955,46935169638.03955,46854344000.52956,46759438017.07955,46772318097.63956,46703329464.419556,46724318897.20956,46720248310.199554,46755457862.68955,46783632868.90955,46768298100.56956,46747543148.739555,46714595691.25955,46714621321.25955]},\"selected\":{\"id\":\"1544\"},\"selection_policy\":{\"id\":\"1543\"}},\"id\":\"1528\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1528\"}},\"id\":\"1533\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"USDC / USD price\"},\"renderers\":[{\"id\":\"1606\"}]},\"id\":\"1637\",\"type\":\"LegendItem\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1514\",\"type\":\"DaysTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1530\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1531\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (USDC)\"},\"renderers\":[{\"id\":\"1532\"}]},\"id\":\"1557\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (DAI)\"},\"renderers\":[{\"id\":\"1499\"}]},\"id\":\"1523\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1602\"},\"glyph\":{\"id\":\"1603\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1605\"},\"nonselection_glyph\":{\"id\":\"1604\"},\"view\":{\"id\":\"1607\"},\"y_range_name\":\"USD Price\"},\"id\":\"1606\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1603\",\"type\":\"Line\"},{\"attributes\":{\"end\":1.0533950595,\"start\":0.9522419238095238},\"id\":\"1601\",\"type\":\"Range1d\"},{\"attributes\":{\"source\":{\"id\":\"1495\"}},\"id\":\"1500\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1495\"},\"glyph\":{\"id\":\"1496\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1498\"},\"nonselection_glyph\":{\"id\":\"1497\"},\"view\":{\"id\":\"1500\"},\"y_range_name\":\"Total supply (USD)\"},\"id\":\"1499\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1602\"}},\"id\":\"1607\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1465\",\"type\":\"DataRange1d\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1491\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"end\":49488112241.08453,\"start\":5913637621.211409},\"id\":\"1527\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1469\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1605\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1463\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1506\"},\"group\":null,\"major_label_policy\":{\"id\":\"1507\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1472\"}},\"id\":\"1471\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"axis_label\":\"Total supply (USD)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1491\"},\"group\":null,\"major_label_policy\":{\"id\":\"1504\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1476\"},\"y_range_name\":\"Total supply (USD)\"},\"id\":\"1475\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1543\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1467\",\"type\":\"LinearScale\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1510\"},{\"id\":\"1511\"},{\"id\":\"1512\"},{\"id\":\"1513\"},{\"id\":\"1514\"},{\"id\":\"1515\"},{\"id\":\"1516\"},{\"id\":\"1517\"},{\"id\":\"1518\"},{\"id\":\"1519\"},{\"id\":\"1520\"},{\"id\":\"1521\"}]},\"id\":\"1472\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1471\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1474\",\"type\":\"Grid\"},{\"attributes\":{\"format\":\"0.00a\"},\"id\":\"1559\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1544\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1475\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1478\",\"type\":\"Grid\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1498\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1504\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1497\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1564\"}},\"id\":\"1569\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1507\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1604\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1564\"},\"glyph\":{\"id\":\"1565\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1567\"},\"nonselection_glyph\":{\"id\":\"1566\"},\"view\":{\"id\":\"1569\"},\"y_range_name\":\"USD Price\"},\"id\":\"1568\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1476\",\"type\":\"BasicTicker\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1523\"},{\"id\":\"1557\"},{\"id\":\"1597\"},{\"id\":\"1637\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1522\",\"type\":\"Legend\"}],\"root_ids\":[\"1462\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"8ac9d0e3-e4ec-4016-a981-edfbb8a0515f\",\"root_ids\":[\"1462\"],\"roots\":{\"1462\":\"c80fc04f-e6e8-413c-ae94-dcabccece50a\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "1462" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "# visualization\n", + "\n", + "v = View(y_axis_name=\"Total supply (USD)\", start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", + " .total_supply(token=\"DAI\") \\\n", + " .total_supply(token=\"USDC\") \\\n", + " .chainlink_prices(token=\"DAI\", base_token = \"USD\", y_axis_name = \"USD Price\") \\\n", + " .chainlink_prices(token=\"USDC\", base_token = \"USD\", y_axis_name = \"USD Price\")\n", + "v.show()" + ] + }, + { + "cell_type": "markdown", + "id": "dbd9e42c-78ca-4ff7-bb22-cbcb87b4a7a7", + "metadata": {}, + "source": [ + "## ERC20 total supply and price" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "b5f49fb9-cfd7-41e5-b6a4-2c2d607289ea", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"fc79d6a5-6a88-4d25-9941-19b74ca0ca5e\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"1867\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"1870\"},{\"id\":\"1874\"},{\"id\":\"1918\"}],\"extra_y_ranges\":{\"Total Supply (USDC)\":{\"id\":\"1889\"},\"WETH / USDC price\":{\"id\":\"1923\"}},\"height\":400,\"left\":[{\"id\":\"1871\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"1895\"},{\"id\":\"1930\"}],\"right\":[{\"id\":\"1924\"}],\"title\":{\"id\":\"1897\"},\"toolbar\":{\"id\":\"1880\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"1859\"},\"x_scale\":{\"id\":\"1863\"},\"y_range\":{\"id\":\"1861\"},\"y_scale\":{\"id\":\"1865\"}},\"id\":\"1858\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1861\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1865\",\"type\":\"LinearScale\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"1906\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1887\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"1913\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1902\"},\"group\":null,\"major_label_policy\":{\"id\":\"1903\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1868\"}},\"id\":\"1867\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1892\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1917\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"1876\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"1911\",\"type\":\"DaysTicker\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"1906\"},{\"id\":\"1907\"},{\"id\":\"1908\"},{\"id\":\"1909\"},{\"id\":\"1910\"},{\"id\":\"1911\"},{\"id\":\"1912\"},{\"id\":\"1913\"},{\"id\":\"1914\"},{\"id\":\"1915\"},{\"id\":\"1916\"},{\"id\":\"1917\"}]},\"id\":\"1868\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1926\"},\"glyph\":{\"id\":\"1927\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1929\"},\"nonselection_glyph\":{\"id\":\"1928\"},\"view\":{\"id\":\"1931\"},\"y_range_name\":\"WETH / USDC price\"},\"id\":\"1930\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"1921\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"1904\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"1909\",\"type\":\"DaysTicker\"},{\"attributes\":{\"end\":2037.995560496734,\"start\":919.9457293673682},\"id\":\"1923\",\"type\":\"Range1d\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"1908\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[1934.5644468210671,1934.8428212236142,1940.9481528540323,1837.55583394018,1818.2540778185944,1825.1840912834787,1824.504077050756,1836.6380006077459,1823.9066792948583,1749.0249728656213,1760.5730604829973,1752.871100069749,1772.1512229311622,1775.4355116855895,1789.5596623795152,1790.9071611451827,1807.1263970149655,1805.103944608851,1884.0419431990217,1910.0471271774052,1860.146373808301,1748.0518280998567,1750.201624457503,1804.907851086414,1826.9040764837287,1804.4085148888194,1792.997124310726,1792.1546490626404,1797.0537473891745,1794.1209127601464,1793.6854291086463,1790.7978897695068,1743.8083965117441,1669.5120439780112,1672.7736131934032,1601.5792103948029,1535.9899846860924,1536.9022632264823,1467.42077228938,1534.2107686684644,1461.1531130175854,1320.2808854911634,1211.5335401938519,1261.145118878155,1165.3597933527399,1181.3733629737035,1222.8956754543615,1220.5054025695056,1032.1696523569403,1115.7429895893301,1225.0627678628541,1171.4002430755452,1087.9569694608406,1107.8205532403556,1087.1667005430104,1093.41622874398,1079.2225045513878,1077.397363819512,987.8949655670659,981.9268053062092,993.8856291457759,965.9430158357367,1030.30312766216,1128.607173176179,1063.2089384419626,1124.971172922527,1107.8379976178605,1125.6898298186507,1151.705615556345,1160.7004801208748,1117.3844706645157,1073.8750151352576,1098.2742541852874,1056.4609958184144,1083.2232495018454,1115.6577277649947,1132.7756679776523,1148.9872111406773,1166.3285932454744,1205.0454945802906,1223.408881948483,1228.5089189747516,1185.642612576056,1242.0540577805064,1242.6538363767725,1224.4363983785427,1240.8990292081392,1219.797321322923,1220.7169730827234,1190.5803849894394,1172.2101008535333,1223.9330855159446,1187.5551464115247,1142.1201223794096,1124.7165204655814,1117.8087841920285,1113.2752416916974,1086.498012163296,1029.9652369702337,1014.2260774038264,1014.2260774038264]},\"selected\":{\"id\":\"1944\"},\"selection_policy\":{\"id\":\"1943\"}},\"id\":\"1926\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"1912\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"1859\",\"type\":\"DataRange1d\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"1910\",\"type\":\"DaysTicker\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"1919\"},{\"id\":\"1957\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"1918\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1872\",\"type\":\"BasicTicker\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1894\",\"type\":\"Line\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"1914\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1893\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1944\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1900\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"1891\"}},\"id\":\"1896\",\"type\":\"CDSView\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"1916\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1891\"},\"glyph\":{\"id\":\"1892\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1894\"},\"nonselection_glyph\":{\"id\":\"1893\"},\"view\":{\"id\":\"1896\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1895\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1875\",\"type\":\"PanTool\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"1915\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"source\":{\"id\":\"1926\"}},\"id\":\"1931\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1936\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1903\",\"type\":\"AllLabels\"},{\"attributes\":{\"end\":49488112241.08453,\"start\":42849450537.01862},\"id\":\"1889\",\"type\":\"Range1d\"},{\"attributes\":{\"label\":{\"value\":\"WETH / USDC price\"},\"renderers\":[{\"id\":\"1930\"}]},\"id\":\"1957\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1943\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1928\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1902\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"axis_label\":\"Total Supply (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1887\"},\"group\":null,\"major_label_policy\":{\"id\":\"1900\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1872\"},\"y_range_name\":\"Total Supply (USDC)\"},\"id\":\"1871\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"WETH / USDC price\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"1921\"},\"group\":null,\"major_label_policy\":{\"id\":\"1937\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"1936\"},\"y_range_name\":\"WETH / USDC price\"},\"id\":\"1924\",\"type\":\"LinearAxis\"},{\"attributes\":{\"label\":{\"value\":\"Total Supply (USDC)\"},\"renderers\":[{\"id\":\"1895\"}]},\"id\":\"1919\",\"type\":\"LegendItem\"},{\"attributes\":{\"tools\":[{\"id\":\"1875\"},{\"id\":\"1876\"},{\"id\":\"1877\"},{\"id\":\"1878\"},{\"id\":\"1879\"}]},\"id\":\"1880\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1905\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1867\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1870\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"1897\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null},\"id\":\"1877\",\"type\":\"HoverTool\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1929\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1927\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1871\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"1874\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1937\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1878\",\"type\":\"ResetTool\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[45717933372.29955,45796596212.89955,45820738122.02956,45699069171.309555,45847656244.669556,45830334486.31955,45808217272.49955,45767953200.63955,45773030860.43955,45759885521.79955,45676863349.96955,45747045438.849556,45739403408.85955,45733946091.54955,45721314704.089554,45713037923.20956,45651474178.67955,45754039307.379555,45653239070.059555,45645394434.43955,45412695842.78955,45392643199.32955,45454671794.21955,45443961403.089554,45523019279.809555,45519781830.27956,45552236447.54955,45440842460.17955,45374642602.239555,45424799196.82955,45494484223.57955,45512496662.06956,45452405993.059555,45520523189.60955,45557831404.04955,45600938755.65955,45605494923.339554,45626424249.03955,45686424249.03955,45722348089.03955,45778020821.72955,45867202840.13956,44991923063.86955,45610367414.57955,45651908175.70956,45513911656.47955,45422169960.20956,45452414806.29955,45573200329.99955,45716301404.85955,45679169506.81956,45816745248.72955,45901833481.629555,46016133096.29955,46010186122.31955,46223796701.56955,46411224609.809555,46436905164.86955,46457052719.90955,46500723966.61955,46579916155.03955,46575719898.22955,46834723881.70956,46994027355.739555,46993904379.50955,47052974753.95956,46999992890.879555,46851471311.52956,46880821159.27956,46977344659.86955,46968381825.02956,47015963910.82955,47131535467.699554,47025826738.78955,47051850508.89955,46912027635.129555,46817056705.35955,46815258696.169556,46850687299.31955,46965858737.849556,46930963626.99955,47003035999.79955,46990661976.32955,46990662076.32955,46990628483.13955,46986626748.00955,46983031443.24955,46975294081.52955,46935169638.03955,46854344000.52956,46759438017.07955,46772318097.63956,46703329464.419556,46724318897.20956,46720248310.199554,46755457862.68955,46783632868.90955,46768298100.56956,46747543148.739555,46714595691.25955,46714621321.25955]},\"selected\":{\"id\":\"1905\"},\"selection_policy\":{\"id\":\"1904\"}},\"id\":\"1891\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1863\",\"type\":\"LinearScale\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"1907\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"1879\",\"type\":\"SaveTool\"}],\"root_ids\":[\"1858\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"fc79d6a5-6a88-4d25-9941-19b74ca0ca5e\",\"root_ids\":[\"1858\"],\"roots\":{\"1858\":\"1ae68a2c-bd31-4859-af03-eeea03996707\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "1858" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "# visualization\n", + "\n", + "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", + " .total_supply(token = \"USDC\") \\\n", + " .chainlink_prices(token=\"WETH\", base_token = \"USDC\")\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "b58e23c8-90e8-4b1a-8daa-cc64751d27b7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "shape: (5, 4)\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "timestamp\n", + "\n", + "date\n", + "\n", + "block_number\n", + "\n", + "price\n", + "
\n", + "u64\n", + "\n", + "datetime[μs]\n", + "\n", + "u64\n", + "\n", + "f64\n", + "
\n", + "1654027190\n", + "\n", + "2022-05-31 23:59:50\n", + "\n", + "14880658\n", + "\n", + "1934.564447\n", + "
\n", + "1654631987\n", + "\n", + "2022-06-07 23:59:47\n", + "\n", + "14922671\n", + "\n", + "1859.267306\n", + "
\n", + "1655236792\n", + "\n", + "2022-06-14 23:59:52\n", + "\n", + "14963567\n", + "\n", + "1203.750861\n", + "
\n", + "1655841600\n", + "\n", + "2022-06-22 00:00:00\n", + "\n", + "15003956\n", + "\n", + "1125.700139\n", + "
\n", + "1656619189\n", + "\n", + "2022-06-30 23:59:49\n", + "\n", + "15052211\n", + "\n", + "1014.226077\n", + "
\n", + "
" + ], + "text/plain": [ + "shape: (5, 4)\n", + "┌────────────┬─────────────────────┬──────────────┬─────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ price │\n", + "│ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪═════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 1934.564447 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 1859.267306 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655236792 ┆ 2022-06-14 23:59:52 ┆ 14963567 ┆ 1203.750861 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 1125.700139 │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 1014.226077 │\n", + "└────────────┴─────────────────────┴──────────────┴─────────────┘" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# data\n", + "\n", + "from web3cat.data import ChainlinkData\n", + "\n", + "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", + "d = ChainlinkData(tokens = [\"WETH\", \"USDC\"], start=datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "d.prices(\"WETH\", \"USDC\", dates)" + ] + }, + { + "cell_type": "markdown", + "id": "d2a5334b-36b6-4b45-a28d-afec0a998e27", + "metadata": {}, + "source": [ + "## ERC20 and ETH balances" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "a2a2728b-48d8-475d-8f92-a756da03b46d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"8192caac-3ec5-4daf-8c41-87c3c5b026c0\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"2192\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"2195\"},{\"id\":\"2199\"},{\"id\":\"2243\"}],\"extra_y_ranges\":{\"Balance (ETH)\":{\"id\":\"2322\"},\"Balance (WBTC)\":{\"id\":\"2248\"}},\"height\":400,\"left\":[{\"id\":\"2196\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"2220\"},{\"id\":\"2253\"},{\"id\":\"2289\"},{\"id\":\"2327\"}],\"right\":[{\"id\":\"2283\"}],\"title\":{\"id\":\"2222\"},\"toolbar\":{\"id\":\"2205\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"2184\"},\"x_scale\":{\"id\":\"2188\"},\"y_range\":{\"id\":\"2186\"},\"y_scale\":{\"id\":\"2190\"}},\"id\":\"2183\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5 balance (ETH)\"},\"renderers\":[{\"id\":\"2327\"}]},\"id\":\"2358\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"2228\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"2227\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"2222\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2225\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"2229\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2219\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2218\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"2216\"}},\"id\":\"2221\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2325\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2217\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d balance (WBTC)\"},\"renderers\":[{\"id\":\"2220\"}]},\"id\":\"2244\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null},\"id\":\"2202\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2344\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]},\"selected\":{\"id\":\"2230\"},\"selection_policy\":{\"id\":\"2229\"}},\"id\":\"2216\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"2244\"},{\"id\":\"2278\"},{\"id\":\"2318\"},{\"id\":\"2358\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"2243\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"2230\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2204\",\"type\":\"SaveTool\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2326\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"2200\",\"type\":\"PanTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2323\"},\"glyph\":{\"id\":\"2324\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2326\"},\"nonselection_glyph\":{\"id\":\"2325\"},\"view\":{\"id\":\"2328\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"2327\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2203\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2201\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2216\"},\"glyph\":{\"id\":\"2217\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2219\"},\"nonselection_glyph\":{\"id\":\"2218\"},\"view\":{\"id\":\"2221\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"2220\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2186\",\"type\":\"DataRange1d\"},{\"attributes\":{\"tools\":[{\"id\":\"2200\"},{\"id\":\"2201\"},{\"id\":\"2202\"},{\"id\":\"2203\"},{\"id\":\"2204\"}]},\"id\":\"2205\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis_label\":\"Balance (WBTC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2212\"},\"group\":null,\"major_label_policy\":{\"id\":\"2225\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2197\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"2196\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2197\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"2196\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2199\",\"type\":\"Grid\"},{\"attributes\":{\"axis\":{\"id\":\"2192\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2195\",\"type\":\"Grid\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"2231\"},{\"id\":\"2232\"},{\"id\":\"2233\"},{\"id\":\"2234\"},{\"id\":\"2235\"},{\"id\":\"2236\"},{\"id\":\"2237\"},{\"id\":\"2238\"},{\"id\":\"2239\"},{\"id\":\"2240\"},{\"id\":\"2241\"},{\"id\":\"2242\"}]},\"id\":\"2193\",\"type\":\"DatetimeTicker\"},{\"attributes\":{},\"id\":\"2188\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2227\"},\"group\":null,\"major_label_policy\":{\"id\":\"2228\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2193\"}},\"id\":\"2192\",\"type\":\"DatetimeAxis\"},{\"attributes\":{},\"id\":\"2190\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2345\",\"type\":\"Selection\"},{\"attributes\":{\"line_color\":\"#d62728\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2324\",\"type\":\"Line\"},{\"attributes\":{\"format\":\"0.00a\"},\"id\":\"2212\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"2184\",\"type\":\"DataRange1d\"},{\"attributes\":{\"end\":66886.04229508953},\"id\":\"2248\",\"type\":\"Range1d\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2249\"},\"glyph\":{\"id\":\"2250\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2252\"},\"nonselection_glyph\":{\"id\":\"2251\"},\"view\":{\"id\":\"2254\"},\"y_range_name\":\"Balance (WBTC)\"},\"id\":\"2253\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2250\",\"type\":\"Line\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"2231\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"2304\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"2232\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"source\":{\"id\":\"2249\"}},\"id\":\"2254\",\"type\":\"CDSView\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"2238\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[25978.11414452,25977.11414452,25977.11414452,25984.747880040002,25986.766357970002,25986.766357970002,25986.766357970002,25987.88956331,25987.88956331,25986.88956331,25986.582445480002,25991.29432471,25992.48448436,25987.61925161,25992.16065222,25992.16065222,25991.05114679,25991.826676790002,25992.03192661,25992.03192661,25992.38844007,25993.13491805,26123.13491805,26127.880530550003,26130.09742635,26137.462487,26137.462487,26137.462487,26137.462487,26138.462487,26138.365787000002,26135.12618259,26134.33154554,26135.95637579,26134.64132248,26134.64132248,25124.8436666,25124.8436666,26281.348347720002,26240.66688632,26238.15878895,25966.75329657,29644.71468453,28435.30186199,30365.19325906,30378.013279990002,30421.193075080002,30407.85239898,30406.685058450006,30210.219633630008,30204.696894180008,30205.392294180005,30199.424683820005,30191.743590430007,30187.776904260005,30205.517158500006,57754.777651070006,57743.52134107,57619.61929483,58004.35997902001,63700.99266199002,63556.69681145002,63550.849119480015,63553.39761774002,63553.830750280016,63548.194321570016,63546.92211846002,63547.49951117003,63547.756468090025,63546.90229388002,63543.38517712003,63543.09944764002,63542.09944764002,63537.562293890034,63537.562293890034,63537.562293890034,63531.36602319003,63658.696591080035,63658.696591080035,63658.696591080035,63658.696591080035,63658.696591080035,57917.85856731003,57918.46796521003,57923.96223555003,57923.96223555003,57922.66223555003,57922.273237140034,57922.273237140034,57924.11378264003,57845.90186654003,57845.90186654003,57827.17418462003,57827.17418462003,57815.462998330026,57815.44729311003,57788.65109002002,57775.52887440003,57774.61878628003,57785.27637600002,57785.27637600002]},\"selected\":{\"id\":\"2265\"},\"selection_policy\":{\"id\":\"2264\"}},\"id\":\"2249\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2252\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"2242\",\"type\":\"YearsTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"2236\",\"type\":\"DaysTicker\"},{\"attributes\":{},\"id\":\"2295\",\"type\":\"BasicTicker\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"2234\",\"type\":\"DaysTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#ff7f0e\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2251\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"2305\",\"type\":\"Selection\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"2233\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5 balance (WBTC)\"},\"renderers\":[{\"id\":\"2253\"}]},\"id\":\"2278\",\"type\":\"LegendItem\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"2237\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"2235\",\"type\":\"DaysTicker\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"2239\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"2241\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"end\":231497.37289677645},\"id\":\"2322\",\"type\":\"Range1d\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"2240\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2287\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d balance (ETH)\"},\"renderers\":[{\"id\":\"2289\"}]},\"id\":\"2318\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"2264\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"2323\"}},\"id\":\"2328\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2296\",\"type\":\"AllLabels\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]},\"selected\":{\"id\":\"2345\"},\"selection_policy\":{\"id\":\"2344\"}},\"id\":\"2323\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2265\",\"type\":\"Selection\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2288\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[1654041600000.0,1654067781000.0,1654093962000.0,1654120143000.0,1654146324000.0,1654172505000.0,1654198686000.0,1654224867000.0,1654251048000.0,1654277229000.0,1654303410000.0,1654329591000.0,1654355772000.0,1654381953000.0,1654408134000.0,1654434315000.0,1654460496000.0,1654486677000.0,1654512858000.0,1654539039000.0,1654565220000.0,1654591401000.0,1654617582000.0,1654643763000.0,1654669944000.0,1654696125000.0,1654722306000.0,1654748487000.0,1654774668000.0,1654800849000.0,1654827030000.0,1654853211000.0,1654879392000.0,1654905573000.0,1654931754000.0,1654957935000.0,1654984116000.0,1655010297000.0,1655036478000.0,1655062659000.0,1655088840000.0,1655115021000.0,1655141202000.0,1655167383000.0,1655193564000.0,1655219745000.0,1655245926000.0,1655272107000.0,1655298288000.0,1655324469000.0,1655350650000.0,1655376831000.0,1655403012000.0,1655429193000.0,1655455374000.0,1655481555000.0,1655507736000.0,1655533917000.0,1655560098000.0,1655586279000.0,1655612460000.0,1655638641000.0,1655664822000.0,1655691003000.0,1655717184000.0,1655743365000.0,1655769546000.0,1655795727000.0,1655821908000.0,1655848089000.0,1655874270000.0,1655900451000.0,1655926632000.0,1655952813000.0,1655978994000.0,1656005175000.0,1656031356000.0,1656057537000.0,1656083718000.0,1656109899000.0,1656136080000.0,1656162261000.0,1656188442000.0,1656214623000.0,1656240804000.0,1656266985000.0,1656293166000.0,1656319347000.0,1656345528000.0,1656371709000.0,1656397890000.0,1656424071000.0,1656450252000.0,1656476433000.0,1656502614000.0,1656528795000.0,1656554976000.0,1656581157000.0,1656607338000.0,1656633519000.0,1656633600000.0],\"y\":[200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,200748.93847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042,220473.68847312042]},\"selected\":{\"id\":\"2305\"},\"selection_policy\":{\"id\":\"2304\"}},\"id\":\"2285\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"Balance (ETH)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2280\"},\"group\":null,\"major_label_policy\":{\"id\":\"2296\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2295\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"2283\",\"type\":\"LinearAxis\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2285\"},\"glyph\":{\"id\":\"2286\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2288\"},\"nonselection_glyph\":{\"id\":\"2287\"},\"view\":{\"id\":\"2290\"},\"y_range_name\":\"Balance (ETH)\"},\"id\":\"2289\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"2285\"}},\"id\":\"2290\",\"type\":\"CDSView\"},{\"attributes\":{\"format\":\"0.00a\"},\"id\":\"2280\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"line_color\":\"#2ca02c\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2286\",\"type\":\"Line\"}],\"root_ids\":[\"2183\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"8192caac-3ec5-4daf-8c41-87c3c5b026c0\",\"root_ids\":[\"2183\"],\"roots\":{\"2183\":\"e82af417-c569-4952-ae96-702ed24813f4\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "2183" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "# visualization\n", + "\n", + "addresses = [\n", + " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", + " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", + "]\n", + "\n", + "v = View(start=datetime(2022, 6, 1), end = datetime(2022, 7, 1)) \\\n", + " .balance(token = \"WBTC\", address = addresses) \\\n", + " .balance(token = \"ETH\", address = addresses)\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "7219deb2-7e4c-4fd2-b077-444c67b5caf8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "shape: (10, 5)\n", + "┌────────────┬─────────────────────┬──────────────┬────────────────────────────────┬───────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ address ┆ balance │\n", + "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ str ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪════════════════════════════════╪═══════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0x78605df79524164911c144801f41 ┆ 200748.938473 │\n", + "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", + "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0x78605df79524164911c144801f41 ┆ 200748.938473 │\n", + "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", + "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0x78605df79524164911c144801f41 ┆ 220473.688473 │\n", + "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", + "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0x78605df79524164911c144801f41 ┆ 220473.688473 │\n", + "│ ┆ ┆ ┆ e9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0xbf72da2bd84c5170618fbe5914b0 ┆ 0.0 │\n", + "│ ┆ ┆ ┆ eca9638d5eb5 ┆ │\n", + "└────────────┴─────────────────────┴──────────────┴────────────────────────────────┴───────────────┘\n", + "shape: (10, 5)\n", + "┌────────────┬─────────────────────┬──────────────┬─────────────────────────────────┬──────────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ address ┆ balance │\n", + "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ str ┆ f64 │\n", + "╞════════════╪═════════════════════╪══════════════╪═════════════════════════════════╪══════════════╡\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", + "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654027190 ┆ 2022-05-31 23:59:50 ┆ 14880658 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 25978.114145 │\n", + "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", + "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654631987 ┆ 2022-06-07 23:59:47 ┆ 14922671 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 26127.880531 │\n", + "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", + "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1655841600 ┆ 2022-06-22 00:00:00 ┆ 15003956 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 63546.902294 │\n", + "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0x78605df79524164911c144801f41e ┆ 0.0 │\n", + "│ ┆ ┆ ┆ 9811b7db73d ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 23:59:49 ┆ 15052211 ┆ 0xbf72da2bd84c5170618fbe5914b0e ┆ 57785.276376 │\n", + "│ ┆ ┆ ┆ ca9638d5eb5 ┆ │\n", + "└────────────┴─────────────────────┴──────────────┴─────────────────────────────────┴──────────────┘\n" + ] + } + ], + "source": [ + "from web3cat.data import ERC20Data, EtherData\n", + "\n", + "addresses = [\n", + " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", + " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", + "]\n", + "\n", + "dates = [datetime(2022, 6, 1), datetime(2022, 6, 8), datetime(2022, 6, 15), datetime(2022, 6, 22), datetime(2022, 7, 1)]\n", + "e_data = EtherData(start = datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "u_data = ERC20Data(token=\"WBTC\", address_filter=addresses, start = datetime(2022, 6, 1), end = datetime(2022, 7, 1))\n", + "\n", + "print(e_data.balances(addresses, dates))\n", + "print(u_data.balances(addresses, dates))" + ] + }, + { + "cell_type": "markdown", + "id": "8d5f4e7b-54f5-4223-bd86-368051b58d6b", + "metadata": {}, + "source": [ + "## Portfolio by token breakdown" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d1a413bf-56c6-4df7-8d23-afca09d7b4d6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"f5e6bd38-0073-4aa4-a9a6-6bb2fa701a94\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"2642\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"2645\"},{\"id\":\"2649\"},{\"id\":\"2718\"}],\"extra_y_ranges\":{\"Balance (USDC)\":{\"id\":\"2681\"}},\"height\":400,\"left\":[{\"id\":\"2646\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"2695\"},{\"id\":\"2725\"},{\"id\":\"2756\"},{\"id\":\"2789\"}],\"title\":{\"id\":\"2697\"},\"toolbar\":{\"id\":\"2655\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"2634\"},\"x_scale\":{\"id\":\"2638\"},\"y_range\":{\"id\":\"2636\"},\"y_scale\":{\"id\":\"2640\"}},\"id\":\"2633\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2634\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2769\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2688\"}},\"y2\":{\"expr\":{\"id\":\"2689\"}}},\"id\":\"2787\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2770\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2700\",\"type\":\"AllLabels\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\",\"WBTC (USDC)\"]},\"id\":\"2689\",\"type\":\"Stack\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2686\"}},\"y2\":{\"expr\":{\"id\":\"2687\"}}},\"id\":\"2753\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2705\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"2720\"}},\"id\":\"2726\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2705\"},\"selection_policy\":{\"id\":\"2704\"}},\"id\":\"2690\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2784\"},\"glyph\":{\"id\":\"2786\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2788\"},\"name\":\"WBTC (USDC)\",\"nonselection_glyph\":{\"id\":\"2787\"},\"view\":{\"id\":\"2790\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2789\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2651\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"label\":{\"value\":\"WETH (USDC)\"},\"renderers\":[{\"id\":\"2725\"}]},\"id\":\"2750\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"WBTC (USDC)\"},\"renderers\":[{\"id\":\"2789\"}]},\"id\":\"2818\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2720\"},\"glyph\":{\"id\":\"2722\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2724\"},\"name\":\"WETH (USDC)\",\"nonselection_glyph\":{\"id\":\"2723\"},\"view\":{\"id\":\"2726\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2725\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2704\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2702\"},\"group\":null,\"major_label_policy\":{\"id\":\"2703\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2643\"}},\"id\":\"2642\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"source\":{\"id\":\"2784\"}},\"id\":\"2790\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2702\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"2690\"}},\"id\":\"2696\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2682\"}},\"y2\":{\"expr\":{\"id\":\"2683\"}}},\"id\":\"2693\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"2805\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2804\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2684\"}},\"y2\":{\"expr\":{\"id\":\"2685\"}}},\"id\":\"2724\",\"type\":\"VArea\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2770\"},\"selection_policy\":{\"id\":\"2769\"}},\"id\":\"2751\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis\":{\"id\":\"2646\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2649\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2717\",\"type\":\"YearsTicker\"},{\"attributes\":{\"fields\":[]},\"id\":\"2682\",\"type\":\"Stack\"},{\"attributes\":{\"callback\":null},\"id\":\"2652\",\"type\":\"HoverTool\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\"]},\"id\":\"2683\",\"type\":\"Stack\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\"]},\"id\":\"2685\",\"type\":\"Stack\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\"]},\"id\":\"2687\",\"type\":\"Stack\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2684\"}},\"y2\":{\"expr\":{\"id\":\"2685\"}}},\"id\":\"2723\",\"type\":\"VArea\"},{\"attributes\":{\"label\":{\"value\":\"USDC (USDC)\"},\"renderers\":[{\"id\":\"2695\"}]},\"id\":\"2719\",\"type\":\"LegendItem\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2737\"},\"selection_policy\":{\"id\":\"2736\"}},\"id\":\"2720\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2688\"}},\"y2\":{\"expr\":{\"id\":\"2689\"}}},\"id\":\"2786\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2684\"}},\"y2\":{\"expr\":{\"id\":\"2685\"}}},\"id\":\"2722\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2686\"}},\"y2\":{\"expr\":{\"id\":\"2687\"}}},\"id\":\"2754\",\"type\":\"VArea\"},{\"attributes\":{\"data\":{\"ETH (USDC)\":[388361759.1071686,358901944.7663363,352715534.5696966,354698463.25146246,252256170.74389517,211519888.64067248,236982335.57580456,241136218.822482,268785526.6329452,223610164.23084614,223610164.23084614],\"USDC (USDC)\":[168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,168928317.0,190639384.0,190639384.0,190639384.0,190639384.0,190639384.0],\"WBTC (USDC)\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"WETH (USDC)\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"2805\"},\"selection_policy\":{\"id\":\"2804\"}},\"id\":\"2784\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2686\"}},\"y2\":{\"expr\":{\"id\":\"2687\"}}},\"id\":\"2755\",\"type\":\"VArea\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"2716\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"2715\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"tools\":[{\"id\":\"2650\"},{\"id\":\"2651\"},{\"id\":\"2652\"},{\"id\":\"2653\"},{\"id\":\"2654\"}]},\"id\":\"2655\",\"type\":\"Toolbar\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"2662\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{},\"id\":\"2636\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\"]},\"id\":\"2684\",\"type\":\"Stack\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"2706\"},{\"id\":\"2707\"},{\"id\":\"2708\"},{\"id\":\"2709\"},{\"id\":\"2710\"},{\"id\":\"2711\"},{\"id\":\"2712\"},{\"id\":\"2713\"},{\"id\":\"2714\"},{\"id\":\"2715\"},{\"id\":\"2716\"},{\"id\":\"2717\"}]},\"id\":\"2643\",\"type\":\"DatetimeTicker\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"2697\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2737\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2640\",\"type\":\"LinearScale\"},{\"attributes\":{\"end\":1801553261.405254},\"id\":\"2681\",\"type\":\"Range1d\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"2719\"},{\"id\":\"2750\"},{\"id\":\"2783\"},{\"id\":\"2818\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"2718\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"2638\",\"type\":\"LinearScale\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"2712\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"2710\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"2709\",\"type\":\"DaysTicker\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\"]},\"id\":\"2686\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"2654\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis\":{\"id\":\"2642\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"2645\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2690\"},\"glyph\":{\"id\":\"2692\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2694\"},\"name\":\"USDC (USDC)\",\"nonselection_glyph\":{\"id\":\"2693\"},\"view\":{\"id\":\"2696\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2695\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[\"USDC (USDC)\",\"WETH (USDC)\",\"ETH (USDC)\"]},\"id\":\"2688\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"2647\",\"type\":\"BasicTicker\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"2706\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"2650\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2682\"}},\"y2\":{\"expr\":{\"id\":\"2683\"}}},\"id\":\"2692\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2682\"}},\"y2\":{\"expr\":{\"id\":\"2683\"}}},\"id\":\"2694\",\"type\":\"VArea\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"2707\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"2653\",\"type\":\"ResetTool\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"2714\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"2711\",\"type\":\"DaysTicker\"},{\"attributes\":{\"axis_label\":\"Balance (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"2662\"},\"group\":null,\"major_label_policy\":{\"id\":\"2700\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"2647\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2646\",\"type\":\"LinearAxis\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"2713\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"label\":{\"value\":\"ETH (USDC)\"},\"renderers\":[{\"id\":\"2756\"}]},\"id\":\"2783\",\"type\":\"LegendItem\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"2708\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2751\"},\"glyph\":{\"id\":\"2753\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2755\"},\"name\":\"ETH (USDC)\",\"nonselection_glyph\":{\"id\":\"2754\"},\"view\":{\"id\":\"2757\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"2756\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2703\",\"type\":\"AllLabels\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ffbb78\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ffbb78\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"2688\"}},\"y2\":{\"expr\":{\"id\":\"2689\"}}},\"id\":\"2788\",\"type\":\"VArea\"},{\"attributes\":{\"source\":{\"id\":\"2751\"}},\"id\":\"2757\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2736\",\"type\":\"UnionRenderers\"}],\"root_ids\":[\"2633\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"f5e6bd38-0073-4aa4-a9a6-6bb2fa701a94\",\"root_ids\":[\"2633\"],\"roots\":{\"2633\":\"1a175bbb-f746-47ba-9952-4e03386abea6\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "2633" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "addresses = [\n", + " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", + " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", + " \"0x8EB8a3b98659Cce290402893d0123abb75E3ab28\"\n", + "]\n", + "tokens = [\"USDC\", \"WETH\", \"ETH\", \"WBTC\"]\n", + "base_tokens = [\"USDC\", \"WETH\"]\n", + "\n", + "v = View().portfolio_by_token(\n", + " addresses = addresses, \n", + " tokens = tokens, \n", + " base_token = \"USDC\", \n", + " start=datetime(2022, 6, 1), \n", + " end=datetime(2022, 7, 1), \n", + " numpoints=10\n", + ")\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "aac60dae-6519-4d2a-80ee-6bc517cb0eea", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "shape: (11, 8)\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "timestamp\n", + "\n", + "date\n", + "\n", + "block_number\n", + "\n", + "USDC (USDC)\n", + "\n", + "WETH (USDC)\n", + "\n", + "WBTC (USDC)\n", + "\n", + "ETH (USDC)\n", + "\n", + "total\n", + "
\n", + "u64\n", + "\n", + "datetime[μs]\n", + "\n", + "u64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "
\n", + "1654027190\n", + "\n", + "2022-05-31 23:59:50\n", + "\n", + "14880658\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "8.2152e8\n", + "\n", + "3.8836e8\n", + "\n", + "1.3788e9\n", + "
\n", + "1654295514\n", + "\n", + "2022-06-04 02:31:54\n", + "\n", + "14899719\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "7.7452e8\n", + "\n", + "3.5890e8\n", + "\n", + "1.3024e9\n", + "
\n", + "1654575284\n", + "\n", + "2022-06-07 08:14:44\n", + "\n", + "14918780\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "7.6863e8\n", + "\n", + "3.5272e8\n", + "\n", + "1.2903e9\n", + "
\n", + "1654855382\n", + "\n", + "2022-06-10 14:03:02\n", + "\n", + "14937841\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "7.8022e8\n", + "\n", + "3.5470e8\n", + "\n", + "1.3038e9\n", + "
\n", + "1655136999\n", + "\n", + "2022-06-13 20:16:39\n", + "\n", + "14956902\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "6.7600e8\n", + "\n", + "2.5226e8\n", + "\n", + "1.0972e9\n", + "
\n", + "1655421669\n", + "\n", + "2022-06-17 03:21:09\n", + "\n", + "14975963\n", + "\n", + "1.68928317e8\n", + "\n", + "0.0\n", + "\n", + "6.1157e8\n", + "\n", + "2.1152e8\n", + "\n", + "9.9202e8\n", + "
\n", + "1655705057\n", + "\n", + "2022-06-20 10:04:17\n", + "\n", + "14995024\n", + "\n", + "1.90639384e8\n", + "\n", + "0.0\n", + "\n", + "1.2706e9\n", + "\n", + "2.3698e8\n", + "\n", + "1.6982e9\n", + "
\n", + "1656005754\n", + "\n", + "2022-06-23 21:35:54\n", + "\n", + "15014085\n", + "\n", + "1.90639384e8\n", + "\n", + "0.0\n", + "\n", + "1.2840e9\n", + "\n", + "2.4114e8\n", + "\n", + "1.7158e9\n", + "
\n", + "1656313716\n", + "\n", + "2022-06-27 11:08:36\n", + "\n", + "15033146\n", + "\n", + "1.90639384e8\n", + "\n", + "0.0\n", + "\n", + "1.2303e9\n", + "\n", + "2.6879e8\n", + "\n", + "1.6897e9\n", + "
\n", + "1656619133\n", + "\n", + "2022-06-30 23:58:53\n", + "\n", + "15052207\n", + "\n", + "1.90639384e8\n", + "\n", + "0.0\n", + "\n", + "1.0898e9\n", + "\n", + "2.2361e8\n", + "\n", + "1.5040e9\n", + "
\n", + "1656619189\n", + "\n", + "2022-06-30 23:59:49\n", + "\n", + "15052211\n", + "\n", + "1.90639384e8\n", + "\n", + "0.0\n", + "\n", + "1.0898e9\n", + "\n", + "2.2361e8\n", + "\n", + "1.5040e9\n", + "
\n", + "
" + ], + "text/plain": [ + "shape: (11, 8)\n", + "┌────────────┬────────────┬────────────┬───────────┬───────────┬───────────┬────────────┬──────────┐\n", + "│ timestamp ┆ date ┆ block_numb ┆ USDC ┆ WETH ┆ WBTC ┆ ETH (USDC) ┆ total │\n", + "│ --- ┆ --- ┆ er ┆ (USDC) ┆ (USDC) ┆ (USDC) ┆ --- ┆ --- │\n", + "│ u64 ┆ datetime[μ ┆ --- ┆ --- ┆ --- ┆ --- ┆ f64 ┆ f64 │\n", + "│ ┆ s] ┆ u64 ┆ f64 ┆ f64 ┆ f64 ┆ ┆ │\n", + "╞════════════╪════════════╪════════════╪═══════════╪═══════════╪═══════════╪════════════╪══════════╡\n", + "│ 1654027190 ┆ 2022-05-31 ┆ 14880658 ┆ 1.6892831 ┆ 0.0 ┆ 8.2152e8 ┆ 3.8836e8 ┆ 1.3788e9 │\n", + "│ ┆ 23:59:50 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654295514 ┆ 2022-06-04 ┆ 14899719 ┆ 1.6892831 ┆ 0.0 ┆ 7.7452e8 ┆ 3.5890e8 ┆ 1.3024e9 │\n", + "│ ┆ 02:31:54 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654575284 ┆ 2022-06-07 ┆ 14918780 ┆ 1.6892831 ┆ 0.0 ┆ 7.6863e8 ┆ 3.5272e8 ┆ 1.2903e9 │\n", + "│ ┆ 08:14:44 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654855382 ┆ 2022-06-10 ┆ 14937841 ┆ 1.6892831 ┆ 0.0 ┆ 7.8022e8 ┆ 3.5470e8 ┆ 1.3038e9 │\n", + "│ ┆ 14:03:02 ┆ ┆ 7e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656005754 ┆ 2022-06-23 ┆ 15014085 ┆ 1.9063938 ┆ 0.0 ┆ 1.2840e9 ┆ 2.4114e8 ┆ 1.7158e9 │\n", + "│ ┆ 21:35:54 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656313716 ┆ 2022-06-27 ┆ 15033146 ┆ 1.9063938 ┆ 0.0 ┆ 1.2303e9 ┆ 2.6879e8 ┆ 1.6897e9 │\n", + "│ ┆ 11:08:36 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619133 ┆ 2022-06-30 ┆ 15052207 ┆ 1.9063938 ┆ 0.0 ┆ 1.0898e9 ┆ 2.2361e8 ┆ 1.5040e9 │\n", + "│ ┆ 23:58:53 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 ┆ 15052211 ┆ 1.9063938 ┆ 0.0 ┆ 1.0898e9 ┆ 2.2361e8 ┆ 1.5040e9 │\n", + "│ ┆ 23:59:49 ┆ ┆ 4e8 ┆ ┆ ┆ ┆ │\n", + "└────────────┴────────────┴────────────┴───────────┴───────────┴───────────┴────────────┴──────────┘" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from web3cat.data import PortfolioData\n", + "\n", + "d = PortfolioData(\n", + " tokens=tokens, \n", + " base_tokens=base_tokens, \n", + " addresses=addresses, \n", + " start=datetime(2022, 6, 1), \n", + " end=datetime(2022, 7, 1), \n", + " numpoints=10\n", + ")\n", + "d.breakdown_by_token(\"USDC\")" + ] + }, + { + "cell_type": "markdown", + "id": "fa2b90e6-8b8a-4141-b33f-185ea83a0b48", + "metadata": {}, + "source": [ + "## Portfolio by address breakdown" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "068124a3-9f91-4365-8126-fbe7b15eb56e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"a7c56787-bcd6-4236-9e21-d019cfdef86f\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#20262B\",\"below\":[{\"id\":\"3119\"}],\"border_fill_color\":\"#15191C\",\"center\":[{\"id\":\"3122\"},{\"id\":\"3126\"},{\"id\":\"3189\"}],\"extra_y_ranges\":{\"Balance (USDC)\":{\"id\":\"3154\"}},\"height\":400,\"left\":[{\"id\":\"3123\"}],\"outline_line_alpha\":0.25,\"outline_line_color\":\"#E0E0E0\",\"renderers\":[{\"id\":\"3166\"},{\"id\":\"3196\"},{\"id\":\"3227\"}],\"title\":{\"id\":\"3168\"},\"toolbar\":{\"id\":\"3132\"},\"toolbar_location\":\"above\",\"width\":919,\"x_range\":{\"id\":\"3111\"},\"x_scale\":{\"id\":\"3115\"},\"y_range\":{\"id\":\"3113\"},\"y_scale\":{\"id\":\"3117\"}},\"id\":\"3110\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"3161\"},\"glyph\":{\"id\":\"3163\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3165\"},\"name\":\"0x78605df79524164911c144801f41e9811b7db73d\",\"nonselection_glyph\":{\"id\":\"3164\"},\"view\":{\"id\":\"3167\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"3166\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"3131\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3155\"}},\"y2\":{\"expr\":{\"id\":\"3156\"}}},\"id\":\"3163\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3155\"}},\"y2\":{\"expr\":{\"id\":\"3156\"}}},\"id\":\"3165\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"3175\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis\":{\"id\":\"3119\"},\"coordinates\":null,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"3122\",\"type\":\"Grid\"},{\"attributes\":{\"base\":24,\"mantissas\":[1,2,4,6,8,12],\"max_interval\":43200000.0,\"min_interval\":3600000.0,\"num_minor_ticks\":0},\"id\":\"3179\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\"]},\"id\":\"3156\",\"type\":\"Stack\"},{\"attributes\":{\"num_minor_ticks\":5,\"tickers\":[{\"id\":\"3177\"},{\"id\":\"3178\"},{\"id\":\"3179\"},{\"id\":\"3180\"},{\"id\":\"3181\"},{\"id\":\"3182\"},{\"id\":\"3183\"},{\"id\":\"3184\"},{\"id\":\"3185\"},{\"id\":\"3186\"},{\"id\":\"3187\"},{\"id\":\"3188\"}]},\"id\":\"3120\",\"type\":\"DatetimeTicker\"},{\"attributes\":{},\"id\":\"3188\",\"type\":\"YearsTicker\"},{\"attributes\":{},\"id\":\"3117\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3157\"}},\"y2\":{\"expr\":{\"id\":\"3158\"}}},\"id\":\"3194\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"3128\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"3207\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"days\":[1,4,7,10,13,16,19,22,25,28]},\"id\":\"3181\",\"type\":\"DaysTicker\"},{\"attributes\":{\"days\":[1,8,15,22]},\"id\":\"3182\",\"type\":\"DaysTicker\"},{\"attributes\":{\"label\":{\"value\":\"0xbf72...5eb5\"},\"renderers\":[{\"id\":\"3227\"}]},\"id\":\"3254\",\"type\":\"LegendItem\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"3208\"},\"selection_policy\":{\"id\":\"3207\"}},\"id\":\"3191\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"tools\":[{\"id\":\"3127\"},{\"id\":\"3128\"},{\"id\":\"3129\"},{\"id\":\"3130\"},{\"id\":\"3131\"}]},\"id\":\"3132\",\"type\":\"Toolbar\"},{\"attributes\":{\"label\":{\"value\":\"0x7860...b73d\"},\"renderers\":[{\"id\":\"3166\"}]},\"id\":\"3190\",\"type\":\"LegendItem\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\",\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\"]},\"id\":\"3160\",\"type\":\"Stack\"},{\"attributes\":{\"days\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},\"id\":\"3180\",\"type\":\"DaysTicker\"},{\"attributes\":{\"mantissas\":[1,2,5],\"max_interval\":500.0,\"num_minor_ticks\":0},\"id\":\"3177\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{},\"id\":\"3240\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text_color\":\"#E0E0E0\",\"text_font\":\"Helvetica\",\"text_font_size\":\"1.15em\"},\"id\":\"3168\",\"type\":\"Title\"},{\"attributes\":{\"months\":[0,2,4,6,8,10]},\"id\":\"3185\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"source\":{\"id\":\"3191\"}},\"id\":\"3197\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3157\"}},\"y2\":{\"expr\":{\"id\":\"3158\"}}},\"id\":\"3193\",\"type\":\"VArea\"},{\"attributes\":{\"callback\":null},\"id\":\"3129\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"3173\",\"type\":\"DatetimeTickFormatter\"},{\"attributes\":{},\"id\":\"3241\",\"type\":\"Selection\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"3241\"},\"selection_policy\":{\"id\":\"3240\"}},\"id\":\"3222\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"3161\"}},\"id\":\"3167\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"3174\",\"type\":\"AllLabels\"},{\"attributes\":{\"days\":[1,15]},\"id\":\"3183\",\"type\":\"DaysTicker\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#aec7e8\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#aec7e8\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3157\"}},\"y2\":{\"expr\":{\"id\":\"3158\"}}},\"id\":\"3195\",\"type\":\"VArea\"},{\"attributes\":{\"base\":60,\"mantissas\":[1,2,5,10,15,20,30],\"max_interval\":1800000.0,\"min_interval\":1000.0,\"num_minor_ticks\":0},\"id\":\"3178\",\"type\":\"AdaptiveTicker\"},{\"attributes\":{\"months\":[0,4,8]},\"id\":\"3186\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#1f77b4\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3155\"}},\"y2\":{\"expr\":{\"id\":\"3156\"}}},\"id\":\"3164\",\"type\":\"VArea\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"3191\"},\"glyph\":{\"id\":\"3193\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3195\"},\"name\":\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\",\"nonselection_glyph\":{\"id\":\"3194\"},\"view\":{\"id\":\"3197\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"3196\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\"]},\"id\":\"3159\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"3176\",\"type\":\"Selection\"},{\"attributes\":{\"axis_label\":\"Balance (USDC)\",\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"3139\"},\"group\":null,\"major_label_policy\":{\"id\":\"3171\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"3124\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"3123\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"3113\",\"type\":\"DataRange1d\"},{\"attributes\":{\"label\":{\"value\":\"0x8eb8...ab28\"},\"renderers\":[{\"id\":\"3196\"}]},\"id\":\"3221\",\"type\":\"LegendItem\"},{\"attributes\":{\"fill_alpha\":0.2,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3159\"}},\"y2\":{\"expr\":{\"id\":\"3160\"}}},\"id\":\"3226\",\"type\":\"VArea\"},{\"attributes\":{},\"id\":\"3208\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"3123\"},\"coordinates\":null,\"dimension\":1,\"grid_line_alpha\":0.25,\"grid_line_color\":\"#E0E0E0\",\"group\":null,\"ticker\":null},\"id\":\"3126\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"3130\",\"type\":\"ResetTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"3222\"},\"glyph\":{\"id\":\"3224\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3226\"},\"name\":\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\",\"nonselection_glyph\":{\"id\":\"3225\"},\"view\":{\"id\":\"3228\"},\"y_range_name\":\"Balance (USDC)\"},\"id\":\"3227\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"format\":\"0.000a\"},\"id\":\"3139\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"background_fill_alpha\":0.25,\"background_fill_color\":\"#20262B\",\"border_line_alpha\":0,\"coordinates\":null,\"glyph_width\":15,\"group\":null,\"items\":[{\"id\":\"3190\"},{\"id\":\"3221\"},{\"id\":\"3254\"}],\"label_standoff\":8,\"label_text_color\":\"#E0E0E0\",\"label_text_font\":\"Helvetica\",\"label_text_font_size\":\"1.025em\",\"spacing\":8},\"id\":\"3189\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"3115\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"3222\"}},\"id\":\"3228\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":0.8,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3159\"}},\"y2\":{\"expr\":{\"id\":\"3160\"}}},\"id\":\"3224\",\"type\":\"VArea\"},{\"attributes\":{\"fill_alpha\":0.1,\"fill_color\":\"#ff7f0e\",\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ff7f0e\"},\"x\":{\"field\":\"date\"},\"y1\":{\"expr\":{\"id\":\"3159\"}},\"y2\":{\"expr\":{\"id\":\"3160\"}}},\"id\":\"3225\",\"type\":\"VArea\"},{\"attributes\":{\"months\":[0,1,2,3,4,5,6,7,8,9,10,11]},\"id\":\"3184\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"months\":[0,6]},\"id\":\"3187\",\"type\":\"MonthsTicker\"},{\"attributes\":{\"data\":{\"0x78605df79524164911c144801f41e9811b7db73d\":[557290076.1071687,527830261.7663363,521643851.5696966,523626780.25146246,421184487.7438952,380448205.64067245,427621719.5758046,431775602.822482,459424910.6329452,414249548.23084617,414249548.23084617],\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\"0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\":[821518564.8781956,774524539.7661322,768631835.9936978,780215615.2367543,676002443.9154632,611566963.0606511,1270556800.887731,1283989408.0396645,1230311955.0023024,1089762180.2957902,1089762180.2957902],\"date\":[1654041590000.0,1654309914000.0,1654589684000.0,1654869782000.0,1655151399000.0,1655436069000.0,1655719457000.0,1656020154000.0,1656328116000.0,1656633533000.0,1656633589000.0]},\"selected\":{\"id\":\"3176\"},\"selection_policy\":{\"id\":\"3175\"}},\"id\":\"3161\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"3124\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\",\"0x8eb8a3b98659cce290402893d0123abb75e3ab28\"]},\"id\":\"3158\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"3127\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"3111\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fields\":[]},\"id\":\"3155\",\"type\":\"Stack\"},{\"attributes\":{\"axis_label_standoff\":10,\"axis_label_text_color\":\"#E0E0E0\",\"axis_label_text_font\":\"Helvetica\",\"axis_label_text_font_size\":\"1.25em\",\"axis_label_text_font_style\":\"normal\",\"axis_line_alpha\":0,\"axis_line_color\":\"#E0E0E0\",\"coordinates\":null,\"formatter\":{\"id\":\"3173\"},\"group\":null,\"major_label_policy\":{\"id\":\"3174\"},\"major_label_text_color\":\"#E0E0E0\",\"major_label_text_font\":\"Helvetica\",\"major_label_text_font_size\":\"1.025em\",\"major_tick_line_alpha\":0,\"major_tick_line_color\":\"#E0E0E0\",\"minor_tick_line_alpha\":0,\"minor_tick_line_color\":\"#E0E0E0\",\"ticker\":{\"id\":\"3120\"}},\"id\":\"3119\",\"type\":\"DatetimeAxis\"},{\"attributes\":{\"fields\":[\"0x78605df79524164911c144801f41e9811b7db73d\"]},\"id\":\"3157\",\"type\":\"Stack\"},{\"attributes\":{\"end\":1801553261.405254},\"id\":\"3154\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"3171\",\"type\":\"AllLabels\"}],\"root_ids\":[\"3110\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n", + " const render_items = [{\"docid\":\"a7c56787-bcd6-4236-9e21-d019cfdef86f\",\"root_ids\":[\"3110\"],\"roots\":{\"3110\":\"4d513479-ec8a-490e-b838-6388574ab3a4\"}}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], + "application/vnd.bokehjs_exec.v0+json": "" + }, + "metadata": { + "application/vnd.bokehjs_exec.v0+json": { + "id": "3110" + } + }, + "output_type": "display_data" + } + ], + "source": [ + "from web3cat.view import View\n", + "from datetime import datetime\n", + "\n", + "addresses = [\n", + " \"0x78605Df79524164911C144801f41e9811B7DB73D\",\n", + " \"0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5\",\n", + " \"0x8EB8a3b98659Cce290402893d0123abb75E3ab28\"\n", + "]\n", + "tokens = [\"USDC\", \"WETH\", \"ETH\", \"WBTC\"]\n", + "base_tokens = [\"USDC\", \"WETH\"]\n", + "\n", + "v = View().portfolio_by_address(\n", + " addresses = addresses, \n", + " tokens = tokens, \n", + " base_token = \"USDC\", \n", + " start=datetime(2022, 6, 1), \n", + " end=datetime(2022, 7, 1), \n", + " numpoints=10\n", + ")\n", + "v.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "7f3ad2ad-b8e2-4c97-8dff-161c9537192d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "shape: (11, 7)\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "timestamp\n", + "\n", + "date\n", + "\n", + "block_number\n", + "\n", + "0x78605df79524164911c144801f41e9811b7db73d\n", + "\n", + "0x8eb8a3b98659cce290402893d0123abb75e3ab28\n", + "\n", + "0xbf72da2bd84c5170618fbe5914b0eca9638d5eb5\n", + "\n", + "total\n", + "
\n", + "u64\n", + "\n", + "datetime[μs]\n", + "\n", + "u64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "\n", + "f64\n", + "
\n", + "1654027190\n", + "\n", + "2022-05-31 23:59:50\n", + "\n", + "14880658\n", + "\n", + "5.5729e8\n", + "\n", + "0.0\n", + "\n", + "8.2152e8\n", + "\n", + "1.3788e9\n", + "
\n", + "1654295514\n", + "\n", + "2022-06-04 02:31:54\n", + "\n", + "14899719\n", + "\n", + "5.2783e8\n", + "\n", + "0.0\n", + "\n", + "7.7452e8\n", + "\n", + "1.3024e9\n", + "
\n", + "1654575284\n", + "\n", + "2022-06-07 08:14:44\n", + "\n", + "14918780\n", + "\n", + "5.2164e8\n", + "\n", + "0.0\n", + "\n", + "7.6863e8\n", + "\n", + "1.2903e9\n", + "
\n", + "1654855382\n", + "\n", + "2022-06-10 14:03:02\n", + "\n", + "14937841\n", + "\n", + "5.2363e8\n", + "\n", + "0.0\n", + "\n", + "7.8022e8\n", + "\n", + "1.3038e9\n", + "
\n", + "1655136999\n", + "\n", + "2022-06-13 20:16:39\n", + "\n", + "14956902\n", + "\n", + "4.2118e8\n", + "\n", + "0.0\n", + "\n", + "6.7600e8\n", + "\n", + "1.0972e9\n", + "
\n", + "1655421669\n", + "\n", + "2022-06-17 03:21:09\n", + "\n", + "14975963\n", + "\n", + "3.8045e8\n", + "\n", + "0.0\n", + "\n", + "6.1157e8\n", + "\n", + "9.9202e8\n", + "
\n", + "1655705057\n", + "\n", + "2022-06-20 10:04:17\n", + "\n", + "14995024\n", + "\n", + "4.2762e8\n", + "\n", + "0.0\n", + "\n", + "1.2706e9\n", + "\n", + "1.6982e9\n", + "
\n", + "1656005754\n", + "\n", + "2022-06-23 21:35:54\n", + "\n", + "15014085\n", + "\n", + "4.3178e8\n", + "\n", + "0.0\n", + "\n", + "1.2840e9\n", + "\n", + "1.7158e9\n", + "
\n", + "1656313716\n", + "\n", + "2022-06-27 11:08:36\n", + "\n", + "15033146\n", + "\n", + "4.5942e8\n", + "\n", + "0.0\n", + "\n", + "1.2303e9\n", + "\n", + "1.6897e9\n", + "
\n", + "1656619133\n", + "\n", + "2022-06-30 23:58:53\n", + "\n", + "15052207\n", + "\n", + "4.1425e8\n", + "\n", + "0.0\n", + "\n", + "1.0898e9\n", + "\n", + "1.5040e9\n", + "
\n", + "1656619189\n", + "\n", + "2022-06-30 23:59:49\n", + "\n", + "15052211\n", + "\n", + "4.1425e8\n", + "\n", + "0.0\n", + "\n", + "1.0898e9\n", + "\n", + "1.5040e9\n", + "
\n", + "
" + ], + "text/plain": [ + "shape: (11, 7)\n", + "┌────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────────┬──────────┐\n", + "│ timestamp ┆ date ┆ block_number ┆ 0x78605df795 ┆ 0x8eb8a3b986 ┆ 0xbf72da2bd8 ┆ total │\n", + "│ --- ┆ --- ┆ --- ┆ 24164911c144 ┆ 59cce2904028 ┆ 4c5170618fbe ┆ --- │\n", + "│ u64 ┆ datetime[μs] ┆ u64 ┆ 801f41e9811b ┆ 93d0123abb75 ┆ 5914b0eca963 ┆ f64 │\n", + "│ ┆ ┆ ┆ 7db73d ┆ e3ab28 ┆ 8d5eb5 ┆ │\n", + "│ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ │\n", + "│ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 ┆ │\n", + "╞════════════╪══════════════╪══════════════╪══════════════╪══════════════╪══════════════╪══════════╡\n", + "│ 1654027190 ┆ 2022-05-31 ┆ 14880658 ┆ 5.5729e8 ┆ 0.0 ┆ 8.2152e8 ┆ 1.3788e9 │\n", + "│ ┆ 23:59:50 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654295514 ┆ 2022-06-04 ┆ 14899719 ┆ 5.2783e8 ┆ 0.0 ┆ 7.7452e8 ┆ 1.3024e9 │\n", + "│ ┆ 02:31:54 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654575284 ┆ 2022-06-07 ┆ 14918780 ┆ 5.2164e8 ┆ 0.0 ┆ 7.6863e8 ┆ 1.2903e9 │\n", + "│ ┆ 08:14:44 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1654855382 ┆ 2022-06-10 ┆ 14937841 ┆ 5.2363e8 ┆ 0.0 ┆ 7.8022e8 ┆ 1.3038e9 │\n", + "│ ┆ 14:03:02 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... ┆ ... │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656005754 ┆ 2022-06-23 ┆ 15014085 ┆ 4.3178e8 ┆ 0.0 ┆ 1.2840e9 ┆ 1.7158e9 │\n", + "│ ┆ 21:35:54 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656313716 ┆ 2022-06-27 ┆ 15033146 ┆ 4.5942e8 ┆ 0.0 ┆ 1.2303e9 ┆ 1.6897e9 │\n", + "│ ┆ 11:08:36 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619133 ┆ 2022-06-30 ┆ 15052207 ┆ 4.1425e8 ┆ 0.0 ┆ 1.0898e9 ┆ 1.5040e9 │\n", + "│ ┆ 23:58:53 ┆ ┆ ┆ ┆ ┆ │\n", + "├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤\n", + "│ 1656619189 ┆ 2022-06-30 ┆ 15052211 ┆ 4.1425e8 ┆ 0.0 ┆ 1.0898e9 ┆ 1.5040e9 │\n", + "│ ┆ 23:59:49 ┆ ┆ ┆ ┆ ┆ │\n", + "└────────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────────┴──────────┘" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from web3cat.data import PortfolioData\n", + "\n", + "d = PortfolioData(\n", + " tokens=tokens, \n", + " base_tokens=base_tokens, \n", + " addresses=addresses, \n", + " start=datetime(2022, 6, 1), \n", + " end=datetime(2022, 7, 1), \n", + " numpoints=10\n", + ")\n", + "d.breakdown_by_address(\"USDC\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e80f9e6-48cf-4524-867c-8ce325c7e821", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/web3cat/data/chainlink/chainlink_data.py b/web3cat/data/chainlink/chainlink_data.py index cf3fe97..b0daf61 100644 --- a/web3cat/data/chainlink/chainlink_data.py +++ b/web3cat/data/chainlink/chainlink_data.py @@ -6,6 +6,7 @@ from typing import Any, Dict, List from datetime import datetime import polars as pl +from web3.constants import ADDRESS_ZERO from web3.contract import Contract import numpy as np @@ -259,6 +260,8 @@ def add_token( start: start of the data end: end of the data """ + if token == ADDRESS_ZERO or token.upper() == "USD": + return meta = self._erc20_metas_service.get(token) if proxy is None: self._datas[meta.address] = ChainlinkUSDData( @@ -278,6 +281,7 @@ def get_data(self, token: str) -> ChainlinkUSDData: Returns: Chainlink USD data for token """ + meta = self._erc20_metas_service.get(token) if not meta.address in self._datas: self.add_token(token) @@ -315,12 +319,15 @@ def prices( """ blocks = self._resolve_timepoints(timepoints) - if token0.upper() == "USD" and token1.upper() == "USD": + token0_is_usd = token0.upper() == "USD" or token0 == ADDRESS_ZERO + token1_is_usd = token1.upper() == "USD" or token1 == ADDRESS_ZERO + + if token0_is_usd and token1_is_usd: prices = [1.0] * len(timepoints) - elif token0.upper() == "USD": + elif token0_is_usd: data = self.get_data(token1) prices = [1.0 / p for p in data.prices(timepoints)["price"]] - elif token1.upper() == "USD": + elif token1_is_usd: data = self.get_data(token0) prices = data.prices(timepoints)["price"] else: diff --git a/web3cat/view/view.py b/web3cat/view/view.py index e50ed66..d2941ad 100644 --- a/web3cat/view/view.py +++ b/web3cat/view/view.py @@ -33,6 +33,8 @@ class View: Arguments: **defaults: default values for all methods called + **common_defaults: Common defaults for all graphs. + Currently it's ``x_axis_name`` and ``y_axis_name``. **fig_args: the arguments for the :class:`bokeh.plotting.Figure` **core_args: the arguments for the :class:`fetcher.core.Core` """ @@ -97,7 +99,7 @@ def figure(self) -> Figure: return figure( toolbar_location="above", tools="pan,wheel_zoom,hover,reset,save", - x_axis_type=self._wireframes[0].x_axis, + x_axis_type=self._wireframes[0].x_axis_name or self._wireframes[0].x_axis, height=400, width=int(400 * 2.3), **self._fig_args, @@ -109,6 +111,7 @@ def total_supply( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ) -> View: """ Historical total supply of the ERC20 tokens @@ -118,6 +121,7 @@ def total_supply( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( { @@ -125,6 +129,7 @@ def total_supply( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) args["token"] = self._erc20_metas_service.get(args["token"]) @@ -138,6 +143,7 @@ def chainlink_prices( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ): """ Chainlink prices. @@ -148,6 +154,7 @@ def chainlink_prices( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( { @@ -156,6 +163,7 @@ def chainlink_prices( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) for name in ["token", "base_token"]: @@ -175,6 +183,7 @@ def balance( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ): """ Balances of ERC20 token. @@ -185,6 +194,7 @@ def balance( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( { @@ -193,6 +203,7 @@ def balance( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) if isinstance(args["address"], str): @@ -215,6 +226,7 @@ def portfolio_by_address( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ) -> View: """ Portfolio of ERC20 tokens, breakdown by address. @@ -228,6 +240,7 @@ def portfolio_by_address( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( @@ -238,6 +251,7 @@ def portfolio_by_address( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) token_metas = [self._erc20_metas_service.get(token) for token in args["tokens"]] @@ -259,6 +273,7 @@ def portfolio_by_token( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ): """ Portfolio of ERC20 tokens, breakdown by token. @@ -272,6 +287,7 @@ def portfolio_by_token( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( @@ -282,6 +298,7 @@ def portfolio_by_token( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) token_metas = [self._erc20_metas_service.get(token) for token in args["tokens"]] @@ -302,6 +319,7 @@ def portfolio_balance( start: int | datetime | None = None, end: int | datetime | None = None, numpoints: int | None = None, + **kwargs, ) -> View: """ Portfolio of one specific ERC20 token, breakdown by address. @@ -314,6 +332,7 @@ def portfolio_balance( start: start timepoint end: end timepoint numpoints: number of points in between + kwargs: common_defaults, see :class:`View` """ args = self._build_wireframe_args( @@ -323,6 +342,7 @@ def portfolio_balance( "start": start, "end": end, "numpoints": numpoints, + **kwargs, } ) base_token_meta = self._erc20_metas_service.get(args["base_token"]) @@ -356,7 +376,11 @@ def show(self): self._glyphs.append( wf.plot( - self.figure, x, y, color=self._get_color(), y_range_name=wf.y_axis + self.figure, + x, + y, + color=self._get_color(), + y_range_name=wf.y_axis_name or wf.y_axis, ) ) show(self.figure) @@ -367,9 +391,10 @@ def _build_data(self): self._datas[wf.data_key] = wf.build_data(data, **self._core_args) def _build_wireframe_args(self, args: Dict[str, Any]): + args_filter = {*args.keys(), "x_axis_name", "y_axis_name"} clean_args = {k: v for k, v in args.items() if not v is None} merged = {**self._defaults, **clean_args} - return {k: v for k, v in merged.items() if k in args} + return {k: v for k, v in merged.items() if k in args_filter} def _get_color(self): color = self._colors[len(self._glyphs) % len(self._colors)] @@ -380,7 +405,7 @@ def _update_axes( ) -> Dict[str, Any]: miny /= 1.05 maxy *= 1.05 - y_axis = wf.y_axis + y_axis = wf.y_axis_name or wf.y_axis formatter = BasicTickFormatter() if (miny + maxy) / 2 <= 0: order = 0 @@ -402,7 +427,7 @@ def _update_axes( needs_y_axis_add = not y_axis in fig.extra_y_ranges old_range = fig.extra_y_ranges.get(y_axis, Range1d(miny, maxy)) new_range = Range1d(min(miny, old_range.start), max(maxy, old_range.end)) - fig.extra_y_ranges[wf.y_axis] = new_range + fig.extra_y_ranges[y_axis] = new_range if needs_y_axis_init: fig.yaxis[0].y_range_name = y_axis diff --git a/web3cat/view/wireframes/abstract.py b/web3cat/view/wireframes/abstract.py index fc34533..0f1de1b 100644 --- a/web3cat/view/wireframes/abstract.py +++ b/web3cat/view/wireframes/abstract.py @@ -6,7 +6,7 @@ from bokeh.models import GlyphRenderer -@dataclass(frozen=True) +@dataclass(frozen=True, kw_only=True) class Wireframe: """ Base class for all wireframes. Wireframe is a set of arguments @@ -16,6 +16,8 @@ class Wireframe: """ numpoints: int + x_axis_name: str | None = None + y_axis_name: str | None = None @property def data_key(self):