Class WebInterface

java.lang.Object
com.bank.trading.web.WebInterface
All Implemented Interfaces:
Runnable

public class WebInterface extends Object implements Runnable
This class is responsible for the web interface. The web interface is used to interact with the trading system and view system-wide data. Will use netty http server to access This is run on the same server as the Lamport clock service.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor to initialize the web interface with an address.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    execute(Order order)
    This method is responsible for executing a manual order.
    byte[]
    This method is responsible for getting the current algorithms.
    byte[]
    This method is responsible for getting the current controls.
    byte[]
    getData(Long start, Long end)
    This method is responsible for getting the data for a specific machine.
    void
    run()
    This method is responsible for starting the web interface HTTP server.
    boolean
    setAlg(byte[] algExecutable)
    This method is responsible for changing the algorithm executable.
    boolean
    setControl(byte[] controls)
    This method is responsible for setting the control parameters for the trading algorithms.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • run

      public void run()
      This method is responsible for starting the web interface HTTP server. It will run the netty http server to handle requests. Every method has HTTp endpoint.
      Specified by:
      run in interface Runnable
    • execute

      public boolean execute(Order order)
      This method is responsible for executing a manual order.
      Parameters:
      order - the order to be executed.
      Returns:
      true if the order was executed successfully, false otherwise.
    • setAlg

      public boolean setAlg(byte[] algExecutable)
      This method is responsible for changing the algorithm executable.
      Parameters:
      algExecutable - the new algorithm executable to be set.
    • setControl

      public boolean setControl(byte[] controls)
      This method is responsible for setting the control parameters for the trading algorithms.
      Parameters:
      controls - the control parameters to be set.
    • getControls

      public byte[] getControls()
      This method is responsible for getting the current controls.
      Returns:
      the current controls.
    • getAlgorithms

      public byte[] getAlgorithms()
      This method is responsible for getting the current algorithms.
      Returns:
      the current algorithms.
    • getData

      public byte[] getData(Long start, Long end)
      This method is responsible for getting the data for a specific machine.
      Parameters:
      start - the start timestamp for the data.
      end - the end timestamp for the data.
      Returns:
      the data for the specified machine and time range.