Matching Orders Algorithm

Hello. I am trying to program a simulation of the financial market.

At the moment I am stuck on implementing the Order Matching algorithm. I am not sure as to what kinds of rules my algorithm should follow. I want my system to resemble the real world as much as possible, so getting the price order matching mechanism is quite important.

I can't find any decent info on how these algorithms work in detail. Wondering if you guys could somehow help me out.

For example if there is a sell order of 200, and two buy orders of 300 and 500. Who does the sell order go to and for how much? ( figures are a bit realistic, but still)

1 Comments
 

Aspernatur inventore tenetur fugiat. Iure porro et et. Maxime rerum nesciunt nam ducimus cumque mollitia soluta et. Quam aut dolores cupiditate et voluptatem quo rerum.

Corrupti iste qui quia voluptas ea saepe unde. Ullam velit quas vel autem. Voluptatem laborum aut quia quis atque deleniti. Tempore alias eos alias vero voluptate.

CNBC sucks "This financial crisis is worse than a divorce. I've lost all my money, but the wife is still here." - Client after getting blown up

Career Advancement Opportunities

October 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • JPMorgan 01 98.4%
  • Morgan Stanley 07 97.9%
  • Guggenheim Partners 01 97.4%

Overall Employee Satisfaction

October 2026 Investment Banking

  • Moelis & Company No 99.5%
  • Morgan Stanley 02 98.9%
  • Evercore 01 98.4%
  • Banco Santander 02 97.9%
  • BMO Capital Markets 12 97.4%

Professional Growth Opportunities

October 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • Morgan Stanley 05 98.4%
  • Goldman Sachs 01 97.9%
  • JPMorgan No 97.4%

Total Avg Compensation

October 2026 Investment Banking

  • Vice President (16) $429
  • Associates (57) $264
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (28) $184
  • Intern/Summer Associate (16) $161
  • 1st Year Analyst (84) $151
  • Intern/Summer Analyst (76) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”