Running PC-SPANŽ Reports and Export Datafiles in Batch

updated January 2, 2001

 

 

 

Introduction

 

Often, PC-SPAN users would like to issue one command which would accomplish some or all of the following:

 

 

This type of task can be accomplished using several utilities included with PC-SPAN -- spanit, spanReport, spanProducts, and spanProductsReport.

 

The spanit utility allows you to create a simple script file which accomplishes loading of SPAN file(s), loading of position file(s), calculation of performance bond requirements, and saving the results to an XML-based SPAN document file (a .spn file).

 

The spanReport utility allows you to take that SPAN document file and in one operation generate three reports:

 

 

The spanProducts utility similarly allows you to take the SPAN document file as input, and in one operation generate four comma-delimited datafiles which can then easily be imported into other applications:

 

 

The spanProductsReport utility allows you to take the SPAN document file as input and in one operation generate four reports:

 

 

The spanReport, spanProducts, and spanProductsReport utilities are all examples of PC-SPAN's batch reporting capability, and their use is described herein.

 

The executions of spanit, spanReport spanProducts, and/or spanProductsReport can themselves be accomplished from within a batch file.  By creating such a batch file, and by placing a shortcut to this batch file on the Windows desktop, you can initiate entire production processes with one mouseclick.

 

 

Using the spanReport utility

 

The full name of this utility is spanReport.hta and it is located in the rptModule subdirectory of the directory where PC-SPAN is installed.  Typically this would be c:\span4\rptModule.  The .hta stands for "hyper-text application."

 

You can run the utility either (a) from within the rptModule directory, or (b) by providing the path to the rptModule directory.  The syntax is:

 

\span4\rptModule\spanReport.hta  xmlFileName [busDate] [firm]

 

where

 

 

For example, suppose that the SPAN document file span.spn contains results for a single business date, November 11, 2000.  The following command would generate the three reports for all portfolios for that business day.

 

            spanReport.hta span.spn

 

The following command would generate the three reports for all accounts for firm 001 for that business day:

 

spanReport.hta span.spn 20001111 001

 

If span.spn contained data for November 11th and November 12th, the following command would generate reports for all accounts for the 12th:

 

spanReport.hta span.spn 20001112

 

and the following command would generate reports for all accounts for firm 001 for the 12th:

 

spanReport.hta span.spn 20001112 001

 

 

Output of the spanReport utility

 

When you run spanReport.hta, if the reports could be successfully generated, the results are created as three files in the Reports subdirectory of the application directory, typically \span4\Reports.  The files are:

 

ˇ          Positions.htm

ˇ          PB Requirements.htm

ˇ          PB Req Delim.txt

 

The first two files can then be opened in any Web browser (Microsoft Internet Explorer version 5.5 recommended) for viewing and/or printing.

 

The third file, containing performance bond requirements in comma-delimited format, can be imported into other applications.

 

 

Using the spanProducts utility

 

Using spanProducts is almost exactly analogous to using spanReport.  The full name of the utility is spanProducts.hta and it is located in the rptModule subdirectory of the directory where PC-SPAN is installed.  Typically this would be c:\span4\rptModule.

 

You can run the utility either (a) from within the rptModule directory, or (b) by providing the path to the rptModule directory.  The syntax is:

 

\span4\rptModule\spanProducts.hta  xmlFileName [busDate]

 

where

 

 

Output of the spanProducts utility

 

When you run spanProducts.hta, if the datafiles could be successfully generated, the results are created as four files in the Reports subdirectory of the application directory, typically \span4\Reports.  The files are:

 

ˇ          Products.txt

ˇ          Futures-Physicals-Combinations.txt

ˇ          Series.txt

ˇ          Options.txt

 

 

Using the spanProductsReport utility

 

The full name of the utility is spanProductsReport.hta and it is located in the rptModule subdirectory of the directory where PC-SPAN is installed.  As with the other utilities, you can run it either (a) from within the rptModule directory, or (b) by providing the path to the rptModule directory.  The syntax is:

 

\span4\rptModule\spanProductsReport.hta  xmlFileName [busDate [ec [cc] ] ]

 

where

 

 

If the exchange complex acronym is not provided, the report will be produced for all exchange complexes for the specified point in time.  Similarly, if a combined commodity code is not specified, the report will be produced for all combined commodities for the specified exchange complex. 

 

 

Output of the spanProductsReport utility

 

When you run spanProductsReport.hta, if the reports could be successfully generated, the results are created as various files in the Reports subdirectory of the application directory, typically \span4\Reports.  The files are:

 

ˇ          Products<xx>.htm

ˇ          Contracts<xx>.htm

ˇ          RiskArrays<xx>.htm

ˇ          RiskArraysStd<xx>.htm

 

where <xx> identifies the exchange complex and combined commodity for which the report was generated.

 

 

Logging

 

A log file is also created in the Reports subdirectory, named rptBatch.log.  Any previous version of this logfile is overwritten.  The following is an example of a log file:

 

rptBatch.log

 

Batch Report Utility log

 

8/30/2000  9:59

 

Batch Parameters:

XML File: ../data/mult_pit.spn

Bus Date: undefined

Firm:     undefined

 

Generated 'Positions' report

 

Generated 'PB Requirements' report

 

Generated 'PB Req Delim' report

 

*** Normal completion ***

 

 

However, if errors were detected, such that the reports cannot be created, the utility generates an error log that describes what went wrong.  The error log is also created in the Reports subdirectory and is named rptBatch.err.  (Any previous version of the error log is overwritten.)  The following is an example of an error log file:

 

rptBatch.err

 

Batch Report Utility log

 

8/30/2000  9:57

 

*** Operation failed !!! ***

 

ERROR: Not all required parameters are specified

 

Usage:  rptBatch.hta  xmlFileName [busDate] [firm]

 

 

Contents of the datafiles produced by spanProducts

 

As described above, spanProducts produces four comma-delimited datafiles:

 

ˇ          Products.txt

ˇ          Futures-Physicals-Combinations.txt

ˇ          Series.txt

ˇ          Options.txt

 

Each of these begins with a line of column-headers, identifying each data element.  Here are the detailed descriptions of each file and its data elements.

 

Products.txt:  these contains a record for every product family for the selected point in time.  For example, if CME data is loaded, there would be records for product families including S&P 500 futures, options on S&P 500 futures, E-Mini S&P 500 futures, and options on E-Mini S&P 500 futures.  Specific data elements are:

 

 

 

Futures-Physicals-Combinations.txt:  contains a record for every tradeable instrument at the specified point in time which is not an option.  Specific data elements are as shown.  Descriptions are provided only for those elements which are not present in the Products datafile.

 

 

 

Series.txt:  contains a record for every option series for the specified point in time.  Descriptions are provided only for those elements which are not present in the Futures-Physicals-Combinations datafile.  Specific data elements are:

 

 

Options.txt:  contains a record for every option for the specified point in time.  Descriptions are provided only for those elements which are not present in the Series datafile.  Data elements are: