createInstrument
Create instrument for X_TRADER
Description
createInstrument(
creates the instrument using one or more c
,Name,Value
)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
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
c
— X_TRADER connection
connection object
X_TRADER connection, specified as a connection object created using xtrdr
.
s
— X_TRADER input structure
structure
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')
Property1
— Valid X_TRADER API options
character vector | string scalar
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
Property2
— Valid X_TRADER API options
character vector | string scalar
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)