LUSID allows you to create your own custom actions to perform on one or more order blocks in the Order Blotter. For example, you could create a block job that runs some data validation, or sends blocks to an external process.
You define these custom block jobs using Luminesce custom views. Once you have created a custom view, you can select it as Block job when interacting with the Order Blotter in the LUSID web app:
The block job is a Luminesce custom view which must take in a BlockIds
table input parameter containing the following:
Block scope
Block code
The custom view should then do the following:
Perform one or more operations using the block.
Use
Lusid.Block.Writer
to update any block values.Output a success or error message using the
WriteErrorCode
.
To make the custom view available in the Order Blotter, you must register the OrderBlotterBlockAction
metadata key with the view.
Example: Creating a block job that sets a contingent order ID
Let’s imagine you want to generate some order numbers for each block, ready for placement. You can use Sys.Admin.SetupView to define the following block job that can be run on any set of blocks, specifying in your query:
A name for the custom view
Optionally, a description
The required input parameters for a block job, as detailed above
The operation to perform on the block. In this example, the view uses
Lusid.Sequence.Writer
to generate an order number.The values to write to the block using Lusid.Block.Writer
A success and an error message depending on the
WriteErrorCode
. For LUSID providers, aWriteErrorCode
of0
indicates the write operation was successful.
Outside of the custom view, you must use the Sys.Registration.Metadata.Writer provider to set the OrderBlotterBlockAction
metadata value to true
.
Note: For the example above, you must first create a sequence with the specified
scope
andcode
using the CreateSequence API.
Once you have created a block job in the form of a custom view, to run it:
Navigate to Dashboard > Order Blotter in the LUSID web app.
Create your order blocks as usual.
Select the blocks you want to include in your block job.
Select a Block job from the dropdown.
Run the block job.
Once the block job has run, the dashboard displays your success or error message: