Skip to main content

Code Generation

Working with TimeBase, you will often deal with routine tasks such as creation of TimeBase stream schemas based on a specific data model and turning stream schemas into target language objects. Doing it manually may be error-prone and time-consuming. TimeBase offers tools that allow automating such tasks and, thus, saving your time and efforts.

Luminary

Luminary is a IDL language and a library that can be used to describe programing language structures. Java and C# objects can be automatically generated based on Luminary descriptions using custom generators. TimeBase Enterprise Edition includes DOJO and DOCO generators to generate TimeBase-specific messages for Java and C# respectively.

You can use Luminary with TimeBase to perform the following tasks:

  • generate TimeBase schemas
  • generate TimeBase messages and codecs for C#
  • generate TimeBase messages and codecs for Java

Below, you may take a look at an example of a Luminary description and a Java code generated based on it.

namespace Deltix.Timebase.Api.Messages;

import Deltix.Timebase.Api.*;

/// Basic information about a bar.
[SchemaElement(Name = "deltix.timebase.api.messages.BarMessage", Title = "Bar Message")]
class BarMessage : MarketMessage {

/// Opening price for the bar interval.
//[FieldType(Value = "FLOAT DECIMAL (8)")]
//[Title(Value = "Open")]
[SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL(8)")]
[SchemaElement(Title = "Open")]
[RelativeTo(Value = "close")]
Float64? Open;

/// Highest price for the bar interval.
//[FieldType(Value = "FLOAT DECIMAL (8)")]
//[Title(Value = "High")]
[SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL(8)")]
[SchemaElement(Title = "High")]
[RelativeTo(Value = "close")]
Float64? High;

/// Lowest price for the bar interval.
//[FieldType(Value = "FLOAT DECIMAL (8)")]
//[Title(Value = "Low")]
[SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL(8)")]
[SchemaElement(Title = "Low")]
[RelativeTo(Value = "close")]
Float64? Low;

/// Closing price for the bar interval.
//[FieldType(Value = "FLOAT DECIMAL (8)")]
//[Title(Value = "Close")]
[SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL(8)")]
[SchemaElement(Title = "Close")]
Float64? Close;

/// Trade volume.
//[FieldType(Value = "FLOAT DECIMAL (8)")]
//[Title(Value = "Volume")]
[SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL(8)")]
[SchemaElement(Title = "Volume")]
Float64? Volume;

/// Vendor-specific market code.
//[FieldType(Value = "VARCHAR ALPHANUMERIC(10)")]
//[Title(Value = "Exchange Code")]
[SchemaType(DataType = SchemaDataType.VARCHAR, Encoding = "ALPHANUMERIC(10)")]
[SchemaElement(Title = "Exchange Code")]
[OldElementName("exchangeCode")]
Int64? ExchangeId = TypeConstants.EXCHANGE_NULL;
}
info

Refer to Luminary open source repository to learn more.

Solution Generator

In case you already have a TimeBase stream schema and you need to create messages in a target language, you can use a tool called Solution Generator to do that.

info

Refer to Solution Generator to learn how to generate classes based on TimeBase schemas.