辅导 program、讲解 Python设计编程
            
                Problem 
Our US stock trading system records all our trades in a log file at the end of a 
trading day. Since trades are critical information, to ensure the correctness we 
also obtain from our execution broker their copy of our trades of that day, and 
compare (i.e. reconcile) the two sources. Trading support staff run this 
reconciliation every day and perform troubleshooting if discrepancies are 
found. 
 
We expect a 1-to-1 match between our copy of trades and broker’s copy of 
trades, unless occasional errors occur causing missing trades. Two matched 
trades are expected to have the same security symbol, same side (buy or sell), 
same price, and same quantity (in shares). However, since two parties may 
receive a trade at slightly different time, the timestamp of two trades may not 
perfectly match, and a small difference (for example 1 second) should be 
tolerated. The ordering of trades in two sources might not be identical. 
 
Our copy of trades is saved in a gzip file. Each line in the file is a json dictionary 
representing a trade. The key attributes security symbol, side, price, quantity 
are respectively called “symbol”, “fill_side”, “fill_px”, “fill_qty”. For fill_side, 0 
means buy and 1 means sell. 
The broker’s copy of trades is a csv file. The key attributes security symbol, side, 
price, quantity are respectively called “SYMBOL”, “SIDE”, “TOTAL_EXEC_QTY”, 
“LAST_PX”. 
Pay attention to the time zone conventions when you interpret the timestamp 
in each file. 
 
See below links for a sample of one day’s data: 
 Our copy of trades: 
https://scientech-pubtraining.s3.amazonaws.com/coding_test_trade_recon/txn.log.gz
 Broker’s copy of trades: https://scientech-pubtraining.s3.amazonaws.com/coding_test_trade_recon/EOD_Executions_
20210104.csv
Requirment 
1. Write a computer program (preferably in Python) to automatically 
reconcile trades from these two sources. The program should at minimum 
print out the unmatched trades from each source. If you have extra time, 
consider adding the feature of producing human friendly report in html 
format that can be embedded in notification email. 
2. Use this program to reconcile the sample dataset, and document your 
findings. 
 
Non-disclosure Agreement (NDA) 
 
Confidential Information 
The content of the coding test ("Test"), including questions, answers or any 
communication, regarding or related to the Test is Scientech Research’s 
confidential information ("Confidential Information"). You are expressly 
prohibited from disclosing, publishing, posting or selling any Confidential 
Information, in whole or in part, in any form or by any means, oral or written, 
electronic or mechanical, for any purpose. The submission of the Test 
expresses and constitutes your entire understanding with respect to the 
subject matter of this Non-disclosure Agreement.