Parsing Options Data from Files

With the help of the folks on this discussion board, I now have a directory filled with daily options data for all traded options. What I would like to do now is parse the data out so that I have one file with all the options data for one or two stocks.
Now I have a file named in the YYYYMMDD.txt format for every trading day. The data in the file looks like this:
AAF,A,,,,,5.65,0,30.0,6.25,6.5,334,2008
AAG,A,,,,,1.71,4,35.0,1.7,1.79,2049,2008
I need to pull information out of that file for specific symbols, and concatenate the date, which can be derived from the file name, at the end of each line.
So far I have a script that goes through the files and parses the information, but I do not know how to insert the information into a blank document and add the date. Here is what I have so far.
set fPath to "path:to:directory:"
tell application "Finder" to set tList to name of every file of folder fPath
repeat with i in tList
do shell script "grep ,PGH, " & quoted form of POSIX path of fPath & i
end repeat
Thank you in advance.

Thanks for the quick reply.
Here is an exert from an example file that I included in my original post. Let me describe the information a little bit, and I think you will see where I am going with grep.
AAF,A,,,,,5.65,0,30.0,6.25,6.5,334,2008
AAG,A,,,,,1.71,4,35.0,1.7,1.79,2049,2008
The first data is the options symbol, and the second is the underlying stock symbol for the option. I have only included two rows but the text files include hundreds of thousands of rows. The first two rows that I am using in my example are for Agilent Technologies whose stock symbol is "A".
So if I use the UNIX command GREP and do , stock symbol , plus the file I can pull out the options information I am interested in for just one stock. In the case of my original post, I was trying to get information for PGH.
For example,
grep ,PGH, /path/to/file/20080102.txt
returns:
PGHAC,PGH,,,,,2.7,0,15.0,2.8,3.1,81,2008
PGHAD,PGH,,,,,0.05,16,20.0,0.0,0.05,5995,2008
PGHAV,PGH,,,,,5.5,0,12.5,5.2,5.6,0,2008
PGHAW,PGH,,,,,0.6,96,17.5,0.45,0.7,3659,2008
PGHAX,PGH,,,,,0.1,0,22.5,0.0,0.05,1476,2008
PGHBC,PGH,,,,,,0,15.0,2.8,3.1,0,2008
PGHBD,PGH,,,,,,0,20.0,0.0,0.1,0,2008
PGHBV,PGH,,,,,,0,12.5,5.3,5.6,0,2008
PGHBW,PGH,,,,,0.55,0,17.5,0.6,0.75,22,2008
PGHBX,PGH,,,,,,0,22.5,0.0,0.05,0,2008
PGHDC,PGH,,,,,2.7,0,15.0,2.8,3.1,376,2008
PGHDD,PGH,,,,,0.15,8,20.0,0.1,0.15,3048,2008
PGHDV,PGH,,,,,5.6,0,12.5,5.3,5.6,29,2008
PGHDW,PGH,,,,,0.95,26,17.5,0.85,1.0,2485,2008
PGHDX,PGH,,,,,0.15,0,22.5,0.0,0.1,224,2008
PGHGC,PGH,,,,,2.9,10,15.0,2.8,3.2,133,2008
PGHGD,PGH,,,,,0.3,16,20.0,0.2,0.3,563,2008
PGHGV,PGH,,,,,5.6,0,12.5,5.2,5.6,10,2008
PGHGW,PGH,,,,,1.05,7,17.5,0.95,1.15,1347,2008
PGHGX,PGH,,,,,,0,22.5,0.0,0.1,0,2008
PGHMC,PGH,,,,,0.05,0,15.0,0.0,0.05,915,2008
PGHMD,PGH,,,,,2.1,25,20.0,1.95,2.2,1072,2008
PGHMV,PGH,,,,,0.03,0,12.5,0.0,0.05,30,2008
PGHMW,PGH,,,,,0.1,5,17.5,0.1,0.25,4430,2008
PGHMX,PGH,,,,,4.6,0,22.5,4.4,4.8,164,2008
PGHNC,PGH,,,,,0.1,0,15.0,0.05,0.1,30,2008
PGHND,PGH,,,,,2.55,0,20.0,2.15,2.4,35,2008
PGHNV,PGH,,,,,,0,12.5,0.0,0.05,0,2008
PGHNW,PGH,,,,,0.4,5,17.5,0.35,0.5,38,2008
PGHNX,PGH,,,,,,0,22.5,4.6,5.0,0,2008
PGHPC,PGH,,,,,0.2,10,15.0,0.15,0.25,431,2008
PGHPD,PGH,,,,,2.6,35,20.0,2.55,2.8,326,2008
PGHPV,PGH,,,,,0.1,0,12.5,0.0,0.1,115,2008
PGHPW,PGH,,,,,0.85,0,17.5,0.75,0.9,1431,2008
PGHPX,PGH,,,,,4.5,0,22.5,4.9,5.2,91,2008
PGHSC,PGH,,,,,0.5,0,15.0,0.35,0.5,57,2008
PGHSD,PGH,,,,,3.3,0,20.0,3.0,3.4,527,2008
PGHSV,PGH,,,,,0.15,30,12.5,0.05,0.15,0,2008
PGHSW,PGH,,,,,1.45,1,17.5,1.3,1.45,664,2008
PGHSX,PGH,,,,,5.3,0,22.5,5.3,5.7,117,2008
Which is the options data for one stock on one day. But I want the options data for one stock for everyday. I hope this makes sense.

