getQuoteReturn; } } else if ($_POST['BUY'] || $_POST['SELL']) { /*This is a buy or sell request*/ $quantity = $_POST['QUANTITY']; $userID = GetUserFromCookie(); $isBuy = FALSE; $isSell = FALSE; if ($_POST['BUY']) { $mode = 0; $isBuy = TRUE; $symbol = $_POST['SYMBOL']; $response = Buy($userID, $symbol, $quantity, $mode); if ($response->buyReturn->orderID) { $buyReturn = $response->buyReturn; $isReply = TRUE; } else { $response = NULL; } } else if($_POST['SELL']) { $isSell = TRUE; $holdingID = $_POST['HOLDINGID']; $response = SellEnhanced($userID, $holdingID, $quantity); if ($response->sellEnhancedReturn->orderID) { $sellEnhancedReturn = $response->sellEnhancedReturn; $isReply = TRUE; } else { $response = NULL; } } } else { /*If not above, the user has just wanted to visit the quote page*/ $quotesInitialPage = TRUE; } ?> WSF/PHP StockTrader Welcome
Trade Alert: The following orders have completed.

"); print(""); $index = 0; while ($getClosedOrdersReturn->OrderDataBean[$index]) { $openDate = new DateTime($getClosedOrdersReturn->OrderDataBean[$index]->openDate); $completionDate = new DateTime($getClosedOrdersReturn->OrderDataBean[$index]->completionDate); print (""); $index ++; } print("
Order IDOrder StatusCreation DateCompletion Date Txn FeeTypeSymbolQuantity
".$getClosedOrdersReturn->OrderDataBean[$index]->orderID." ".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus." ".$openDate->format("m/d/Y h:i:s A")." ".$completionDate->format("m/d/Y h:i:s A")." $".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee." ".$getClosedOrdersReturn->OrderDataBean[$index]->orderType." ".$getClosedOrdersReturn->OrderDataBean[$index]->symbol." ".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."


"); } if ($isReply == TRUE) { /*Check whether the user has requested to buy or sell some quote.*/ print ("

New Order

"); print ("

Order ".$buyReturn->orderID." to ".(($buyReturn->quantity) ? "buy ".($buyReturn->quantity): "sell ".($sellReturn->quantity))." shares of s:0 has been submitted for processing.

"); print ("

Order Details:

"); print (""); if ($isBuy == TRUE) { $dateTime = new DateTime($buyReturn->openDate); print (""); } else if ($isSell == TRUE) { $dateTime = new DateTime($sellEnhancedReturn->openDate); print (""); } print ("
Order IDOrder StatusCreation Date Completion DateTxn FeeTypeSymbol Quantity
".$buyReturn->orderID."".$buyReturn->orderStatus. "".$dateTime->format("m/d/Y h:i:s A")."Pending". "$".$buyReturn->orderFee."".$buyReturn->orderType. "".$buyReturn->symbol."".$buyReturn->quantity."
".$sellEnhancedReturn->orderID."".$sellEnhancedReturn->orderStatus. "".$dateTime->format("m/d/Y h:i:s A")."Pending". "$".$sellEnhancedReturn->orderFee."".$sellEnhancedReturn->orderType. "".$sellEnhancedReturn->symbol."".$sellEnhancedReturn->quantity."
"); } else if ($_POST['GETQUOTE']) { print("

Stock Quotes

"); print(""); print("
"); print(""); if ($quotesReturn->symbol) { print (""); } print("
SymbolCompanyVolumePrice Range Open PriceCurrent PriceGain(Loss)Trade
".$quotesReturn->symbol."".$quotesReturn->companyName. "".$quotesReturn->volume."$".$quotesReturn->low."-$". $quotesReturn->high."$".$quotesReturn->open." $".$quotesReturn->price.""); if ($quotesReturn->change > 0) { print ("$".$quotesReturn->change.""); } else if ($quotesReturn->change < 0) { print ("$".$quotesReturn->change.""); } else { print ("$".$quotesReturn->change.""); } print("
volume."\"> symbol."\"> price."\">
"); } else if($quotesInitialPage == TRUE) { print("

Stock Quotes

"); print(""); print("
"); print(""); $symbolCount = 0; while($symbolCount < 5) { $quotes = GetQuote("s:".$symbolCount); if ($quotes) { $quotesReturn = $quotes->getQuoteReturn; if ($quotesReturn->symbol) { print (""); } } $symbolCount ++; } print("
SymbolCompanyVolumePrice Range Open PriceCurrent PriceGain(Loss)Trade
".$quotesReturn->symbol."".$quotesReturn->companyName. "".$quotesReturn->volume."$".$quotesReturn->low."-$". $quotesReturn->high."$".$quotesReturn->open." $".$quotesReturn->price.""); if ($quotesReturn->change > 0) { print ("$".$quotesReturn->change.""); } else if ($quotesReturn->change < 0) { print ("$".$quotesReturn->change.""); } else { print ("$".$quotesReturn->change.""); } print("
volume."\"> symbol."\"> price."\">
"); } else { print("

Stock Quotes

"); print(""); print("
"); } ?>