| Previous Contents Index Next |
| iPlanet Market Maker 4.5 Exchange Customization Guide |
Chapter 2 Defining the Exchange Attributes
This chapter provides instructions for setting up attributes to identify order matching criteria for the iPlanet Market Maker Exchange module.This chapter contains the following sections:
Overview
Overview
To be able to match buy and sell orders, the Exchange module must first know what criteria to use to identify whether a match does, or does not, exist. This is accomplished by defining a common set of attributes, also known as the matching criteria. This set of attributes, such as price and quantity, is the basis for comparing orders in an exchange. After you have defined these attributes, the Exchange module compares these attributes to identify potential matches between buy orders and sell orders.Symbols in an exchange are similar and share common matching attributes. To set up an exchange, you need to specify the symbols you want to trade and the attributes associated with those symbols. Because of the flexible nature of the iPlanet Market Maker Exchange module, you can define whatever attributes are necessary to compare orders.
An exchange has the following types of attributes:
Criteria
Criteria define all the information required to place an order in an exchange. Each criteria has a set of criteria fields, which you enter in the Exchange module user interface. The criteria fields specify the quantity you want to buy or sell, at what price, and so on. These are the front-end, or human-entered, or specified, matching attributes in an exchange.
Dimension
Axes and criteria are based on dimensions, which define their internal value types.
Axes
Axes provide a set of values to allow comparisons between orders. They are the back-end matching engine-readable representations of matching criteria.
Flattening
To convert the criteria to a set of matching attribute values that the Exchange module can interpret, you define a flatten function, which is a Java class that translates the criteria to the values of the exchange axes. The Exchange module processes the axes values to identify potential matches.Figure 2-1 shows an example of the relationship between axes and criteria. The left side shows the defined criteria and criteria fields that appear in an Exchange module user interface. In this example, the Order Criteria of Market means that the buyer or seller accepts the current market price, so no explicit price is specified. Other criteria types might require you to specify a price.
The right side of Figure 2-1 represents the exchange processing that takes place after the flatten function converts the criteria fields to a value of the axis that the Exchange module uses to identify potential order matches.
Figure 2-1    Criteria and Axes in an Exchange
![]()
There is a flatten function for each criteria. It is possible for a flatten function to convert more than one criteria field to the same axis, as shown in Figure 2-1. Figure 2-2 shows another representation of how a flatten function converts criteria to axes.
Figure 2-2    Flattening More Than One Criteria Field to the Same Axis
![]()
Often there is a one-to-one correspondence between axes and criteria, but not always. In an Exchange module user interface you might specify a quantity criteria field as an amount, and also have an option to accept a partial quantity.
Example
Suppose that Figure 2-3 is a buy order, willing to accept a partial quantity, for 10 widgets. There is a previous buy order in the exchange for 10 widgets only, and a sell order for 7 widgets. Because there are orders to buy 20 widgets and sell 7 widgets, the Exchange module needs a method for comparing 20 to 7 to determine if there is a potential match. In this case, quantity is not a single value as specified in the user interface, but is a range of values.In the example, the buy order for 10 widgets willing to accept a partial quantity is a potential match with the sell order for 7 widgets. The other buy order for 10 widgets not willing to accept a partial quantity is not a potential match with the order to sell 7 widgets.
Figure 2-3    Buy Order Accepting a Partial Quantity
![]()
To determine if there are potential matches, the Exchange module compares all the axes of all the buy and sell orders. If there is any non-zero overlap in all the axes of a buy and sell order, there is a potential match. Figure 2-4 shows a representation of the axes associated with the criteria fields in Figure 2-3.
Figure 2-4    Exchange Axes for Matching Buy and Sell Orders
![]()
Example
Suppose, given the criteria and axes in Figure 2-3 and Figure 2-4, there is a buy order for 10 symbols and a sell order for 7 symbols. The Exchange module compares the buy and sell order axes values to determine if there is a potential match.Table 2-1 shows another interpretation of the axes in Figure 2-4. A potential match requires a Yes in the Potential Match column for all axes in a buy and sell order. Because the order is for the market price, and not for a specific price or range of prices, the Price axis is irrelevant in the comparison. If both the buy and sell orders accept the market price, the Price axis has an overlap by default. Note that this potential match need not be exact, as is the case with the Quantity axis.
Table 2-1    Matching Potential Buy and Sell Orders
Axis
Order Number
Buy Order
Sell Order
Potential Match
Implementing the Exchange Attributes
The requirements that define the schema for an exchange depend on the symbols you want to trade. The exchange symbols, criteria, axes, and the user interface in which to enter the criteria are defined using an XML file.The iPlanet Market Maker software comes with two sample exchange implementations. The schema files for these exchanges are in this directory:
<ias_inst_dir>/ias/APPS/imm40/imm40/WEB-INF/classes/exchange
The sample schema files are:
You can copy these files and use them as templates to edit and set up the schema for your exchange. The ExchangeList.xml file in the same directory lists the exchanges in a marketplace. This file lets you define multiple exchanges on a single host.
The following sections explain the tasks of implementing the symbols, criteria, and axes for a sample exchange (this sample is for trading natural gas energy services):
Defining the Symbols to be Traded
The names of the symbols to be traded in the sample energy exchange are.By default, the symbol catalog data store is located in the same directory as the schema file. This can be changed by modifying the service property FILE for the SymbolCatalogService.
Language-specific symbol stores can be added in the standard Java fashion. For example, a French version of the <exchange_name>Symbol.properties file should be named <exchange_name>Symbol_fr.properties; it can be referenced in the exchange schema descriptor file with its path.
To locate the file containing the definitions of symbols for an exchange, search for SymbolCatalogService in the schema descriptor file of the exchange. The definition of Symbol Catalog Service in the XML schema descriptor file, and the syntax, are shown in Table 2-2 and Table 2-4 respectively.
<SERVICE name="SymbolCatalogService" impl_class ="com.reference.energyb.service.PropertyBasedSymbolCatalogServiceImpl">
<SERVICE_PROPERTY name="FILE" value="exchange/EnergyBSymbols"/>
The Table 2-3 below shows the contents of the EnergyBsymbol.xml file which defines the symbols for the exchange EnergyB. This file defines the order in which the exchange symbols are loaded and displayed in the user interface. To localize the exchange, language-specific symbols, for example, French, can be stored in the ExchangeBSymbol_fr.properties file. This file can then be referenced in the exchange XML schema descriptor EnergyBSchema.xml file
Note The symbol GUID should not be localized.
Defining Axes
To locate the definitions for the axes in one of the sample XML files, search for >AXIS_CONFIG. The syntax and definitions for the quantity axis in this exchange are shown in Table 2-6.
Table 2-5    Sample Quantity Axis Definition The arguments for the AXIS_CONFIG tag are described Table 2-6.
Defining Criteria
To locate the definitions for the criteria in one of the sample XML files, search for <CRITERIA>.
Note You specify the flatten function file name in the flatten argument for the CRITERIA tag. This class contains the logic that converts the data defined in each CRITERIA_FIELD tag to an axis.
In an exchange XML file, there are two types of Java class files:
Classes prefaced with com.iplanetThese are exchange system classes that you generally do not have to customize to create your own exchange.
If you want to introduce a new criteria, you must write a flattening class function and specify the function name for the flatten argument. You can also extend the flattening class of one criteria and implement the flattening logic for another criteria.Classes prefaced with com.referenceThese are classes that you might need to customize or replace, depending on the needs of your exchange. The flatten class file is an example.
The syntax and definitions for the market order criteria in the energy exchange is shown in Table 2-8.
Table 2-7    Sample Market Criteria Definition The arguments for the CRITERIA and CRITERIA_FIELD tags are listed in Table 2-8.
Defining Dimensions
To locate the definitions for the dimensions in one of the sample XML files, search for <DIMENSION>. The syntax and definitions for the market order criteria in this exchange is shown in and Table 2-10.
Table 2-9    Sample Quantity Dimension Definition The arguments for the DIMENSION tag are described in Table 2-10.
Defining the Life Spans for Orders
To control how long orders are eligible to be matched in an exchange, specify the information for the LIFESPANS tag. Search for <LIFESPANS> in one of the sample files.
Table 2-11    Sample Life Span Definitions calculator="com.reference.energyb.lifespan.GoodUntilCancel">
calculator="com.reference.energyb.lifespan.ImmediateOrCancel">
The syntax and definitions for life spans in this exchange is shown in Table 2-12.
Defining an Exchange User Interface
To locate the definitions for the Exchange module user interface, search for <UI_CRITERIAS>.
Table 2-13    Sample User Interface Definitions The arguments for the UI_CRITERIA tag are described in Table 2-14
.
Previous Contents Index Next
Copyright © 2001 Sun Microsystems, Inc. All rights reserved.
Last Updated April 03, 2002