Advertisement
Guest User

Untitled

a guest
Jun 28th, 2011
1,475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. <?php
  2. ####
  3. #Author: Jos lieben
  4. #Site: http://www.lieben.nu
  5. #Copyright: use as you wish, but please leave this header intact
  6. ####
  7.  
  8. echo "<html><head>
  9. <link href=\"fx.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\">
  10. <link href=\"fx.css\" rel=\"stylesheet\" type=\"text/css\">
  11. </head><body><div id=\"wrapper\">";
  12.  
  13. if ($login_name=="") {
  14. echo "Enter your myfxbook account login and password:<br>
  15. <form name=\"login\" method=\"POST\" action=\"fxbook.php\">
  16. login: <input type=\"text\" name=\"login_name\"> password: <input type=\"password\" name=\"login_pw\">
  17. <input type=\"submit\" value=\"show fxbook\"></form><br>";
  18. }
  19. else {
  20.  
  21. $login_string = "$login_name&password=$login_pw";
  22. $url = "http://www.myfxbook.com/api/login.xml?email=$login_string";
  23.  
  24. $login = file_get_contents($url);
  25. $xml_sess = simplexml_load_string($login);
  26. $sess = $xml_sess->session;
  27.  
  28. $url="http://www.myfxbook.com/api/get-my-accounts.xml?session=$sess";
  29. $data = file_get_contents($url);
  30. $xml_data = simplexml_load_string($data);
  31.  
  32. $i =0;
  33. echo "<table class=\"dataTable\" cellpadding=\"3\"><tr><td width=\"50px\" align=\"left\"><b>Name</b></td><td width=\"50px
  34.  
  35. \"><b>Profit</b></td><td width=\"55px\"><b>Profit Abs</b></td><td width=\"50px\"><b>Balance</b></td><td width=\"50px
  36.  
  37. \"><b>Equity</b></td><td><b>DD</b></td><td width=\"55px\"><b>Age</b></td><td><b>Deposits</b></td><td width=\"55px
  38.  
  39. \"><b>Updated:</b></td><td></td></tr>";
  40. foreach ($xml_data->xpath('//account') as $niks) {
  41.  
  42. echo "<tr><td align=\"left\"><b>";
  43. echo $xml_data->accounts->account[$i]->name;
  44. echo "</b></td><td>";
  45. $profit = (double) $xml_data->accounts->account[$i]->profit;
  46. $deposits = (double) $xml_data->accounts->account[$i]->deposits;
  47. $withdrawals = (double) $xml_data->accounts->account[$i]->withdrawals;
  48. $net_deposits = $deposits-$withdrawals;
  49. $equity = (double) $xml_data->accounts->account[$i]->equity;
  50. $balance = (double) $xml_data->accounts->account[$i]->balance;
  51. $drawdown = (double) $xml_data->accounts->account[$i]->drawdown;
  52. $per = ($profit/$net_deposits)*100;
  53. $aper = (($equity-$net_deposits)/$net_deposits)*100;
  54. $nu = time();
  55. $start = strtotime($xml_data->accounts->account[$i]->creationDate);
  56. $looptijd = floor(($nu-$start)/(60*60*24));
  57. $update = strtotime($xml_data->accounts->account[$i]->lastUpdateDate);
  58. $updated = floor(($nu-$update)/60);
  59. if ($per > 0) {
  60. echo "<font color=\"green\">+";
  61. }else{
  62. echo "<font color=\"red\">-";
  63. }
  64. print round($per,2);
  65. echo "%</font></td><td>";
  66. if ($aper > $per) echo "<b>";
  67. if ($aper > 0) {
  68. $profit = 1;
  69. echo "<font color=\"green\">+";
  70. }else{
  71. $profit = 0;
  72. echo "<font color=\"red\">";
  73. }
  74. print round($aper,2);
  75. echo "%</font></td><td>";
  76. if ($aper > $per) echo "</b>";
  77. if($balance>$net_deposits){
  78. echo "<font color=\"green\">";
  79. }else{
  80. echo "<font color=\"red\">";
  81. }
  82. echo "€ ";
  83. echo round($balance,2);
  84. echo "</font></td><td>";
  85. if($equity>$net_deposits){
  86. echo "<font color=\"green\">";
  87. }else{
  88. echo "<font color=\"red\">";
  89. }
  90. echo "€ ";
  91. echo round($equity,2);
  92. echo "</font></td><td>";
  93. echo round($drawdown,2);
  94. echo "%</td>";
  95.  
  96. echo "<td>$looptijd days</td><td>€ $net_deposits</td><td>";
  97. if($updated > 30) echo "<font color=\"red\"><b>";
  98. echo "$updated Min";
  99. if($updated > 30) echo "</b></font>";
  100. echo "</td><td>";
  101. echo "<img src=\"http://mobile.myfxbook.com/system-spark.png?id=";
  102. echo $xml_data->accounts->account[$i]->id;
  103. echo "\"></td></tr>";
  104. $i++;
  105.  
  106. }
  107. echo "</table>";
  108.  
  109.  
  110. $url = "http://www.myfxbook.com/api/logout.xml?session=$sess";
  111. $logout = file_get_contents($url);
  112. $xml_logout = simplexml_load_string($logout);
  113. }
  114.  
  115. echo "</div></body></html>";
  116.  
  117.  
  118. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement