CUPID
CODING TEST
0 Answer(s)      7 months 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.

View Answers









Related Pages:
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
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 Coding - Java Beginners
that calls the printMessage method so that it prints the message ?Chapter 4 Test
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
coding problem in netbeans - Java Beginners
coding problem in netbeans  hi, i have just started programming... ClassA{ JFrame frame; JTextField text1; void form() { frame=new JFrame("test...=new JButton("Submit"); f=new JFrame("test"); JPanel cp=new JPanel(); cp.add
Java-mysql coding - Java Beginners
; String url = "jdbc:mysql://localhost:3306/"; String db = "test...:mysql://localhost:3306/"; String db = "test"; String driver... = "jdbc:mysql://localhost:3306/"; String db = "test"; String driver
how i want to create a coding by this question?
how i want to create a coding by this question?  Design and write a class named Person and its two subclasses named Student and Employee. Make... diagram for the classes. Write a test program named Asg1_3 that creates
Coding errors for printing function, please help
Coding errors for printing function, please help  Hello, We, my classmates and I, wrote this software but I ran into problems with printing button...()); /* Now we perform our rendering */ g.drawString("Test the print
Need coding help - two dimensional matrix and it returns back a boolean.
Need coding help - two dimensional matrix and it returns back a boolean. ... triangular matrix. I need to be test this method using main method. If it is true it is a triangular matrix if false it is not. any help with this coding
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
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
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 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
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 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
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
putting words to line number form a java file/test file and show occurrence
putting words to line number form a java file/test file and show occurrence  hi all i want putting words to line number form a java file and show... and BinarySearchTree and please help me in java coding
view jsp file (reference file). is the way of coding good ?
view jsp file (reference file). is the way of coding good ?  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding...;% Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db = "test
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
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 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 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
how to conduct the test in java
how to conduct the test in java  how to conduct the test in java
coding for anchor tags
coding for anchor tags  coding for anchor tags
coding for anchor tags
coding for anchor tags  coding for anchor tags
coding for updating profile
coding for updating profile  coding for updating profile
coding for forgot password
coding for forgot password  coding for forgot password
coding for deleting file
coding for deleting file  coding for deleting file
coding for login page
coding for login page  coding for login page
coding for anchor tags
coding for anchor tags  coding for anchor tags
coding for update profile
coding for update profile  coding for update profile
coding for anchor tags
coding for anchor tags  coding for anchor tags
coding for online reservation
coding for online reservation  coding for online reservation
Coding In Paradise
Coding In Paradise       Excellent and thoughtful AJAX tutorials and techniques by Brad Neuberg Read full Description
unit test in php - PHP
unit test in php  How can i run the unit test in PHP
Junit @Test annotation
Junit @Test annotation  What is the Application of @Test Annotation in JUnit ?   The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case : public class Example