|
This guide to PC-SPAN® script language details the scripting utility and general
scripting rules. The commands in both spanit and spanitrm, as well as additional commands, include
a description, parameters and remarks.
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 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 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.
back to top
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.
back to top
Commands Available in both Spanit and Spanitrm
- Load
fileName [,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. 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.
back to top
- 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 |
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. 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.
back to top
- 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 (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 |
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.
back to top
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.
- 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).
back to top
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.
back to top
Additional Commands Available only in SPAN Risk Manager
- SelectPointInTime
[busDate [,settleFlag [(,finalFlag | ,busTime)[,
description]]]]
Description:
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.
back to top
- SelectExchangeComplex
excAcro
Description:
Select Exchange Complex for use in the following Calc and Update commands.
Parameters:
| excAcro |
exchange complex acronym (required) |
Remarks:
Use this command to select Exchange Complex for use in the Calc and Update commands. Point In
Time should be already selected prior to using this command. If no Point In Time is selected an
error will be generated.
back to top
Description:
Select BFCC for use in the following Calc and Update commands.Parameters:
Parameters:
| ccCode |
combined commodity code (required) |
Remarks:
Use this command to select BFCC for use in the Calc and Update commands. Exchange Complex
should be already selected prior to using this command. If no Exchange Complex is selected an error
will be generated.
back to top
- SelectProductFamily
exchCode ,pfCode ,pfType
Description:
Select Product Family for use in the following Calc and Update commands.
Parameters:
| exchCode |
exchange code (required) |
| pfCode |
product family code (required) |
| pfType |
product family type (required) |
Remarks:
Use this command to select Product Family for use in the Calc and Update commands.
BFCC should be already selected prior to using this command. If no BFCC is selected an error will
be generated.
Possible values for pfType:
- PHY - physical
- FUT - future
- CMB - combination
- EQTY - equity (stock)
- DEBT - debt
- EDEBT - debt equivalence
- OOP - option on physical
- OOF - option on future
- OOC - option on combination
- OOS - option on stock
back to top
- SetStartPeriod
periodCode
Description:
Set Starting Period for the period range used in Update commands.
Parameters:
| periodCode |
period code in YYYYMM format (required) |
Remarks:
Use this command to set Starting Period for the period range for use in Update commands.
Product Family should be already selected prior to using this command. If no Product Family is
selected an error will be generated.
back to top
Description:
Set Ending Period for the period range used in Update commands.
Parameters:
| periodCode |
period code in YYYYMM format (required) |
Remarks:
Use this command to set Ending Period for the period range for use in Update commands.
Product Family should be already selected prior to using this command. If no Product Family is
selected an error will be generated.
back to top
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.
back to top
Description:
Resets Exchange Complex selection.
Parameters:
Remarks:
Use this command to reset Exchange Complex selection. Also resets BFCC and Product
Family.
back to top
Description:
Resets BFCC selection.
Parameters:
Remarks:
Use this command to reset BFCC selection. Also resets Product Family.
back to top
Description:
Resets Product Family selection.
Parameters:
Remarks:
Use this command to reset Product Family selection.
back to top
Description:
Resets Period Range selection.
Parameters:
Remarks:
Use this command to reset Period Range selection.
back to top
Description:
Calculates Implied Volatilities for selected object.
Parameters:
Remarks:
Use this command to Calculate Implied Volatilities. It works on the lowest level object
already selected (product family, bfcc, exchange complex, point in time). If point in time is not
selected it will work on all loaded points in time.
back to top
Description:
Does Call/Put Averaging for selected object.
Parameters:
Remarks:
Use this command to do Call/Put Averaging. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time.
back to top
Description:
Calculates Series Level Volatilities for selected object.
Parameters:
Remarks:
Use this command to Calculate Series Level Volatilities. It works on the lowest level object
already selected (product family, bfcc, exchange complex, point in time). If point in time is not
selected it will work on all loaded points in time.
back to top
Description:
Calculates Theoretical Prices for selected object.
Parameters:
Remarks:
Use this command to Calculate Theoretical Prices. It works on the lowest level
object already selected (product family, bfcc, exchange complex, point in time). If point in time
is not selected it will work on all loaded points in time.
back to top
Description:
Calculates Risk Arrays for selected object.
Parameters:
Remarks:
Use this command to Calculate Risk Arrays. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. This method uses option level volatilities. If option
level volatility is not determined for a given contract series level volatility is used.
back to top
Description:
Calculates Risk Arrays for selected object.
Parameters:
Remarks:
Use this command to Calculate Risk Arrays. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. This method uses option level volatilities.
back to top
Description:
Calculates Risk Arrays for selected object.
Parameters:
Remarks:
Use this command to Calculate Risk Arrays. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. This method uses series level volatilities.
back to top
- UpdatePrice
value [,method]
Description:
Updates Prices for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Prices. It works on the lowest level object already selected
(product family, bfcc, exchange complex, point in time). If point in time is not selected it will
work on all loaded points in time. It will update prices using value and one of the following
methods:
Possible Values for Method:
- SET - set price to value
- CHG - change price by value
- PCNT - change price by value %
SET is the default method
back to top
- UpdateVolatility
value [,method]
Description:
Updates Volatilities for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Volatilities. It works on the lowest level object already selected
(product family, bfcc, exchange complex, point in time). If point in time is not selected it will
work on all loaded points in time. It will update volatilities using value and one of the following
methods:
Possible Values for Method:
- SET - set volatility to value
- CHG - change volatility by value
- PCNT - change volatility by value %
SET is the default method
back to top
- UpdatePriceScan
value [,method]
Description:
Updates Price Scans for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Price Scans. It works on the lowest level object already selected
(product family, bfcc, exchange complex, point in time). If point in time is not selected it will
work on all loaded points in time. It will update price scans using value and one of the following
methods:
Possible Values for Method:
- SET - set price scan to value
- CHG - change price scan by value
- PCNT - change price scan by value %
SET is the default method
back to top
- UpdateVolScan
value [,method]
Description:
Updates Volatility Scans for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Volatility Scans. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. It will update volatility scans using value and one of
the following methods:
Possible Values for Method:
- SET - set volatility scan to value
- CHG - change volatility scan by value
- PCNT - change volatility scan by value %
SET is the default method
back to top
- UpdateRiskFreeRate
value [,method]
Description:
Updates Risk-Free Rates for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Risk-Free Rates. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. It will update risk-free rates using value and one of
the following methods:
Possible Values for Method:
- SET - set risk-free rate to value
- CHG - change risk-free rate by value
- PCNT - change risk-free rate by value %
SET is the default method
back to top
- UpdateDividendYield
value [,method]
Description:
Updates Dividend Yields for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Dividend Yields. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. It will update dividend yields using value and one of
the following methods:
Possible Values for Method:
- SET - set dividend yield to value
- CHG - change dividend yield by value
- PCNT - change dividend yield by value %
SET is the default method
back to top
- UpdateTimeToExpiration
value [,method]
Description:
Updates Times To Expiration for selected object.
Parameters:
| value |
update value (required) |
| method |
update method (optional) |
Remarks:
Use this command to Update Times To Expiration. It works on the lowest level object already
selected (product family, bfcc, exchange complex, point in time). If point in time is not selected
it will work on all loaded points in time. It will update times to expiration using value and one
of the following methods:
Possible Values for Method:
- SET - set time to expiration to value
- CHG - change time to expiration by value
- PCNT - change time to expiration by value %
SET is the default method
back to top
- CopyPointInTime
description [,busDate [,settleFlag [,finalFlag |
,busTime]]]
Description:
Copy selected Point In Time into the Point In Time specified by the command attributes.
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 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.
back to top
|