diff --git a/funding campaign demo.ipynb b/funding campaign demo.ipynb index dd50123..f7e5608 100644 --- a/funding campaign demo.ipynb +++ b/funding campaign demo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 8, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -23,37 +23,37 @@ "campaigns = {1:{'name': 'ABC field test',\n", " 'multiplier': 2.5,\n", " 'min_raise': 984.0, \n", - " 'max_raise': 1500.0, \n", + " 'max_raise': 1260.0, \n", " 'cutoff_date': init_date+timedelta(days=365*2/12.0),\n", " 'expected_time': timedelta(days=365*8/12.0)},\n", " 2:{'name': 'Giveth field test',\n", " 'multiplier': 2.0,\n", " 'min_raise': 726.0, \n", - " 'max_raise': 1500.0, \n", + " 'max_raise': 940.0, \n", " 'cutoff_date': init_date+timedelta(days=365*4/12),\n", " 'expected_time': timedelta(days=365*6/12.0)},\n", " 3:{'name': 'CV field test',\n", " 'multiplier': 1.5,\n", " 'min_raise': 1140.0, \n", - " 'max_raise': 2000.0, \n", + " 'max_raise': 1460.0, \n", " 'cutoff_date': init_date+timedelta(days=365*6/12),\n", " 'expected_time': timedelta(days=365*12/12)},\n", " 4:{'name': 'Analytics',\n", " 'multiplier': 1.25,\n", " 'min_raise': 780.0, \n", - " 'max_raise': 1500.0, \n", + " 'max_raise': 975.0, \n", " 'cutoff_date': init_date+timedelta(days=365*4/12.0),\n", " 'expected_time': timedelta(days=365*16/12.0)},\n", " 5:{'name': 'Mobile first',\n", " 'multiplier': 1.125,\n", " 'min_raise': 1610.0, \n", - " 'max_raise': 2500.0, \n", + " 'max_raise': 2010.0, \n", " 'cutoff_date': init_date+timedelta(days=365*8/12.0),\n", " 'expected_time': timedelta(days=365*24/12.0)},\n", " 6:{'name': 'Easy Deploy',\n", " 'multiplier': 1.0,\n", " 'min_raise': 1500.0, \n", - " 'max_raise': 3000.0, \n", + " 'max_raise': 1875.0, \n", " 'cutoff_date': init_date+timedelta(days=365*6/12.0),\n", " 'expected_time': timedelta(days=365*30/12.0)},\n", " \n", @@ -62,19 +62,41 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1875.0" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1500*1.25" + ] + }, + { + "cell_type": "code", + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "total_min = sum([campaigns[i]['min_raise'] for i in campaigns.keys()])\n", "total_max = sum([campaigns[i]['max_raise'] for i in campaigns.keys()])\n", "\n", - "total_first3_at_max = sum([campaigns[i]['max_raise'] for i in campaigns.keys()if i<4] )" + "total_first3_at_max = sum([campaigns[i]['max_raise'] for i in campaigns.keys()if i<4] )\n", + "total_first3_at_min = sum([campaigns[i]['min_raise'] for i in campaigns.keys()if i<4] )\n", + "total_first4_at_min = sum([campaigns[i]['min_raise'] for i in campaigns.keys()if i<5] )" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -91,14 +113,14 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "largest outcome: 12000.0\n" + "largest outcome: 8520.0\n" ] } ], @@ -115,7 +137,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "outcome at first 3 full amount: 5000.0\n" + "outcome at first 3 full amount: 3660.0\n" ] } ], @@ -123,6 +145,23 @@ "print(\"outcome at first 3 full amount: \"+str(total_first3_at_max))" ] }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "buffer for first 3 given first 3 full amount: 1.2842105263157895\n" + ] + } + ], + "source": [ + "print(\"buffer for first 3 given first 3 full amount: \"+str(total_first3_at_max/total_first3_at_min))" + ] + }, { "cell_type": "code", "execution_count": 25, @@ -132,7 +171,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "share of total budget covered by capping first 3: 0.7418397626112759\n" + "share of total budget covered by capping first 3: 0.543026706231454\n" ] } ], @@ -142,43 +181,120 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "share of 4 iteration budget covered by capping first 3: 1.0082644628099173\n" + ] + } + ], + "source": [ + "print(\"share of 4 iteration budget covered by capping first 3: \"+str(total_first3_at_max/total_first4_at_min))" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "multi_mins = [campaigns[i]['multiplier']*campaigns[i]['min_raise'] for i in campaigns.keys()]\n", + "multi_maxs = [campaigns[i]['multiplier']*campaigns[i]['max_raise'] for i in campaigns.keys()]" + ] + }, + { + "cell_type": "code", + "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{1: {'cutoff_date': datetime.datetime(2019, 9, 24, 7, 14, 2, 789927),\n", + "[2460.0, 1452.0, 1710.0, 975.0, 1811.25, 1500.0]" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "multi_mins" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hatch allocations after first 3 at min:4286.25\n", + "hatch allocations after first 6 at min:9908.25\n", + "hatch allocations after first 3 at max:5355.0\n", + "hatch allocations after first 6 at max:12575.0\n" + ] + } + ], + "source": [ + "#hatch allocations after first 3 at min\n", + "print(\"hatch allocations after first 3 at min:\"+str(sum(multi_mins[3:])) )\n", + "\n", + "#hatch allocations after all 6 at min\n", + "print(\"hatch allocations after first 6 at min:\"+str(sum(multi_mins)) )\n", + "\n", + "#hatch allocations after first 3 at max\n", + "print(\"hatch allocations after first 3 at max:\"+str(sum(multi_maxs[3:])) )\n", + "\n", + "#hatch allocations after all 6 at max\n", + "print(\"hatch allocations after first 6 at max:\"+str(sum(multi_maxs)) )" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{1: {'cutoff_date': datetime.datetime(2019, 9, 24, 7, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(243, 28800),\n", " 'max_raise': 1500.0,\n", " 'min_raise': 984.0,\n", " 'multiplier': 2.5,\n", " 'name': 'ABC field test'},\n", - " 2: {'cutoff_date': datetime.datetime(2019, 11, 24, 3, 14, 2, 789927),\n", + " 2: {'cutoff_date': datetime.datetime(2019, 11, 24, 3, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(182, 43200),\n", " 'max_raise': 1500.0,\n", " 'min_raise': 726.0,\n", " 'multiplier': 2.0,\n", " 'name': 'Giveth field test'},\n", - " 3: {'cutoff_date': datetime.datetime(2020, 1, 23, 23, 14, 2, 789927),\n", + " 3: {'cutoff_date': datetime.datetime(2020, 1, 23, 23, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(365),\n", " 'max_raise': 2000.0,\n", " 'min_raise': 1140.0,\n", " 'multiplier': 1.5,\n", " 'name': 'CV field test'},\n", - " 4: {'cutoff_date': datetime.datetime(2019, 11, 24, 3, 14, 2, 789927),\n", + " 4: {'cutoff_date': datetime.datetime(2019, 11, 24, 3, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(486, 57600),\n", " 'max_raise': 1500.0,\n", " 'min_raise': 780.0,\n", " 'multiplier': 1.25,\n", " 'name': 'Analytics'},\n", - " 5: {'cutoff_date': datetime.datetime(2020, 3, 24, 19, 14, 2, 789927),\n", + " 5: {'cutoff_date': datetime.datetime(2020, 3, 24, 19, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(730),\n", " 'max_raise': 2500.0,\n", " 'min_raise': 1610.0,\n", " 'multiplier': 1.125,\n", " 'name': 'Mobile first'},\n", - " 6: {'cutoff_date': datetime.datetime(2020, 1, 23, 23, 14, 2, 789927),\n", + " 6: {'cutoff_date': datetime.datetime(2020, 1, 23, 23, 21, 10, 221483),\n", " 'expected_time': datetime.timedelta(912, 43200),\n", " 'max_raise': 3000.0,\n", " 'min_raise': 1500.0,\n", @@ -186,7 +302,7 @@ " 'name': 'Easy Deploy'}}" ] }, - "execution_count": 10, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -197,7 +313,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -208,7 +324,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -225,7 +341,7 @@ " 6: {'raised': 0, 'status': 'not_started'}}}" ] }, - "execution_count": 5, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -236,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -260,20 +376,20 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 12, "metadata": {}, "outputs": [ { "ename": "IndentationError", - "evalue": "expected an indented block (, line 12)", + "evalue": "expected an indented block (, line 12)", "output_type": "error", "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m12\u001b[0m\n\u001b[0;31m elif week > campaigns[ct]['cutoff_date']:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m expected an indented block\n" + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m12\u001b[0m\n\u001b[0;31m elif week > campaigns[ct]['cutoff_date']:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m expected an indented block\n" ] } ], "source": [ - " \n", + "#to be written to match the logic in the image above \n", "def tranche_iter_logic(week, state):\n", " \n", " ct = state['active_tranche']\n", @@ -309,6 +425,7 @@ "metadata": {}, "outputs": [], "source": [ + "# generate a simulation so what happens!\n", "states = [state]\n", "for t in range(T):\n", " new_raise = gen_raise()\n",