Class InstrumentDataRequestRedirectHelper

java.lang.Object
velox.api.layer1.providers.helper.InstrumentDataRequestRedirectHelper

public class InstrumentDataRequestRedirectHelper extends Object

When creating synthetic instruments using Layer1UpstreamDataEditor bookmap will still try to query those instruments for certain things (like "which provider does it belong to?", "which order types are supported by that instrument").

This class provides helper methods to take care of that for you.

  • Constructor Details

    • InstrumentDataRequestRedirectHelper

      public InstrumentDataRequestRedirectHelper()
  • Method Details

    • redirectUserMessage

      public static Object redirectUserMessage(Object data, Function<Object,Object> forwardFunction, Function<String,String> aliasMapper)
      Should be used inside Layer1ApiAdminProvider.sendUserMessage(Object), helps you to redirect requests Delegates to redirectUserMessage(Object, Function, Function, boolean) without keeping provider (use this method for synthetic instruments)
    • redirectUserMessage

      public static Object redirectUserMessage(Object data, Function<Object,Object> forwardFunction, Function<String,String> aliasMapper, boolean keepProvider)
      Should be used inside Layer1ApiAdminProvider.sendUserMessage(Object), helps you to redirect requests
      Parameters:
      data - the original data object that you have received as part of request
      forwardFunction - where to forward requests (usually to the lower layers, often will be something like super::sendUserMessage)
      aliasMapper - your function that handles alias translation. If provided alias isn't created by your strategy - return null, otherwise provide some other alias to take that information from (e.g. if you are creating synthetic instruments that will often be one of underlying instruments)
      keepProvider - defines if messages should be forwarded futher and not change the provider. The value should be true if the data provider of the mapped alias was not changed. For synthetic instruments the value should be false.
      Returns:
      value that should be returned by Layer1ApiAdminProvider.sendUserMessage(Object)