Beispiel #1
0
update_stock_info($ticker);
$stock = get_stock($ticker);
$t = $_REQUEST['t'];
if ($t == "") {
    $t = 20;
}
$tid = $_REQUEST['tid'];
$sa = $_REQUEST['sa'];
$sb = $_REQUEST['sb'];
$sc = $_REQUEST['sc'];
$sd = $_REQUEST['sd'];
$se = $_REQUEST['se'];
$chart_url = urlencode('chart.php?t=' . $t . '&tid=' . $stock->getId() . '&sa=' . $sa . '&sb=' . $sb . '&sc=' . $sc . '&sd=' . $sd . '&se=' . $se);
if ($_REQUEST['do'] == 'processTrade') {
    $trade = new Trade();
    $message = $trade->buildFromPost();
    if ($message == "") {
        $trade->persist();
        $message = "Successfully added trade.";
        include 'html/green_messagebox.php';
    } else {
        include 'html/red_messagebox.php';
    }
}
if ($_REQUEST['do'] == 'closeTrade') {
    $trade_id = $_POST['trade_id'];
    $trade = new Trade($trade_id);
    $message = $trade->closeTrade();
    if ($message == "") {
        $trade->persist();
        $message = "Successfully closed trade.";