Caplin Trader 5.1.0

Class: module:ct-fx/services/BusinessDateService

module:ct-fx/services/BusinessDateService()

The interface represents a service that retrieves FX business date information. The implementors of this interface should allow for listeners to be added so that if a day roll occurs, they can be notified of changing business dates.

Note that this interface supports asynchronous calls for business dates via callbacks, but if this is not required, the implementor can immediately invoke the callback with the required information.

Constructor

new module:ct-fx/services/BusinessDateService()

Methods

addSettlementDatesListener(sInstrument, pTenors, fCallback)

Adds a listener to listen to settlement date changes for a set of tenors.

Parameters:
Name Type Description
sInstrument String

The instrument for the wanted settlement dates.

pTenors Array

The list of tenors for the wanted settlement dates.

fCallback function

The function to call back when the settlement dates are known. function arguments: sInstrument The instrument for the requested settlement dates mSettlementDates The map of tenor keys -> settlement dates values.

See:

addTenorListener(sInstrument, sSettlementDate, fCallback)

Adds a listener for changes to a tenor for the specified settlement date. If there is no corresponding tenor, the method should callback with a value of 'broken'.

Parameters:
Name Type Description
sInstrument String

The instrument for the wanted tenor.

sSettlementDate String

The settlement date for the wanted tenor, in the format yyyymmdd.

fCallback function

The function to call back when the tenor is known. function arguments: sInstrument The instrument for the requested tenor. sTenor The tenor or 'broken'.

See:
  • removeTenorListener

addTradeDateListener(sInstrument, fCallback)

Adds a listener to listen for trade date changes. If there is a date roll, the listener should be informed with the new trade date.

Parameters:
Name Type Description
sInstrument String

The instrument for the submitted trade.

fCallback function

The function to be called when the trade date is known. function arguments: sInstrument The instrument for the trade date sTradeDate The trade date in format yyyymmdd.

See:

addTransactionDateListener(sInstrument, fCallback)

Adds a listener to listen for transaction date changes. If there is a date roll, the listener should be informed with the new transaction date.

Parameters:
Name Type Description
sInstrument String

The instrument for the submitted trade.

fCallback function

The function to be called when the transaction date is known. function arguments: sInstrument The instrument for the transaction date sTransactionDate The transaction date in format yyyymmdd.

See:

getSettlementCalendar(sInstrument, sYear, sMonth, fCallback)

Retrieves settlement calendar information for the specified instrument, year and month.

Parameters:
Name Type Description
sInstrument String

The instrument to get the settlement calendar information for.

sYear String

The year for the wanted calendar information, in the format yyyy.

sMonth String

The month for the wanted calendar information, in the format mm.

fCallback function

The callback function that will be called with the calendar information function arguments: sInstrument The instrument the calendar information is for sYear The year the information is for sMonth The month the information is for pDates A list of valid settlement dates

isValidBusinessDate(sInstrument, sDate, fCallback)

Checks to see if the specified instrument can be settled on the specified settlement date.

Parameters:
Name Type Description
sInstrument String

The instrument to check the date for.

sDate Date

the settlement date to check to see if the instrument can be settled on.

fCallback function

The function to callback with the validity of the settlement date. function arguments: sInstrument The instrument to check the settlement date for sSettlementDate The settlement Date that this request was for. bValid True if the instrument can be settled on the date, false otherwise.

removeSettlementDatesListener(fCallback)

Removes a listener that was previously listening for settlement date changes.

Parameters:
Name Type Description
fCallback function

The function previously listening to callback changes.

See:

removeTenorListener(fCallback)

Removes a listener that was previously listening for tenor changes.

Parameters:
Name Type Description
fCallback function

The function previously listening to callback changes.

See:

removeTradeDateListener(fCallback)

Removes a listener that was previously listening for trade date changes.

Parameters:
Name Type Description
fCallback function

The function previously listening to callback changes.

See:

removeTransactionDateListener(fCallback)

Removes a listener that was previously listening for transaction date changes.

Parameters:
Name Type Description
fCallback function

The function previously listening to callback changes.

See: