Skip to content

sjpiazza99/simple_cross

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleCross - a process that matches internal orders

Overview: * Accept/remove orders as they are entered and keep a book of resting orders * Determine if an accepted order would be satisfied by previously accepted orders (i.e. a buy would cross a resting sell) * Output (print) crossing events and remove completed (fully filled) orders from the book

Inputs: A string of space separated values representing an action. The number of values is determined by the action to be performed and have the following format:

ACTION [OID [SYMBOL SIDE QTY PX]]

ACTION: single character value with the following definitions
O - place order, requires OID, SYMBOL, SIDE, QTY, PX
X - cancel order, requires OID
P - print sorted book (see example below)

OID: positive 32-bit integer value which must be unique for all orders

SYMBOL: alpha-numeric string value. Maximum length of 8.

SIDE: single character value with the following definitions
B - buy
S - sell

QTY: positive 16-bit integer value

PX: positive double precision value (7.5 format)

FILL_QTY: positive 16-bit integer value representing qty of the order filled by
          this crossing event

OPEN_QTY: positive 16-bit integer value representing qty of the order not yet filled

FILL_PX:  positive double precision value representing price of the fill of this
          order by this crossing event (7.5 format)

ORD_PX:   positive double precision value representing original price of the order (7.5 format)

Conditions/Assumptions: * The implementation should be a standalone Linux console application (include source files, testing tools and Makefile in submission) * The app should respond to malformed input and other errors with a RESULT of type 'E' and a descriptive error message * Development should be production level quality. Design and implementation choices should be documented * Performance is always a concern in software, but understand that this is an unrealistic test. Only be concerned about performance where it makes sense to the important sections of this application (i.e. reading actions.txt is not important). * All orders are standard limit orders * Orders should be selected for crossing using price-time (FIFO) priority * Orders for different symbols should not cross (i.e. the book must support multiple symbols)

If you have questions or need any clarification about the problem you can email your HR contact.

Example session: INPUT | OUTPUT ============================================================================ "O 10000 IBM B 10 100.00000" | results.size() == 0 "O 10001 IBM B 10 99.00000" | results.size() == 0 "O 10002 IBM S 5 101.00000" | results.size() == 0 "O 10003 IBM S 5 100.00000" | results.size() == 2 | results[0] == "F 10003 IBM 5 100.00000" | results[1] == "F 10000 IBM 5 100.00000" "O 10004 IBM S 5 100.00000" | results.size() == 2 | results[0] == "F 10004 IBM 5 100.00000" | results[1] == "F 10000 IBM 5 100.00000" "X 10002" | results.size() == 1 | results[0] == "X 10002" "O 10005 IBM B 10 99.00000" | results.size() == 0 "O 10006 IBM B 10 100.00000" | results.size() == 0 "O 10007 IBM S 10 101.00000" | results.size() == 0 "O 10008 IBM S 10 102.00000" | results.size() == 0 "O 10008 IBM S 10 102.00000" | results.size() == 1 | results[0] == "E 10008 Duplicate order id" "O 10009 IBM S 10 102.00000" | results.size() == 0 "P" | results.size() == 6 | results[0] == "P 10009 IBM S 10 102.00000" | results[1] == "P 10008 IBM S 10 102.00000" | results[2] == "P 10007 IBM S 10 101.00000" | results[3] == "P 10006 IBM B 10 100.00000" | results[4] == "P 10001 IBM B 10 99.00000" | results[5] == "P 10005 IBM B 10 99.00000"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages