Script Language for PC-SPAN v.4.05 and SPAN Risk Manager
- 1 Scripting Utility
- 1.1 General Scripting Rules
- 1.2 Command List
- 1.3 Commands Available in Both SPANIT and SPANITRM-Clearing
- 1.3.1 Load fileName [(NOREPLACE |,USEXTLAYOUT)][,busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]]
- 1.3.2 Calc [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]] [[,]PORTFOLIO [,firmCode [,acctCode [,segType]]]]
- 1.3.3 Delete [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]] [[,]PORTFOLIO [,firmCode [,acctCode [,segType]]]]
- 1.3.4 Save fileName
- 1.3.5 SaveCalcSummary fileName
- 1.3.6 Log [processLimit][,priorityLimit]
- 1.3.7 LogSave fileName
- 1.3.8 SavePortfolios fileName
- 1.3.9 SavePositions fileName
- 1.3.10 LogClear
- 1.3.11 CopyPointInTime description [,busDate [,settleFlag [,finalFlag | ,busTime]]]
- 1.3.12 ResetPointInTime
- 1.3.13 SelectPointInTime [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]]
- 1.3.14 Print [DateTime] [,SelPIT] [,AllPIT] [,SelExc] [,SelBFCC] [,SelPf] [,StartPeriod] [,EndPeriod]
- 1.4 Additional commands available only in SPAN Risk Manager-Clearing:
- 1.4.1 SaveVarSummary fileName
- 1.4.2 SelectExchangeComplex excAcro
- 1.4.3 SelectBFCC ccCode
- 1.4.4 SelectProductFamily exchCode ,pfCode ,pfType
- 1.4.5 SetStartPeriod periodCode
- 1.4.6 SetEndPeriod periodCode
- 1.4.7 ReplicateBasePrices [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]]
- 1.4.8 ResetExchangeComplex
- 1.4.9 ResetBFCC
- 1.4.10 ResetMarketPrices
- 1.4.11 ResetProductFamily
- 1.4.12 ResetPeriods
- 1.4.13 ResetPrices [productType]
- 1.4.14 CalcImpliedVolatility
- 1.4.15 CalcCallPutAverage
- 1.4.16 CalcSeriesVolatility useZero, minExpTime, maxIn, maxOut, minAccept
- 1.4.17 CalcPrice meth, resetAll
- 1.4.18 CalcRiskArray meth, limitAtOptValue
- 1.4.19 CalcValues
- 1.4.20 DoMarketObservation
- 1.4.21 UpdatePrice value [,method]
- 1.4.22 UpdateVolatility value [,method]
- 1.4.23 UpdatePriceScan value [,method]
- 1.4.24 UpdateVolScan value [,method]
- 1.4.25 UpdateRiskFreeRate value [,method]
- 1.4.26 UpdateDividendYield value [,method]
- 1.4.27 UpdateTimeToExpiration value [,method]
- 1.4.28 ApplyWhatIf fileName [,DO_CALC]
- 1.4.29 ApplyVolatilitySkew [SkewMethod]
- 1.4.30 Additional commands available in PC-SPAN + PC Credit and PC-SPAN RM Clearing + PC Credit
- 1.4.31 SaveCDSPositions fileName
Scripting Utility
PC-SPAN version 4's scripting component is available as a separate utility, called spanit. You can call it from the command line or batch file by issuing the following command:
spanit fileName
Where fileName is a fully specified pathname of the script file. Scripting component will attempt to execute commands in the script file and will return 0 if successful and 1 if any significant error is encountered.
If you have the SPAN Risk Manager-Clearing software, the scripting component is called spanitrm. You work with this component in exactly the same manner as you do with spanit. The only difference is that the script commands available in spanitrm are a superset of those available in spanit.
General Scripting Rules
Script should be written as a regular ASCII file. There are no restrictions on the naming of the file other than restrictions placed by the file system. Every command in the file should be on a separate line (CR serves as a delimiter). Parameters for commands are delimited by comma (any number of spaces between parameters is allowed). Any number of empty lines is allowed between commands. Comments should be placed on separate lines. Comment lines should start with “//”, though any line which starts with something other than one of command keywords will be considered a comment. Script language is case insensitive, however it is recommended that all commands are entered exactly as described in this document for clarity of the script. Any text after the last possible parameter for every command will be ignored. However it is not recommended to exploit this feature for writing comments – it might slow down script processing and can cause your scripts to stop working with future versions of PC-SPAN batch.
Command List
| SPANIT and SpanitRM-Clearing |
| SpanitRM-Clearing Only |
| Calc |
| ApplyVolatilitySkew |
| CopyPointInTime |
| ApplyWhatIf |
| Delete |
| CalcCallPutAverage |
| Load |
| CalcImpliedVolatility |
| Log |
| CalcPrice |
| LogClear |
| CalcRiskArray |
| LogSave |
| CalcSeriesVolatility |
| ResetPointInTime |
| CalcValues |
| Save |
| DoMarketObservation |
| SaveCalcSummary |
| ReplicateBasePrices |
| SavePortfolios |
| ResetBFCC |
| SavePositions |
| ResetExchangeComplex |
| SelectPointInTime |
| ResetMarketPrices |
|
| ResetPeriods | |
| PC-SPAN + PC Credit and PC-SPAN RM Clearing + PC Credit |
| ResetPrices |
| SaveCDSPositions |
| ResetProductFamily |
|
|
| SaveVarSummary |
|
|
| SelectBFCC |
|
|
| SelectExchangeComplex |
|
|
| SelectProductFamily |
|
|
| SetStartPeriod |
|
|
| UpdateDividendYield |
|
|
| UpdatePrice |
|
|
| UpdatePriceScan |
|
|
| UpdateRiskFreeRate |
|
|
| UpdateTimeToExpiration |
|
|
| UpdateVolatility |
|
|
| UpdateVolScan |
Commands Available in Both SPANIT and SPANITRM-Clearing
Load fileName [(NOREPLACE |,USEXTLAYOUT)][,busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]]
Description:
Load file specified in filename into SPAN Risk Manager
Parameters:
Ø fileName fully specified path name of the file to load (required)
Ø busDate business date in YYYYMMDD format (optional)
Ø settleFlag S(settle) or I(intraday) (optional)
Ø finalFlag E(early) or F(final) (optional)
Ø busTime business time in HHMM format (optional)
Ø description point in time description (optional)
Remarks:
Use this command to load files into SPAN Risk Manager. It supports all file formats: *.par, *.pa2, .txt (positions file), and XML. NOREPLACE flag specifies that PC-SPAN should not replace already loaded exchange complexes with the ones from the file (it replaces by default). Other optional parameters could be used if you are loading positions file (.txt or XML format - *.pos). USEXTLAYOUT flag is useful when you are loading a *.txt positions file with Span4 extended layout and want to use this layout (have risk parameter file in XML format). The rest of the parameters specify the point in time where positions should be loaded. If these parameters are not specified (by default) positions will be loaded into the point in time specified in the positions file. If this point in time is not present first available point in time will be used. It is not necessary to fully specify point in time – in most cases just date is sufficient to identify point in time.
Calc [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]] [[,]PORTFOLIO [,firmCode [,acctCode [,segType]]]]
Description:
Calculate portfolios loaded into SPAN Risk Manager.
Parameters:
Ø busDate business date in YYYYMMDD format (optional)
Ø settleFlag S(settle) or I(intraday) (optional)
Ø finalFlag E(early) or F(final) (optional)
Ø busTime business time in HHMM format (optional)
Ø description point in time description (optional)
Ø firmCode firm code for portfolio (optional)
Ø acctCode account code for portfolio (optional)
Ø segType segregation type for portfolio CUST or HOUS (optional)
Remarks:
Use this command to calculate portfolios loaded into SPAN Risk Manager. If no optional parameters are specified all portfolios will be calculated. If some of the parameters specifying point in time are present only portfolios for corresponding points in time will be calculated. Use this command to calculate portfolios loaded into SPAN Risk Manager. If no optional parameters are specified all portfolios will be calculated. If some of the parameters specifying point in time are present only portfolios for corresponding points in time will be calculated. It is not necessary to fully specify point in time – in most cases just date is sufficient to identify point in time. If, in addition to point in time, some parameters specifying particular portfolio are present only corresponding portfolios from the specified point in time will be calculated.
Delete [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]] [[,]PORTFOLIO [,firmCode [,acctCode [,segType]]]]
Description:
Calculate portfolios loaded into SPAN Risk Manager.
Parameters:
Ø busDate business date in YYYYMMDD format (required)
Ø settleFlag S(settle) or I(intraday) (optional)
Ø finalFlag E(early) or F(final) (optional)
Ø busTime business time in HHMM format (optional)
Ø description point in time description (optional)
Ø firmCode firm code for portfolio (optional)
Ø acctCode account code for portfolio (optional)
Ø segType segregation type for portfolio CUST or HOUS (optional)
Remarks:
Use this command to delete portfolios and risk parameters loaded into SPAN Risk Manager. If no optional parameters are specified all portfolios and risk arrays will be deleted. If some of the parameters specifying point in time are present only this points in time corresponding to these parameters will be deleted. It is not necessary to fully specify point in time – in most cases just date is sufficient to identify point in time. If, in addition to point in time, some parameters specifying particular portfolio are present only portfolios corresponding to these parameters in the specified (or first) point in time will be deleted.
Save fileName
Description:
Save SPAN Risk Manager results into the file specified in filename
Parameters:
Ø fileName fully specified path name of the file (required)
Remarks:
Use this command to save SPAN Risk Manager calculation results into the file. Results will be saved in the XML file format.
SaveCalcSummary fileName
Description:
Save PB Calculation Summary file to the file specified in filename in .CSV format
Parameters:
Ø fileName fully specified path name of the file (required)
Remarks:
Use this command to save SPAN Performance Bond calculation results into the specified file. Results will be saved in the .CSV file format.
Log [processLimit][,priorityLimit]
Description:
Specifies parameters for logging.
Parameters:
Ø processLimit upper limit for process id of the log message source (required)
Ø priorityLimit lower limit for the log message priority (optional)
Remarks:
Use this command to specify logging parameters for SPAN Risk Manager. You can issue this command in any place within your script. Possible values for parameters are:
For processLimit:
PROC_ID_LOAD_RISK = 10;
PROC_ID_LOAD_POS = 20;
PROC_ID_LOAD_XML = 30;
PROC_ID_OMNIBUS = 40;
PROC_ID_CALC_START = 51;
PROC_ID_CALC_PBOND = 60;
PROC_ID_CALC_SPREAD = 70;
PROC_ID_CALC_LIQ_RISK = 80;
PROC_ID_CALC_DETAIL_START = 101;
PROC_ID_CALC_SPREAD_DETAIL = 110;
PROC_ID_CALC_LIQ_RISK_DETAIL = 120;
PROC_ID_CALC_POS_DETAIL = 130;
PROC_ID_UPPER = -1;
For priorityLimit:
PRIORITY_ID_LOW = -1;
PRIORITY_ID_NORMAL = 10;
PRIORITY_ID_WARNING = 20;
PRIORITY_ID_ERROR = 30;
Default values are 0 and 30 (only errors are logged).
LogSave fileName
Description:
Saves log into specified file.
Parameters:
Ø fileName fully specified path name of the file for log (required)
Remarks:
Use this command to save SPAN Risk Manager log. You can issue this command in any place within your script.
SavePortfolios fileName
Description:
Saves portfolio into specified file in XML format.
Parameters:
Ø fileName fully specified path name of the file for portfolios (required)
Remarks:
Use this command to save SPAN portfolios to a file. Results will be saved in the XML format.
SavePositions fileName
Description:
Saves positions into the specified file in XML format.
Parameters:
Ø fileName fully specified path name of the file for positions (required)
Remarks:
Use this command to save SPAN positions to a file. Results will be saved in the XML format.
LogClear
Description:
Clears out the SPAN log.
Parameters:
Remarks:
Use this command to clear out the log.
CopyPointInTime description [,busDate [,settleFlag [,finalFlag | ,busTime]]]
Description:
Copy selected Point In Time into the Point In Time specified by the command attributes.
Parameters:
Ø description point in time description, can be empty string
Ø busDate business date in YYYYMMDD format (optional)
Ø settleFlag S(settle) or I(intraday) (optional)
Ø finalFlag E(early) or F(final) (optional)
Ø busTime business time in HHMM format (optional)
Remarks:
Use this command to copy Point In Time. This command creates new Point In Time object exactly matching the selected Point In Time. Attributes of the newly created Point In Time will be changed using parameters specified for the command. If Point In Time with these attributes already exists an error will be generated. Point In Time should be selected prior to using this command. If no Point In Time is selected an error will be generated. This command does not affect selected Point In Time.
ResetPointInTime
Description:
Resets Point In Time selection.
Parameters:
Remarks:
Use this command to reset Point In Time selection. Also resets Exchange Complex, BFCC and Product Family.
SelectPointInTime [busDate [,settleFlag [(,finalFlag | ,busTime)[, description]]]]
Remarks:
Select Point In Time for use in the following Calc and Update commands.
Parameters:
Ø busDate business date in YYYYMMDD format (optional)
Ø settleFlag S(settle) or I(intraday) (optional)
Ø finalFlag E(early) or F(final) (optional)
Ø busTime business time in HHMM format (optional)
Ø description point in time description (optional)
Remarks:
Use this command to select Point In Time for use in the Calc and Update commands. If no optional parameters are specified first available Point In Time will be selected. It is not necessary to fully specify Point In Time – in most cases just date is sufficient to identify Point In Time.
Print [DateTime] [,SelPIT] [,AllPIT] [,SelExc] [,SelBFCC] [,SelPf] [,StartPeriod] [,EndPeriod]
Remarks: