Write two Perl scripts which create a database and import data from a flat CSV file to the database as specified below.
Sample input data is [here]. **Caution:** That file is over 21 meg, and frankly, you'll *really* only need a few Kbytes to get the idea, so feel free to abort the download quickly! (The "real" data is 3 gig.)
The "create" script will drop and then create the following:
Table: Stocks. Primary key is Symbol.
Table: StockDailies. Primary key is Symbol+QuoteDate.
Table: Options. Primary key is Underlying+Expiration+Strike100+Contract+QuoteDate.
Strike100 int unsigned
The "import" script will be run in a directory which contains a set of files, each of which has a set of lines, each of which has the following pieces of data, separated by commas:
* Expiration_Date as M/D/Y
* Quote_Date as M/D/Y followed by time and AM/PM
Set max_stock_symbol, max_op_root and max_op_ext each to 0.
For each line in each file in the current directory, do the following:
If the lengths of Underlying_Symbol, Option_Root, and/or Option_Extension exceeed the corresponding max's, set them appropriately.
If [url removed, login to view] = Underlying_Symbol does not exist, create it.
If [url removed, login to view] > Quote_Date, then set it.
If [url removed, login to view] < Quote_Date, then set it.
If [url removed, login to view] = Underlying_Symbol and [url removed, login to view] = Quote_Date does not exist, create it with Price = Underlying_Price. Otherwise, if it does exist and the price does not match, output a warning.
Add a row to Options using the file's line's data as follows:
Underlying = Underlying_Symbol
Expiration = Expiration_Date
Strike100 = 100 * Strike, converted to int
Contract = "C" if Contract_Type is "call", "P" if "put", else " " and output warning
QuoteDate = Quote_Date; ignore time entirely
Root = Option_Root
Ext = Option_Extension
Last, Bid, Ask, Volume, Open, ImpVol, Delta, Gamma should be set to the last eight values in the line, respectively.
(Exchange is ignored.)
After all files have been processed, output the three max's, as well as total number of files and lines processed, and excecution time.
| ![No PGP] | PGP is **not** required for this project. |
| ![No NDA] | An NDA is **not** required for this project. |
We will retain full legal rights to the code and/or data upon completion. All code and/or data is and becomes *our* intellectual property! You will *not* have any rights to the code and/or data in any fashion.
**Thank you for your consideration and for bidding through RentACoder!**
* * *Copyright ? 2005, Buyer
[notecom]. **All Rights Reserved.** Reproduction without permission is strictly prohibited.
* * *1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
Linux, Perl, MySQL