Similar Messages

  • Transfer data from File server to SAP R/3 AS

    hi, i need to transfer data from file server (http:/.....) to SAP R/3 application server. I have the HTTP Host name (http:/......) and login details. please let me know how i can resolve this.
    best regards
    Neeraj

    Hi
    You need to create a RFC Destination with the details what you have, then you can create a RFC Fucntion module to read the data, according to the destination system, you have to code that, once you
    pick the data from the destination system, later you need to convert it to SAP Format.
    To trace your fm status, there are function module availabe in sap, search with http, you can find.
    regards
    Praveen

  • How to insert data from file into matlab script node

    I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • How to transformed data from File to DB but the data to be insert two tables  parallel?

    Hi friends ,I am new to Oracle SOA ,I have one requirement  for the project
    actually in these project
    1.I have to read three different types of files (Employee info,Purchase Order Info,Salaes Order Info) through file adapter these records are to be store in  data base 
    transaction table.In these transaction table contains WHO columns and payload  with clob data type which contains each  record  in xml form.
    2. Now I have to  take these payload data  which is in xml form and store   in the respective table(employee or PO or SO) .I have to call these in dynamically.
    so please give me ideas and suggesstions ,,
    thanks in advance

    Roger,
    I don't know about simple way to load data from file into a table using button from your application,
    Maybe some piece of PL/SQL code with UTL_FILE or DBMS_LOB, or you can try to upload file to database using Apex "File browse" item, and then do some processing with DBMS_LOB... but it will require some work...
    Maybe someone else could advice with some simple method I don't know...
    However loading files using Apex Load Utility is quite easy.
    You can use something like this to load data to views created on remote tables:
    CREATE TABLE local_tmp_table AS SELECT * FROM view_on_remote_table WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO view_on_remote_table SELECT * FROM local_tmp_table;
    COMMIT;
    DROP local_tmp_table;Or without views:
    CREATE TABLE local_tmp_table AS SELECT * FROM remote_table@dblink WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO remote_table@dblink SELECT * FROM local_tmp_table;
    DROP local_tmp_table;Regards
    Tomasz
    Message was edited by:
    Tomasz K.

  • Parsing the data from and xml type field

    Hi - I have registered a schema and inserted arecord into the table with the xml type column. Now I want to parse the data from the xmltype field into a relational table. I have been using the following select statement to accomplish this - and it does work if there is data in all the selected fields but when the filed is null then the whole select statement fails and brings back 'no rows returned'.If the value is null I want the select statment to return null. please give any ideas.
    SELECT version,frmd_transaction_date,extractValue(value(b), 'event_update/location')"location",
    extractValue(value(b), 'event_update/sending_system')"sending_system",
    extractValue(value(b), 'event_update/event_identifier')"event_identifier",
    extractValue(value(b), 'event_update/event_link')"event_link",
    extractValue(value(b), 'event_update/organization_code')"organization_code",
    nvl(extractValue(value(c), '/schedule/event_duration_minutes'),'000')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c

    ...then I guess you have to rewrite the query.
    Is schedule another xml sequence inside of event_update sequence ?
    If it is not you can try this :
    SELECT version,frmd_transaction_date,extractValue(value(b), '/event_update/location/text()')"location",
    extractValue(value(b), '/event_update/sending_system/text()')"sending_system",
    extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",
    extractValue(value(b), '/event_update/event_link/text()')"event_link",
    extractValue(value(b), '/event_update/organization_code/text()')"organization_code",
    extractValue(value(b), '/event_update/schedule/event_duration_minutes/text()')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b
    ...if yes, did you try nvl function (I don't think this would be a solution of a problem):
    SELECT version,frmd_transaction_date,nvl(extractValue(value(b), '/event_update/location/text()')"location", 'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/sending_system/text()')"sending_system",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_link/text()')"event_link",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/organization_code/text()')"organization_code",'NULL VALUE'),
    nvl(extractValue(value(c), '/schedule/event_duration_minutes/text()')"event_minutes",'NULL VALUE')
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c
    If none of this works post your xml schema.

  • Reading data from file in EJB

    I would like to read data from files in EJBS (Stateless Session Bean I think). I've heard that the EJB sepcifications don't allow to use the java.io package to access the filesystem. How can I resolve this problem? Possible solutions I've thought of are:
    * Use a webserver to store the data
    * put the files in a jar and access them using the getResource() in the classloader class
    Could you comment on this plesae
    greetings

    The specification states:
    "An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.
    The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data."
    From this I understand I cannot acces files directly, but it does not specifiy I can't use the java.io package at all. It specifically says not to use the java.io package to acces files and directories, they don't say anything about using the classes for other use.
    however, a litle lower the specification states:
    "The enterprise bean must not attempt to create a class loader; obtain the current class loader; set the context class loader; set security manager; create a new security manager; stop the JVM; or change the input, output, and error streams.
    These functions are reserved for the EJB Container. Allowing the enterprise bean to use these functions could compromise security and decrease the Container�s ability to properly manage the runtime environment."
    I'm not sure how to interpret this, but I believe this rule makes my solution invalid.
    Please comment on this,
    thanks

  • Get data from file in server to client and vice versa

    after greeting
    i really didn't know how to use socket and serversocket to get data from file in the server and display it to client.
    also read file from client and save it to server.
    really i didn't know how to do it.
    really i want the reply as soon as possible

    You REALLY need to work through the Java networking tutorials:
    http://java.sun.com/docs/books/tutorial/networking/index.html

  • Load data from File on Client side (via Sqlplus)

    Server OS: RedHat, Oracle 10g rel 2.
    I am trying to load data from OS .txt files to clob field.
    I am able to do this successfully using:
    Oracle DIRECTORY
    BFILE
    DBMS_LOB.loadclobfromfile packageIssue is: this only works if my files and DIR are on database server.
    Is it not possible "load clob from file" from client side, files being on client and exec command via SQLPlus. Is there any other option to load data from client side.
    Thanks for any help.

    Options:
    1) Search for OraDAV
    2) Learn about Application Express.

  • Parse table data from HTML page

    Hello. I have a program that creates an HTML page with several tables to present some data. What I would like to do is extract the data row by row from one of the tables, and parse the data I'm interested in from each row. Can anyone suggest how I should approach this problem?

    Andrew,<br /><br />1. If you want to append these data to the existent one, you've to read the XMP of the file.<br /><br />2. You've to add or modify the Dublin Core Description field <dc:description><br /><br />For example:<br /><rdf:Description rdf:about='uuid:d659be9a-21d7-11d9-9b6a-c1fd593acb83'<br />  xmlns:dc='http://purl.org/dc/elements/1.1/'><br /> <dc:format>image/jpeg</dc:format><br /> <dc:description><br />  <rdf:Alt><br />   <rdf:li xml:lang='x-default'>Image Caption</rdf:li><br />  </rdf:Alt><br /> </dc:description><br /></rdf:Description><br /><br />3. You've to replace the app1 block on the JPG with the new XMP<br /><br />Regards,<br /><br />Juan Pablo

  • POWER QUERY Get External Data From File From Folder (Excel 2013)

    Hi,
    Beginner's question :
    What could be the use of the query on a folder : we just get a list of files with their path. What can we do with that?
    Thanks

    Hi,
    Do you want to combine data from multiple Excel Files in the same folder path into one table? If I understand correct, we can add a custom column to import the data.
    After we getting a list of files with their path, the Query Editor window will activate to show you a table containing a record for each file in the chosen directory. These will provide our function with the needed FilePath and FileName parameters. 
    Function sample: File name([Folder path],[Field name]
    For more detailed steps, please see the article:
    http://datapigtechnologies.com/blog/index.php/using-power-query-to-combine-data-from-multiple-excel-files-into-one-table/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Getting data from file to array

    try
        System.out.println("Enter file name: ");
        fileName = Object.nextLine();
        BufferedReader inputStream =
                new BufferedReader(new FileReader(fileName));
        String employee = null;
        employee = inputStream.readLine();
        System.out.println("The first employee in " + fileName + " is");
        System.out.println(employee);
        inputStream.close();
    catch(FileNotFoundException e)
        System.out.println("File " + fileName + " not found ");
    catch(IOException e)
        System.out.println("Error reading from file " + fileName);
    }This is just a little example I made. You can look at my other thread to see the other code. I need to put the data in a file into the array. Does it need to be casted somehow?

    public void getData()
           try {
       System.out.println("Enter file name to read: ");
       File = Object.nextLine();
       BufferedReader Object =
                new BufferedReader(new FileReader(File));
        for(int i = 0; i < people.length && people[i] != null; i++)
    String temp = Object.readLine();
    people.setLastname(temp);
    temp = Object.readLine();
    people[i].setFirstname(temp);
    temp = Object.readLine();
    people[i].setID(temp);
    temp = Object.readLine();
    people[i].setPhone(temp);
    temp = Object.readLine();
    people[i].setYearlySalary(Double.parseDouble(temp));
    temp = Object.readLine();
    people[i].calcBonus(Double.parseDouble(temp));
    temp = Object.readLine();
    people[i].getMonthlyPay(temp));
    } Object.close(); }I know, I got careless with the naming. I'm trying a different route now. I think I can just do it in reverse. lol How would I get the method getMonthlyPay to have no errors. It's a public void() method with monthlyPay = (yearlySalary + bonus) / 12; in its definition.
    anyone?
    Edited by: Program_1 on Dec 9, 2007 5:42 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to insert data from file into long raw field using utl_file?

    I try to insert binary data from a file (under AIX 4.3.3) into a LONG
    RAW field (Oracle 8.1.6).
    First, I retrieve the data from the file like this:
    DECLARE
    FileHandle = UTL_FILE.FILE_TYPE;
    myVariable LONG RAW;
    FileHandle := UTL_FILE.FOPEN ;('prj/oracle/admin/MARTIJN/udump',
    'MyFile.ATT', 'R');
    UTL_FILE.GET_LINE (FileHandle, myVariable);
    UTL_FILE.FCLOSE(FileHandle);
    INSERT INTO myTable(DUMMYFIELD) VALUES(myVariable);
    Where DUMMYFIELD of table myTable is of type LONG RAW.
    The GET_LINE statement crashes on Oracle Error ORA-6502: Numeric of
    Value error: hex to raw conversion error.
    What do I do wrong?
    Do I use the right method to retrieve information from a file and put
    it into a long raw field, should I try it another way?
    Any help greatly appreciated,
    Martijn Rutte

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • Removing date from file name

    Hello,
    Is there any way to move all the file from one location to another and remove the datepart from filename.
    for eg:- if file name is abc_20150411.xls change to abc.xls. if file name does not contain date part then ignore it.
    Can any one suggest if its possible.
    Thank You

    Hi ,
    I have created package based on your question and decribed in detail in below post:-
    https://msbitips.wordpress.com/2015/04/12/ssis-removing-datestamp-from-file-name-when-moving-from-one-location-to-other/
    You need package code, just add comment in this thread.
    Thanks
    Prasad
    Mark this as Answer if it helps you to proceed on further.

  • Load data from file and send to background

    Hello, is it possible to load data from a file on the presentation server and then create a batch input to call a transaction with those values but on background NOT using data set?
    Thanks in advance.

    U can surely design the process to be executed in various ways..one of them is as below ::
    Upload ABAP.
    1. It reads the file from the presentation server and exports it into INDX database with a specific filename.
    2. Updates a ztable with user/upload date and time/filename/status=U.
    Batch ABAP.
    1. It reads the ztable for all the files with status=U.
    2. Using the filename IMPORTS the data from INDX database.
    3. Creates the batch input to call transaction.
    4. Sets the status as process along with process date and time.
    With the above you can have multiple uploading data and batch job picking up each file and doing the needful.
    Regards
    Anurag

  • Load data from file error - it's ok now

    hi
    i'm trying to load data from .ctl file, previously created by smallworld, using enterprise manager and i am asked for host credentials (username and pswrd). i assume these host credentials are of operating system. anyway, i have tried to enter username and pswrd i use when logging in windows and another time username and pswrd for database account as well, but none it these is working. always get a message: RemoteOperationException: ERROR: Wrong password for user.
    need to solve this problem because it's urgent.
    any help is appreciated
    thanks
    Message was edited by:
    uncle carmine

    Your error will be the same as this posting
    Jobs Credentials Problem
    What it needs is the Windows User and it needs to have the Local Security privilege 'Log on as a batch job' . This will be probably already assigned to the ORA_DBA group. So enure that the user you use to logon to Windows is in the ORA_DBA group.

Maybe you are looking for

  • Error code: 0x80070035 The network path was not found

    "Error code: 0x80070035 The network path was not found" while trying to access another PC running Windows 7 Ultimate I searched and read dozens of similiar posts to try to resolve this issue with no success. The situation is, I have a router in home

  • How do i connect apple cinema display a1082 to my new macbook pro

    I have a macbook pro intel core duo2 and i'm trying to connect my apple cinema display a1092 to my computer, there is an adapter available, but it does not seem to address the fireware cable coming out of my cinema display

  • Generate Paper Report with dynamic columns in Reports 9i

    Hi, I'd like to know if it's possible to select wich columns I want to show in the report just before it is shown. If yes, how can I do it? I'm using 9i Developer Suite and I'm calling the report from Oracle Forms. Thanx

  • Runnable interface declaration

    Hello, Although the function run() is inside the public interface Runnable. its once again declared as abstract. Can i get to know the reason for this ? Thanks in advance.

  • Maintain Web Server  settings in SWu3

    Hi all, We are working on SRM 7.1. Can someone pls explain me the use of the node"Maintain Web Server " in SWU3  transaction? If we are using UWL in Portal to execute the work items,do we need to activate this setting in SWU3? Pls advise.