|
This document provides a technical reference to the real-time component interface,
which is separately available for PC-SPAN® version 4. With this additional software module,
you can develop programs which interface to PC-SPAN in real-time.
For example, suppose a customer requests an order. Using the component interface,
your program can call PC-SPAN, specify the updated position that will result from the order,
request that the performance bond be calculated, and receive back the updated performance bond
requirement — in extremely short execution times.
Dispinterface Ispancom
methods:
short Load(BSTR fileName, boolean useExtLayout);
Loads into the PC-SPAN any file, specified by fileName. All position files (*.txt
and .pos) require corresponding risk parameter files to be already loaded. Positions are loaded
into the currently selected point in time. If point in time is not selected positions are loaded
into the point in time specified in the position file. If this point in time is not present
positions are loaded into the first available point in time. useExtLayout parameter specifies
whether PC-SPAN should use extended file layout when loading positions. It is only used for loading
old format position files (*.txt). Return value can be 0 (success) or non-zero (failure).
short Save(BSTR fileName);
Saves all the information from PC-SPAN into the file, specified by fileName.
Information is saved in the XML format. Return value can be 0 (success) or non-zero (failure).
short SelectPIT(BSTR busDate, short isSettle, short isFinal, BSTR busTime);
Selects specified point in time as current. busDate has following format: YYYYMMDD.
isSettle and isFinal can have following values:
-1 – ignore
0 – false
1 – true
busTime has format: HHMM. If busDate is empty the rest of the parameters are
ignored and first available point in time is selected. If either isSettle or isFinal is set to –1
this parameter and all parameters following it are ignored. If busTime is empty it is ignored.
Return value can be 0 (success) or non-zero (failure).
short SelectPortfolio(BSTR firmCode, BSTR acctCode, BSTR segType);
Selects specified portfolio as current. This method searches for the specified
portfolio in the currently selected point in time. If point in time is not selected it fails. If
firmCode is empty the rest of the parameters are ignored and first available portfolio is selected.
If either acctCode or segType is empty this parameter and all parameters following it are ignored.
Return value can be 0 (success) or non-zero (failure).
void ResetPIT();
Sets currently selected point in time to NULL (removes selection). Also resets
portfolio selection.
void ResetPortfolio();
Sets currently selected portfolio to NULL (removes selection).
short Calculate();
Performs SPAN requirements calculations for the currently selected object. If
portfolio selection is not NULL it does calculations only for the selected portfolio. If it is NULL
and point in time selection is not NULL it does calculations for all portfolios in the selected
point in time. If both selected portfolio and selected point in time are NULL it does calculations
for all points in time and portfolios loaded into PC-SPAN. Return value can be 0 (success) or
non-zero (failure).
double GetPortfLongFutValue();
Returns long futures value calculated for the selected portfolio. If portfolio is
not selected (NULL) it returns 0.
double GetPortfShortFutValue();
Returns short futures value calculated for the selected portfolio. If portfolio is
not selected (NULL) it returns 0.
double GetPortfLongOptValue();
Returns long options value calculated for the selected portfolio. If portfolio is
not selected (NULL) it returns 0.
double GetPortfShortOptValue();
Returns short options value calculated for the selected portfolio. If portfolio is
not selected (NULL) it returns 0.
double GetPortfSpanReq(short pbClass, boolean isInitial);
Returns SPAN requirement calculated for the selected portfolio. pbClass can be
1(CORE) or 2(RESERVE). isInitial indicates maintenance or initial requirement. If portfolio is not
selected (NULL) it returns 0.
double GetPortfTotalReq(short pbClass, boolean isInitial);
Returns SPAN requirement calculated for the selected portfolio. pbClass can be
1(CORE) or 2(RESERVE). isInitial indicates maintenance or initial requirement. If portfolio is not
selected (NULL) it returns 0.
void Delete();
Deletes currently selected object from PC-SPAN. If portfolio selection is not NULL
it deletes only the selected portfolio. If it is NULL and point in time selection is not NULL it
deletes selected point in time. If both selected portfolio and selected point in time are NULL
whole contents of the PC-SPAN is deleted.
void SetLogLevel(short processId, short priorityId);
Use this method to specify logging level for PC-SPAN. processLimit — upper limit
for process id of the log message source. priorityLimit — lower limit for the log message priority.
Possible values for parameters are:
For processId:
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 priorityId:
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).
void LogSave(BSTR fileName);
Saves PC-SPAN log into the file specified by fileName.
short CreatePortfolio(BSTR firmCode, BSTR acctCode, BSTR segType);
Creates a new portfolio with specified parameters in the selected point in time and
selects it as current. Fails if point in time is not selected. If portfolio with given parameters
already exist selects the existing portfolio as current (does not create a duplicate one). If
segType is empty “N/A” segment type is assumed. Returns 0 (success) or non-zero (failure).
short SetPortfAcctType(BSTR acctType, boolean isClearing);
Sets account type for the selected portfolio. If portfolio is not selected – fails.
If method does not find specified account type in the organization master database it also fails.
If selected portfolio already has some positions defined method fails. Following values are
currently defined for the acctType:
N - normal
M - member
H - hedge
S - speculator
O - omnibus (speculator)
Q - omnibus (hedge).
isClearing specifies whether account is customer or clearing. Returns 0 (success)
or non-zero (failure).
short SetPortfParent(BSTR firmCode, BSTR acctCode, BSTR segType);
Sets parent portfolio for the selected portfolio. Used only for omnibus accounts.
Only omnibus account can be a parent of another portfolio. Only one level of parents is supported.
Fails if portfolio is not selected, parent portfolio can not be found or omnibus rules are
violated. Returns 0 (success) or non-zero (failure).
short SetPortfCurrency(BSTR currencyCode);
Sets currency for the selected portfolio. currencyCode is a three-letter ISO code
for the currency (USD, EUR, GBP etc.). Fails if portfolio is not selected or currency is not
defined in the organization master database. Returns 0 (success) or non-zero (failure).
BSTR GetPortfCurrency();
Returns a three-letter ISO code for the currency of the selected portfolio. If
portfolio is not selected or currency for it is not specified method returns an empty string.
short SetPortfLedgerBalance(double value);
Sets ledger balance for the selected portfolio. Fails if portfolio is not selected.
Returns 0 (success) or non-zero (failure).
double GetPortfLedgerBalance();
Returns ledger balance for the selected portfolio. If portfolio is not selected
returns 0.
short SetPortfOpenTradeEquity(double value);
Sets open trade equity for the selected portfolio. Fails if portfolio is not
selected. Returns 0 (success) or non-zero (failure).
double GetPortfOpenTradeEquity();
Returns open trade equity for the selected portfolio. If portfolio is not selected
returns 0.
short SetPortfSecurityOnDeposit(double value);
Sets security on deposit for the selected portfolio. Fails if portfolio is not
selected. Returns 0 (success) or non-zero (failure).
double GetPortfSecurityOnDeposit();
Returns security on deposit for the selected portfolio. If portfolio is not
selected returns 0.
short SetPortfPosition(BSTR exchCmplxAcro, BSTR exchAcro, BSTR pfCode, short pfType, BSTR
futPeriod, BSTR optPeriod, boolean isPut, double strike, long totalLong, long totalShort, long
intraLong, long intraShort, long interLong, long interShort);
Sets positions in the selected portfolio in the specified contract. If portfolio is
not selected or contract can not be found method fails. Parameters:
exchCmplxAcro - exchange complex acronym (“CME”, “BOTCC”)
exchAcro - exchange acronym (“CME”, “CBT”)
pfCode - product family code (“SP”, “BP”)
pfType - product family type:
1 - physical
2 - debt
3 - stock
11 - future
12 - equivalence debt
21 - option on physical
22 - option on future
23 - option on equity
31 - combination
41 - option on combination
futPeriod - period code for future contract (period code for the underlying
contract for options). Format is usually YYYYMM, there are special cases like weeklies and flexes
when some characters are added to this format (for example “200002W3”). For physicals, equity and
options on physicals/equity this parameter should be set to “000000”.
optPeriod - period code for option contract. This parameter and following contract
identification parameters are ignored for non-option contracts. Same format as futPeriod.
isPut - put/call flag for options. True means put.
strike - strike price for options.
totalLong - new value for total long positions. If portfolio is net based this
value will be used for calculating net positions (Net = totalLong – totalShort).
totalShort - new value for total short positions. If portfolio is net based this
value will be used for calculating net positions (Net = totalLong – totalShort).
intraLong - new value for intra long positions. If portfolio is net based this
value is ignored. It is used for calculating number of naked positions (NakedLong = totalLong –
intraLong - interLong).
intraShort - new value for intra short positions. If portfolio is net based this
value is ignored. It is used for calculating number of naked positions (NakedShort = totalShort –
intraShort - interShort).
interLong - new value for inter long positions. If portfolio is net based this
value is ignored. It is used for calculating number of naked positions (NakedLong = totalLong –
intraLong - interLong).
interShort - new value for inter short positions. If portfolio is net based this
value is ignored. It is used for calculating number of naked positions (NakedShort = totalShort –
intraShort - interShort).
If number of positions specified is inconsistent totalLong < intraLong +
intraShort or totalShort < intraShort + interShort method fails. Returns 0 (success) or non-zero
(failure).
short ChangePortfPosition(BSTR exchCmplxAcro, BSTR exchAcro, BSTR pfCode, short pfType,
BSTR futPeriod, BSTR optPeriod, boolean isPut, double strike, long totalLong, long totalShort, long
intraLong, long intraShort, long interLong, long interShort);
Modifies positions in the selected portfolio in the specified contract. If
portfolio is not selected or contract can not be found method fails. Parameters:
exchCmplxAcro - exchange complex acronym (“CME”, “BOTCC”)
exchAcro - exchange acronym (“CME”, “CBT”)
pfCode - product family code (“SP”, “BP”)
pfType - product family type:
1 - physical
2 - debt
3 - stock
11 - future
12 - equivalence debt
21 - option on physical
22 - option on future
23 - option on equity
31 - combination
41 - option on combination
futPeriod - period code for future contract (period code for the underlying
contract for options). Format is usually YYYYMM, there are special cases like weeklies and flexes
when some characters are added to this format (for example “200002W3”). For physicals, equity and
options on physicals/equity this parameter should be set to “000000”.
optPeriod - period code for option contract. This parameter and following contract
identification parameters are ignored for non-option contracts. Same format as futPeriod.
isPut - put/call flag for options. True means put.
strike - strike price for options.
totalLong - change in total long positions. If portfolio is net based this value
will be used for calculating change in net positions (NetChange = totalLong – totalShort).
totalShort - change in total short positions. If portfolio is net based this value
will be used for calculating change in net positions (NetChange = totalLong – totalShort).
intraLong - change in intra long positions. If portfolio is net based this value
is ignored. It is used for calculating change in number of naked positions (NakedLongChange =
totalLong – intraLong - interLong).
intraShort - change in intra short positions. If portfolio is net based this value
is ignored. It is used for calculating change in number of naked positions (NakedShortChange =
totalShort – intraShort - interShort).
interLong - change in inter long positions. If portfolio is net based this value
is ignored. It is used for calculating change in number of naked positions (NakedLongChange =
totalLong – intraLong - interLong).
interShort - change in inter short positions. If portfolio is net based this value
is ignored. It is used for calculating change in number of naked positions (NakedShortChange =
totalShort – intraShort - interShort).
If number of positions specified is inconsistent totalLong < intraLong +
intraShort or totalShort < intraShort + interShort method fails. Returns 0 (success) or non-zero
(failure).
short SavePositions(BSTR fileName);
Saves positions for the selected object into the file, specified by fileName. If
selected portfolio is not NULL saves only positions for selected portfolio. If selected portfolio
is NULL, but selected point in time is not saves positions for all portfolios in the selected point
in time. If both selected portfolio and selected point in time are NULL method fails. Returns 0
(success) or non-zero (failure).
back to top
|