Main Content

krg

Create Kissell Research Group transaction cost analysis object

Description

To begin a transaction cost analysis, use MATLAB® to retrieve the encrypted market-impact parameters from the Kissell Research Group (KRG) FTP site. Then, use the krg function to create a krg object in which to store the encrypted data. After you create a krg object, you can use the object functions to estimate trading costs, optimize trading strategies for a single stock or a portfolio, and conduct back testing and stress testing. For details about market-impact parameters and data, consult the Kissell Research Group. For a simple example of estimating trading costs, see Estimate Trading Costs for Collection of Stocks.

Creation

Description

example

k = krg(midata) creates a transaction cost analysis object and sets the MiData property.

example

k = krg(midata,midate) also selects a market-impact date.

example

k = krg(midata,midate,micode) also sets the MiCode property.

example

k = krg(midata,midate,micode,tradedaysinyear) also sets the TradeDaysInYear property.

Input Arguments

expand all

Market-impact date, specified as a double, character vector, string, or datetime array. By default, the market-impact date is the current date. To decrypt market-impact parameters for a specific date, specify the date using this input argument. For details, consult the Kissell Research Group.

Example: 'yesterday'

Data Types: double | char | string | datetime

Properties

expand all

Market-impact data, specified as a table. This table contains the encrypted market-impact date, code, and parameters. Retrieve this data from the KRG FTP site ftp://ftp.kissellresearch.com using your user name and password. For details, consult the Kissell Research Group.

Example: [276x12 table]

Data Types: table

Market-impact date, specified as a datetime array. By default, the market-impact date is the current date. To decrypt market-impact parameters for a specific date, specify the date using the midate input argument. For details, consult the Kissell Research Group.

The krg function sets this property using the midate input argument.

Example: 09-Sep-2015

Data Types: datetime

Market-impact code, specified as a numeric scalar. By default, the market-impact code is 1. To decrypt market-impact parameters for a specific market region, specify the code by setting this property using dot notation. For details, consult the Kissell Research Group.

Example: 1

Data Types: double

Number of trading days in the year, specified as a numeric scalar.

Example: 251

Data Types: double

Object Functions

costCurvesEstimate market-impact cost of order execution
iStarEstimate instantaneous trading cost for order
liquidityFactorEstimate and compare liquidation costs across stocks
marketImpactEstimate price movement due to order or trade
portfolioCostCurvesEstimate market-impact cost of order execution for portfolio
priceAppreciationEstimate trading cost due to natural price movement
timingRiskEstimate uncertainty of market impact cost

Examples

collapse all

First, retrieve market-impact data from KRG. Then, create a transaction cost analysis object and estimate trading costs for the current day.

Retrieve the market impact data from the KRG FTP site. Connect to the FTP site using the ftp function with a user name and password. Navigate to the MI_Parameters folder and retrieve the market impact data in the MI_Encrypted_Parameters.csv file. miData contains the encrypted market impact date, code, and parameters.

f = ftp('ftp.kissellresearch.com','username','pwd');
mget(f,'MI_Encrypted_Parameters.csv');

miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ...
    ',','ReadRowNames',false,'ReadVariableNames',true);

Create a KRG transaction cost analysis object k.

k = krg(miData)
k = 

  krg with properties:

             MiData: [276x12 table]
             MiDate: 09-Sep-2015
             MiCode: 1.00
    TradeDaysInYear: 250.00

k has these properties:

  • Market-impact data

  • Market-impact date

  • Market-impact code

  • Number of trading days in the year

Load the example data TradeData from the file KRGExampleData.mat, which is included with Datafeed Toolbox™.

load KRGExampleData.mat TradeData

For a description of the example data, see Kissell Research Group Data Sets.

Estimate the instantaneous trading cost itc using TradeData.

itc = iStar(k,TradeData);

You can estimate other trading costs using the market activity for the current day. For details, see Estimate Trading Costs for Collection of Stocks.

First, retrieve market-impact data from KRG. Then, create a transaction cost analysis object using a specific date and estimate trading costs for that date.

Retrieve the market impact data from the KRG FTP site. Connect to the FTP site using the ftp function with a user name and password. Navigate to the MI_Parameters folder and retrieve the market impact data in the MI_Encrypted_Parameters.csv file. miData contains the encrypted market impact date, code, and parameters.

f = ftp('ftp.kissellresearch.com','username','pwd');
mget(f,'MI_Encrypted_Parameters.csv');

miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ...
    ',','ReadRowNames',false,'ReadVariableNames',true);

Create a KRG transaction cost analysis object k with a specific market-impact date midate. Set the date to yesterday.

midate = 'yesterday';

