Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


CUPID
CODING TEST
0 Answer(s)      2 years and a month ago
Posted in : Java Interview Questions


Problem Statement Consider a inter dealer-broker network which various financial stock brokers use to execute customer stock trading orders. Everytime a customer needs to buy/sell a stock; it reaches out to its designated broker who then uses this broker-network to buy/sell the stock at the current market price. When the trade gets executed between two customers through brokers, it gets assigned a unique identifier called â??TransIdâ??. While trades get executed during the day, money settlement between the customers happens at the end of the day. To find out how much money needs to be transferred between buying/selling customers, every broker produces following report at end of day, which lists customer specific transactions as below:

Report from Broker Alpha

TransId Security Currency Volume Price TransType CustomerId
1112 114CD USD 100000 16.72 BUY 447FG
1113 121XQ EUR 50000 45.24 SELL 432DF
1114 178AA CHF 80000 24.00 BUY 444AK

Report from Broker Beta

TransId Security Currency Volume Price TransType CustomerId
1112 114CD USD 100000 16.72 SELL 852KS
1115 136RT GBP 50000 63.568 BUY 851GF

This data is first fed into a third-party Reconciliation System that first reconciles transaction data from various brokers based on the â??TransIdâ??. Reconciled trades are then fed into a central Accounting System that generates payment orders.

You need to write code â??ONLYâ?? for this Reconciliation System (not Accounting System) based on the specifications below. Specifications The trade data from a broker is in the form of a CSV file (comma separated values), with the following fields: â?¢ TransId â??? Unique identifier for the transaction/trade. It will be same for a set of matching transactions. â?¢ Security â??? Financial security identifier (e.g. for Reliance stocks, this would be RIL). â?¢ Currency â??? 3-letter currency code for the transaction/trade. â?¢ Volume â??? Number of units of the traded security. â?¢ Price â??? Unit price of the traded security. â?¢ TransType â??? Type of transaction/trade from customerâ??s perspective. - BUY or SELL. For a valid trade, if one customer has â??BUYâ?? for a security, then there must be another customer having â??SELLâ??. â?¢ CustomerId â??? Broker specific identifier for the customer who raised trade request with the broker. The system should be able to perform the following functions: â?¢ Load the trade data files from various brokers, and match transactions data. â?¢ Transaction data should be â??matchedâ?? based on â??TransIdâ??. Following fields should be compared for differences: 1. Security 2. Currency 3. Volume 4. Price (Price data should be matched by rounding up to 2 decimal places) â?¢ If differences are found, output should be written to a differences file in the following format: TransId, Security, BrokerAName, BrokerBName, DiffFieldName, ValueA, ValueB â?¢ The above differences should be sorted by â??Securityâ?? in the output differences file. â?¢ If for a given TransId, an opposite matching trade is not found, then that data should be stored in a separate file, so that it could be processed in the next dayâ??s run. Here we assume that the matching transaction might arrive in the next runâ??s input file from the other broker. (Hint: Consider this pending data as the additional file to be processed for comparison) â?¢ If the system is not able to find any disparities between the transaction data from multiple brokers during a process run, then the message â??No differences found for last process runâ?? should be written to the output. Exception Scenarios: â?¢ If the â??Currencyâ?? for a transaction is not a 3-letter code, then return a user-friendly error and log to a common exception output, but the process should continue to run for rest of the transactions within that file. â?¢ If the â??TransTypeâ?? is either BUY or SELL for both sides of a transaction, then return a user-friendly error and log to a common exception output, but the process should continue to run for rest of the transactions.

Other Instructions Please keep following instructions in mind: â?¢ Do not write boiler-plate code for reading/writing from the file. Mock the function that does these things. â?¢ The solution should be scalable enough to accommodate input transaction files from multiple brokers, and considering that each broker could have hundreds of transactions in corresponding input file. The solution should be able to run the whole comparison process in minimum time possible.

Evaluation criteria â?¢ Code Completeness/ Correctness â?¢ Code Structure and quality: Modularity, usage of OO principles, size of classes/functions, class/function/variable names, package/class structure â?¢ Choice of data structures â?¢ Unit Test cases â?¢ Coding productivity (more time you take to submit the exercise, lesser you will score) Better you perform on this criteria, higher you will score.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
CODING TEST
CODING TEST  Problem Statement Consider a inter dealer-broker network.../class structure â?¢ Choice of data structures â?¢ Unit Test cases â?¢ Coding productivity (more time you take to submit the exercise, lesser you
CODING TEST
CODING TEST  Problem Statement Consider a inter dealer-broker network.../class structure â?¢ Choice of data structures â?¢ Unit Test cases â?¢ Coding productivity (more time you take to submit the exercise, lesser you
Advertisements
coding
coding  I need the logout coding. can you please help me.   Please visit the following links: http://www.roseindia.net/quickguide/tomcat/Logout.shtml http://www.roseindia.net/jsp/loginstatus.shtml
test case
test case  Hi Can you explain me how to write test case in java. regards kennedy
WRITE AND TEST
WRITE AND TEST   WRITE AND TEST PROGRAM TO ACCEPT A STRING? 1).WHICH STARTS WITH 'S' OR 's' 2).ENDS WITH "nd" 3) THE LENGTH OF THE STRING SHOULD BE 10 OR LESS
Online test
Online test   I am creating a project for online test system. There should be a timer,on pressing next button it will retrieve a next question and it will show on the same page,on completion of test it will show result
Grouping Of Test cases by using struts
Grouping Of Test cases by using struts  Hi, I can able to create, save, delete and execute test cases in my application. But i want to group those test cases. Give me the flow for coding
java test
into an xml file using java? (test_sample.csv(it should contain at least 39 lines)) i...:\\Documents and Settings/janardhany/Desktop/test_sample.txt... FileInputStream("C:\\Documents and Settings/janardhany/Desktop/test_sample.xls
coding for project
coding for project  hai how to write jsp coding for project smart accessories ...... that s to navigate to another page when you click on a tag
program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program.please provide the coding for this problem
coding for chart
coding for chart  I want to convert a character into binary then convert it into its diagram in form of digital electrical signals.How can I do java coding for this diagram
Java Coding
Java Coding  Hello, Can u please tel me how to improve my coding techniques.I am feeling difficulty with coding but I am perfect with my theory part
coding of button
coding of button  What is code of fetching the value of button in a textbox using javascript
program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program
coding C
coding C  Write a program for a GENERAL NUMBER CONVERTERS which include binary, decimal, octa and hexadecimal. You need to write the program using C language
need coding
need coding  sir i need code for simple bank application in jsp please send it   sir i need the coding for simple bank application in jsp.   Please visit the following link: Jsp Bank Application
Query to Test MySQL Performance
Query to Test MySQL Performance  Query to Test MySQL Performance
how to conduct the test in java
how to conduct the test in java  how to conduct the test in java
coding shape
coding shape  i need to write a simple java program. the system must be in an applet and allows a user to choose whether to draw shapes such as circles, rectangles or lines on the screen. also, user can add circles by choosing
Coding with Ejb
Coding with Ejb  Hi Team, I am learning Ejb now. Can anybody help me how to implement this Stateful Session Bean Example by using this Hibernate example. Thanks in advance.   Sorry, actually I want simple code adding
coding in java
coding in java  write a code to calculate the product of odd integers from 1-15   class ProductOfOddIntegers { public static void main(String[] args) { long product=1; for(int i=1;i<=15;i
coding for forgot password
coding for forgot password  coding for forgot password
coding for online reservation
coding for online reservation  coding for online reservation
 

 

 

DMCA.com