diff --git "a/notebooks/trader_agent_metrics.ipynb" "b/notebooks/trader_agent_metrics.ipynb" new file mode 100644--- /dev/null +++ "b/notebooks/trader_agent_metrics.ipynb" @@ -0,0 +1,2239 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "import gc\n", + "\n", + "sns.set_style(\"darkgrid\")" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "open_markets = pd.read_parquet(\"../data/markets_live_data.parquet\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "RangeIndex: 947 entries, 0 to 946\n", + "Data columns (total 23 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 creationTimestamp 947 non-null object \n", + " 1 id 947 non-null object \n", + " 2 liquidityMeasure 947 non-null int64 \n", + " 3 liquidityParameter 947 non-null object \n", + " 4 openingTimestamp 947 non-null object \n", + " 5 outcomeTokenAmounts 947 non-null object \n", + " 6 title 947 non-null object \n", + " 7 sample_timestamp 947 non-null int64 \n", + " 8 open 947 non-null bool \n", + " 9 total_trades 947 non-null int64 \n", + " 10 dist_gap_perc 947 non-null float64 \n", + " 11 first_outcome 947 non-null object \n", + " 12 second_outcome 947 non-null object \n", + " 13 sample_datetime 947 non-null datetime64[ns]\n", + " 14 first_token_perc 947 non-null float64 \n", + " 15 second_token_perc 947 non-null float64 \n", + " 16 mean_trade_size 947 non-null float64 \n", + " 17 total_bet_amount 947 non-null float64 \n", + " 18 price_weighted_first_outcome_perc 947 non-null float64 \n", + " 19 price_weighted_second_outcome_perc 947 non-null float64 \n", + " 20 bought_tokens_first_perc 947 non-null float64 \n", + " 21 bought_tokens_second_perc 947 non-null float64 \n", + " 22 resolutionTimestamp 0 non-null object \n", + "dtypes: bool(1), datetime64[ns](1), float64(9), int64(3), object(9)\n", + "memory usage: 163.8+ KB\n" + ] + } + ], + "source": [ + "open_markets.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "open\n", + "False 834\n", + "True 113\n", + "Name: count, dtype: int64" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open_markets.open.value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "all_trades = pd.read_parquet('../data/all_trades_profitability.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "RangeIndex: 8210 entries, 0 to 8209\n", + "Data columns (total 20 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 trader_address 8210 non-null object \n", + " 1 market_creator 8210 non-null object \n", + " 2 trade_id 8210 non-null object \n", + " 3 creation_timestamp 8210 non-null datetime64[ns, UTC]\n", + " 4 title 8210 non-null object \n", + " 5 market_status 8210 non-null object \n", + " 6 collateral_amount 8210 non-null float64 \n", + " 7 outcome_index 8210 non-null object \n", + " 8 trade_fee_amount 8210 non-null float64 \n", + " 9 outcomes_tokens_traded 8210 non-null float64 \n", + " 10 current_answer 8210 non-null int64 \n", + " 11 is_invalid 8210 non-null bool \n", + " 12 winning_trade 8210 non-null bool \n", + " 13 earnings 8210 non-null float64 \n", + " 14 redeemed 8210 non-null bool \n", + " 15 redeemed_amount 8210 non-null float64 \n", + " 16 num_mech_calls 8210 non-null int64 \n", + " 17 mech_fee_amount 8210 non-null float64 \n", + " 18 net_earnings 8210 non-null float64 \n", + " 19 roi 8210 non-null float64 \n", + "dtypes: bool(3), datetime64[ns, UTC](1), float64(8), int64(2), object(6)\n", + "memory usage: 1.1+ MB\n" + ] + } + ], + "source": [ + "all_trades.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "market_status\n", + "CLOSED 8210\n", + "Name: count, dtype: int64" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "all_trades.market_status.value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "all_trades[\"creation_date\"] = all_trades[\"creation_timestamp\"].dt.date" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Metrics we can compute at the trader agent level (for closed markets)\n", + "\n", + "\n", + "* ROI per market and per day (sorted by creation date)\n", + "* number of trades per market and per day\n", + "* net earnings\n", + "* earnings\n", + "* bet amount\n", + "* nr mech calls\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addresstitlenr_trades_per_market
00x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Apple implement significant changes in th...3
10x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Apple launch the iPhone 16, Watch, and Ai...2
20x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Bayer Leverkusen retain the Bundesliga ti...1
30x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Chick-fil-A successfully launch a streami...2
40x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Donald Trump's new cryptocurrency platfor...1
\n", + "
" + ], + "text/plain": [ + " trader_address \\\n", + "0 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "1 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "2 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "3 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "4 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "\n", + " title nr_trades_per_market \n", + "0 Will Apple implement significant changes in th... 3 \n", + "1 Will Apple launch the iPhone 16, Watch, and Ai... 2 \n", + "2 Will Bayer Leverkusen retain the Bundesliga ti... 1 \n", + "3 Will Chick-fil-A successfully launch a streami... 2 \n", + "4 Will Donald Trump's new cryptocurrency platfor... 1 " + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "volume_trades_per_trader_and_market = all_trades.groupby([\"trader_address\", \"title\"])[\"roi\"].count().reset_index()\n", + "volume_trades_per_trader_and_market.rename(columns={\"roi\":\"nr_trades_per_market\"}, inplace=True)\n", + "volume_trades_per_trader_and_market.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Adding multibet category" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "volume_trades_per_trader_and_market[\"multibet\"] = volume_trades_per_trader_and_market.apply(lambda x: True if x.nr_trades_per_market > 1 else False, axis=1)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addresstitlenr_trades_per_marketmultibet
00x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Apple implement significant changes in th...3True
10x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Apple launch the iPhone 16, Watch, and Ai...2True
20x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Bayer Leverkusen retain the Bundesliga ti...1False
30x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Chick-fil-A successfully launch a streami...2True
40x022b36c50b85b8ae7addfb8a35d76c59d5814834Will Donald Trump's new cryptocurrency platfor...1False
\n", + "
" + ], + "text/plain": [ + " trader_address \\\n", + "0 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "1 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "2 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "3 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "4 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 \n", + "\n", + " title nr_trades_per_market \\\n", + "0 Will Apple implement significant changes in th... 3 \n", + "1 Will Apple launch the iPhone 16, Watch, and Ai... 2 \n", + "2 Will Bayer Leverkusen retain the Bundesliga ti... 1 \n", + "3 Will Chick-fil-A successfully launch a streami... 2 \n", + "4 Will Donald Trump's new cryptocurrency platfor... 1 \n", + "\n", + " multibet \n", + "0 True \n", + "1 True \n", + "2 False \n", + "3 True \n", + "4 False " + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "volume_trades_per_trader_and_market.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Global dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "trader_agent_metrics = pd.merge(all_trades, volume_trades_per_trader_and_market, on=['trader_address', 'title'])" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addressmarket_creatortrade_idcreation_timestamptitlemarket_statuscollateral_amountoutcome_indextrade_fee_amountoutcomes_tokens_traded...earningsredeemedredeemed_amountnum_mech_callsmech_fee_amountnet_earningsroicreation_datenr_trades_per_marketmultibet
00x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x02...2024-08-25 02:37:35+00:00Will the first floating offshore wind research...CLOSED0.45042610.0090090.729589...0.729589False0.020.020.2501540.5217692024-08-251False
10x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x012bf74d4c7060799f590c7c08accc0e9938e6c40x02...2024-08-30 03:24:45+00:00Will SpaceX's Polaris Dawn mission launch on 3...CLOSED0.41966200.0083930.610289...0.610289False0.010.010.1722340.3931792024-08-301False
20x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-26 02:48:20+00:00Will Apple implement significant changes in th...CLOSED0.64173210.0128351.572272...0.000000False0.040.04-0.694567-1.0000002024-08-263True
30x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-27 00:23:25+00:00Will Apple implement significant changes in th...CLOSED0.48250610.0096501.013458...0.000000False0.040.04-0.532156-1.0000002024-08-273True
40x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-28 01:41:30+00:00Will Apple implement significant changes in th...CLOSED0.56793010.0113591.285445...0.000000False0.040.04-0.619289-1.0000002024-08-283True
\n", + "

5 rows × 23 columns

\n", + "
" + ], + "text/plain": [ + " trader_address market_creator \\\n", + "0 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "1 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "2 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "3 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "4 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "\n", + " trade_id \\\n", + "0 0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x02... \n", + "1 0x012bf74d4c7060799f590c7c08accc0e9938e6c40x02... \n", + "2 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "3 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "4 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "\n", + " creation_timestamp \\\n", + "0 2024-08-25 02:37:35+00:00 \n", + "1 2024-08-30 03:24:45+00:00 \n", + "2 2024-08-26 02:48:20+00:00 \n", + "3 2024-08-27 00:23:25+00:00 \n", + "4 2024-08-28 01:41:30+00:00 \n", + "\n", + " title market_status \\\n", + "0 Will the first floating offshore wind research... CLOSED \n", + "1 Will SpaceX's Polaris Dawn mission launch on 3... CLOSED \n", + "2 Will Apple implement significant changes in th... CLOSED \n", + "3 Will Apple implement significant changes in th... CLOSED \n", + "4 Will Apple implement significant changes in th... CLOSED \n", + "\n", + " collateral_amount outcome_index trade_fee_amount outcomes_tokens_traded \\\n", + "0 0.450426 1 0.009009 0.729589 \n", + "1 0.419662 0 0.008393 0.610289 \n", + "2 0.641732 1 0.012835 1.572272 \n", + "3 0.482506 1 0.009650 1.013458 \n", + "4 0.567930 1 0.011359 1.285445 \n", + "\n", + " ... earnings redeemed redeemed_amount num_mech_calls mech_fee_amount \\\n", + "0 ... 0.729589 False 0.0 2 0.02 \n", + "1 ... 0.610289 False 0.0 1 0.01 \n", + "2 ... 0.000000 False 0.0 4 0.04 \n", + "3 ... 0.000000 False 0.0 4 0.04 \n", + "4 ... 0.000000 False 0.0 4 0.04 \n", + "\n", + " net_earnings roi creation_date nr_trades_per_market multibet \n", + "0 0.250154 0.521769 2024-08-25 1 False \n", + "1 0.172234 0.393179 2024-08-30 1 False \n", + "2 -0.694567 -1.000000 2024-08-26 3 True \n", + "3 -0.532156 -1.000000 2024-08-27 3 True \n", + "4 -0.619289 -1.000000 2024-08-28 3 True \n", + "\n", + "[5 rows x 23 columns]" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trader_agent_metrics.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [], + "source": [ + "trader_agent_metrics.sort_values(by=[\"trader_address\", \"title\", \"creation_timestamp\"],inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addressmarket_creatortrade_idcreation_timestamptitlemarket_statuscollateral_amountoutcome_indextrade_fee_amountoutcomes_tokens_traded...earningsredeemedredeemed_amountnum_mech_callsmech_fee_amountnet_earningsroicreation_datenr_trades_per_marketmultibet
20x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-26 02:48:20+00:00Will Apple implement significant changes in th...CLOSED0.64173210.0128351.572272...0.000000False0.040.04-0.694567-1.0000002024-08-263True
30x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-27 00:23:25+00:00Will Apple implement significant changes in th...CLOSED0.48250610.0096501.013458...0.000000False0.040.04-0.532156-1.0000002024-08-273True
40x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x02e93f85cbc48b380c725d58e85e083c112bd0180x02...2024-08-28 01:41:30+00:00Will Apple implement significant changes in th...CLOSED0.56793010.0113591.285445...0.000000False0.040.04-0.619289-1.0000002024-08-283True
410x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x493b27d17cd2672631b30f32115f52eb2ec101850x02...2024-08-29 00:40:05+00:00Will Apple launch the iPhone 16, Watch, and Ai...CLOSED1.79872110.0359742.906159...2.906159False0.030.031.0414630.5585162024-08-292True
420x022b36c50b85b8ae7addfb8a35d76c59d5814834quickstart0x493b27d17cd2672631b30f32115f52eb2ec101850x02...2024-08-30 03:04:05+00:00Will Apple launch the iPhone 16, Watch, and Ai...CLOSED1.29438210.0258881.952878...1.952878False0.030.030.6026080.4462872024-08-302True
\n", + "

5 rows × 23 columns

\n", + "
" + ], + "text/plain": [ + " trader_address market_creator \\\n", + "2 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "3 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "4 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "41 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "42 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 quickstart \n", + "\n", + " trade_id \\\n", + "2 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "3 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "4 0x02e93f85cbc48b380c725d58e85e083c112bd0180x02... \n", + "41 0x493b27d17cd2672631b30f32115f52eb2ec101850x02... \n", + "42 0x493b27d17cd2672631b30f32115f52eb2ec101850x02... \n", + "\n", + " creation_timestamp \\\n", + "2 2024-08-26 02:48:20+00:00 \n", + "3 2024-08-27 00:23:25+00:00 \n", + "4 2024-08-28 01:41:30+00:00 \n", + "41 2024-08-29 00:40:05+00:00 \n", + "42 2024-08-30 03:04:05+00:00 \n", + "\n", + " title market_status \\\n", + "2 Will Apple implement significant changes in th... CLOSED \n", + "3 Will Apple implement significant changes in th... CLOSED \n", + "4 Will Apple implement significant changes in th... CLOSED \n", + "41 Will Apple launch the iPhone 16, Watch, and Ai... CLOSED \n", + "42 Will Apple launch the iPhone 16, Watch, and Ai... CLOSED \n", + "\n", + " collateral_amount outcome_index trade_fee_amount outcomes_tokens_traded \\\n", + "2 0.641732 1 0.012835 1.572272 \n", + "3 0.482506 1 0.009650 1.013458 \n", + "4 0.567930 1 0.011359 1.285445 \n", + "41 1.798721 1 0.035974 2.906159 \n", + "42 1.294382 1 0.025888 1.952878 \n", + "\n", + " ... earnings redeemed redeemed_amount num_mech_calls mech_fee_amount \\\n", + "2 ... 0.000000 False 0.0 4 0.04 \n", + "3 ... 0.000000 False 0.0 4 0.04 \n", + "4 ... 0.000000 False 0.0 4 0.04 \n", + "41 ... 2.906159 False 0.0 3 0.03 \n", + "42 ... 1.952878 False 0.0 3 0.03 \n", + "\n", + " net_earnings roi creation_date nr_trades_per_market multibet \n", + "2 -0.694567 -1.000000 2024-08-26 3 True \n", + "3 -0.532156 -1.000000 2024-08-27 3 True \n", + "4 -0.619289 -1.000000 2024-08-28 3 True \n", + "41 1.041463 0.558516 2024-08-29 2 True \n", + "42 0.602608 0.446287 2024-08-30 2 True \n", + "\n", + "[5 rows x 23 columns]" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trader_agent_metrics.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Adding weekly time window\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/var/folders/gp/02mb1d514ng739czlxw1lhh00000gn/T/ipykernel_79146/2162443128.py:4: UserWarning: Converting to PeriodArray/Index representation will drop timezone information.\n", + " trader_agent_metrics[\"creation_timestamp\"].dt.to_period(\"W\").dt.strftime(\"%b-%d\")\n" + ] + } + ], + "source": [ + "trader_agent_metrics = trader_agent_metrics.sort_values(by=\"creation_timestamp\", ascending=True)\n", + "\n", + "trader_agent_metrics[\"month_year_week\"] = (\n", + " trader_agent_metrics[\"creation_timestamp\"].dt.to_period(\"W\").dt.strftime(\"%b-%d\")\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addressmarket_creatortrade_idcreation_timestamptitlemarket_statuscollateral_amountoutcome_indextrade_fee_amountoutcomes_tokens_traded...redeemedredeemed_amountnum_mech_callsmech_fee_amountnet_earningsroicreation_datenr_trades_per_marketmultibetmonth_year_week
22090x95ecc70d9f4feb162ed9f41c4432d990c36c8f57quickstart0x33ec6978224941c04b51704cbc55943898c13a1b0x95...2024-07-20 02:10:10+00:00Will iOS 18's significant upgrade for the iPho...CLOSED0.16000010.0032000.310165...False0.00000030.03-0.193200-1.0000002024-07-202TrueJul-21
65880xf089874165be0377680683fd5187a058dea82683quickstart0x5658c1834d053e92143956069926ccef1cb3c92b0xf0...2024-07-20 05:18:00+00:00Will Argentina win the Copa America 2024?CLOSED1.00000000.0200001.839649...True1.83964920.020.7996490.7688932024-07-202TrueJul-21
13160x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2quickstart0x33ec6978224941c04b51704cbc55943898c13a1b0x49...2024-07-20 05:28:50+00:00Will iOS 18's significant upgrade for the iPho...CLOSED1.07085510.0214171.925006...False0.00000030.03-1.122272-1.0000002024-07-202TrueJul-21
77760xe283e408c6017447da9fe092d52c386753699680pearl0xb13be57227a3e806b36c72ab1cd5792df2e5e8070xe2...2024-07-20 05:51:20+00:00Will a scientific study be published on 23 Jul...CLOSED1.00000010.0200001.839649...False0.00000020.02-1.040000-1.0000002024-07-201FalseJul-21
63440x480e5b5abd27cd754745871116e79caf90468dd4quickstart0x5658c1834d053e92143956069926ccef1cb3c92b0x48...2024-07-20 06:32:05+00:00Will Argentina win the Copa America 2024?CLOSED1.20000000.0240001.964669...True1.96466920.020.7206690.5793162024-07-201FalseJul-21
\n", + "

5 rows × 24 columns

\n", + "
" + ], + "text/plain": [ + " trader_address market_creator \\\n", + "2209 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 quickstart \n", + "6588 0xf089874165be0377680683fd5187a058dea82683 quickstart \n", + "1316 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 quickstart \n", + "7776 0xe283e408c6017447da9fe092d52c386753699680 pearl \n", + "6344 0x480e5b5abd27cd754745871116e79caf90468dd4 quickstart \n", + "\n", + " trade_id \\\n", + "2209 0x33ec6978224941c04b51704cbc55943898c13a1b0x95... \n", + "6588 0x5658c1834d053e92143956069926ccef1cb3c92b0xf0... \n", + "1316 0x33ec6978224941c04b51704cbc55943898c13a1b0x49... \n", + "7776 0xb13be57227a3e806b36c72ab1cd5792df2e5e8070xe2... \n", + "6344 0x5658c1834d053e92143956069926ccef1cb3c92b0x48... \n", + "\n", + " creation_timestamp \\\n", + "2209 2024-07-20 02:10:10+00:00 \n", + "6588 2024-07-20 05:18:00+00:00 \n", + "1316 2024-07-20 05:28:50+00:00 \n", + "7776 2024-07-20 05:51:20+00:00 \n", + "6344 2024-07-20 06:32:05+00:00 \n", + "\n", + " title market_status \\\n", + "2209 Will iOS 18's significant upgrade for the iPho... CLOSED \n", + "6588 Will Argentina win the Copa America 2024? CLOSED \n", + "1316 Will iOS 18's significant upgrade for the iPho... CLOSED \n", + "7776 Will a scientific study be published on 23 Jul... CLOSED \n", + "6344 Will Argentina win the Copa America 2024? CLOSED \n", + "\n", + " collateral_amount outcome_index trade_fee_amount \\\n", + "2209 0.160000 1 0.003200 \n", + "6588 1.000000 0 0.020000 \n", + "1316 1.070855 1 0.021417 \n", + "7776 1.000000 1 0.020000 \n", + "6344 1.200000 0 0.024000 \n", + "\n", + " outcomes_tokens_traded ... redeemed redeemed_amount num_mech_calls \\\n", + "2209 0.310165 ... False 0.000000 3 \n", + "6588 1.839649 ... True 1.839649 2 \n", + "1316 1.925006 ... False 0.000000 3 \n", + "7776 1.839649 ... False 0.000000 2 \n", + "6344 1.964669 ... True 1.964669 2 \n", + "\n", + " mech_fee_amount net_earnings roi creation_date \\\n", + "2209 0.03 -0.193200 -1.000000 2024-07-20 \n", + "6588 0.02 0.799649 0.768893 2024-07-20 \n", + "1316 0.03 -1.122272 -1.000000 2024-07-20 \n", + "7776 0.02 -1.040000 -1.000000 2024-07-20 \n", + "6344 0.02 0.720669 0.579316 2024-07-20 \n", + "\n", + " nr_trades_per_market multibet month_year_week \n", + "2209 2 True Jul-21 \n", + "6588 2 True Jul-21 \n", + "1316 2 True Jul-21 \n", + "7776 1 False Jul-21 \n", + "6344 1 False Jul-21 \n", + "\n", + "[5 rows x 24 columns]" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trader_agent_metrics.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "market_creator\n", + "quickstart 6896\n", + "pearl 1314\n", + "Name: count, dtype: int64" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "trader_agent_metrics.market_creator.value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "DEFAULT_MECH_FEE = 0.01 # xDAI" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [], + "source": [ + "from tqdm import tqdm" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_metrics(trader_address: str, trader_data: pd.DataFrame) -> dict:\n", + "\n", + " if len(trader_data) == 0:\n", + " print(\"No data to compute metrics\")\n", + " return {}\n", + "\n", + " weekly_metrics = {}\n", + " weekly_metrics[\"trader_address\"] = trader_address\n", + " total_net_earnings = trader_data.net_earnings.sum()\n", + " total_bet_amounts = trader_data.collateral_amount.sum()\n", + " total_num_mech_calls = trader_data.num_mech_calls.sum()\n", + " weekly_metrics[\"net_earnings\"] = total_net_earnings\n", + " weekly_metrics[\"earnings\"] = trader_data.earnings.sum()\n", + " weekly_metrics[\"bet_amount\"] = total_bet_amounts\n", + " weekly_metrics[\"nr_mech_calls\"] = total_num_mech_calls\n", + " total_fee_amounts = trader_data.mech_fee_amount.sum()\n", + " total_costs = (\n", + " total_bet_amounts\n", + " + total_fee_amounts\n", + " + (total_num_mech_calls * DEFAULT_MECH_FEE)\n", + " )\n", + " weekly_metrics[\"roi\"] = total_net_earnings / total_costs\n", + " print(weekly_metrics)\n", + " return weekly_metrics\n", + "\n", + "\n", + "def compute_trader_metrics_by_trader_type(\n", + " trader_address: str, week_traders_data: pd.DataFrame, trader_type: str = \"all\"\n", + ") -> pd.DataFrame:\n", + " \"\"\"This function computes for a specific week the different metrics: roi, net_earnings, earnings, bet_amount, nr_mech_calls.\n", + " The global roi of the trader agent by computing the individual net profit and the indivicual costs values\n", + " achieved per market and dividing both.\n", + " It is possible to filter by trader type: multibet, singlebet, all\"\"\"\n", + " assert \"trader_type\" in week_traders_data.columns\n", + " filtered_traders_data = week_traders_data.loc[\n", + " week_traders_data[\"trader_address\"] == trader_address\n", + " ]\n", + "\n", + " if trader_type != \"all\": # compute only for the specific type\n", + " filtered_traders_data = filtered_traders_data.loc[\n", + " filtered_traders_data[\"trader_type\"] == trader_type\n", + " ]\n", + " if len(filtered_traders_data) == 0:\n", + " return pd.DataFrame() # No Data\n", + "\n", + " return compute_metrics(trader_address, filtered_traders_data)\n", + "\n", + "\n", + "def compute_trader_metrics_by_market_creator(\n", + " trader_address: str, week_traders_data: pd.DataFrame, market_creator: str = \"all\"\n", + ") -> dict:\n", + " \"\"\"This function computes for a specific week the different metrics: roi, net_earnings, earnings, bet_amount, nr_mech_calls.\n", + " The global roi of the trader agent by computing the individual net profit and the indivicual costs values\n", + " achieved per market and dividing both.\n", + " It is possible to filter by market creator: quickstart, pearl, all\"\"\"\n", + " assert \"market_creator\" in week_traders_data.columns\n", + " filtered_traders_data = week_traders_data.loc[\n", + " week_traders_data[\"trader_address\"] == trader_address\n", + " ]\n", + " if market_creator != \"all\": # compute only for the specific market creator\n", + " print(f\"Filtering only specific market creators = {market_creator}\")\n", + " filtered_traders_data = filtered_traders_data.loc[\n", + " filtered_traders_data[\"market_creator\"] == market_creator\n", + " ]\n", + " if len(filtered_traders_data) == 0:\n", + " print(f\"No data. Skipping market creator {market_creator}\")\n", + " return {} # No Data\n", + " print(\n", + " f\"Volume of data for trader {trader_address} and market creator {market_creator} = {len(filtered_traders_data)}\"\n", + " )\n", + " metrics = compute_metrics(trader_address, filtered_traders_data)\n", + " return metrics\n", + "\n", + "\n", + "def merge_trader_metrics(\n", + " trader: str, weekly_data: pd.DataFrame, week: str\n", + ") -> pd.DataFrame:\n", + " trader_metrics = []\n", + " # computation as specification 1 for all types of markets\n", + " weekly_metrics_all = compute_trader_metrics_by_market_creator(\n", + " trader, weekly_data, market_creator=\"all\"\n", + " )\n", + " weekly_metrics_all[\"month_year_week\"] = week\n", + " weekly_metrics_all[\"market_creator\"] = \"all\"\n", + " trader_metrics.append(weekly_metrics_all)\n", + "\n", + " # computation as specification 1 for quickstart markets\n", + " weekly_metrics_qs = compute_trader_metrics_by_market_creator(\n", + " trader, weekly_data, market_creator=\"quickstart\"\n", + " )\n", + " if len(weekly_metrics_qs) > 0:\n", + " weekly_metrics_qs[\"month_year_week\"] = week\n", + " weekly_metrics_qs[\"market_creator\"] = \"quickstart\"\n", + " trader_metrics.append(weekly_metrics_qs)\n", + " # computation as specification 1 for pearl markets\n", + " weekly_metrics_pearl = compute_trader_metrics_by_market_creator(\n", + " trader, weekly_data, market_creator=\"pearl\"\n", + " )\n", + " if len(weekly_metrics_pearl) > 0:\n", + " weekly_metrics_pearl[\"month_year_week\"] = week\n", + " weekly_metrics_pearl[\"market_creator\"] = \"pearl\"\n", + " trader_metrics.append(weekly_metrics_pearl)\n", + " result = pd.DataFrame.from_dict(trader_metrics, orient=\"columns\")\n", + " print(f\"Total length of all trader metrics for this week = {len(result)}\")\n", + " print(result.head())\n", + " return result\n", + "\n", + "\n", + "def compute_weekly_metrics_by_market_creator(\n", + " trader_agents_data: pd.DataFrame,\n", + ") -> pd.DataFrame:\n", + " \"\"\"Function to compute the metrics at the trader level per week and with different categories by market creator\"\"\"\n", + " contents = []\n", + " all_weeks = list(trader_agents_data.month_year_week.unique())\n", + " for week in all_weeks:\n", + " weekly_data = trader_agents_data.loc[\n", + " trader_agents_data[\"month_year_week\"] == week\n", + " ]\n", + " print(f\"Computing weekly metrics for week ={week} by market creator\")\n", + " # traverse each trader agent\n", + " traders = list(weekly_data.trader_address.unique())\n", + " for trader in tqdm(traders, desc=f\"Trader' metrics\", unit=\"metrics\"):\n", + " #for trader in traders:\n", + " contents.append(merge_trader_metrics(trader, weekly_data, week))\n", + " break\n", + " print(\"End computing all weekly metrics by market creator\")\n", + " return pd.concat(contents, ignore_index=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Computing weekly metrics for week =Jul-21 by market creator\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Trader' metrics: 100%|██████████| 19/19 [00:00<00:00, 528.86metrics/s]" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume of data for trader 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 and market creator all = 3\n", + "{'trader_address': '0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57', 'net_earnings': -0.7234109591878646, 'earnings': 1.7851345317122906, 'bet_amount': 2.380926951862897, 'nr_mech_calls': 8, 'roi': -0.2847035640507064}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 and market creator quickstart = 3\n", + "{'trader_address': '0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57', 'net_earnings': -0.7234109591878646, 'earnings': 1.7851345317122906, 'bet_amount': 2.380926951862897, 'nr_mech_calls': 8, 'roi': -0.2847035640507064}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 -0.723411 1.785135 \n", + "1 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 -0.723411 1.785135 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 2.380927 8 -0.284704 Jul-21 all \n", + "1 2.380927 8 -0.284704 Jul-21 quickstart \n", + "Volume of data for trader 0xf089874165be0377680683fd5187a058dea82683 and market creator all = 1\n", + "{'trader_address': '0xf089874165be0377680683fd5187a058dea82683', 'net_earnings': 0.7996491228070175, 'earnings': 1.8396491228070175, 'bet_amount': 1.0, 'nr_mech_calls': 2, 'roi': 0.7688933873144399}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0xf089874165be0377680683fd5187a058dea82683 and market creator quickstart = 1\n", + "{'trader_address': '0xf089874165be0377680683fd5187a058dea82683', 'net_earnings': 0.7996491228070175, 'earnings': 1.8396491228070175, 'bet_amount': 1.0, 'nr_mech_calls': 2, 'roi': 0.7688933873144399}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0xf089874165be0377680683fd5187a058dea82683 0.799649 1.839649 \n", + "1 0xf089874165be0377680683fd5187a058dea82683 0.799649 1.839649 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 1.0 2 0.768893 Jul-21 all \n", + "1 1.0 2 0.768893 Jul-21 quickstart \n", + "Volume of data for trader 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 and market creator all = 4\n", + "{'trader_address': '0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2', 'net_earnings': -1.0071645410215222, 'earnings': 3.350264102099237, 'bet_amount': 4.154341806981137, 'nr_mech_calls': 12, 'roi': -0.22919576702510377}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 and market creator quickstart = 4\n", + "{'trader_address': '0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2', 'net_earnings': -1.0071645410215222, 'earnings': 3.350264102099237, 'bet_amount': 4.154341806981137, 'nr_mech_calls': 12, 'roi': -0.22919576702510377}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 -1.007165 3.350264 \n", + "1 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 -1.007165 3.350264 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 4.154342 12 -0.229196 Jul-21 all \n", + "1 4.154342 12 -0.229196 Jul-21 quickstart \n", + "Volume of data for trader 0xe283e408c6017447da9fe092d52c386753699680 and market creator all = 1\n", + "{'trader_address': '0xe283e408c6017447da9fe092d52c386753699680', 'net_earnings': -1.04, 'earnings': 0.0, 'bet_amount': 1.0, 'nr_mech_calls': 2, 'roi': -1.0}\n", + "Filtering only specific market creators = quickstart\n", + "No data. Skipping market creator quickstart\n", + "Filtering only specific market creators = pearl\n", + "Volume of data for trader 0xe283e408c6017447da9fe092d52c386753699680 and market creator pearl = 1\n", + "{'trader_address': '0xe283e408c6017447da9fe092d52c386753699680', 'net_earnings': -1.04, 'earnings': 0.0, 'bet_amount': 1.0, 'nr_mech_calls': 2, 'roi': -1.0}\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0xe283e408c6017447da9fe092d52c386753699680 -1.04 0.0 \n", + "1 0xe283e408c6017447da9fe092d52c386753699680 -1.04 0.0 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 1.0 2 -1.0 Jul-21 all \n", + "1 1.0 2 -1.0 Jul-21 pearl \n", + "Volume of data for trader 0x480e5b5abd27cd754745871116e79caf90468dd4 and market creator all = 2\n", + "{'trader_address': '0x480e5b5abd27cd754745871116e79caf90468dd4', 'net_earnings': -0.36794781695584966, 'earnings': 1.9646689200064404, 'bet_amount': 2.2476634676100886, 'nr_mech_calls': 4, 'roi': -0.1580760372261362}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x480e5b5abd27cd754745871116e79caf90468dd4 and market creator quickstart = 2\n", + "{'trader_address': '0x480e5b5abd27cd754745871116e79caf90468dd4', 'net_earnings': -0.36794781695584966, 'earnings': 1.9646689200064404, 'bet_amount': 2.2476634676100886, 'nr_mech_calls': 4, 'roi': -0.1580760372261362}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x480e5b5abd27cd754745871116e79caf90468dd4 -0.367948 1.964669 \n", + "1 0x480e5b5abd27cd754745871116e79caf90468dd4 -0.367948 1.964669 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 2.247663 4 -0.158076 Jul-21 all \n", + "1 2.247663 4 -0.158076 Jul-21 quickstart \n", + "Volume of data for trader 0x3c01b79bad670a37c8784bdf47b973b341064f10 and market creator all = 4\n", + "{'trader_address': '0x3c01b79bad670a37c8784bdf47b973b341064f10', 'net_earnings': 0.5130050997258764, 'earnings': 5.0788528986176456, 'bet_amount': 4.3978899989135, 'nr_mech_calls': 8, 'roi': 0.11255319892497745}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x3c01b79bad670a37c8784bdf47b973b341064f10 and market creator quickstart = 4\n", + "{'trader_address': '0x3c01b79bad670a37c8784bdf47b973b341064f10', 'net_earnings': 0.5130050997258764, 'earnings': 5.0788528986176456, 'bet_amount': 4.3978899989135, 'nr_mech_calls': 8, 'roi': 0.11255319892497745}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x3c01b79bad670a37c8784bdf47b973b341064f10 0.513005 5.078853 \n", + "1 0x3c01b79bad670a37c8784bdf47b973b341064f10 0.513005 5.078853 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 4.39789 8 0.112553 Jul-21 all \n", + "1 4.39789 8 0.112553 Jul-21 quickstart \n", + "Volume of data for trader 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 and market creator all = 6\n", + "{'trader_address': '0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164', 'net_earnings': -0.7499826129605537, 'earnings': 5.962404072727221, 'bet_amount': 6.345477142831152, 'nr_mech_calls': 24, 'roi': -0.10987988052209152}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 and market creator quickstart = 6\n", + "{'trader_address': '0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164', 'net_earnings': -0.7499826129605537, 'earnings': 5.962404072727221, 'bet_amount': 6.345477142831152, 'nr_mech_calls': 24, 'roi': -0.10987988052209152}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 -0.749983 5.962404 \n", + "1 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 -0.749983 5.962404 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 6.345477 24 -0.10988 Jul-21 all \n", + "1 6.345477 24 -0.10988 Jul-21 quickstart \n", + "Volume of data for trader 0x8dd0f0f64e575a356545d9ed096122a1887e64bf and market creator all = 4\n", + "{'trader_address': '0x8dd0f0f64e575a356545d9ed096122a1887e64bf', 'net_earnings': -0.11720618783292708, 'earnings': 3.8719908166532613, 'bet_amount': 3.7639186318492035, 'nr_mech_calls': 15, 'roi': -0.028840682713077548}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x8dd0f0f64e575a356545d9ed096122a1887e64bf and market creator quickstart = 4\n", + "{'trader_address': '0x8dd0f0f64e575a356545d9ed096122a1887e64bf', 'net_earnings': -0.11720618783292708, 'earnings': 3.8719908166532613, 'bet_amount': 3.7639186318492035, 'nr_mech_calls': 15, 'roi': -0.028840682713077548}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x8dd0f0f64e575a356545d9ed096122a1887e64bf -0.117206 3.871991 \n", + "1 0x8dd0f0f64e575a356545d9ed096122a1887e64bf -0.117206 3.871991 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 3.763919 15 -0.028841 Jul-21 all \n", + "1 3.763919 15 -0.028841 Jul-21 quickstart \n", + "Volume of data for trader 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 and market creator all = 4\n", + "{'trader_address': '0xec97bdf61fcb901033a3b8fcbcde77a372927b61', 'net_earnings': -0.826361612049082, 'earnings': 1.876615508201772, 'bet_amount': 2.551938353187112, 'nr_mech_calls': 10, 'roi': -0.3002834751338252}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 and market creator quickstart = 4\n", + "{'trader_address': '0xec97bdf61fcb901033a3b8fcbcde77a372927b61', 'net_earnings': -0.826361612049082, 'earnings': 1.876615508201772, 'bet_amount': 2.551938353187112, 'nr_mech_calls': 10, 'roi': -0.3002834751338252}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 -0.826362 1.876616 \n", + "1 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 -0.826362 1.876616 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 2.551938 10 -0.300283 Jul-21 all \n", + "1 2.551938 10 -0.300283 Jul-21 quickstart \n", + "Volume of data for trader 0x74d2b585a46279b4fa9feeae001efc972726c709 and market creator all = 1\n", + "{'trader_address': '0x74d2b585a46279b4fa9feeae001efc972726c709', 'net_earnings': 0.3248132469295979, 'earnings': 1.5588132469295979, 'bet_amount': 1.2, 'nr_mech_calls': 1, 'roi': 0.266240366335736}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x74d2b585a46279b4fa9feeae001efc972726c709 and market creator quickstart = 1\n", + "{'trader_address': '0x74d2b585a46279b4fa9feeae001efc972726c709', 'net_earnings': 0.3248132469295979, 'earnings': 1.5588132469295979, 'bet_amount': 1.2, 'nr_mech_calls': 1, 'roi': 0.266240366335736}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x74d2b585a46279b4fa9feeae001efc972726c709 0.324813 1.558813 \n", + "1 0x74d2b585a46279b4fa9feeae001efc972726c709 0.324813 1.558813 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 1.2 1 0.26624 Jul-21 all \n", + "1 1.2 1 0.26624 Jul-21 quickstart \n", + "Volume of data for trader 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe and market creator all = 2\n", + "{'trader_address': '0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe', 'net_earnings': -0.06246427000467561, 'earnings': 0.46153572999532444, 'bet_amount': 0.2, 'nr_mech_calls': 32, 'roi': -0.07436222619604238}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe and market creator quickstart = 2\n", + "{'trader_address': '0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe', 'net_earnings': -0.06246427000467561, 'earnings': 0.46153572999532444, 'bet_amount': 0.2, 'nr_mech_calls': 32, 'roi': -0.07436222619604238}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe -0.062464 0.461536 \n", + "1 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe -0.062464 0.461536 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 0.2 32 -0.074362 Jul-21 all \n", + "1 0.2 32 -0.074362 Jul-21 quickstart \n", + "Volume of data for trader 0x324267d9c6190f9bbcc126d10047eb9f761df540 and market creator all = 1\n", + "{'trader_address': '0x324267d9c6190f9bbcc126d10047eb9f761df540', 'net_earnings': 0.08069455409216866, 'earnings': 0.4426945540921687, 'bet_amount': 0.1, 'nr_mech_calls': 26, 'roi': 0.13015250660027203}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x324267d9c6190f9bbcc126d10047eb9f761df540 and market creator quickstart = 1\n", + "{'trader_address': '0x324267d9c6190f9bbcc126d10047eb9f761df540', 'net_earnings': 0.08069455409216866, 'earnings': 0.4426945540921687, 'bet_amount': 0.1, 'nr_mech_calls': 26, 'roi': 0.13015250660027203}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x324267d9c6190f9bbcc126d10047eb9f761df540 0.080695 0.442695 \n", + "1 0x324267d9c6190f9bbcc126d10047eb9f761df540 0.080695 0.442695 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 0.1 26 0.130153 Jul-21 all \n", + "1 0.1 26 0.130153 Jul-21 quickstart \n", + "Volume of data for trader 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b and market creator all = 2\n", + "{'trader_address': '0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b', 'net_earnings': -0.42400000000000004, 'earnings': 0.0, 'bet_amount': 0.2, 'nr_mech_calls': 22, 'roi': -0.6625000000000001}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b and market creator quickstart = 2\n", + "{'trader_address': '0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b', 'net_earnings': -0.42400000000000004, 'earnings': 0.0, 'bet_amount': 0.2, 'nr_mech_calls': 22, 'roi': -0.6625000000000001}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b -0.424 0.0 \n", + "1 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b -0.424 0.0 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 0.2 22 -0.6625 Jul-21 all \n", + "1 0.2 22 -0.6625 Jul-21 quickstart \n", + "Volume of data for trader 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 and market creator all = 4\n", + "{'trader_address': '0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9', 'net_earnings': 1.0946011886656675, 'earnings': 5.0475474599643215, 'bet_amount': 3.7872022267633865, 'nr_mech_calls': 9, 'roi': 0.2759126271106906}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 and market creator quickstart = 4\n", + "{'trader_address': '0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9', 'net_earnings': 1.0946011886656675, 'earnings': 5.0475474599643215, 'bet_amount': 3.7872022267633865, 'nr_mech_calls': 9, 'roi': 0.2759126271106906}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 1.094601 5.047547 \n", + "1 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 1.094601 5.047547 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 3.787202 9 0.275913 Jul-21 all \n", + "1 3.787202 9 0.275913 Jul-21 quickstart \n", + "Volume of data for trader 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 and market creator all = 1\n", + "{'trader_address': '0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9', 'net_earnings': 0.8096491228070175, 'earnings': 1.8396491228070175, 'bet_amount': 1.0, 'nr_mech_calls': 1, 'roi': 0.7937736498108015}\n", + "Filtering only specific market creators = quickstart\n", + "No data. Skipping market creator quickstart\n", + "Filtering only specific market creators = pearl\n", + "Volume of data for trader 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 and market creator pearl = 1\n", + "{'trader_address': '0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9', 'net_earnings': 0.8096491228070175, 'earnings': 1.8396491228070175, 'bet_amount': 1.0, 'nr_mech_calls': 1, 'roi': 0.7937736498108015}\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 0.809649 1.839649 \n", + "1 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 0.809649 1.839649 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 1.0 1 0.793774 Jul-21 all \n", + "1 1.0 1 0.793774 Jul-21 pearl \n", + "Volume of data for trader 0x1b9e28e7f817e1312636a485f31cca8a4be61fac and market creator all = 1\n", + "{'trader_address': '0x1b9e28e7f817e1312636a485f31cca8a4be61fac', 'net_earnings': -1.03, 'earnings': 0.0, 'bet_amount': 1.0, 'nr_mech_calls': 1, 'roi': -1.0098039215686274}\n", + "Filtering only specific market creators = quickstart\n", + "No data. Skipping market creator quickstart\n", + "Filtering only specific market creators = pearl\n", + "Volume of data for trader 0x1b9e28e7f817e1312636a485f31cca8a4be61fac and market creator pearl = 1\n", + "{'trader_address': '0x1b9e28e7f817e1312636a485f31cca8a4be61fac', 'net_earnings': -1.03, 'earnings': 0.0, 'bet_amount': 1.0, 'nr_mech_calls': 1, 'roi': -1.0098039215686274}\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x1b9e28e7f817e1312636a485f31cca8a4be61fac -1.03 0.0 \n", + "1 0x1b9e28e7f817e1312636a485f31cca8a4be61fac -1.03 0.0 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 1.0 1 -1.009804 Jul-21 all \n", + "1 1.0 1 -1.009804 Jul-21 pearl \n", + "Volume of data for trader 0xe0113a139f591efa8bf5e19308c7c27199682d77 and market creator all = 2\n", + "{'trader_address': '0xe0113a139f591efa8bf5e19308c7c27199682d77', 'net_earnings': -2.08, 'earnings': 0.0, 'bet_amount': 2.0, 'nr_mech_calls': 4, 'roi': -1.0}\n", + "Filtering only specific market creators = quickstart\n", + "No data. Skipping market creator quickstart\n", + "Filtering only specific market creators = pearl\n", + "Volume of data for trader 0xe0113a139f591efa8bf5e19308c7c27199682d77 and market creator pearl = 2\n", + "{'trader_address': '0xe0113a139f591efa8bf5e19308c7c27199682d77', 'net_earnings': -2.08, 'earnings': 0.0, 'bet_amount': 2.0, 'nr_mech_calls': 4, 'roi': -1.0}\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0xe0113a139f591efa8bf5e19308c7c27199682d77 -2.08 0.0 \n", + "1 0xe0113a139f591efa8bf5e19308c7c27199682d77 -2.08 0.0 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 2.0 4 -1.0 Jul-21 all \n", + "1 2.0 4 -1.0 Jul-21 pearl \n", + "Volume of data for trader 0x9694c0fdb79a37d048ea19deb15e051482a690c4 and market creator all = 2\n", + "{'trader_address': '0x9694c0fdb79a37d048ea19deb15e051482a690c4', 'net_earnings': -0.34400000000000003, 'earnings': 0.0, 'bet_amount': 0.2, 'nr_mech_calls': 14, 'roi': -0.7166666666666667}\n", + "Filtering only specific market creators = quickstart\n", + "Volume of data for trader 0x9694c0fdb79a37d048ea19deb15e051482a690c4 and market creator quickstart = 2\n", + "{'trader_address': '0x9694c0fdb79a37d048ea19deb15e051482a690c4', 'net_earnings': -0.34400000000000003, 'earnings': 0.0, 'bet_amount': 0.2, 'nr_mech_calls': 14, 'roi': -0.7166666666666667}\n", + "Filtering only specific market creators = pearl\n", + "No data. Skipping market creator pearl\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x9694c0fdb79a37d048ea19deb15e051482a690c4 -0.344 0.0 \n", + "1 0x9694c0fdb79a37d048ea19deb15e051482a690c4 -0.344 0.0 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 0.2 14 -0.716667 Jul-21 all \n", + "1 0.2 14 -0.716667 Jul-21 quickstart \n", + "Volume of data for trader 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 and market creator all = 1\n", + "{'trader_address': '0x66a022b113b41e08d90cfd9468b8b6565d6ea995', 'net_earnings': 3.6733333333333356, 'earnings': 13.883333333333335, 'bet_amount': 10.0, 'nr_mech_calls': 1, 'roi': 0.3666001330671992}\n", + "Filtering only specific market creators = quickstart\n", + "No data. Skipping market creator quickstart\n", + "Filtering only specific market creators = pearl\n", + "Volume of data for trader 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 and market creator pearl = 1\n", + "{'trader_address': '0x66a022b113b41e08d90cfd9468b8b6565d6ea995', 'net_earnings': 3.6733333333333356, 'earnings': 13.883333333333335, 'bet_amount': 10.0, 'nr_mech_calls': 1, 'roi': 0.3666001330671992}\n", + "Total length of all trader metrics for this week = 2\n", + " trader_address net_earnings earnings \\\n", + "0 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 3.673333 13.883333 \n", + "1 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 3.673333 13.883333 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 10.0 1 0.3666 Jul-21 all \n", + "1 10.0 1 0.3666 Jul-21 pearl \n", + "End computing all weekly metrics by market creator\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trader_addressnet_earningsearningsbet_amountnr_mech_callsroimonth_year_weekmarket_creator
00x95ecc70d9f4feb162ed9f41c4432d990c36c8f57-0.7234111.7851352.3809278-0.284704Jul-21all
10x95ecc70d9f4feb162ed9f41c4432d990c36c8f57-0.7234111.7851352.3809278-0.284704Jul-21quickstart
20xf089874165be0377680683fd5187a058dea826830.7996491.8396491.00000020.768893Jul-21all
30xf089874165be0377680683fd5187a058dea826830.7996491.8396491.00000020.768893Jul-21quickstart
40x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2-1.0071653.3502644.15434212-0.229196Jul-21all
50x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2-1.0071653.3502644.15434212-0.229196Jul-21quickstart
60xe283e408c6017447da9fe092d52c386753699680-1.0400000.0000001.0000002-1.000000Jul-21all
70xe283e408c6017447da9fe092d52c386753699680-1.0400000.0000001.0000002-1.000000Jul-21pearl
80x480e5b5abd27cd754745871116e79caf90468dd4-0.3679481.9646692.2476634-0.158076Jul-21all
90x480e5b5abd27cd754745871116e79caf90468dd4-0.3679481.9646692.2476634-0.158076Jul-21quickstart
100x3c01b79bad670a37c8784bdf47b973b341064f100.5130055.0788534.39789080.112553Jul-21all
110x3c01b79bad670a37c8784bdf47b973b341064f100.5130055.0788534.39789080.112553Jul-21quickstart
120x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164-0.7499835.9624046.34547724-0.109880Jul-21all
130x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164-0.7499835.9624046.34547724-0.109880Jul-21quickstart
140x8dd0f0f64e575a356545d9ed096122a1887e64bf-0.1172063.8719913.76391915-0.028841Jul-21all
150x8dd0f0f64e575a356545d9ed096122a1887e64bf-0.1172063.8719913.76391915-0.028841Jul-21quickstart
160xec97bdf61fcb901033a3b8fcbcde77a372927b61-0.8263621.8766162.55193810-0.300283Jul-21all
170xec97bdf61fcb901033a3b8fcbcde77a372927b61-0.8263621.8766162.55193810-0.300283Jul-21quickstart
180x74d2b585a46279b4fa9feeae001efc972726c7090.3248131.5588131.20000010.266240Jul-21all
190x74d2b585a46279b4fa9feeae001efc972726c7090.3248131.5588131.20000010.266240Jul-21quickstart
200x22335c348afa4eae4cc6d2158c1ac259aaaecdfe-0.0624640.4615360.20000032-0.074362Jul-21all
210x22335c348afa4eae4cc6d2158c1ac259aaaecdfe-0.0624640.4615360.20000032-0.074362Jul-21quickstart
220x324267d9c6190f9bbcc126d10047eb9f761df5400.0806950.4426950.100000260.130153Jul-21all
230x324267d9c6190f9bbcc126d10047eb9f761df5400.0806950.4426950.100000260.130153Jul-21quickstart
240x6f99ccc54f239a9c0e7fe501e99c16b89785b96b-0.4240000.0000000.20000022-0.662500Jul-21all
250x6f99ccc54f239a9c0e7fe501e99c16b89785b96b-0.4240000.0000000.20000022-0.662500Jul-21quickstart
260x593c4ca4c85f24145de87e2591b7ec5d2e01d5e91.0946015.0475473.78720290.275913Jul-21all
270x593c4ca4c85f24145de87e2591b7ec5d2e01d5e91.0946015.0475473.78720290.275913Jul-21quickstart
280x913dedfcfb335a49509b67acb3b1ab2612a5c0c90.8096491.8396491.00000010.793774Jul-21all
290x913dedfcfb335a49509b67acb3b1ab2612a5c0c90.8096491.8396491.00000010.793774Jul-21pearl
300x1b9e28e7f817e1312636a485f31cca8a4be61fac-1.0300000.0000001.0000001-1.009804Jul-21all
310x1b9e28e7f817e1312636a485f31cca8a4be61fac-1.0300000.0000001.0000001-1.009804Jul-21pearl
320xe0113a139f591efa8bf5e19308c7c27199682d77-2.0800000.0000002.0000004-1.000000Jul-21all
330xe0113a139f591efa8bf5e19308c7c27199682d77-2.0800000.0000002.0000004-1.000000Jul-21pearl
340x9694c0fdb79a37d048ea19deb15e051482a690c4-0.3440000.0000000.20000014-0.716667Jul-21all
350x9694c0fdb79a37d048ea19deb15e051482a690c4-0.3440000.0000000.20000014-0.716667Jul-21quickstart
360x66a022b113b41e08d90cfd9468b8b6565d6ea9953.67333313.88333310.00000010.366600Jul-21all
370x66a022b113b41e08d90cfd9468b8b6565d6ea9953.67333313.88333310.00000010.366600Jul-21pearl
\n", + "
" + ], + "text/plain": [ + " trader_address net_earnings earnings \\\n", + "0 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 -0.723411 1.785135 \n", + "1 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57 -0.723411 1.785135 \n", + "2 0xf089874165be0377680683fd5187a058dea82683 0.799649 1.839649 \n", + "3 0xf089874165be0377680683fd5187a058dea82683 0.799649 1.839649 \n", + "4 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 -1.007165 3.350264 \n", + "5 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2 -1.007165 3.350264 \n", + "6 0xe283e408c6017447da9fe092d52c386753699680 -1.040000 0.000000 \n", + "7 0xe283e408c6017447da9fe092d52c386753699680 -1.040000 0.000000 \n", + "8 0x480e5b5abd27cd754745871116e79caf90468dd4 -0.367948 1.964669 \n", + "9 0x480e5b5abd27cd754745871116e79caf90468dd4 -0.367948 1.964669 \n", + "10 0x3c01b79bad670a37c8784bdf47b973b341064f10 0.513005 5.078853 \n", + "11 0x3c01b79bad670a37c8784bdf47b973b341064f10 0.513005 5.078853 \n", + "12 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 -0.749983 5.962404 \n", + "13 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164 -0.749983 5.962404 \n", + "14 0x8dd0f0f64e575a356545d9ed096122a1887e64bf -0.117206 3.871991 \n", + "15 0x8dd0f0f64e575a356545d9ed096122a1887e64bf -0.117206 3.871991 \n", + "16 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 -0.826362 1.876616 \n", + "17 0xec97bdf61fcb901033a3b8fcbcde77a372927b61 -0.826362 1.876616 \n", + "18 0x74d2b585a46279b4fa9feeae001efc972726c709 0.324813 1.558813 \n", + "19 0x74d2b585a46279b4fa9feeae001efc972726c709 0.324813 1.558813 \n", + "20 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe -0.062464 0.461536 \n", + "21 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe -0.062464 0.461536 \n", + "22 0x324267d9c6190f9bbcc126d10047eb9f761df540 0.080695 0.442695 \n", + "23 0x324267d9c6190f9bbcc126d10047eb9f761df540 0.080695 0.442695 \n", + "24 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b -0.424000 0.000000 \n", + "25 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b -0.424000 0.000000 \n", + "26 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 1.094601 5.047547 \n", + "27 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9 1.094601 5.047547 \n", + "28 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 0.809649 1.839649 \n", + "29 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9 0.809649 1.839649 \n", + "30 0x1b9e28e7f817e1312636a485f31cca8a4be61fac -1.030000 0.000000 \n", + "31 0x1b9e28e7f817e1312636a485f31cca8a4be61fac -1.030000 0.000000 \n", + "32 0xe0113a139f591efa8bf5e19308c7c27199682d77 -2.080000 0.000000 \n", + "33 0xe0113a139f591efa8bf5e19308c7c27199682d77 -2.080000 0.000000 \n", + "34 0x9694c0fdb79a37d048ea19deb15e051482a690c4 -0.344000 0.000000 \n", + "35 0x9694c0fdb79a37d048ea19deb15e051482a690c4 -0.344000 0.000000 \n", + "36 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 3.673333 13.883333 \n", + "37 0x66a022b113b41e08d90cfd9468b8b6565d6ea995 3.673333 13.883333 \n", + "\n", + " bet_amount nr_mech_calls roi month_year_week market_creator \n", + "0 2.380927 8 -0.284704 Jul-21 all \n", + "1 2.380927 8 -0.284704 Jul-21 quickstart \n", + "2 1.000000 2 0.768893 Jul-21 all \n", + "3 1.000000 2 0.768893 Jul-21 quickstart \n", + "4 4.154342 12 -0.229196 Jul-21 all \n", + "5 4.154342 12 -0.229196 Jul-21 quickstart \n", + "6 1.000000 2 -1.000000 Jul-21 all \n", + "7 1.000000 2 -1.000000 Jul-21 pearl \n", + "8 2.247663 4 -0.158076 Jul-21 all \n", + "9 2.247663 4 -0.158076 Jul-21 quickstart \n", + "10 4.397890 8 0.112553 Jul-21 all \n", + "11 4.397890 8 0.112553 Jul-21 quickstart \n", + "12 6.345477 24 -0.109880 Jul-21 all \n", + "13 6.345477 24 -0.109880 Jul-21 quickstart \n", + "14 3.763919 15 -0.028841 Jul-21 all \n", + "15 3.763919 15 -0.028841 Jul-21 quickstart \n", + "16 2.551938 10 -0.300283 Jul-21 all \n", + "17 2.551938 10 -0.300283 Jul-21 quickstart \n", + "18 1.200000 1 0.266240 Jul-21 all \n", + "19 1.200000 1 0.266240 Jul-21 quickstart \n", + "20 0.200000 32 -0.074362 Jul-21 all \n", + "21 0.200000 32 -0.074362 Jul-21 quickstart \n", + "22 0.100000 26 0.130153 Jul-21 all \n", + "23 0.100000 26 0.130153 Jul-21 quickstart \n", + "24 0.200000 22 -0.662500 Jul-21 all \n", + "25 0.200000 22 -0.662500 Jul-21 quickstart \n", + "26 3.787202 9 0.275913 Jul-21 all \n", + "27 3.787202 9 0.275913 Jul-21 quickstart \n", + "28 1.000000 1 0.793774 Jul-21 all \n", + "29 1.000000 1 0.793774 Jul-21 pearl \n", + "30 1.000000 1 -1.009804 Jul-21 all \n", + "31 1.000000 1 -1.009804 Jul-21 pearl \n", + "32 2.000000 4 -1.000000 Jul-21 all \n", + "33 2.000000 4 -1.000000 Jul-21 pearl \n", + "34 0.200000 14 -0.716667 Jul-21 all \n", + "35 0.200000 14 -0.716667 Jul-21 quickstart \n", + "36 10.000000 1 0.366600 Jul-21 all \n", + "37 10.000000 1 0.366600 Jul-21 pearl " + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "compute_weekly_metrics_by_market_creator(trader_agent_metrics)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "hf_dashboards", + "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.12.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}