Main Content

createInstrument

Create instrument for X_TRADER

Description

example

createInstrument(c,s) creates the X_TRADER® instrument defined by the structure s with fields corresponding to valid X_TRADER API options. For details, see the Trading Technologies® X_TRADER API RTD Tutorial or X_TRADER API Class Reference.

example

createInstrument(c,Name,Value) creates the instrument using one or more Name,Value pair arguments with names and values corresponding to valid X_TRADER API options. For details, see the Trading Technologies X_TRADER API RTD Tutorial or X_TRADER API Class Reference.

Examples

collapse all

The instruments used in these examples continually expire. To ensure you use a current instrument, see the Market Explorer in X_TRADER Pro.

Create the X_TRADER connection.

c = xtrdr;

Define an input structure s with fields corresponding to valid X_TRADER API options. For example, create the input structure for Euro-Bobl Futures.

s = [];
s.Exchange = 'Eurex';
s.Product = 'OGBM';
s.ProdType = 'Option';
s.Contract = 'Jan12 P12300';
s.Alias = 'TestInstrument3';
s
s = 

    Exchange: 'Eurex'
     Product: 'OGBM'
    ProdType: 'Option'
    Contract: 'Jan12 P12300'
       Alias: 'TestInstrument3'

Requirement:

Restart the MATLAB® session before reusing an 'Alias' setting.

Create an X_TRADER instrument.

createInstrument(c,s)

Close the connection.

close(c)

Create the X_TRADER connection.

c = xtrdr;

Create an X_TRADER instrument for Euro-Bobl Futures using name-value pair arguments corresponding to valid X_TRADER API options.

createInstrument(c,'Exchange','Eurex','Product','OGBM',...
                'ProdType','Option','Contract','Jan12 P12300',...
                'Alias','TestInstrument3')

Close the connection.

close(c)

Create the X_TRADER connection.

c = xtrdr;

Create an X_TRADER instrument for Euro-Bobl Futures using name-value pair arguments corresponding to valid X_TRADER API options.

createInstrument(c,'Exchange','Eurex','Product','OGBM',...
                'ProdType','Option','Contract','Jun14 P127',...
                'Alias','PriceInstrumentEurex')

Create another X_TRADER instrument for CAISO NP15 EZ Gen Hub 5 MW Peak Calendar-Day Real-Time LMP Futures using name-value pair arguments corresponding to valid X_TRADER API options. This contract expires in April 2014.

createInstrument(c,'Exchange','CME','Product','2F',...
                'ProdType','Future','Contract','Apr14',...
                'Alias','PriceInstrumentCMEApr14')

Create another X_TRADER instrument for CAISO NP15 EZ Gen Hub 5 MW Peak Calendar-Day Real-Time LMP Futures using name-value pair arguments corresponding to valid X_TRADER API options. This contract expires in October 2014.

createInstrument(c,'Exchange','CME','Product','2F',...
                'ProdType','Future','Contract','Oct14',...
                'Alias','PriceInstrumentCMEOct14')

Retrieve the exchange and product identifier for all three X_TRADER instruments.

d = getData(c,{'Exchange','Product'})
d = 
    Exchange: {3x1 cell}
     Product: {3x1 cell}

d is a structure containing the Exchange and Product fields. The fields are cell arrays.

Display the Exchange field.

d.Exchange
ans = 
    'Eurex'
    'CME'
    'CME'

The Exchange field contains the exchange names Eurex and CME for the three X_TRADER instruments.

Close the connection.

close(c)

Input Arguments

collapse all

X_TRADER connection, specified as a connection object created using xtrdr.

X_TRADER input structure, specified using fields corresponding to valid X_TRADER API options. For details, see the Trading Technologies X_TRADER API RTD Tutorial or X_TRADER API Class Reference.

Caution

If the symbols for the exchange are entered incorrectly or the exchange server is down, an error appears. For example, if the exchange is “CME” and the CME exchange server is down, then this error appears: The price server for the Exchange CME is down. Unable to create instrument.

Example: s = [];
s.Exchange = 'Eurex';
s.Product = 'OGBM';
s.ProdType = 'Option';
s.Contract = 'Jan12 P12300';
s.Alias = 'TestInstrument3';

Data Types: struct

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: createInstrument(X,'Exchange','Eurex','Product','OGBM','ProdType','Option','Contract','Jan12 P12300','Alias','TestInstrument3')

Valid X_TRADER API options, specified as a character vector or string scalar using information in the Trading Technologies X_TRADER API RTD Tutorial or X_TRADER API Class Reference.

Requirements:

  • When using the 'Alias' name-value pair argument, ensure that every 'Alias' name is unique across all X_TRADER instruments.

  • Restart the MATLAB session before reusing an 'Alias' name.

Otherwise, createInstrument returns an error.

Data Types: char | string

Valid X_TRADER API options, specified as a character vector or string scalar using information in the Trading Technologies X_TRADER API RTD Tutorial or X_TRADER API Class Reference.

Data Types: char | string

Version History

Introduced in R2013a