Interface Layer1ApiAdminProvider

All Superinterfaces:
AutoCloseable, Layer1ApiAdminListenable
All Known Subinterfaces:
Layer1ApiProvider
All Known Implementing Classes:
ExternalLiveBaseProvider, ExternalReaderBaseProvider, Layer1ApiDepthFreezer, Layer1ApiInjectorRelay, Layer1ApiRelay, Layer1ApiStrategiesEchoMessagesLayer

@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) public interface Layer1ApiAdminProvider extends AutoCloseable, Layer1ApiAdminListenable
Class implementing this should provide general Layer1 Api functions.
  • Method Details

    • getSupportedFeatures

      Layer1ApiProviderSupportedFeatures getSupportedFeatures()

      Get information about features that are supported by a provider. Note that some fields might be set differently depending on when request is made. E.g. adapter might not know if trading will be there until login actually happens.

      If you are writing a provider - take a look at MaximumSupportedFeatures as a way to declare full list of capabilities before being instantiated

      Returns:
      object describing supported features
      See Also:
    • login

      void login(LoginData loginData)
      Initiate login to the platform.
      Parameters:
      loginData - credentials, different platforms use different subclasses
    • getCurrentTime

      long getCurrentTime()
      Returns current Unix epoch time. This method allows time distortions if consumer is too slow - in this case time of the next event may be returned.
      Returns:
      current Unix epoch time in nanoseconds
    • getSource

      String getSource()
      Returns string representing data source.
      Returns:
      string representing data source
    • sendUserMessage

      @Nullable Object sendUserMessage(Object data)
      Send a downstream event. Allows incorporating arbitrary functionality into protocol.

      This is the extension point of the downstream direction: the caller hands an arbitrary object to the layer below, which either handles it or passes it further down. The counterpart for the upstream direction is Layer1ApiAdminListener.onUserMessage(Object).

      The call is synchronously propagated downstream. It must eventually be consumed by a layer, that will stop propagation and return the result back upwards. Layers are also allowed to alter it without consuming. Layers that do not recognize a message must forward it unchanged (see Layer1ApiRelay). Messages that implement Layer1ApiIgnorableDownwardMessage may reach the bottom of the stack unhandled. All others throw if unhandled.

      Some messages are requests whose reply is not the return value but an upstream onUserMessage that arrives later, possibly after this method has returned.

      Parameters:
      data - Message content, never null
      Returns:
      response of the handling layer, or null if the message has no synchronous response or nobody handled it
    • close

      void close()
      Shut down and dispose. For details on the provider lifecycle, check out the Javadoc of ExternalLiveBaseProvider and ExternalReaderBaseProvider for Live and Replay external modules respectively.

      In a layer chain this call propagates downwards: a layer closes the provider below it and then stops forwarding upstream events.

      Specified by:
      close in interface AutoCloseable