<% # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. %>
<% # Checking whether there is new status change happened in the # related to a particular order. if (@closedOrders != nil) %>

Trade Alert: The following orders have completed.

<% index = 0 if(@closedOrders["OrderDataBean"].class.to_s == "Array") while ((order = @closedOrders["OrderDataBean"][index]) != nil) openDate = convert_date(order["openDate"]) completionDate = convert_date(order["completionDate"]) %> <% index = index + 1 end else order = @closedOrders["OrderDataBean"] openDate = convert_date(order["openDate"]) completionDate = convert_date(order["completionDate"]) %> <% end %>
Order IDOrder Status Creation DateCompletion Date Txn FeeTypeSymbol Quantity
<%=order["orderID"]%> <%=order["orderStatus"]%> <%=openDate%> <%=completionDate%> $<%=order["orderFee"]%> <%=order["orderType"]%> <%=order["symbol"]%> <%=order["quantity"]%>
<%=order["orderID"]%> <%=order["orderStatus"]%> <%=openDate%> <%=completionDate%> $<%=order["orderFee"]%> <%=order["orderType"]%> <%=order["symbol"]%> <%=order["quantity"]%>


<% end %> <% if (@isReply) # Check whether the user has requested to buy or sell some quote. %>

New Order

Order <%= (@buyReturn && @buyReturn["orderID"] != nil) ? @buyReturn["orderID"]: @sellEnhancedReturn["orderID"] %> to <%= (@buyReturn && @buyReturn["quantity"] != nil) ? "buy " + @buyReturn["quantity"]: "sell " + @sellEnhancedReturn["quantity"] %> shares of s:0 has been submitted for processing.

Order Details:

<% if(@isBuy) dateTime = convert_date(@buyReturn["openDate"]) %> <% elsif (@isSell) dateTime = convert_date(@sellEnhancedReturn["openDate"]) %> <% end %>
Order IDOrder StatusCreation Date Completion DateTxn FeeTypeSymbol Quantity
<%=@buyReturn["orderID"]%> <%=@buyReturn["orderStatus"]%> <%=dateTime%> Pending $<%=@buyReturn["orderFee"]%> <%=@buyReturn["orderType"]%> <%=@buyReturn["symbol"]%> <%=@buyReturn["quantity"]%>
<%=@sellEnhancedReturn["orderID"]%> <%=@sellEnhancedReturn["orderStatus"]%> <%=dateTime%> Pending $<%=@sellEnhancedReturn["orderFee"]%> <%=@sellEnhancedReturn["orderType"]%> <%=@sellEnhancedReturn["symbol"]%> <%=@sellEnhancedReturn["quantity"]%>
<% elsif(@quotesReturn != nil) #else to isreply %>

Stock Quotes

<% if(@quotesReturn["symbol"] != nil) %> <% end %>
SymbolCompanyVolumePrice Range Open PriceCurrent PriceGain(Loss)Trade
<%=@quotesReturn["symbol"]%> <%=@quotesReturn["companyName"]%> <%=@quotesReturn["volume"]%> $<%=@quotesReturn["low"]%>-$<%=@quotesReturn["high"]%> $<%=@quotesReturn["open"]%> $<%=@quotesReturn["price"]%> <% if (@quotesReturn["change"].to_f > 0) %> $<%="%.2f" % @quotesReturn["change"]%> <% elsif (@quotesReturn["change"].to_f < 0) abs_change = -1 * @quotesReturn["change"].to_f %> $<%="%.2f" % (abs_change)%> <% else %> $<%=@quotesReturn["change"]%> <% end %>
"/> "/> "/>
<% elsif(@quotesInitialPage) # else for isreply %>

Stock Quotes

<% symbolCount = 0; while(symbolCount < 5) quotesReturn = GetQuote("s:" + symbolCount.to_s) if (quotesReturn) if (quotesReturn["symbol"]) %> <% end %> <% end symbolCount = symbolCount + 1 %> <% end %>
SymbolCompanyVolumePrice Range Open PriceCurrent PriceGain(Loss)Trade
<%=quotesReturn["symbol"]%> <%=quotesReturn["companyName"]%> <%=quotesReturn["volume"]%> $<%=quotesReturn["low"]%>-$<%=quotesReturn[">high"]%> $<%=quotesReturn["open"]%> $<%=quotesReturn["price"]%> <% if (quotesReturn["change"].to_f> 0) %> $<%="%.2f" % quotesReturn["change"]%> <% elsif (quotesReturn["change"].to_f< 0) abs_ret = -1 *quotesReturn["change"].to_f %> $<%="%.2f" % (abs_ret)%> <% else %> $<%=quotesReturn["change"]%> <% end %>
"/> "/> "/>
<% else %>

Stock Quotes

<% end %>