Table structures
(1) AccountProfile
UserID (PK) (string)
Password (string)
Address (string)
email (string)
credit card (string)
full name (string)
(2) Account
ProfileUserID (string)
AccountID (PK) (int)
OpenBalance (double)
Balance (double)
LogoutCount(int)
LoginCount(int)
CreationDate(date)
LastLoginDate(date)
(3) Holding
HoldingID (PK) (int)
PurchasePrice(double)
Quantity(double)
AccountID(int)
QuoteSymbol(string)
PurchaseDate(Date)
(4) Orders
OrderID(PK)(int)
OrderFee(double)
CompletionDate(Date)
OrderType(string)
OrderStatus(string)
Price(double)
Quantity(double)
OpenDate(Date)
AccountID(int)
QuoteSymbol(string)
HoldingID(int)
(5) Quote
Symbol(PK) (string)
Open (double) (price when symbol was introduced)
Volume(double)
Price (double) (Current price)
High (double) (High price in all the time)
CompanyName(string)
Change(double) (current price change)
Low(double) (Low price in all the time)
Following are the operations
(1) Register user
(2) Login user
Given a user name, check whether password is correct according to AccountProfile table. If success, return the details from Account table.
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "
Host: shankar:89
Content-Length: 208
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<login xmlns="
<userID>shankar</userID>
<password>shankar</password>
</login>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 523
<s:Envelope xmlns:s="
<s:Body>
<loginResponse xmlns="
<loginReturn xmlns:i="
<accountID>100</accountID>
<loginCount>12</loginCount>
<logoutCount>4</logoutCount>
<lastLogin>2008-04-02T12:24:36.733</lastLogin>
<creationDate>2008-04-01T22:23:47.107</creationDate>
<balance>84680.25</balance>
<openBalance>100000.00</openBalance>
<profileID>shankar</profileID>
</loginReturn>
</loginResponse>
</s:Body</s:Envelope>
(3) Get Account Data
Given a user name, return the details from Account table.
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "getAccountData"
Host: shankar:89
Content-Length: 198
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getAccountData xmlns="
<userID>shankar</userID>
</getAccountData>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 559
<s:Envelope xmlns:s="
<s:Body>
<getAccountDataResponse xmlns="
<getAccountDataReturn xmlns:i="
<accountID>100</accountID>
<loginCount>11</loginCount>
<logoutCount>4</logoutCount>
<lastLogin>2008-04-02T12:24:36.733</lastLogin>
<creationDate>2008-04-01T22:23:47.107</creationDate>
<balance>84680.25</balance>
<openBalance>100000.00</openBalance>
<profileID>shankar</profileID>
</getAccountDataReturn>
</getAccountDataResponse>
</s:Body</s:Envelope>
(4) Get Holdings
Given a user name, return the details from Holdings table.
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "getHoldings"
Host: shankar:89
Content-Length: 192
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getHoldings xmlns="
<userID>shankar</userID>
</getHoldings>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 1246
<s:Envelope xmlns:s="
<s:Body>
<getHoldingsResponse xmlns="
<getHoldingsReturn xmlns:i="
<HoldingDataBean>
<holdingID>504</holdingID>
<quantity>12</quantity>
<purchasePrice>100.00</purchasePrice>
<purchaseDate>2008-04-02T12:00:59.953</purchaseDate>
<quoteID>s:1</quoteID>
</HoldingDataBean>
<HoldingDataBean>
<holdingID>503</holdingID>
<quantity>10</quantity>
<purchasePrice>100.00</purchasePrice>
<purchaseDate>2008-04-02T11:57:16.797</purchaseDate>
<quoteID>s:3</quoteID>
</HoldingDataBean>
<HoldingDataBean>
<holdingID>502</holdingID>
<quantity>20</quantity>
<purchasePrice>102.00</purchasePrice>
<purchaseDate>2008-04-02T10:46:15</purchaseDate>
<quoteID>s:2</quoteID>
</HoldingDataBean>
<HoldingDataBean>
<holdingID>501</holdingID>
<quantity>10</quantity>
<purchasePrice>100.00</purchasePrice>
<purchaseDate>2008-04-02T10:45:38.733</purchaseDate>
<quoteID>s:2</quoteID>
</HoldingDataBean>
<HoldingDataBean>
<holdingID>500</holdingID>
<quantity>100</quantity>
<purchasePrice>100.00</purchasePrice>
<purchaseDate>2008-04-01T22:24:36.03</purchaseDate>
<quoteID>s:0</quoteID>
</HoldingDataBean>
</getHoldingsReturn>
</getHoldingsResponse>
</s:Body</s:Envelope>
(5) Get Quote
Given a symbol name, return the details from Quote table.
Note: If none of the symbols are given, return empty getQuoteReturn element (this way is used to check the connectivity of the service)
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "
Host: shankar:89
Content-Length: 182
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getQuote xmlns="
<symbol>s:1</symbol>
</getQuote>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 437
<s:Envelope xmlns:s="
<s:Body>
<getQuoteResponse xmlns="
<getQuoteReturn xmlns:i="
<symbol>s:1</symbol>
<companyName>S1 Incorporated</companyName>
<price>98.00</price>
<open>100.00</open>
<low>98.00</low>
<high>100.00</high>
<change>-2</change>
<volume>12</volume>
</getQuoteReturn>
</getQuoteResponse>
</s:Body</s:Envelope>
(6) Get Market Summery
Return top 5 +ve changes and top 5 -ve changes from Quote table.
Note: No idea about TSIA, openTSIA elements. SummeryDate is current date
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "getMarketSummary"
Host: shankar:89
Content-Length: 160
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getMarketSummary xmlns="
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 2564
<s:Envelope xmlns:s="
<s:Body>
<getMarketSummaryResponse xmlns="
<getMarketSummaryReturn xmlns:i="
<TSIA>100.000000</TSIA>
<openTSIA>100.000000</openTSIA>
<volume>0</volume>
<topGainers>
<QuoteDataBean>
<symbol>s:100</symbol>
<companyName>S100 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:101</symbol>
<companyName>S101 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:102</symbol>
<companyName>S102 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:103</symbol>
<companyName>S103 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:104</symbol>
<companyName>S104 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
</topGainers>
<topLosers>
<QuoteDataBean>
<symbol>s:100</symbol>
<companyName>S100 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:101</symbol>
<companyName>S101 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:102</symbol>
<companyName>S102 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:103</symbol>
<companyName>S103 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
<QuoteDataBean>
<symbol>s:104</symbol>
<companyName>S104 Incorporated</companyName>
<price>100.00</price>
<open>100.00</open>
<low>100.00</low>
<high>100.00</high>
<change>0</change>
<volume>0</volume>
</QuoteDataBean>
</topLosers>
<summaryDate>2008-04-02T12:24:37.140625+05:30</summaryDate>
</getMarketSummaryReturn>
</getMarketSummaryResponse>
</s:Body</s:Envelope>
(7) Get Orders
Given the user name, return all data's of that user from Order table. Order status of those records should be “completed”
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "getOrders"
Host: shankar:89
Content-Length: 188
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getOrders xmlns="
<userID>shankar</userID>
</getOrders>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:54:47 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 1782
<s:Envelope xmlns:s="
<s:Body>
<getOrdersResponse xmlns="
<getOrdersReturn xmlns:i="
<OrderDataBean>
<orderID>504</orderID>
<orderType>buy</orderType>
<orderStatus>completed</orderStatus>
<openDate>2008-04-02T12:00:59.95</openDate>
<completionDate>2008-04-02T12:00:59.95</completionDate>
<quantity>12</quantity>
<price>100.00</price>
<orderFee>15.95</orderFee>
<symbol>s:1</symbol>
</OrderDataBean>
<OrderDataBean>
<orderID>503</orderID>
<orderType>buy</orderType>
<orderStatus>completed</orderStatus>
<openDate>2008-04-02T11:57:16.793</openDate>
<completionDate>2008-04-02T11:57:16.793</completionDate>
<quantity>10</quantity>
<price>100.00</price>
<orderFee>15.95</orderFee>
<symbol>s:3</symbol>
</OrderDataBean>
<OrderDataBean>
<orderID>501</orderID>
<orderType>buy</orderType>
<orderStatus>completed</orderStatus>
<openDate>2008-04-02T10:45:38.733</openDate>
<completionDate>2008-04-02T10:45:38.763</completionDate>
<quantity>10</quantity>
<price>100.00</price>
<orderFee>15.95</orderFee>
<symbol>s:2</symbol>
</OrderDataBean>
</getOrdersReturn>
</getOrdersResponse>
</s:Body</s:Envelope>
(8) Buy/Sell
Have to insert a record to Order table. “opendate”, “quote_symbol”, “quantity”, “ordertype”, “orderstatus”, “accountid” columns should be populated in the record. “ordertype” should be “buy” for buy operation and “sell” for sell operation. “orderstatus” should be “open”. After inserting the record, a request should be sent to Order Processing Service for further completion. Once order processor service finished its processing, created order details should be returned as the response.
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "sell"
Host: shankar:89
Content-Length: 263
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<sell xmlns="
<userID>shankar</userID>
<symbol>s:2</symbol>
<quantity>10</quantity>
<orderProcessingMode>0</orderProcessingMode>
</buy>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:55:07 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 532
<s:Envelope xmlns:s="
<s:Body>
<buyResponse xmlns="
<buyReturn xmlns:i="
<orderID>505</orderID>
<orderType>buy</orderType>
<orderStatus>closed</orderStatus>
<openDate>2008-04-02T12:25:07.078125+05:30</openDate>
<completionDate>2008-04-02T12:25:07.078125+05:30</completionDate>
<quantity>10</quantity>
<price>104.04</price>
<orderFee>15.95</orderFee>
<symbol>s:2</symbol>
</buyReturn>
</buyResponse>
</s:Body</s:Envelope>
(9) Get Closed orders
Given the user name, return all data of that user from Order table, where the order status is “closed”. Before returning the results, change the status of those orders to “completed”.
Note: If no records are available, return empty getClosedOrdersReturn element
Request will be
POST /TradeServiceWcf/TradeServiceWcf.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "getClosedOrders"
Host: shankar:89
Content-Length: 200
Expect: 100-continue
<s:Envelope xmlns:s="
<s:Body>
<getClosedOrders xmlns="
<userID>shankar</userID>
</getClosedOrders>
</s:Body</s:Envelope>
Response will be
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 02 Apr 2008 06:55:15 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 596
<s:Envelope xmlns:s="
<s:Body>
<getClosedOrdersResponse xmlns="
<getClosedOrdersReturn xmlns:i="
<OrderDataBean>
<orderID>505</orderID>
<orderType>buy</orderType>
<orderStatus>completed</orderStatus>
<openDate>2008-04-02T12:25:07.077</openDate>
<completionDate>2008-04-02T12:25:07.077</completionDate>
<quantity>10</quantity>
<price>104.04</price>
<orderFee>15.95</orderFee>
<symbol>s:2</symbol>
</OrderDataBean>
</getClosedOrdersReturn>
</getClosedOrdersResponse>
</s:Body</s:Envelope>