The mktstate package provides the functionality to determine whether a symbol update has been received within the trading hours of its parent market.
There are three sorts of market CloseType handled by this package:
- "next" - The update after the market close time is the closing value
- "wait" - The next update with CloseField and CloseValue is the closing value. This could be used for example to interrogate a flag on the update
- "snapshot" - Takes a snapshot of the current data at the closing time.
These types sould be defined in the CloseType field, for example for Market AAA with a "next" closetype, the following pipeline configuration option should be used
database-insert "/TRADEGROUP/AAA" "CloseType" "next"
For market BBB which is of type "wait" whereby field "Status" has a value of "C" when the symbol has a close price, the following configuration options would be used:
database-insert "/TRADEGROUP/BBB" "CloseType" "wait"
database-insert "/TRADEGROUP/BBB" "CloseField" "Status"
database-insert "/TRADEGROUP/BBB" "CloseValue" "C"
mktstate.close_symbol |
( |
var |
mkt, |
|
|
var |
symname, |
|
|
var |
pricefieldname, |
|
|
var |
closefieldname |
|
) |
| |
Handle closing a symbol.
- Parameters
-
mkt | - Market that the symbol belongs to |
symname | - Symbolname that we wish to close |
pricefieldname | - Name of the output field used for price (data dictionary name) |
closefieldname | - Name of the output field used for closing price (data dictionary name) |
- Return values
-
nil | - Next updates will close |
- Returns
- - An update packet containing closing values
This function exists solely to handle the snapshot close markets
mktstate.force_reclose |
( |
var |
symname, |
|
|
var |
mkt |
|
) |
| |
Force a symbol to reclose.
- Parameters
-
symname | - (incoming) Symbolname that we want to force to be open |
mkt | - Market |
- Return values
-
nil | - No further action required |
1 | - Create a snapshot now |
mktstate.handle |
( |
var |
updatepkt, |
|
|
var |
inname, |
|
|
var |
mkt |
|
) |
| |
Handle the market status for equities.
- Parameters
-
updatepkt | - Incoming update |
inname | - Symbol name that we want to handle the market status of |
mkt | - Market that this symbol belongs to |
- Note
- In this implementation, the symbol name is the incoming feed symbol
- Return values
-
mktstate.CLOSED | - Market is closed (don't send updates) |
mktstate.OPEN | - Market is open (send updates) |
mktstate.LASTUPDATE | - This is the last update |
mktstate.snapshot_close |
( |
var |
symname, |
|
|
var |
closename, |
|
|
var |
pricefieldname, |
|
|
var |
closefieldname |
|
) |
| |
Create and send a snapshot close.
- Parameters
-
symname | - Normalised name |
closename | - Name to be used for the closing symbol |
pricefieldname | - Name of the output field used for price (data dictionary name) |
closefieldname | - Name of the output field used for closing price (data dictionary name) |
- Returns
- An update packet containing the closing values