Introduction:
The BBH interest claims system, unlike the other systems rely on the API for reading the daily source data and static data. The utility for calling the API is designed and maintained by us. The purpose of this document is to understand the code technically so that making modifications and configuration changes can be done with ease.
This code runs as a single DLL and the core application making calls using this DLL. The name of the DLL is CSJIT_BBH_IC_API.cs and it has a single class called CSJIT_BBH_IC_API.
The DLL is uploaded as a local code to the systems using it. There is a capability on the core application, when called, download the dll to the local temporary directory and make calls dynamically.
The source code for this dll can be found within ..\meritsoft-shared-libraries\CSHGEN\CSJIT\IC\CSJIT_BBH_IC_API.cs. This code is shared by both IC and CSDR applications. Therefore when making changes you have to make sure that the existing CSDR functionality is not altered.
Dependencies:
This app uses the below libraries:
using System
using System.Linq
using System.Text
using System.Threading.Tasks
using CSHFE
using GenFun
In addition to the above the core code for this module is written within ..\meritsoft-shared-libraries\CSHGEN\CSJIT\BBH\BBH_CSDR_Api.cs
Configuring the API calls:
The configuration of this done via the SETUP->System parameters->Attributes option of the core application using the below system parameters:
Att.[CLNT1_BBH_API_AUTHREGION]:
The location for the resource (URL) where the API calls are made to authenticate the user who is about to read data. The server/resource reside within the firewalls of BBH and has no access to outside.
Therefore the URL is configured by client and tested during UAT releases. The only access we have is their development server. This has to be done on request for any further developments.
The below is an example UAT URL:
https://qcapi.bbh.com/oauth/token?grant_type=client_credentials
Att.[CLNT1_BBH_API_USERNAMEl]:
Username for authenticating the data server access. The user is created and managed by internal IT of BBH
Enc.[CLNT1_BBH_API_PWD]:
Password for authenticating the data server access. The password is created by BBH, then encrypted using Claims Manager encryption utility(AES).
The encrypted value is then saved within the system parameter option.
Att.[CLNT1_BBH_API_DATAREGION]:
The resource location for the source data. Once the user is authenticated using the above attributes, then only have access to use the data centre to read data.
The below is an example data centre URL:
https://qcapi.bbh.com/dataservices/
Att.[CLNT1_BBH_API_PAGESIZE]:
The above parameter determines how many records to be downloaded per page. If the parameter is not specified, it will assume the default value of 100.
Att.[CLNT1_BBH_API_LOGJSON]:
The token indicate if the output from the above query to be returned as JASON format or not. "Y" is for JASON format and others as treated as no.
Making modifications to code:
BBH_CSDR_Api:
a. This DLL has the following primary functions:
- Build up the request model depending based input parameters supplied by the local implementation
Function name: BuildRequestModel
Parameters:
query : GENREPSPEC object containing a list of filter criteria (name[0], value[0], operator[0], name[1], value[1], operator[1] etc..)
filter : GENREPSPEC object containing a list of query criteria (name[0], value[0], name[1], value[1] etc..)
sort : GENREPSPEC object containing a list of fileter criteria (sort[0]. directio[0], sort[1], direction[1] etc...)
fields : List of fields/columns to be returned in the result
page : Integer value for page number (pagination)
pageSize : Integer value for page size (pagination)
The function returns a RequestModel object / or Exception object on error - Making API calls to read Claims data.
Function name: Claims
Parameters:
token : Auth token for API access :
query : (optional) GENREPSPEC containing the query data :
filter : (optional) GENREPSPEC containing the filter data :
sort : (optional) sort GENREPSPEC :
fields : (optional) List of fields/columns - returns all by default :
page : (optional) Integer for the page number :
pageSize : (optional) Integer for the page size :
This function returns the response string from the API call - Call to retrieve FX Rates
Function name: FXRates
Parameters:
token : Auth token for API access
query : (optional) GENREPSPEC containing the query data
filter : (optional) GENREPSPEC containing the filter data
sort : (optional) sort GENREPSPEC
fields : (optional) List of fields/columns - returns all by default
page : (optional) Integer for the page number
pageSize : (optional) Integer for the page size
The response string from the API call - Call to retrieve Fed Fund Rates
Function name: FedFundRates
Parameters:
token : Auth token for API access
query : (optional) GENREPSPEC containing the query data
filter : (optional) GENREPSPEC containing the filter data
sort : (optional) sort GENREPSPEC
fields : (optional) List of fields/columns - returns all by default
page : (optional) Integer for the page number
pageSize : (optional) Integer for the page size
The response string from the API call - Call to retrieve Overdraft Rates
Function name: OverdraftRates
Parameters:
token : Auth token for API access
query : (optional) GENREPSPEC containing the query data
filter : (optional) GENREPSPEC containing the filter data
sort : (optional) sort GENREPSPEC
fields : (optional) List of fields/columns - returns all by default
page : (optional) Integer for the page number
pageSize : (optional) Integer for the page size
The response string from the API call
To release the code changes, you have to build the BBH_IC_Api with these changes.
BBH_IC_Api:
This DLL has the following primary functions:
- Modifying claims data return values:
Open file ..\meritsoft-shared-libraries\CSHGEN\CSJIT\IC\Models\ClaimsResponseModel.cs
Find the the class definition "public class ApiClaim"
Declare a public variable. This variable name must match the field name provided by BBH
Then modify the append line with the variable.
Build the API DLL.
- Modifying FX rates data return values:
Open file ..\meritsoft-shared-libraries\CSHGEN\CSJIT\IC\Models\FXRateResponseModel.cs
Find the the class definition "public class FXrate"
Declare a public variable. This variable name must match the field name provided by BBH
Then modify the append line with the variable.
Build the API DLL.
- Modifying FED fund and/or Overdraft rates data return values:
These two rates are returned from the same source. Therefore the field structure is same and single response model class is used.
Open file ..\meritsoft-shared-libraries\CSHGEN\CSJIT\IC\Models\InterestRateResponseModel.cs
Find the the class definition "public class InterestRate"
Declare a public variable. This variable name must match the field name provided by BBH
Then modify the append line with the variable.
Build the API DLL.
Patching instructions:
Logon to Desktop version of BBH IC Claims Manager
Go to SETUP-->Local implementation (scripts)
Click on the "Upload..." button
Browse for the below file and click Open
CSJIT_BBH_IC_API.DLL
Close the dialog
Data gathered by the API:
The following claims and static data is read daily from the API.
Information on the data downloaded and their description for claims and static data.
CLAIMS:
Note that the location "/csdr/trades/claims" is added (hard coded within the script) to the above URL.
**A token usage would be the beneficial approach for the above in case if client wants to change the path, we do not need to rebuild the DLL
| BBH_REF_NUMBER | Unique id |
| TRANSACTION_TYPE | Transaction type |
| PARTIAL_SETTLEMENT_INDICATOR | Partial sett ind |
| CLIENT_ASSET_TYPE | Cleint asset type |
| CURRENCY_CODE | CCY |
| SECURITY_MOVEMENT_TYPE_CODE | Sec mov type code |
| NET_AMOUNT | Deal amount |
| TRADE_CONSIDERATION_UNSETTLED | Trade cons unsettled |
| SECURITY_NAME | Security name |
| PRIMARY_SECURITY_ID | Primary sec ID |
| SHARE_AMOUNT | Share amount |
| TRADE_QUANTITY_UNSETTLED | Trade QTY unsett |
| TRADE_DATE | Trade date |
| CONTRACTUAL_SETTLEMENT_DATE | Sett date |
| ACTUAL_SETTLEMENT_DATE | Act sett date |
| VALUE_DATE | Value date |
| EXECUTING_BROKER_ID | Broker ID |
| EXECUTING_BROKER | Brokere |
| CLEARING_BROKER_ID | Clearing Broker ID |
| CLEARING_BROKER | Clearing Broker |
| LOCATION_ACCOUNT_NUMBER | Location A/C no |
| LOCATION_ACCOUNT_NAME | Location A/C name |
| RECEIVED_DATE | Received date |
| RECEIPT_METHOD_CODE | Receipt method code |
| RECEIPT_METHOD_DESCRIPTION | Receipt method desc |
| GROUP_CODE | Group code |
| ACCOUNT_GROUP_NAME | Group name |
| HEAD_ACCOUNT_NUMBER | A/C no |
| HEAD_ACCOUNT_NAME | A/C name |
| LEDGER_60 | Ledger 60 |
| ACCOUNT_DIER_CODE | Acc dier code |
| ACCOUNT_CONTRACTUAL_CASH_INDICATOR | Contractual cash ind |
| ENTRY_DEADLINE_INDICATOR | Entry deadlind ind |
| BBH_ENTRY_DEADLINE_DATE | Entry deadline date |
| MET_SUB_DEADLINE_IND | Met sub deadline ind |
| SUBCUSTODIAN_DEADLINE_DATE | Subcustodian deadline date |
| WORKFLOW_STATUS_CODE | Workflow status code |
| ALLOCATION_STATUS_CODE | Alloc status code |
| SETTLEMENT_STATUS_CODE | Sett status code |
| TRADE_STATUS_CODE | Trade status code |
| SETTLEMENT_STATUS_DATE | Sett status date |
| SETTLEMENT_REASON_BBH_CODE | Sett reason code |
| SETTLEMENT_REASON_DESC | Sett reason desc |
| REPAIR_STATUS_IND | Repair status ind |
| INSTITUTION_TYPE_CODE | Institution type code |
| BOOKKEEPING_OFFICE_CODE | Bookkeeping office code |
| REPAIR_REASON | Repair reason |
| FLD_REFERENCE_NUMBER | Repair no |
| REPAIR_CODE | Repair code |
| CLIENT_REF_NUMBER | Client ref number |
| SEC_LENDING_QTY | Sec lending QTY |
| OTHER_QTY | Other QTY |
| TOTAL_QTY | Total QTY |
| POSITION_DATE | Position date |
| SOURCE_CREATION_DATE | Source creation date |
| SONIC_REFERENCE_NUMBER | Sonic ref number |
| BBH_SECURITY_ID | Sec ID |
| ISIN | ISIN |
| SEDOL | Sedol |
| EXECUTING_BROKER_NAME | Executing Broker name |
| PAY_REC | Pay/Rec |
| ETF_INDICATOR | ETF ind |
| SENDER_BIC_ADDRESS | Sender BIC address |
| ALLOCATION DATE/TIME | Allocation date |
| TRADE_REBOOK_INDICATOR | Trade rebook ind |
| RB_WORKFLOW_SOURCE_CD | RebookSourceCd |
| RTD_INDICATOR | Return Del Ind |
| LTRADE_REPAIR_STATUS_IND | Last trade status ind |
FXRATES:
Note that the location "/csdr/rates/fx" is added (hard coded within the script) to the above URL.
**A token usage would be the beneficial approach for the above in case if client wants to change the path, we do not need to rebuild the DLL
| EFFECTIVE_DATE | Effective date of the interest rate. Refreshed on week days |
| CURRENCY_CODE | Currency code(3 letter) for which rate is specified |
| RTE | Interest rate value for the currency for that effective date. |
FEDFUNDRATES:
Note that the location "/csdr/rates/fedfund" is added (hard coded within the script) to the above URL.
**A token usage would be the beneficial approach for the above in case if client wants to change the path, we do not need to rebuild the DLL
| EFFECTIVE_DATE | Effective date for which FED fund rate is specified |
| CURRENCY_CODE | Currency code(3 letter) for which the rate is specified. |
| BIF_PROD_CDE | BIF_PROD_CDE Field |
| SCHDL_CDE | SCHDL_CDE Field |
| BASE_DB_RTE | BASE_DB_RTE Field |
| SPRD_DB_RTE | SPRD_DB_RTE Field |
| BASE_CR_RTE | BASE_CR_RTE Field |
| SPRD_CR_RTE | SPRD_CR_RTE Field |
| LMT_01_RTE | LMT_01_RTE Field |
| LMT_02_RTE | LMT_02_RTE Field |
| LMT_03_RTE | LMT_03_RTE Field |
| LMT_04_RTE | LMT_04_RTE Field |
| LMT_05_RTE | LMT_05_RTE Field |
| LMT_06_RTE | LMT_06_RTE Field |
| LMT_07_RTE | LMT_07_RTE Field |
| LMT_08_RTE | LMT_08_RTE Field |
| LMT_09_RTE | LMT_09_RTE Field |
| LMT_10_RTE | LMT_10_RTE Field |
| BASE_RTE | Base FED fund rate used in claim calculation |
ODRATS/OVERDRAFT RATES:
Note that the location "/csdr/rates/overdraft" is added (hard coded within the script) to the above URL.
**A token usage would be the beneficial approach for the above in case if client wants to change the path, we do not need to rebuild the DLL
Overdraft rates are similar to FEDFUND rates. However the difference is that FEDFUND rates are applicable for USD currency only.
| EFFECTIVE_DATE | Effective date for which FED fund rate is specified |
| CURRENCY_CODE | Currency code(3 letter) for which the rate is specified. |
| BIF_PROD_CDE | BIF_PROD_CDE Field |
| SCHDL_CDE | SCHDL_CDE Field |
| BASE_DB_RTE | BASE_DB_RTE Field |
| SPRD_DB_RTE | SPRD_DB_RTE Field |
| BASE_CR_RTE | BASE_CR_RTE Field |
| SPRD_CR_RTE | SPRD_CR_RTE Field |
| LMT_01_RTE | LMT_01_RTE Field |
| LMT_02_RTE | LMT_02_RTE Field |
| LMT_03_RTE | LMT_03_RTE Field |
| LMT_04_RTE | LMT_04_RTE Field |
| LMT_05_RTE | LMT_05_RTE Field |
| LMT_06_RTE | LMT_06_RTE Field |
| LMT_07_RTE | LMT_07_RTE Field |
| LMT_08_RTE | LMT_08_RTE Field |
| LMT_09_RTE | LMT_09_RTE Field |
| LMT_10_RTE | LMT_10_RTE Field |
| BASE_RTE | Base FED fund rate used in claim calculation |
Comments
0 comments
Please sign in to leave a comment.