You can ask the user to select a saved order template using
Framework.ChooseOrderTemplate(null, function(template) {
// Asynchronously receives the selected template, or null
if (template) {
// Potentially modify or add to the template
// …
// And then pass the template into the deal ticket
Framework.CreateDialog({
type: "dealticket",
settings: {
orderDefinition: template
}
});
}
});
Alternatively, you can add an
Framework.ChooseOrderTemplate(null, function(template) {
// Asynchronously receives the selected template, or null
if (template) {
// Put the required market into the template
template.instrumentId = <some market ID>;
// And then pass the template into the deal ticket
Framework.SendOrder(template, function (MsgResult) {
// … handle asynchronous success or failure
});
}
});
The first parameter for
| Property | Description |
| showNone | Adds a "None" button to the selection dialog. Allows you to distinguish between the user cancelling the dialog versus saying "I don't want to use a stored template". If the button is clicked then the return value from |
| showDefault | Similar to |
There is no functional difference between
Framework.ChooseOrderTemplate({showDefault: true}, function(template) {
if (template == "default") {
// User clicked the Default button.
// Display the deal ticket. A blank or omitted orderDefinition will mean
// that the deal ticket automatically selects any user-defined default
Framework.CreateDialog({
type: "dealticket"
});
} else if (template) {
// User selected a template
// Pre-populate the selected template into the deal ticket
Framework.CreateDialog({
type: "dealticket",
settings: {
orderDefinition: template
}
});
} else {
// (User cancelled the dialog)
}
});