Package com.bank.trading.web
Class WebInterface
java.lang.Object
com.bank.trading.web.WebInterface
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionWebInterface(InetSocketAddress address, InetSocketAddress http, Map<String, InetSocketAddress> services) Constructor to initialize the web interface with an address. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis 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[]This method is responsible for getting the data for a specific machine.voidrun()This method is responsible for starting the web interface HTTP server.booleansetAlg(byte[] algExecutable) This method is responsible for changing the algorithm executable.booleansetControl(byte[] controls) This method is responsible for setting the control parameters for the trading algorithms.
-
Constructor Details
-
WebInterface
public WebInterface(InetSocketAddress address, InetSocketAddress http, Map<String, InetSocketAddress> services) Constructor to initialize the web interface with an address.- Parameters:
address- the user for the web interface.
-
-
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. -
execute
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
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.
-