コード例 #1
0
 @Override
 public TradingAgentExecutionHandle createExecution(
     TradingAgentBindingHandle bindingHandle, ExecutionType type)
     throws ExecutionCreationException {
   TradingAgentBinding binding = retrieveBinding(bindingHandle);
   ITradingAgentExecution execution;
   ITradingAgent tradingAgent = binding.getConfiguration().newTradingAgent();
   if (type == ExecutionType.LIVE) {
     if (liveExecutionService == null) {
       throw new ExecutionCreationException("Live execution service not available");
     }
     execution = new TradingAgentExecution(tradingAgent, liveExecutionService);
   } else {
     if (simulatedExecutionServiceFactory == null) {
       throw new ExecutionCreationException("Simulated execution service factory not available");
     }
     execution =
         new SimulatedTradingAgentExecution(
             tradingAgent, simulatedExecutionServiceFactory.createSimulatedExecutionService());
   }
   String executionOutputSeriesId = "output-" + execution.toString();
   LinkedListSeries<Date, Double, ISeriesPoint<Date, Double>> outputSeries =
       new LinkedListSeries<Date, Double, ISeriesPoint<Date, Double>>(
           executionOutputSeriesId, false);
   execution.wire(binding.getInputSeries(), outputSeries);
   TradingAgentExecutionHandle handle = new TradingAgentExecutionHandle(execution.toString());
   hierarchyContainer.putTradingAgentExecution(handle, execution, bindingHandle);
   return handle;
 }
コード例 #2
0
 @Override
 public void removeExecution(TradingAgentExecutionHandle executionHandle) {
   ITradingAgentExecution execution =
       hierarchyContainer.removeTradingAgentExecution(executionHandle);
   if (execution == null) {
     throw new IllegalArgumentException(
         "Handle: " + executionHandle + " does not correspont to an object");
   }
   execution.kill();
 }