Main Content


Create X_TRADER connection


The xtrdr function creates an xtrdr object, which represents an X_TRADER® connection. After you create an xtrdr object, you can use the object functions to create instrument notifiers, instruments, order sets, and order profiles, and obtain current data. You can also submit orders to X_TRADER.


Create only one X_TRADER connection per MATLAB® session. To create an X_TRADER connection, start a new MATLAB session.





c = xtrdr creates an X_TRADER connection object c. The xtrdr function starts X_TRADER or connects to an existing X_TRADER session.


expand all

Gate, specified as an ActiveX COM object.

Example: [1x1 COM.Xtapi_TTGate_1]

Instrument notifier, specified as an X_TRADER XTAPI instrument notifier object. For details, see X_TRADER API.

To set this property, use the createNotifier function.

Example: [1×1 COM.Xtapi_TTInstrNotify]

Instrument, specified as an X_TRADER XTAPI instrument object. For details, see X_TRADER API.

To set this property, use the createInstrument function.

Example: [1×1 COM.Xtapi_TTInstrObj]

Order set, specified as an X_TRADER order set object. For details, see X_TRADER API.

To set this property, use the createOrderSet function.

Example: [1×1 COM.Xtapi_TTOrderSet]

Object Functions

createNotifierCreate instrument notifier for X_TRADER
createInstrumentCreate instrument for X_TRADER
createOrderSetCreate order set for X_TRADER
createOrderProfileCreate order profile for X_TRADER
getDataObtain current X_TRADER data
closeClose X_TRADER connection


collapse all

Use an X_TRADER connection to retrieve the exchange and last price data for an instrument. The instrument used in this example continually expires.

To ensure that you use a current instrument, see the Market Explorer in X_TRADER Pro.

Create an X_TRADER connection.

c = xtrdr
c = 
  xtrdr with properties:

           Gate: [1x1 COM.Xtapi_TTGate_1]
    InstrNotify: []
     Instrument: []
       OrderSet: []

Define an input structure s with fields corresponding to valid X_TRADER API options. This example defines 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 = 

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


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

Create an X_TRADER instrument.


Return the exchange and last price fields for the instrument.

s = c.Instrument(1);
f = {'Exchange','Last'};
d = getData(c,s,f)
d = 

    Exchange: {'Eurex'}
        Last: {'45'}

Close the X_TRADER connection.


Version History

Introduced in R2013a