Observing External Data - netrium/Netrium GitHub Wiki

Observing External Data

Return to The role of Time

In Netrium, almost all numbers and decisions that are exposed through the language can be accessed as Observables. Observables are time-dependent observations of either numeric or boolean data types.

contract = scale cpardFoo (one (Financial eur cash Nothing)) 

In the above example, cpardFoo is registered in the Observable database as a double. When simulating the contract, a value will need to be supplied - along with a validity date - so that the contract can be successfully executed.

The Syntax Tree shows this as follows:

Syntax Tree

Through the Netrium Contract Engineer (a part of the commercial toolset), the observable can be edited as follows:

Edit Foo

Which is simply a user interface on top of the observable XML file:

   <?xml version="1.0"?>
   <SimulationInputs> 
       <Time>2012-03-24 09:25:01 UTC</Time> <!-- start time -->
       <ObservationSeries var="cpardFoo" type="Double">
           <SeriesEntry>
             <Time>2010-03-24 00:00:00 UTC</Time>
             <Double>1000</Double>
           </SeriesEntry>
           <SeriesUnbounded/> 
       </ObservationSeries> 
       <Choices/> 
   </SimulationInputs>

After execution, the results returned show the Observable in action:

Edit Foo

Observing boolean conditions on doubles

There are many times in which the contract may need to observe a double, and convert that into a boolean condition. This is done very simply in Netrium, using standard relational operators. Below is a sample barrier option, in which the option can only be exercised if the observed temperature drops below 5 degrees.

Syntax Tree

Syntax Tree

Decision Tree

Decision Tree

Next

How to add new elements to the language

⚠️ **GitHub.com Fallback** ⚠️