Presentation is loading. Please wait.

Presentation is loading. Please wait.

Simulation of Stock Trading J.-S. Roger Jang ( 張智星 ) MIR Lab, CSIE Dept. National Taiwan University.

Similar presentations


Presentation on theme: "Simulation of Stock Trading J.-S. Roger Jang ( 張智星 ) MIR Lab, CSIE Dept. National Taiwan University."— Presentation transcript:

1 Simulation of Stock Trading J.-S. Roger Jang ( 張智星 ) jang@mirlab.org http://mirlab.org/jang MIR Lab, CSIE Dept. National Taiwan University

2 2/13 Introduction to Stock Trading Types of bids Buy 100 shares at 120 for TSMC Sell 20 shares at 110 for TSMC Cancel previous bids Rules A transaction is established if buy price is higher than sell price, as each bid comes in. Partial buy/sell is allowed. We need a data structure that supports efficient “insert” and “remove min/max”  heaps

3 3/13 Input/Output Formats Input format Fields: bidId clientId action price shareCount Input example 0 983 1 114 2 1 741 0 128 41 2 816 0 183 68 3 244 1 171 100 4 712 1 125 1 5 543 1 127 61 6 934 1 144 74 7 234 0 173 68 8 48 1 181 58 9 883 0 139 39 Output format Fields: transId buyClientId sellClientId transPrice transShareCount Output example 07419831142 1816244171 68 27417121251 3741543127 38 4234543127 23 5234934144 45


Download ppt "Simulation of Stock Trading J.-S. Roger Jang ( 張智星 ) MIR Lab, CSIE Dept. National Taiwan University."

Similar presentations


Ads by Google