User Tools

Site Tools


trade_formula

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
trade_formula [2017/03/16 11:06] – admintrade_formula [2026/03/21 10:12] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Trade Formula ====== ====== Trade Formula ======
-  
-Trade Formula – a formula used by script to calculate priority of each trade. Higher priority means more hits to this trader. Simplified view is presented by classic formula 
  
-  TOTAL_OWED*0.3 +  +**Trade Formula** – This formula calculates each trader's priority. Higher priority means more traffic. Traders are ranked using these parameters: 
-  HOUR_OWED*0.3 + +  TOTAL_OWED total debt 
-  HOUR_HITS*0 + +  HOUR_OWED hourly debt 
 +  HOUR_HITS number of hits per hour 
 +  HOUR_PROD hourly productivity 
 +  TOTAL_HITS total number of hits 
 +  TOTAL_PROD total productivity 
 +  TOTAL_OUT2CLICK total ratio of outs to clicks 
 +  HOUR_OUT2CLICK – hourly ratio of outs to clicks 
 +  TOTAL_RELOWN total debt relative to trade value, i.e. if we owe 10 for a 10k trade that's not as bad as owing 10 for a 50 hit trade. 
 +  HOUR_RELOWN hourly relative debt 
 + 
 +When calculating priority each of these parameters is taken into account to a certain degree, some parameters are more important to us, some are less important. The formula shows which parameter the script should weight more heavily. If you don't understand something in this formula, it's better not to change anything. 
 + 
 + 
 +Classical 
 + 
 +  TOTAL_OWED*0.2 + 
 +  HOUR_OWED*0.2 + 
 +  HOUR_HITS*0 +
   HOUR_TRADE_PROD*0+   HOUR_TRADE_PROD*0+
-  HOUR_PROD*0 +  +  HOUR_PROD*0 + 
-  TOTAL_HITS*0 +  +  TOTAL_HITS*0 + 
-  TOTAL_TRADE_PROD*0++  TOTAL_TRADE_PROD*0.2+
   TOTAL_PROD*0 +   TOTAL_PROD*0 +
-  TOTAL_OUT2CLICK*0 +  +  TOTAL_OUT2CLICK*0 + 
-  HOUR_OUT2CLICK*0 +  +  HOUR_OUT2CLICK*0 + 
-  TOTAL_RELOWN*0.6 +  +  TOTAL_RELOWN*0.4 + 
-  HOUR_RELOWN*0  +  HOUR_RELOWN*0
  
  
-0.3, 0.6 and so are weight parameters that define impotance of each number. In this example HOUR_OWED (hourly owed) 2 times less important then TOTAL_RELOWN (total relative own).+The order of numbers doesn't matter, you can safely multiply by 100, 1000 or 100000 - the result will be the same, what matters is the ratio between the parameter weights. 0.2 and so on is only made for convenience of perception - i.e. the sum of all weights = 1. If we change some parameter from 0.1 to 0.2 - this means we increase its weight by 10%.
  
  
-Here is some formulas offered by our users: 
  
-  1; $_POST[priority] = @round( ($d['day']['ctd']+$d['day']['cud'])/$d['day']['od']* $d['trat'] / 100); 
  
 +The awm_mark formula
  
-  1; $_POST[priority] = @round( ($d['day']['rd'] * $d['trat']) / ($d['day']['od']+1) * 100)+<code> 
 +TOTAL_OWED*0 + 
 +HOUR_OWED*0 + 
 +HOUR_HITS*1 + 
 +HOUR_TRADE_PROD*0 + 
 +HOUR_PROD*1 + 
 +TOTAL_HITS*9 + 
 +TOTAL_TRADE_PROD*3 + 
 +TOTAL_PROD*1 + 
 +TOTAL_OUT2CLICK*0 + 
 +HOUR_OUT2CLICK*0 + 
 +TOTAL_RELOWN*5 + 
 +HOUR_RELOWN*0 
 +</code>
  
  
