<% # 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 (@holdingsReturn) %>

Portfolio Information

<% index = 0; purchaseBasis = 0; marketValue = 0; gain = 0; while ((bean=@holdingsReturn["HoldingDataBean"][index]) != nil) quoteID = bean["quoteID"] purchaseBasis = purchaseBasis + bean["purchasePrice"].to_f * (bean["quantity"].to_i) marketValue = marketValue + (@quoteInfo[quoteID].to_i) * (bean["quantity"].to_i) gain = (@quoteInfo[quoteID].to_f - bean["purchasePrice"].to_f) * (bean["quantity"].to_i) dateTime = convert_date(bean["purchaseDate"]) %> <% index = index + 1 end %> <% elsif (gain > 0) %> $<%=gain%> <% else %> $<%=gain%> <% end %>
Holding IDPurchase DateSymbol QuantityPurchase PriceCurrent Price Purchase BasisMarket ValueGain(Loss) Trade
<%=bean["holdingID"]%> <%=dateTime%>
"/> ">
<%=bean["quantity"]%> $<%=bean["purchasePrice"]%> $<%=@quoteInfo[quoteID]%> $<%="%.2f" % ((bean["purchasePrice"].to_f) * (bean["quantity"].to_i))%> $<%="%.2f" % (@quoteInfo[quoteID].to_f * bean["quantity"].to_i)%> <% if (gain > 0) %> $<%="%.2f" % gain%> <% elsif (gain < 0) gain = gain * -1 %> $<%="%.2f" % gain%> <% else %> $<%="%.2f" % gain%> <% end %>
"> "> ">
Totals$<%=purchaseBasis%> $<%=marketValue%> <% gain = marketValue - purchaseBasis if (gain < 0) %> $<%=gain%>
<% end %>