k = krg(miData,midate)
k = 

  krg with properties:

             MiData: [276x12 table]
             MiDate: 09-Sep-2015
             MiCode: 1.00
    TradeDaysInYear: 250.00

Load the example data TradeData from the file KRGExampleData.mat, which is included with Datafeed Toolbox.

load KRGExampleData.mat TradeData

For a description of the example data, see Kissell Research Group Data Sets.

Estimate the instantaneous trading cost itc using TradeData.

itc = iStar(k,TradeData);

You can estimate other trading costs using the market activity for yesterday. For details, see Estimate Trading Costs for Collection of Stocks.

First, retrieve market-impact data from the KRG. Then, create a transaction cost analysis object using a specific market-impact code, and estimate trading costs for a particular market region.

Retrieve the market impact data from the KRG FTP site. Connect to the FTP site using the ftp function with a user name and password. Navigate to the MI_Parameters folder and retrieve the market impact data in the MI_Encrypted_Parameters.csv file. miData contains the encrypted market impact date, code, and parameters.

f = ftp('ftp.kissellresearch.com','username','pwd');
mget(f,'MI_Encrypted_Parameters.csv');

miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ...
    ',','ReadRowNames',false,'ReadVariableNames',true);

Create a KRG transaction cost analysis object k with a specific market-impact code micode. Set the date to yesterday. Set the code to 1.

midate = 'yesterday';
micode = 1;

k = krg(miData,midate,micode)
k = 

  krg with properties:

             MiData: [276x12 table]
             MiDate: 09-Sep-2015
             MiCode: 1.00
    TradeDaysInYear: 250.00

Load the example data TradeData from the file KRGExampleData.mat, which is included with Datafeed Toolbox.

load KRGExampleData.mat TradeData

For a description of the example data, see Kissell Research Group Data Sets.

Estimate the instantaneous trading cost itc using TradeData.

itc = iStar(k,TradeData);

Using the market activity for yesterday, you can estimate trading costs for a particular market region. For details, see Estimate Trading Costs for Collection of Stocks.

First, retrieve market-impact data from the KRG. Then, create a transaction cost analysis object using a specified number of trading days, and estimate trading costs for those trading days.

Retrieve the market impact data from the KRG FTP site. Connect to the FTP site using the ftp function with a user name and password. Navigate to the MI_Parameters folder and retrieve the market impact data in the MI_Encrypted_Parameters.csv file. miData contains the encrypted market impact date, code, and parameters.

f = ftp('ftp.kissellresearch.com','username','pwd');
mget(f,'MI_Encrypted_Parameters.csv');

miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ...
    ',','ReadRowNames',false,'ReadVariableNames',true);

Create a KRG transaction cost analysis object k with a specific number of trading days in the year tradedays. Set the number of trading days to 251. Enter [] for the market-impact date and code so that krg sets these input arguments to their default values.

tradedays = 251;

k = krg(miData,[],[],tradedays)
k = 

  krg with properties:

             MiData: [276x12 table]
             MiDate: 09-Sep-2015
             MiCode: 1.00
    TradeDaysInYear: 251.00

Load the example data TradeData from the file KRGExampleData.mat, which is included with Datafeed Toolbox.

load KRGExampleData.mat TradeData

For a description of the example data, see Kissell Research Group Data Sets.

Estimate the instantaneous trading cost itc using TradeData.

itc = iStar(k,TradeData);

Using the market activity for yesterday, you can estimate trading costs for a particular market region with 251 trading days in the year. For details, see Estimate Trading Costs for Collection of Stocks.

First, retrieve market-impact data from the KRG. Then, create a transaction cost analysis object and set the market-impact date using the object properties.

Retrieve the market impact data from the KRG FTP site. Connect to the FTP site using the ftp function with a user name and password. Navigate to the MI_Parameters folder and retrieve the market impact data in the MI_Encrypted_Parameters.csv file. miData contains the encrypted market impact date, code, and parameters.

f = ftp('ftp.kissellresearch.com','username','pwd');
mget(f,'MI_Encrypted_Parameters.csv');

miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ...
    ',','ReadRowNames',false,'ReadVariableNames',true);

Create a KRG transaction cost analysis object k using miData.

k = krg(miData);

Modify the MiDate property to retrieve market-impact data from a different day.

k.MiDate = '05-Dec-2015'
k = 

  krg with properties:

             MiData: [276x12 table]
             MiDate: '05-Dec-2015'
             MiCode: 1.00
    TradeDaysInYear: 251.00

You can estimate trading costs using the market activity for the specified day. For details, see Estimate Trading Costs for Collection of Stocks.

Tips

If the market-impact code does not exist in the market-impact data, this error appears.

The given region code does not match any records in the market impact data.

Version History

Introduced in R2016a