-  1; $_POST[priority] = round ( (( ( ($d['day']['thishourct']+$d['day']['thishourcu'])/($d['day']['thishouro']+1)*100)/3) // 3 - hour weight 
-  +((($d['day']['ctd']+$d['day']['cud'])/($d['day']['od']+1)*100)/2)) // 2 - day weight 
-  *pow(round((($d['day']['last_click'])/($d['day']['od']+1))*100)/100,1) ); // 1 click again weight 
  
  
-  1; if ( ( ( ($d['day']['thishourct']+$d['day']['thishourcu']) / ($d['day']['thishouro']+1)*100)/3)       +===== Which formula is better ===== 
-  + (( ($d['day']['ctd']+$d['day']['cud']) / ($d['day']['od']+1)*100)/2)  > 900) {             + 
-     $_POST[priority] = (($d['day']['rd'] * 900)/($d['day']['od']+1));                 +If some concrete formula was better than all others and worked in all cases, and this was known for sure - why wouldn't they put it directly in the script? Why write in the wiki and make the formula open in the settings? 
-  } else { + 
-     $_POST[priority] = round ( (((($d['day']['thishourct']+$d['day']['thishourcu'])/($d['day']['thishouro']+1)*100)/3) + 
-     +((($d['day']['ctd']+$d['day']['cud'])/($d['day']['od']+1)*100)/2)) );        +===== Formula Limits ===== 
-  }+ 
 +Since the formula itself assumes some calculations, there are 2 options for their calculation. 
 + 
 +1. When the script parses the formula and tries to figure out + - and so on by itself. 
 + 
 +2. When the script does eval - this is when your code is executed directly by PHP. 
 + 
 +Option 1 is used by default because it's safer. However it can't do complex calculations, only +- */ 
 + 
 +Option 2 can do everything PHP can do, however it's less secure. 
 +The thing is that cron runs as a user, so in option 2 all code that you can enter in the admin will be executed as that user. 
 + 
 +So in option 2 if someone gets into the admin or can write to the database on your server - they can effectively execute anything on the server as that user. 
 + 
 +To enable this option you need to add to config.php 
 + 
 +$config['allow_eval'] = true; 
 + 
 +and then you can use any PHP code in the formula. 
 + 
 + 
 + 
 +By default in the trade formula you can only use 
 + 
 +$config['allow_eval'] = true; 
 + 
 + 
 +With this parameter you can use Formulas suggested by users 
 + 
 +<code> 
 + 
 +Fett 
 +http://smartcj.com/forum/viewtopic.php?f=2&t=93113&start=20 
 + 
 +1; $_POST[priority] = @round( (((($d['day']['cd']/$d['day']['od'])*100)*0.7) + ((($d['day']['ud']/$d['day']['rd'])*100)*0.3)) + ( (((($d['day']['rd']-$d['day']['od'])/$d['day']['rd'])*100)*0.25) + ((($d['day']['rd']/$d['day']['od'])*100)*0.75) ) ); 
 + 
 + 
 +</code> 
 + 
 + 
 + 
 +Simple option 
 +<code> 
 +  $_POST[priority] = @round( ($d['day']['ctd']+$d['day']['cud'])/$d['day']['od']* $d['trat'] / 100); 
 +</code> 
 + 
 + 
 +User formulas 
 + 
 +<code> 
 +  $_POST[priority] = round ( (( ( ($d['day']['thishourct']+$d['day']['thishourcu'])/($d['day']['thishouro']+1)*100)/3) 
 +  +((($d['day']['ctd']+$d['day']['cud'])/($d['day']['od']+1)*100)/2)) 
 +  *pow(round((($d['day']['last_click'])/($d['day']['od']+1))*100)/100,1) ) 
 +</code> 
  
  
  
-Variables +Variables for custom formulas
  
 <code> <code>
Line 75: Line 153:
 [prod] => Array [prod] => Array
     (     (
-        [hour_trade] => prod to trade  +        [hour_trade] => prod to trade 
-        [hour_total] =>  +        [hour_total] => 
-        [day_trade] =>  +        [day_trade] => 
-        [day_total] =>  +        [day_total] => 
-        [hour_out2click] =>  +        [hour_out2click] => 
-        [day_out2click] => +        [day_out2click] =>
     )     )
  
trade_formula.1489662414.txt.gz · Last modified: by admin