Get a handle to the Signal object.

Joined
Apr 11, 2023
Posts
17
Likes
6
I am creating a signal via the below code. Notice that I am setting the `value` to the ImbalanceInfo object.


Java:
    @Override
    public void onImbalanceAdded(float price, ImbalanceInfo imbalanceInfo) {
        System.out.println("DeltaFlow.onImbalanceAdded: " + price + " " + imbalanceInfo);

        // Create a signal
        this.getDataContext().signal(this.getDataContext().getDataSeries().getEndIndex(),
                Signals.IMBALANCE_CREATED,
                String.format("Price: %f, Side: %s, Imbalance: %f", imbalanceInfo.price(), imbalanceInfo.side(), imbalanceInfo.imbalanceValue()),
                imbalanceInfo);
    }


When I capture the signal via the `onSignal` method here I cannot for the life of me figure out how to get a hold of ImbalanceObject value that was set. Is there something I am missing???


Java:
    @Override
    public void onSignal(OrderContext ctx, Object signalKey){
        System.out.println("DeltaFlow.onSignal: " + signalKey);
        RuntimeDescriptor runtimeDescriptor = this.getRuntimeDescriptor();
        SignalDescriptor signalDescriptor = runtimeDescriptor.getSignal(signalKey);

        // TODO: Get a handle to the Signal object???
 
It's not this... `foobar` is null.


Java:
        var foobar = this.getDataContext().getDataSeries().getValue(signalKey);
        System.out.println("foobar: " + foobar);
 
Top