github.com/pdaian/flashboys2@v0.0.0-20190718175736-b101c35361f0/webapp/templates/strategies.html (about)

     1  {% include 'header.html' %}
     2  
     3  <div id="content">
     4  
     5  <h3 style="text-align:center;"><b>Navigation:</b><a href="/">Market Insight</a> | <a href="/revenue">Bot Trades</a>  | <a href="/global"> Global Market Summary</a> | Bot Strategies</h3>
     6  <br>
     7  
     8  <h1> Individual Strategies </h1>
     9  
    10  {% for individual in pairwise_data['self_time'].keys()|sort %}
    11  {% if pairwise_data['self_time'][individual]|length > 50 %}
    12  <br><br><h3><a id="{{individual}}"></a> <a href="#{{individual}}">{{ individual }}</a> </h3>
    13  ({{pairwise_data['auctions'][individual]|length }} auctions participated / {{  pairwise_data['self_time'][individual]|length }} bids: {% for auction in pairwise_data['auctions'][individual]|sort %} <a href="/auction/{{auction}}">{{ auction }}</a> {% endfor %})
    14  <div style="width: 100%; overflow: hidden;">
    15    <div style="display:inline-block; width: 50%; margin-left: 0; margin-right: 0; margin: 0; float: left;"><div id="individual-price-percent-{{ individual }}"></div><!-- Plotly chart will be drawn inside this DIV --></div>
    16    <div id="individual-price-{{ individual }}" style="display: inline-block; width: 50%; margin-left: auto; margin-right: auto;"><!-- Plotly chart will be drawn inside this DIV --></div>
    17  </div>
    18    <div id="individual-time-{{ individual }}" style="width: 90%; margin-left: auto; margin-right: auto;"><!-- Plotly chart will be drawn inside this DIV --></div>
    19    <script>
    20  var time_deltas = {{ pairwise_data['self_time'][individual] }};
    21  var price_deltas = {{ pairwise_data['self_price'][individual] }};
    22  var price_percent_deltas = {{ pairwise_data['self_price_percent'][individual] }};
    23  
    24  var time_deltas_others = [{% for pair in pairwise_data['pairs'][individual] %} {{ pairwise_data['pairwise_time'][pair]|join(', ') }}, {% endfor %} ];
    25  var price_deltas_others = [{% for pair in pairwise_data['pairs'][individual] %} {{ pairwise_data['pairwise_price'][pair]|join(', ') }}, {% endfor %}] ;
    26  var price_percent_deltas_others = [{% for pair in pairwise_data['pairs'][individual] %} {{ pairwise_data['pairwise_price_percent'][pair]|join(', ') }}, {% endfor %}] ;
    27  
    28  var layout_time = {
    29    title: 'Individual Strategy - Observed Response Speed',
    30    xaxis: {
    31      title: 'Observed Time since Previous Bid (s)',
    32      titlefont: {
    33        family: 'Courier New, monospace',
    34        size: 18,
    35        color: '#7f7f7f'
    36      }
    37    },
    38    yaxis: {
    39      title: 'Observed Instances (Normed)',
    40      titlefont: {
    41        family: 'Courier New, monospace',
    42        size: 18,
    43        color: '#7f7f7f'
    44      }
    45    },
    46    barmode: "overlay"
    47  };  
    48  var layout_price = {
    49    title: 'Individual Strategy - Price Differences to Response (Positive Only)',
    50    xaxis: {
    51      title: 'Observed Price Increase Over Last Bid (wei)',
    52      titlefont: {
    53        family: 'Courier New, monospace',
    54        size: 18,
    55        color: '#7f7f7f'
    56      }
    57    },
    58    yaxis: {
    59      title: 'Observed Instances (Normed)',
    60      titlefont: {
    61        family: 'Courier New, monospace',
    62        size: 18,
    63        color: '#7f7f7f'
    64      }
    65    },
    66    barmode: "overlay"
    67  };
    68  var layout_pp = {
    69    title: 'Individual Strategy - Price Percentage Differences to Response (Positive Only)',
    70    xaxis: {
    71      title: 'Observed Percentage Difference to Last Bid',
    72      titlefont: {
    73        family: 'Courier New, monospace',
    74        size: 18,
    75        color: '#7f7f7f'
    76      }
    77    },
    78    yaxis: {
    79      title: 'Observed Instances (Normed)',
    80      titlefont: {
    81        family: 'Courier New, monospace',
    82        size: 18,
    83        color: '#7f7f7f'
    84      }
    85    },
    86    barmode: "overlay"
    87  };
    88  
    89  
    90  var trace_pp = {
    91      x:price_percent_deltas,
    92      type: 'histogram', histnorm: 'probability',
    93      opacity: 0.5,
    94      name: 'Against Self',
    95    xbins: { 
    96      end: 1000, 
    97      size: 1.0, 
    98      start: 0
    99    },
   100    };
   101  var trace_pp_o = {
   102      name: 'Against Others',
   103      x:price_percent_deltas_others,
   104      type: 'histogram', histnorm: 'probability',
   105      opacity: 0.5,
   106    marker: {
   107       color: 'orange',
   108    },
   109    xbins: { 
   110      end: 1000, 
   111      size: 1.0, 
   112      start: 0
   113    },
   114    };
   115  var trace_p = {
   116      name: 'Against Self',
   117      x:price_deltas,
   118      opacity: 0.5,
   119      type: 'histogram', histnorm: 'probability',
   120    xbins: { 
   121      end: 1000000000000.0, 
   122      size: 5.0, 
   123      start: 0.0
   124    },
   125    };
   126  var trace_p_o = {
   127      name: 'Against Others',
   128      x:price_deltas_others,
   129      opacity: 0.5,
   130    marker: {
   131       color: 'orange',
   132    },
   133      type: 'histogram', histnorm: 'probability',
   134    xbins: { 
   135      end: 1000000000000.0, 
   136      size: 5.0, 
   137      start: 0.0
   138    },
   139    };
   140  var trace_t = {
   141      name: 'Against Self',
   142      x:time_deltas,
   143      type: 'histogram', histnorm: 'probability',
   144      opacity: 0.5,
   145    xbins: { 
   146      end: 30.0, 
   147      size: 0.05, 
   148      start: 0.0
   149    },
   150    };
   151  var trace_t_o = {
   152      name: 'Against Others',
   153      x:time_deltas_others,
   154      type: 'histogram', histnorm: 'probability',
   155      opacity: 0.5,
   156    marker: {
   157       color: 'orange',
   158    },
   159    xbins: { 
   160      end: 30.0, 
   161      size: 0.05, 
   162      start: 0.0
   163    },
   164    };
   165  Plotly.newPlot('individual-price-percent-{{ individual }}', [trace_pp, trace_pp_o], layout_pp);
   166  Plotly.newPlot('individual-price-{{ individual }}', [trace_p, trace_p_o], layout_price);
   167  Plotly.newPlot('individual-time-{{ individual }}', [trace_t, trace_t_o], layout_time);
   168  </script>
   169  {% endif %}
   170  {% endfor %}
   171  
   172  <h1> Pairwise Strategies </h1>
   173  
   174  {% for pair in pairwise_data['pairwise_time'].keys()|sort %}
   175  {% if pairwise_data['pairwise_time'][pair]|length > 50 %}
   176  <h3> {{ pair }} </h3>
   177  <div style="width: 100%; overflow: hidden;">
   178    <div style="display:inline-block; width: 50%; margin-left: 0; margin-right: 0; margin: 0; float: left;"><div id="pairwise-price-percent-{{ pair }}"></div><!-- Plotly chart will be drawn inside this DIV --></div>
   179    <div id="pairwise-price-{{ pair }}" style="display: inline-block; width: 50%; margin-left: auto; margin-right: auto;"><!-- Plotly chart will be drawn inside this DIV --></div>
   180  </div>
   181    <div id="pairwise-time-{{ pair }}" style="width: 90%; margin-left: auto; margin-right: auto;"><!-- Plotly chart will be drawn inside this DIV --></div>
   182    <script>
   183  var time_deltas = {{ pairwise_data['pairwise_time'][pair] }};
   184  var price_deltas = {{ pairwise_data['pairwise_price'][pair] }};
   185  var price_percent_deltas = {{ pairwise_data['pairwise_price_percent'][pair] }};
   186  var layout_time = {
   187    title: 'Pairwise Strategy - Observed Response Speed',
   188    xaxis: {
   189      title: 'Observed Time since Previous Bid (s)',
   190      titlefont: {
   191        family: 'Courier New, monospace',
   192        size: 18,
   193        color: '#7f7f7f'
   194      }
   195    },
   196    yaxis: {
   197      title: 'Observed Instances',
   198      titlefont: {
   199        family: 'Courier New, monospace',
   200        size: 18,
   201        color: '#7f7f7f'
   202      }
   203    }
   204  };
   205  var layout_price = {
   206    title: 'Pairwise Strategy - Price Differences to Response (Positive Only)',
   207    xaxis: {
   208      title: 'Observed Price Increase Over Last Bid (wei)',
   209      titlefont: {
   210        family: 'Courier New, monospace',
   211        size: 18,
   212        color: '#7f7f7f'
   213      }
   214    },
   215    yaxis: {
   216      title: 'Observed Instances',
   217      titlefont: {
   218        family: 'Courier New, monospace',
   219        size: 18,
   220        color: '#7f7f7f'
   221      }
   222    }
   223  };
   224  var layout_pp = {
   225    title: 'Pairwise Strategy - Price Percentage Differences to Response (Positive Only)',
   226    xaxis: {
   227      title: 'Observed Percentage Difference to Last Bid',
   228      titlefont: {
   229        family: 'Courier New, monospace',
   230        size: 18,
   231        color: '#7f7f7f'
   232      }
   233    },
   234    yaxis: {
   235      title: 'Observed Instances',
   236      titlefont: {
   237        family: 'Courier New, monospace',
   238        size: 18,
   239        color: '#7f7f7f'
   240      }
   241    }
   242  };
   243  
   244  
   245  var trace_pp = {
   246      x:price_percent_deltas,
   247      type: 'histogram',
   248    xbins: { 
   249      end: 1000, 
   250      size: 1.0, 
   251      start: 0
   252    },
   253    };
   254  var trace_p = {
   255      x:price_deltas,
   256      type: 'histogram',
   257    xbins: { 
   258      size: 100000 
   259    },
   260    };
   261  var trace_t = {
   262      x:time_deltas,
   263      type: 'histogram',
   264    xbins: { 
   265      end: 10.0, 
   266      size: 0.05, 
   267      start: 0.0
   268    },
   269    };
   270  Plotly.newPlot('pairwise-price-percent-{{ pair }}', [trace_pp], layout_pp);
   271  Plotly.newPlot('pairwise-price-{{ pair }}', [trace_p], layout_price);
   272  Plotly.newPlot('pairwise-time-{{ pair }}', [trace_t], layout_time);
   273  </script>
   274  {% endif %}
   275  {% endfor %}
   276  
   277  </div>
   278  
   279  
   280  {% include 'footer.html' %}
   281