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;
}
?>
Trade Alert: The following orders have completed.");
print("
Order ID | Order Status | Creation Date | Completion Date |
Txn Fee | Type | Symbol | Quantity |
");
$index = 0;
while ($getClosedOrdersReturn->OrderDataBean[$index])
{
print ("".$getClosedOrdersReturn->OrderDataBean[$index]->orderID." |
".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus." |
".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->openDate)." |
".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->completionDate)." |
$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee." |
".$getClosedOrdersReturn->OrderDataBean[$index]->orderType." |
".$getClosedOrdersReturn->OrderDataBean[$index]->symbol." |
".$getClosedOrdersReturn->OrderDataBean[$index]->quantity." |
");
$index ++;
}
print("
");
}
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 ("
Order ID | Order Status | Creation Date |
Completion Date | Txn Fee | Type | Symbol |
Quantity |
");
if ($isBuy == TRUE)
{
print ("".$buyReturn->orderID." | ".$buyReturn->orderStatus.
" | ".date("m/d/Y h:i:s A", $buyReturn->openDate)." | Pending".
" | $".$buyReturn->orderFee." | ".$buyReturn->orderType.
" | ".$buyReturn->symbol." | ".$buyReturn->quantity." |
");
}
else if ($isSell == TRUE)
{
print ("".$sellEnhancedReturn->orderID." | ".$sellEnhancedReturn->orderStatus.
" | ".date("m/d/Y h:i:s A", $sellEnhancedReturn->openDate)." | Pending".
" | $".$sellEnhancedReturn->orderFee." | ".$sellEnhancedReturn->orderType.
" | ".$sellEnhancedReturn->symbol." | ".$sellEnhancedReturn->quantity." |
");
}
print ("
");
}
else if ($_POST['GETQUOTE'])
{
print("
Stock Quotes
");
print("");
print("");
print("
Symbol | Company | Volume | Price Range |
Open Price | Current Price | Gain(Loss) | Trade |
");
if ($quotesReturn->symbol)
{
print ("".$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(" | |
");
}
print("
");
}
else if($quotesInitialPage == TRUE)
{
print("
Stock Quotes
");
print("");
print("");
print("
Symbol | Company | Volume | Price Range |
Open Price | Current Price | Gain(Loss) | Trade |
");
$symbolCount = 0;
while($symbolCount < 5)
{
$quotes = GetQuote("s:".$symbolCount);
if ($quotes)
{
$quotesReturn = $quotes->getQuoteReturn;
if ($quotesReturn->symbol)
{
print ("".$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(" | |
");
}
}
$symbolCount ++;
}
print("
");
}
else
{
print("
Stock Quotes
");
print("");
print("");
}
?>