Try TT Now

Creating Custom Pricing Models in COM

To create a Custom Price Model using Visual C++ (Visual Studio 2005 or higher)…

Step

Action

1.Create an ATL project.
  1. Select Server Type | DLL.
  2. Select Allow merging of proxy/stub code.
2.Create a Price Model class.
  1. Create a new ATL Simple Object.
    • The object name does not matter.
    • Use the default options.
  2. In the Class View...
    • Select the new Price Model class.
    • From the menu, select Project | Implement Interface.
    • Select the Type Library TTPriceModel 1.0 Type Library <1.0>.
    • Copy IPriceModel to the Implement Interfaces list.
    • Select Finish.
  3. Replace the bodies of each of the three methods with the logic of the Custom Price Model.
3.Create the Price Model Factory class.
  1. Create a new ATL Simple Object.
    • The object name does not matter.
    • Use the default options.
  2. In the Class View...
    • Select the new Price Model Factory class.
    • From the menu, select Project | Implement Interface.
    • Select Implement Interface from | Registry.
    • Select the Type Library TTPriceModel 1.0 Type Library <1.0>.
    • Copy IPriceModelFactory to the Implement Interfaces list.
    • Select Finish.
  3. Replace the body of NumberOfSupportedPricingModels with code to return the number of Custom Price Models implemented within the Library and created by the derived Price Model Factor.
  4. Replace the body of GetPriceModelName with code to return the name of the Custom Price Model based on its index, which you define.

    Note: These names MUST NOT conflict with any other Price Model name within X_TRADER, either built in or custom. The entire Library will be ignored if any name collisions are encountered

  5. Replace the body of GetPriceModel with code to return a new instance of the Custom Price Model object based upon its index, which you define.

    Note: DO NOT throw any exceptions out of the Custom Price Model. X_TRADER is not set up to catch them and they will cause undefined behavior.

To create a Custom Price Model using Visual Basic 6…

Step

Action

1.Create a Visual Basic ActiveX DLL project.
2.Add a reference to the COM object TTPriceModel 1.0 Type Library.
  1. Create a new Visual Basic class.
    • The name of the file or class does not matter.
  2. Set the class to implement TTPriceModelLib.IPriceModelFactory
  3. Replace the bodies of each of the three methods with the logic of the Custom Price Model.
3.Create the Price Factory Model.
  1. Create a new Visual Basic class.
    • The name of the file or class does not matter.
  2. Set the class to implement TTPriceModelLib.IPriceModelFactory.
  3. Replace the body of NumberOfSupportedPricingModels with code to return the number of Custom price Models implemented within the Library.
  4. Replace the body of GetPriceModelName with code to return the name of the Custom Price Model based on its index, which you define.

    Note: These names MUST NOT conflict with any Price Model name within X_TRADER, either built in or custom. The entire Library will be ignored if any name collisions are encountered.

  5. Replace the body of GetPriceModel with code to return a new instance of the Custom Price Model object based upon the index, which you define.