MARKET_SHIFTS

The MARKET_SHIFTS table contains some of the attributes for market shifts for the Taylor VaR calculations and FX shifts for FX risk computation. It is an isolated table and not part of any cube facts. The market shift vectors are present in the MARKET_SHIFTS_VECTOR table.

Column Name Type Not Null Default Value1 Description
AS_OF_DATE DATE Y Timestamp (at close of business) for the data.
RISK_FACTOR_ID STRING Y N/A The internal risk factor/bucket identifier: instrument, curve, vol surface/cube identifier.
SCENARIO_SET STRING Y N/A Name of the set of scenarios. Example: “Historical”, “Stress”.
TENOR STRING Y N/A Tenor label, such as 3M, 5Y, and so on, if applicable.
MATURITY STRING Y N/A Maturity label, such as 3M, 5Y, and so on, if applicable.
MONEYNESS STRING Y N/A Moneyness label, if applicable.

Unique Key

Columns
AS_OF_DATE
RISK_FACTOR_ID
SCENARIO_SET
TENOR
MATURITY
MONEYNESS

Incoming Joins

Source Table Source Columns Target Columns
MARKET_SHIFTS_VECTOR AS_OF_DATE
RISK_FACTOR_ID
SCENARIO_SET
TENOR
MATURITY
MONEYNESS
AS_OF_DATE
RISK_FACTOR_ID
SCENARIO_SET
TENOR
MATURITY
MONEYNESS

Table creation script

Snowflake

Table creation

create OR REPLACE table MARKET_SHIFTS(
	AS_OF_DATE DATE NOT NULL,
	RISK_FACTOR_ID STRING NOT NULL DEFAULT 'N/A',
	SCENARIO_SET STRING NOT NULL DEFAULT 'N/A',
	TENOR STRING NOT NULL DEFAULT 'N/A',
	MATURITY STRING NOT NULL DEFAULT 'N/A',
	MONEYNESS STRING NOT NULL DEFAULT 'N/A',
	primary key (AS_OF_DATE, RISK_FACTOR_ID, SCENARIO_SET, TENOR, MATURITY, MONEYNESS)
);

Table population from files (optional)

If you want to populate the table from CSV files, you can run the following scripts (this example assumes that you want to load the files MarketShifts.csv present in the folders 2023-09-26, 2023-09-27 and 2023-09-28):

create OR REPLACE stage MR_INPUT_RAW;

create OR REPLACE file format CSV_GZIP TYPE = CSV COMPRESSION = GZIP SKIP_HEADER = 1 comment = 'File format to import MR data';

create OR REPLACE file format CSV_FORMAT TYPE = CSV COMPRESSION = AUTO SKIP_HEADER = 1 comment = 'File format to import MR data';

PUT file://<full path to you data folder>/2023-09-26/MarketShifts.csv @MR_INPUT_RAW/2023-09-26; PUT file://<full path to you data folder>/2023-09-27/MarketShifts.csv @MR_INPUT_RAW/2023-09-27; PUT file://<full path to you data folder>/2023-09-28/MarketShifts.csv @MR_INPUT_RAW/2023-09-28;

copy into MARKET_SHIFTS from( select $1, $2, ifnull($3, 'N/A'), ifnull($4, 'N/A'), ifnull($5, 'N/A'), ifnull($6, 'ATM') from @MR_INPUT_RAW (pattern => './MarketShifts..csv.gz' , FILE_FORMAT => 'CSV_GZIP'));


  1. If the default value is marked as empty, it means that the default value is 'null' for nullable fields, and that a value needs to be explicitly set for non-nullable fields.  ↩︎