createInstrument

Create instrument for X_TRADER

Syntax

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 Programming 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 Programming Tutorial or X_TRADER API Class Reference.

Examples

expand all

Create an X_TRADER Instrument Using an Input Structure

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 an X_TRADER Instrument Using Name-Value Pairs

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)

Retrieve Data Using Multiple X_TRADER Instruments

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

expand all

c — X_TRADER connectionconnection object

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

s — X_TRADER input structurestructure

X_TRADER input structure, specified using fields corresponding to valid X_TRADER API options. For details, see the Trading Technologies X_TRADER API Programming 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 Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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

'Property1' — Valid X_TRADER API optionsstring

Valid X_TRADER API options, specified using information in the Trading Technologies X_TRADER API Programming 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

'Property2' — Valid X_TRADER API optionsstring

Valid X_TRADER API options, specified using information in the Trading Technologies X_TRADER API Programming Tutorial or X_TRADER API Class Reference.

Data Types: char

Was this topic helpful?