Last active
May 8, 2023 22:14
-
-
Save ingenieroariel/74c37802097e104a9fbc050cb91b86ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs.nixpkgs.url = github:NixOS/nixpkgs/b3251e04ee470c20f81e75d5a6080ba92dc7ed3f; | |
outputs = { self, nixpkgs }: { | |
nixosConfigurations.sensei = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
modules = [ | |
nixpkgs.nixosModules.notDetected | |
{ config, pkgs, lib, ... }: | |
let | |
hasuraDbPerms = pkgs.writeScript "hasuraDbPerms.sql" '' | |
CREATE EXTENSION IF NOT EXISTS pgcrypto; | |
CREATE EXTENSION IF NOT EXISTS timescaledb; | |
CREATE SCHEMA IF NOT EXISTS hdb_catalog; | |
CREATE SCHEMA IF NOT EXISTS hdb_views; | |
ALTER SCHEMA hdb_catalog OWNER TO ${cfg.dbUser}; | |
ALTER SCHEMA hdb_views OWNER TO ${cfg.dbUser}; | |
GRANT SELECT ON ALL TABLES IN SCHEMA information_schema TO ${cfg.dbUser}; | |
GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO ${cfg.dbUser}; | |
'''; | |
in | |
{ | |
fileSystems."/zfs" = | |
{ device = "apool/root/nixos"; | |
fsType = "zfs"; | |
}; | |
hardware.enableAllFirmware = true; | |
fileSystems."/" = | |
{ device = "/dev/disk/by-label/nix"; | |
fsType = "btrfs"; | |
}; | |
fileSystems."/boot" = | |
{ device = "/dev/disk/by-label/boot"; | |
fsType = "vfat"; | |
}; | |
fileSystems."tmpfs" = | |
{ mountPoint = "/tmp"; | |
device = "tmpfs"; | |
fsType = "tmpfs"; | |
options = [ "size=15g" "mode=1777" ]; | |
}; | |
boot.loader.timeout = 5; | |
boot.loader = { | |
efi = { | |
canTouchEfiVariables = true; | |
efiSysMountPoint = "/boot"; | |
}; | |
grub = { | |
devices = [ "nodev" ]; | |
efiSupport = true; | |
enable = true; | |
version = 2; | |
}; | |
}; | |
time.timeZone = "America/Bogota"; | |
networking.networkmanager.enable = false; | |
networking.useDHCP = false; | |
networking.hostId = "1238dcba"; | |
networking.hostName = "quipu-api"; | |
users.mutableUsers = false; | |
networking.firewall = { | |
enable = true; | |
allowPing = true; | |
allowedTCPPorts = [ 80 443 ]; | |
allowedUDPPorts = [ 443 ]; | |
extraCommands = '' | |
''; | |
}; | |
services.blueman.enable = true; | |
services.ofono.enable = true; | |
services.openssh.enable = true; | |
services.openssh.passwordAuthentication = false; | |
services.openssh.permitRootLogin = "no"; | |
environment.systemPackages = with pkgs; [ | |
wget vim any-nix-shell htop tmux git nixFlakes | |
ripgrep usbutils | |
]; | |
fonts.fontconfig.dpi = 115; | |
fonts.fontconfig.subpixel.rgba = "bgr"; | |
system.stateVersion = "nixos-unstable"; | |
nix.systemFeatures = | |
[ "benchmark" "big-parallel" "kvm" "nixos-test" "recursive-nix" "nix-command" "ca-references" ]; | |
nixpkgs.config = { | |
allowUnfree = true; | |
}; | |
boot.supportedFilesystems = [ "zfs" ]; | |
boot.initrd.supportedFilesystems = [ "zfs" ]; | |
boot.zfs.enableUnstable = true; | |
services.zfs.autoScrub.enable = true; | |
programs.dconf.enable = true; | |
swapDevices = [ ]; | |
nix.maxJobs = 12; | |
nix.buildCores = 48; | |
zramSwap.enable = true; | |
nix.package = pkgs.nixFlakes; | |
nix.extraOptions = '' | |
keep-outputs = true | |
keep-derivations = true | |
trusted-users = x | |
experimental-features = nix-command flakes ca-references | |
extra-platforms = aarch64-linux arm-linux | |
''; | |
systemd.services.graphql-engine = { | |
wantedBy = [ "multi-user.target" ]; | |
requires = [ "postgresql.service" ]; | |
path = with pkgs; [ curl netcat postgresql sudo ]; | |
preStart = '' | |
for x in {1..10}; do | |
nc -z 127.0.0.1 5432 && break | |
echo loop $x: waiting for postgresql 2 sec... | |
sleep 2 | |
done | |
sudo -u postgres -- psql quipuswap < ${hasuraDbPerms} | |
''; | |
script = '' | |
${pkgs.graphql-engine}/bin/graphql-engine \ | |
--host ${cfg.host} \ | |
-u ${cfg.dbUser} \ | |
--password ${cfg.password} \ | |
-d ${cfg.db} \ | |
--port ${toString cfg.dbPort} \ | |
serve \ | |
--server-port ${toString cfg.enginePort} \ | |
--enable-telemetry=false \ | |
--disable-cors | |
''; | |
}; | |
services.postgresql = { | |
enable = true; | |
dataDir = "/zfs/postgres"; | |
package = pkgs.postgresql_12.withPackages(ps: [ ps.postgis ps.timescaledb ps.pgcrypto ]); | |
extraConfig = "shared_preload_libraries = 'timescaledb'"; | |
enableTCPIP = true; | |
authentication = pkgs.lib.mkOverride 10 '' | |
local all all trust | |
host all x 127.0.0.1/32 trust | |
''; | |
}; | |
]; | |
}; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#@title Collecting data and processing data functions\n", | |
"\n", | |
"from matplotlib import pyplot as plt\n", | |
"from pandas import json_normalize\n", | |
"import json\n", | |
"import pandas as pd\n", | |
"from tqdm import tqdm\n", | |
"import requests\n", | |
"import time\n", | |
"import seaborn as sns\n", | |
"\n", | |
"sns.set_style(\"whitegrid\")\n", | |
"\n", | |
"\n", | |
"def make_deep_requests(url, depth=5, limit=1000, sleep_time=2, stop_id=None):\n", | |
"\n", | |
" last_id = None\n", | |
" data = pd.DataFrame()\n", | |
"\n", | |
" for counter in tqdm(range(depth)):\n", | |
" if last_id:\n", | |
" url += f'&lastId={last_id}'\n", | |
"\n", | |
" try:\n", | |
" response = requests.get(url)\n", | |
" new_data = json_normalize(json.loads(response.text))\n", | |
" \n", | |
" data = data.append(new_data)\n", | |
"\n", | |
" except Exception as exception:\n", | |
" print(exception)\n", | |
" import pdb; pdb.set_trace()\n", | |
"\n", | |
" if len(data) > 0:\n", | |
" last_id = data.id.iloc[-1]\n", | |
"\n", | |
" if len(new_data) < limit:\n", | |
" break\n", | |
"\n", | |
" if stop_id in data['id'].values:\n", | |
" break\n", | |
"\n", | |
" time.sleep(sleep_time)\n", | |
"\n", | |
" return data\n", | |
"\n", | |
"\n", | |
"def process_pool_data(df, token_decimals=6):\n", | |
"\n", | |
" convert = {\n", | |
" 'value.storage.tez_pool': lambda x: float(x) / 1_000_000,\n", | |
" 'value.storage.token_pool': lambda x: float(x) / (10**token_decimals),\n", | |
" 'timestamp': pd.Timestamp\n", | |
" }\n", | |
"\n", | |
" for column_name, mapper in convert.items():\n", | |
" df[column_name] = df[column_name].map(mapper)\n", | |
"\n", | |
" df['rate'] = df['value.storage.tez_pool'] / df['value.storage.token_pool']\n", | |
" df = df.set_index('timestamp')\n", | |
" return df\n", | |
"\n", | |
"\n", | |
"def collect_storage_history(smart_contract, depth=1):\n", | |
" url = f'https://api.tzkt.io/v1/contracts/{smart_contract}/storage/history?limit=100'\n", | |
" return make_deep_requests(url, depth=depth)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#@title QuipuSwap contracts (unhide and insert here another QuipuSwap contracts if you want to)\n", | |
"\n", | |
"# tokens dict contains:\n", | |
"# 1. QuipuSwap token address (note that this is address of the contract\n", | |
"# that used to trade, not the FA2/FA1.2 token address)\n", | |
"# 2. Decimals used in this token\n", | |
"\n", | |
"tokens = dict(\n", | |
" hDAO = ('KT1QxLqukyfohPV5kPkw97Rs6cw1DDDvYgbB', 6),\n", | |
" WRAP = ('KT1FG63hhFtMEEEtmBSX2vuFmP87t9E7Ab4t', 8),\n", | |
" tCow = ('KT1XQZxsG4pMgcN7q7Nu3XFihsb9mEvqBmAT', 2),\n", | |
" bDAO = ('KT1DssMzoSr8fnUUq1WxeSuHfLG4gzS7pgge', 6),\n", | |
" sDAO = ('KT1WDe2vJCDqz5euKupppQsioPcakUd45Tfo', 0),\n", | |
" tCowLP = ('KT1UEfXGj5Ag73qCdZTk2534SZDT7cd7J8m8', 0),\n", | |
" STKR = ('KT1BMEEPX7MWzwwadW3NCSZe9XGmFJ7rs7Dr', 18),\n", | |
" GUTS = ('KT1WYQj3HEt3sxdsV4dMLA8RKzUnYAzXgguS', 0),\n", | |
" Tacoz = ('KT1VfiExduEkrpM4TbsnAw9QV1VURqaRFGKs', 18),\n", | |
" token42 = ('KT1M5H8qkJEzhdC3ZxZ78bSxgmcddrcusbry', 0),\n", | |
" tSpanish = ('KT1A834QfnWremTQ4tc63s8NKbHzLJVszgxc', 0),\n", | |
" DeanCoin = ('KT1BAPAVXMuYz63HrF9CGM9Gu8JVYTFpYqao', 6),\n", | |
" tezos10x = ('KT1A4Sj8TBg4pazMkj226bAAcH6A4iCNQno4', 0),\n", | |
" RSAL = ('KT1PrRTVNgxkRgyqqNQvwTiVhd55dqyxXJ6n', 0),\n", | |
" banana = ('KT1Sd8jvepChHEHo63owNfjnqgzJEkUWSj9q', 2),\n", | |
" SHTz = ('KT1G7Z14RJLKbfu96Hc22bwNL67aykunAGyH', 2),\n", | |
"\n", | |
" sUSD = ('KT1KFszq8UFCcWxnXuhZPUyHT9FK3gjmSKm6', 6),\n", | |
" ETHtz = ('KT1Evsp2yA19Whm24khvFPcwimK6UaAJu8Zo', 18),\n", | |
" kUSD = ('KT1K4EwTpbvYN9agJdjpyJm4ZZdhpUNKB3F6', 18),\n", | |
"\n", | |
" wUSDC = ('KT1U2hs5eNdeCpHouAvQXGMzGFGJowbhjqmo', 6),\n", | |
" wWETH = ('KT1DuYujxrmgepwSDHtADthhKBje9BosUs1w', 18),\n", | |
" RITA = ('KT1L98jqwZtKUZbcPNxb3pTY7b2WXUGEzn8G', 6),\n", | |
" MEL = ('KT1BsDKTXBiYck85fJnoDzedyKKNtMuC9B9h', 6),\n", | |
" BDoge = ('KT1Th57AbgJmiZWDny6Ewqd2sx5qSxJwu8ry', 4),\n", | |
" wMATIC = ('KT1RsfuBee5o7GtYrdB7bzQ1M6oVgyBnxY4S', 18)\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#@title Select token\n", | |
"token = \"hDAO\" #@param ['hDAO', 'WRAP', 'tCow', 'bDAO', 'sDAO', 'tCowLP', 'STKR', 'GUTS', 'Tacoz', 'token42', 'tSpanish', 'DeanCoin', 'tezos10x', 'RSAL', 'banana', 'SHTz', 'sUSD', 'ETHtz', 'kUSD', 'wUSDC', 'wWETH', 'RITA', 'MEL', 'BDoge', 'wMATIC']\n", | |
"requests_depth = 100#@param {type:\"integer\"}\n", | |
"contract_address = tokens[token][0]\n", | |
"token_decimals = tokens[token][1]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
" 0%| | 0/100 [00:00<?, ?it/s]\n" | |
] | |
} | |
], | |
"source": [ | |
"#@title Requesting data\n", | |
"# Running requests & processing:\n", | |
"data = process_pool_data(\n", | |
" collect_storage_history(contract_address, depth=requests_depth),\n", | |
" token_decimals=token_decimals\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from sqlalchemy import create_engine\n", | |
"engine = create_engine('postgresql://user:pass@hostname:5432/hdao')\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>id</th>\n", | |
" <th>level</th>\n", | |
" <th>operation.type</th>\n", | |
" <th>operation.hash</th>\n", | |
" <th>operation.counter</th>\n", | |
" <th>operation.parameter.entrypoint</th>\n", | |
" <th>operation.parameter.value.amount</th>\n", | |
" <th>operation.parameter.value.min_out</th>\n", | |
" <th>operation.parameter.value.receiver</th>\n", | |
" <th>value.storage.veto</th>\n", | |
" <th>...</th>\n", | |
" <th>value.dex_lambdas</th>\n", | |
" <th>value.token_lambdas</th>\n", | |
" <th>operation.parameter.value</th>\n", | |
" <th>operation.parameter.value.value</th>\n", | |
" <th>operation.parameter.value.voter</th>\n", | |
" <th>operation.parameter.value.candidate</th>\n", | |
" <th>operation.parameter.value.shares</th>\n", | |
" <th>operation.parameter.value.min_tez</th>\n", | |
" <th>operation.parameter.value.min_tokens</th>\n", | |
" <th>rate</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>timestamp</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>2021-05-01 17:29:48+00:00</th>\n", | |
" <td>48433396</td>\n", | |
" <td>1453072</td>\n", | |
" <td>transaction</td>\n", | |
" <td>oo2oHiy8Cv4kRdNRFdLbqR2YyWLCicvF7Lp1ZTnFHJ2DY1...</td>\n", | |
" <td>11889391</td>\n", | |
" <td>tokenToTezPayment</td>\n", | |
" <td>10000000</td>\n", | |
" <td>42780208</td>\n", | |
" <td>tz1UAYfFWmaTrQTYMptaGCw6LrXK5Yv84VnQ</td>\n", | |
" <td>0</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>4.301542</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2021-05-01 17:29:48+00:00</th>\n", | |
" <td>48433386</td>\n", | |
" <td>1453072</td>\n", | |
" <td>transaction</td>\n", | |
" <td>op8VWHaqXTo2jjoudw2P7WrDmVfXxSLYq1WQv3r1dfDtNd...</td>\n", | |
" <td>13607527</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>NaN</td>\n", | |
" <td>22951071</td>\n", | |
" <td>tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U</td>\n", | |
" <td>0</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>4.307395</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2021-05-01 17:23:48+00:00</th>\n", | |
" <td>48432542</td>\n", | |
" <td>1453066</td>\n", | |
" <td>transaction</td>\n", | |
" <td>opXSyDJ2GmrYN6HEL7tTjHwfXMD7U1YpsXVJDNHNDKiZLq...</td>\n", | |
" <td>11871573</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>NaN</td>\n", | |
" <td>9014881</td>\n", | |
" <td>tz1XAS3EymJmeFzrQR15wyupr8QY9rdX5cfB</td>\n", | |
" <td>0</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>4.293803</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2021-05-01 17:21:48+00:00</th>\n", | |
" <td>48432205</td>\n", | |
" <td>1453064</td>\n", | |
" <td>transaction</td>\n", | |
" <td>oneHLvgFCpmhAb9HZb34nVuyKyQwB51iKZNMs3Sxk5mWC2...</td>\n", | |
" <td>14287704</td>\n", | |
" <td>tokenToTezPayment</td>\n", | |
" <td>200000000</td>\n", | |
" <td>862550501</td>\n", | |
" <td>tz1TEDuJUYpJ81AeAZWvcSqiWsbye6CddFDX</td>\n", | |
" <td>0</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>4.288372</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2021-05-01 17:15:48+00:00</th>\n", | |
" <td>48431312</td>\n", | |
" <td>1453058</td>\n", | |
" <td>transaction</td>\n", | |
" <td>ooF9E7MaxQgqMDRodX3DpJEQTNB1e7e7G35EM2s1oSeoLH...</td>\n", | |
" <td>13607526</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>NaN</td>\n", | |
" <td>47861274</td>\n", | |
" <td>tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U</td>\n", | |
" <td>0</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>4.407197</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>5 rows × 43 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" id level operation.type \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 48433396 1453072 transaction \n", | |
"2021-05-01 17:29:48+00:00 48433386 1453072 transaction \n", | |
"2021-05-01 17:23:48+00:00 48432542 1453066 transaction \n", | |
"2021-05-01 17:21:48+00:00 48432205 1453064 transaction \n", | |
"2021-05-01 17:15:48+00:00 48431312 1453058 transaction \n", | |
"\n", | |
" operation.hash \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 oo2oHiy8Cv4kRdNRFdLbqR2YyWLCicvF7Lp1ZTnFHJ2DY1... \n", | |
"2021-05-01 17:29:48+00:00 op8VWHaqXTo2jjoudw2P7WrDmVfXxSLYq1WQv3r1dfDtNd... \n", | |
"2021-05-01 17:23:48+00:00 opXSyDJ2GmrYN6HEL7tTjHwfXMD7U1YpsXVJDNHNDKiZLq... \n", | |
"2021-05-01 17:21:48+00:00 oneHLvgFCpmhAb9HZb34nVuyKyQwB51iKZNMs3Sxk5mWC2... \n", | |
"2021-05-01 17:15:48+00:00 ooF9E7MaxQgqMDRodX3DpJEQTNB1e7e7G35EM2s1oSeoLH... \n", | |
"\n", | |
" operation.counter operation.parameter.entrypoint \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 11889391 tokenToTezPayment \n", | |
"2021-05-01 17:29:48+00:00 13607527 tezToTokenPayment \n", | |
"2021-05-01 17:23:48+00:00 11871573 tezToTokenPayment \n", | |
"2021-05-01 17:21:48+00:00 14287704 tokenToTezPayment \n", | |
"2021-05-01 17:15:48+00:00 13607526 tezToTokenPayment \n", | |
"\n", | |
" operation.parameter.value.amount \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 10000000 \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 200000000 \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.min_out \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 42780208 \n", | |
"2021-05-01 17:29:48+00:00 22951071 \n", | |
"2021-05-01 17:23:48+00:00 9014881 \n", | |
"2021-05-01 17:21:48+00:00 862550501 \n", | |
"2021-05-01 17:15:48+00:00 47861274 \n", | |
"\n", | |
" operation.parameter.value.receiver \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 tz1UAYfFWmaTrQTYMptaGCw6LrXK5Yv84VnQ \n", | |
"2021-05-01 17:29:48+00:00 tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U \n", | |
"2021-05-01 17:23:48+00:00 tz1XAS3EymJmeFzrQR15wyupr8QY9rdX5cfB \n", | |
"2021-05-01 17:21:48+00:00 tz1TEDuJUYpJ81AeAZWvcSqiWsbye6CddFDX \n", | |
"2021-05-01 17:15:48+00:00 tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U \n", | |
"\n", | |
" value.storage.veto ... value.dex_lambdas \\\n", | |
"timestamp ... \n", | |
"2021-05-01 17:29:48+00:00 0 ... 1876 \n", | |
"2021-05-01 17:29:48+00:00 0 ... 1876 \n", | |
"2021-05-01 17:23:48+00:00 0 ... 1876 \n", | |
"2021-05-01 17:21:48+00:00 0 ... 1876 \n", | |
"2021-05-01 17:15:48+00:00 0 ... 1876 \n", | |
"\n", | |
" value.token_lambdas operation.parameter.value \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 1883 NaN \n", | |
"2021-05-01 17:29:48+00:00 1883 NaN \n", | |
"2021-05-01 17:23:48+00:00 1883 NaN \n", | |
"2021-05-01 17:21:48+00:00 1883 NaN \n", | |
"2021-05-01 17:15:48+00:00 1883 NaN \n", | |
"\n", | |
" operation.parameter.value.value \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 NaN \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.voter \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 NaN \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.candidate \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 NaN \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.shares \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 NaN \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.min_tez \\\n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:29:48+00:00 NaN \n", | |
"2021-05-01 17:23:48+00:00 NaN \n", | |
"2021-05-01 17:21:48+00:00 NaN \n", | |
"2021-05-01 17:15:48+00:00 NaN \n", | |
"\n", | |
" operation.parameter.value.min_tokens rate \n", | |
"timestamp \n", | |
"2021-05-01 17:29:48+00:00 NaN 4.301542 \n", | |
"2021-05-01 17:29:48+00:00 NaN 4.307395 \n", | |
"2021-05-01 17:23:48+00:00 NaN 4.293803 \n", | |
"2021-05-01 17:21:48+00:00 NaN 4.288372 \n", | |
"2021-05-01 17:15:48+00:00 NaN 4.407197 \n", | |
"\n", | |
"[5 rows x 43 columns]" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"data.head()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 107, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"column_names = {'id': 'id', 'level': 'level', \n", | |
" 'operation.type': 'operation_type',\n", | |
" 'operation.hash': 'operation_hash', \n", | |
" 'operation.counter': 'operation_counter',\n", | |
" # 'operation.nonce': 'operation_counter',\n", | |
" 'operation.parameter.entrypoint': 'operation_parameter_entrypoint',\n", | |
" 'operation.parameter.value.value': 'operation_parameter_value_value', \n", | |
" 'operation.parameter.value.voter': 'operation_parameter_value_voter', \n", | |
" 'operation.parameter.value.candidate': 'operation_parameter_value_candidate',\n", | |
" 'value.storage.veto': 'value_storage_veto',\n", | |
" 'value.storage.vetos': 'value_storage_vetos',\n", | |
" 'value.storage.votes': 'value_storage_votes',\n", | |
" 'value.storage.ledger': 'value_storage_ledger',\n", | |
" 'value.storage.reward': 'value_storage_reward',\n", | |
" 'value.storage.voters': 'value_storage_voters',\n", | |
" 'value.storage.tez_pool': 'value_storage_tez_pool',\n", | |
" 'value.storage.token_id': 'value_storage_token_id',\n", | |
" 'value.storage.last_veto': 'value_storage_last_veto',\n", | |
" 'value.storage.token_pool': 'value_storage_token_pool',\n", | |
" 'value.storage.reward_paid': 'value_storage_reward_paid',\n", | |
" 'value.storage.total_votes': 'value_storage_total_votes',\n", | |
" 'value.storage.total_reward': 'value_storage_total_reward',\n", | |
" 'value.storage.total_supply': 'value_storage_total_supply',\n", | |
" 'value.storage.user_rewards': 'value_storage_user_rewards',\n", | |
" 'value.storage.period_finish': 'value_storage_period_finish',\n", | |
" 'value.storage.token_address' : 'value_storage_token_address',\n", | |
" 'value.storage.reward_per_sec': 'value_storage_reward_per_sec',\n", | |
" 'value.storage.baker_validator': 'value_storage_baker_validator',\n", | |
" 'value.storage.last_update_time' : 'value_storage_last_update_time',\n", | |
" 'value.storage.reward_per_share': 'value_storage_reward_per_share',\n", | |
" 'value.storage.current_candidate': 'value_storage_current_candidate',\n", | |
" 'value.storage.current_delegated': 'value_storage_current_delegated',\n", | |
" 'value.metadata': 'value_metadata',\n", | |
" 'value.dex_lambdas': 'value_dex_lambdas',\n", | |
" 'value.token_lambdas': 'value_token_lambdas',\n", | |
" 'operation.parameter.value': 'operation_parameter_value',\n", | |
" 'operation.parameter.value.min_out': 'operation_parameter_value_min_out',\n", | |
" 'operation.parameter.value.receiver': 'operation_parameter_value_receiver',\n", | |
" 'operation.parameter.value.amount': 'operation_parameter_value_amount',\n", | |
" 'operation.parameter.value.shares': 'operation_parameter_value_shares',\n", | |
" 'operation.parameter.value.min_tez': 'operation_parameter_value_min_tez',\n", | |
" 'operation.parameter.value.min_tokens': 'operation_parameter_value_min_tokens',\n", | |
" 'rate': 'rate',\n", | |
" 'timestamp': 'timestamp'\n", | |
" }" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 108, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"id int64\n", | |
"level int64\n", | |
"operation.type object\n", | |
"operation.hash object\n", | |
"operation.counter int64\n", | |
"operation.parameter.entrypoint object\n", | |
"operation.parameter.value.amount object\n", | |
"operation.parameter.value.min_out object\n", | |
"operation.parameter.value.receiver object\n", | |
"value.storage.veto object\n", | |
"value.storage.vetos object\n", | |
"value.storage.votes object\n", | |
"value.storage.ledger object\n", | |
"value.storage.reward object\n", | |
"value.storage.voters object\n", | |
"value.storage.tez_pool float64\n", | |
"value.storage.token_id object\n", | |
"value.storage.last_veto object\n", | |
"value.storage.token_pool float64\n", | |
"value.storage.reward_paid object\n", | |
"value.storage.total_votes object\n", | |
"value.storage.total_reward object\n", | |
"value.storage.total_supply object\n", | |
"value.storage.user_rewards object\n", | |
"value.storage.period_finish object\n", | |
"value.storage.token_address object\n", | |
"value.storage.reward_per_sec object\n", | |
"value.storage.baker_validator object\n", | |
"value.storage.last_update_time object\n", | |
"value.storage.reward_per_share object\n", | |
"value.storage.current_candidate object\n", | |
"value.storage.current_delegated object\n", | |
"value.metadata object\n", | |
"value.dex_lambdas object\n", | |
"value.token_lambdas object\n", | |
"operation.parameter.value object\n", | |
"operation.parameter.value.value object\n", | |
"operation.parameter.value.voter object\n", | |
"operation.parameter.value.candidate object\n", | |
"operation.parameter.value.shares object\n", | |
"operation.parameter.value.min_tez object\n", | |
"operation.parameter.value.min_tokens object\n", | |
"rate float64\n", | |
"dtype: object" | |
] | |
}, | |
"execution_count": 108, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"data.dtypes" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 109, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"tokens = data.rename(columns=column_names, index={'timestamp': 'timestamp'})" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 110, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"id int64\n", | |
"level int64\n", | |
"operation_type object\n", | |
"operation_hash object\n", | |
"operation_counter int64\n", | |
"operation_parameter_entrypoint object\n", | |
"operation_parameter_value_amount object\n", | |
"operation_parameter_value_min_out object\n", | |
"operation_parameter_value_receiver object\n", | |
"value_storage_veto object\n", | |
"value_storage_vetos object\n", | |
"value_storage_votes object\n", | |
"value_storage_ledger object\n", | |
"value_storage_reward object\n", | |
"value_storage_voters object\n", | |
"value_storage_tez_pool float64\n", | |
"value_storage_token_id object\n", | |
"value_storage_last_veto object\n", | |
"value_storage_token_pool float64\n", | |
"value_storage_reward_paid object\n", | |
"value_storage_total_votes object\n", | |
"value_storage_total_reward object\n", | |
"value_storage_total_supply object\n", | |
"value_storage_user_rewards object\n", | |
"value_storage_period_finish object\n", | |
"value_storage_token_address object\n", | |
"value_storage_reward_per_sec object\n", | |
"value_storage_baker_validator object\n", | |
"value_storage_last_update_time object\n", | |
"value_storage_reward_per_share object\n", | |
"value_storage_current_candidate object\n", | |
"value_storage_current_delegated object\n", | |
"value_metadata object\n", | |
"value_dex_lambdas object\n", | |
"value_token_lambdas object\n", | |
"operation_parameter_value object\n", | |
"operation_parameter_value_value object\n", | |
"operation_parameter_value_voter object\n", | |
"operation_parameter_value_candidate object\n", | |
"operation_parameter_value_shares object\n", | |
"operation_parameter_value_min_tez object\n", | |
"operation_parameter_value_min_tokens object\n", | |
"rate float64\n", | |
"dtype: object" | |
] | |
}, | |
"execution_count": 110, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"tokens.dtypes" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 111, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"tokens.to_sql('tokens_import',engine, if_exists='replace')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 112, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"the_columns = \",\".join([column_names[x] for x in column_names])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 113, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'id,level,operation_type,operation_hash,operation_counter,operation_parameter_entrypoint,operation_parameter_value_value,operation_parameter_value_voter,operation_parameter_value_candidate,value_storage_veto,value_storage_vetos,value_storage_votes,value_storage_ledger,value_storage_reward,value_storage_voters,value_storage_tez_pool,value_storage_token_id,value_storage_last_veto,value_storage_token_pool,value_storage_reward_paid,value_storage_total_votes,value_storage_total_reward,value_storage_total_supply,value_storage_user_rewards,value_storage_period_finish,value_storage_token_address,value_storage_reward_per_sec,value_storage_baker_validator,value_storage_last_update_time,value_storage_reward_per_share,value_storage_current_candidate,value_storage_current_delegated,value_metadata,value_dex_lambdas,value_token_lambdas,operation_parameter_value,operation_parameter_value_min_out,operation_parameter_value_receiver,operation_parameter_value_amount,operation_parameter_value_shares,operation_parameter_value_min_tez,operation_parameter_value_min_tokens,rate,timestamp'" | |
] | |
}, | |
"execution_count": 113, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"the_columns" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# CREATE TABLE tokens (LIKE tokens_import INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);\n", | |
"# SELECT create_hypertable('tokens', 'timestamp');" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 114, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with engine.connect() as con:\n", | |
"\n", | |
" \n", | |
" rs = con.execute('INSERT INTO tokens(%s) SELECT %s FROM tokens_import' % (the_columns, the_columns))\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 116, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"saved_tokens = pd.read_sql('tokens',engine)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 117, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>timestamp</th>\n", | |
" <th>id</th>\n", | |
" <th>level</th>\n", | |
" <th>operation_type</th>\n", | |
" <th>operation_hash</th>\n", | |
" <th>operation_counter</th>\n", | |
" <th>operation_parameter_entrypoint</th>\n", | |
" <th>operation_parameter_value_amount</th>\n", | |
" <th>operation_parameter_value_min_out</th>\n", | |
" <th>operation_parameter_value_receiver</th>\n", | |
" <th>...</th>\n", | |
" <th>value_dex_lambdas</th>\n", | |
" <th>value_token_lambdas</th>\n", | |
" <th>operation_parameter_value</th>\n", | |
" <th>operation_parameter_value_value</th>\n", | |
" <th>operation_parameter_value_voter</th>\n", | |
" <th>operation_parameter_value_candidate</th>\n", | |
" <th>operation_parameter_value_shares</th>\n", | |
" <th>operation_parameter_value_min_tez</th>\n", | |
" <th>operation_parameter_value_min_tokens</th>\n", | |
" <th>rate</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>2021-05-01 17:29:48+00:00</td>\n", | |
" <td>48433396</td>\n", | |
" <td>1453072</td>\n", | |
" <td>transaction</td>\n", | |
" <td>oo2oHiy8Cv4kRdNRFdLbqR2YyWLCicvF7Lp1ZTnFHJ2DY1...</td>\n", | |
" <td>11889391</td>\n", | |
" <td>tokenToTezPayment</td>\n", | |
" <td>10000000</td>\n", | |
" <td>42780208</td>\n", | |
" <td>tz1UAYfFWmaTrQTYMptaGCw6LrXK5Yv84VnQ</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.301542</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>2021-05-01 17:29:48+00:00</td>\n", | |
" <td>48433386</td>\n", | |
" <td>1453072</td>\n", | |
" <td>transaction</td>\n", | |
" <td>op8VWHaqXTo2jjoudw2P7WrDmVfXxSLYq1WQv3r1dfDtNd...</td>\n", | |
" <td>13607527</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>22951071</td>\n", | |
" <td>tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.307395</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>2021-05-01 17:23:48+00:00</td>\n", | |
" <td>48432542</td>\n", | |
" <td>1453066</td>\n", | |
" <td>transaction</td>\n", | |
" <td>opXSyDJ2GmrYN6HEL7tTjHwfXMD7U1YpsXVJDNHNDKiZLq...</td>\n", | |
" <td>11871573</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>9014881</td>\n", | |
" <td>tz1XAS3EymJmeFzrQR15wyupr8QY9rdX5cfB</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.293803</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>2021-05-01 17:21:48+00:00</td>\n", | |
" <td>48432205</td>\n", | |
" <td>1453064</td>\n", | |
" <td>transaction</td>\n", | |
" <td>oneHLvgFCpmhAb9HZb34nVuyKyQwB51iKZNMs3Sxk5mWC2...</td>\n", | |
" <td>14287704</td>\n", | |
" <td>tokenToTezPayment</td>\n", | |
" <td>200000000</td>\n", | |
" <td>862550501</td>\n", | |
" <td>tz1TEDuJUYpJ81AeAZWvcSqiWsbye6CddFDX</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.288372</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>2021-05-01 17:15:48+00:00</td>\n", | |
" <td>48431312</td>\n", | |
" <td>1453058</td>\n", | |
" <td>transaction</td>\n", | |
" <td>ooF9E7MaxQgqMDRodX3DpJEQTNB1e7e7G35EM2s1oSeoLH...</td>\n", | |
" <td>13607526</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>47861274</td>\n", | |
" <td>tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.407197</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>95</th>\n", | |
" <td>2021-05-01 08:31:32+00:00</td>\n", | |
" <td>48394123</td>\n", | |
" <td>1452544</td>\n", | |
" <td>transaction</td>\n", | |
" <td>ooV8LgFxeGiRw2oJWd8e5uE1hDBg7es25XhhgwgNJG9Te8...</td>\n", | |
" <td>14275554</td>\n", | |
" <td>tokenToTezPayment</td>\n", | |
" <td>14499890</td>\n", | |
" <td>62052089</td>\n", | |
" <td>tz1QP4hESmQ8ysFo7MfLg4FVqoVLJmRwKQmb</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.309561</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>96</th>\n", | |
" <td>2021-05-01 08:23:32+00:00</td>\n", | |
" <td>48393642</td>\n", | |
" <td>1452536</td>\n", | |
" <td>transaction</td>\n", | |
" <td>oobPfk1tTDpz1gH3hwtGrQayfpd3D7zXugPNfipXWGnkfc...</td>\n", | |
" <td>13604387</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>229726</td>\n", | |
" <td>tz1cgYRbR57rUWRCMwVDHELe9Bp7vNcpCWKC</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.318297</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>97</th>\n", | |
" <td>2021-05-01 08:19:32+00:00</td>\n", | |
" <td>48393395</td>\n", | |
" <td>1452532</td>\n", | |
" <td>transaction</td>\n", | |
" <td>ooTFKtxkfBdruXsQhNRpxiWuubE3bfw6k2qmomdZnNrLCu...</td>\n", | |
" <td>14103003</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>229734</td>\n", | |
" <td>tz1UVqdadM9iFZ3GiMmRSsmb1CuF5RKiepRa</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.318157</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>98</th>\n", | |
" <td>2021-05-01 08:16:32+00:00</td>\n", | |
" <td>48393207</td>\n", | |
" <td>1452529</td>\n", | |
" <td>transaction</td>\n", | |
" <td>op5uP5WMuXU4q1zcv2Brv8Ea1RRX6p7LmrxbMEZVSfwfyh...</td>\n", | |
" <td>14171206</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>2296</td>\n", | |
" <td>tz1f6G2CQghaqKgbvhrZWowHpDLxTGJTDnQs</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.318018</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>99</th>\n", | |
" <td>2021-05-01 08:10:32+00:00</td>\n", | |
" <td>48392812</td>\n", | |
" <td>1452523</td>\n", | |
" <td>transaction</td>\n", | |
" <td>opGqyv37xQqnu2s7HvpbtiD3HbKWDwuDp8vjLQep6GWa89...</td>\n", | |
" <td>14266302</td>\n", | |
" <td>tezToTokenPayment</td>\n", | |
" <td>None</td>\n", | |
" <td>43785130</td>\n", | |
" <td>tz1T6Fuk1tb9T7p3p8YzXnuaX55axBMJ4srG</td>\n", | |
" <td>...</td>\n", | |
" <td>1876</td>\n", | |
" <td>1883</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>4.318016</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>100 rows × 44 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" timestamp id level operation_type \\\n", | |
"0 2021-05-01 17:29:48+00:00 48433396 1453072 transaction \n", | |
"1 2021-05-01 17:29:48+00:00 48433386 1453072 transaction \n", | |
"2 2021-05-01 17:23:48+00:00 48432542 1453066 transaction \n", | |
"3 2021-05-01 17:21:48+00:00 48432205 1453064 transaction \n", | |
"4 2021-05-01 17:15:48+00:00 48431312 1453058 transaction \n", | |
".. ... ... ... ... \n", | |
"95 2021-05-01 08:31:32+00:00 48394123 1452544 transaction \n", | |
"96 2021-05-01 08:23:32+00:00 48393642 1452536 transaction \n", | |
"97 2021-05-01 08:19:32+00:00 48393395 1452532 transaction \n", | |
"98 2021-05-01 08:16:32+00:00 48393207 1452529 transaction \n", | |
"99 2021-05-01 08:10:32+00:00 48392812 1452523 transaction \n", | |
"\n", | |
" operation_hash operation_counter \\\n", | |
"0 oo2oHiy8Cv4kRdNRFdLbqR2YyWLCicvF7Lp1ZTnFHJ2DY1... 11889391 \n", | |
"1 op8VWHaqXTo2jjoudw2P7WrDmVfXxSLYq1WQv3r1dfDtNd... 13607527 \n", | |
"2 opXSyDJ2GmrYN6HEL7tTjHwfXMD7U1YpsXVJDNHNDKiZLq... 11871573 \n", | |
"3 oneHLvgFCpmhAb9HZb34nVuyKyQwB51iKZNMs3Sxk5mWC2... 14287704 \n", | |
"4 ooF9E7MaxQgqMDRodX3DpJEQTNB1e7e7G35EM2s1oSeoLH... 13607526 \n", | |
".. ... ... \n", | |
"95 ooV8LgFxeGiRw2oJWd8e5uE1hDBg7es25XhhgwgNJG9Te8... 14275554 \n", | |
"96 oobPfk1tTDpz1gH3hwtGrQayfpd3D7zXugPNfipXWGnkfc... 13604387 \n", | |
"97 ooTFKtxkfBdruXsQhNRpxiWuubE3bfw6k2qmomdZnNrLCu... 14103003 \n", | |
"98 op5uP5WMuXU4q1zcv2Brv8Ea1RRX6p7LmrxbMEZVSfwfyh... 14171206 \n", | |
"99 opGqyv37xQqnu2s7HvpbtiD3HbKWDwuDp8vjLQep6GWa89... 14266302 \n", | |
"\n", | |
" operation_parameter_entrypoint operation_parameter_value_amount \\\n", | |
"0 tokenToTezPayment 10000000 \n", | |
"1 tezToTokenPayment None \n", | |
"2 tezToTokenPayment None \n", | |
"3 tokenToTezPayment 200000000 \n", | |
"4 tezToTokenPayment None \n", | |
".. ... ... \n", | |
"95 tokenToTezPayment 14499890 \n", | |
"96 tezToTokenPayment None \n", | |
"97 tezToTokenPayment None \n", | |
"98 tezToTokenPayment None \n", | |
"99 tezToTokenPayment None \n", | |
"\n", | |
" operation_parameter_value_min_out operation_parameter_value_receiver \\\n", | |
"0 42780208 tz1UAYfFWmaTrQTYMptaGCw6LrXK5Yv84VnQ \n", | |
"1 22951071 tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U \n", | |
"2 9014881 tz1XAS3EymJmeFzrQR15wyupr8QY9rdX5cfB \n", | |
"3 862550501 tz1TEDuJUYpJ81AeAZWvcSqiWsbye6CddFDX \n", | |
"4 47861274 tz1eiyML8sHGBL139FwJQJeLGHWAFtDqPz4U \n", | |
".. ... ... \n", | |
"95 62052089 tz1QP4hESmQ8ysFo7MfLg4FVqoVLJmRwKQmb \n", | |
"96 229726 tz1cgYRbR57rUWRCMwVDHELe9Bp7vNcpCWKC \n", | |
"97 229734 tz1UVqdadM9iFZ3GiMmRSsmb1CuF5RKiepRa \n", | |
"98 2296 tz1f6G2CQghaqKgbvhrZWowHpDLxTGJTDnQs \n", | |
"99 43785130 tz1T6Fuk1tb9T7p3p8YzXnuaX55axBMJ4srG \n", | |
"\n", | |
" ... value_dex_lambdas value_token_lambdas operation_parameter_value \\\n", | |
"0 ... 1876 1883 None \n", | |
"1 ... 1876 1883 None \n", | |
"2 ... 1876 1883 None \n", | |
"3 ... 1876 1883 None \n", | |
"4 ... 1876 1883 None \n", | |
".. ... ... ... ... \n", | |
"95 ... 1876 1883 None \n", | |
"96 ... 1876 1883 None \n", | |
"97 ... 1876 1883 None \n", | |
"98 ... 1876 1883 None \n", | |
"99 ... 1876 1883 None \n", | |
"\n", | |
" operation_parameter_value_value operation_parameter_value_voter \\\n", | |
"0 None None \n", | |
"1 None None \n", | |
"2 None None \n", | |
"3 None None \n", | |
"4 None None \n", | |
".. ... ... \n", | |
"95 None None \n", | |
"96 None None \n", | |
"97 None None \n", | |
"98 None None \n", | |
"99 None None \n", | |
"\n", | |
" operation_parameter_value_candidate operation_parameter_value_shares \\\n", | |
"0 None None \n", | |
"1 None None \n", | |
"2 None None \n", | |
"3 None None \n", | |
"4 None None \n", | |
".. ... ... \n", | |
"95 None None \n", | |
"96 None None \n", | |
"97 None None \n", | |
"98 None None \n", | |
"99 None None \n", | |
"\n", | |
" operation_parameter_value_min_tez operation_parameter_value_min_tokens \\\n", | |
"0 None None \n", | |
"1 None None \n", | |
"2 None None \n", | |
"3 None None \n", | |
"4 None None \n", | |
".. ... ... \n", | |
"95 None None \n", | |
"96 None None \n", | |
"97 None None \n", | |
"98 None None \n", | |
"99 None None \n", | |
"\n", | |
" rate \n", | |
"0 4.301542 \n", | |
"1 4.307395 \n", | |
"2 4.293803 \n", | |
"3 4.288372 \n", | |
"4 4.407197 \n", | |
".. ... \n", | |
"95 4.309561 \n", | |
"96 4.318297 \n", | |
"97 4.318157 \n", | |
"98 4.318018 \n", | |
"99 4.318016 \n", | |
"\n", | |
"[100 rows x 44 columns]" | |
] | |
}, | |
"execution_count": 117, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"saved_tokens" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.8.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment