Package com.quantcomponents.algo

Examples of com.quantcomponents.algo.ITradingAgentExecution


  }
 
  @Override
  public TradingAgentExecutionHandle createExecution(TradingAgentBindingHandle bindingHandle, ExecutionType type) throws ExecutionCreationException {
    TradingAgentBinding binding = retrieveBinding(bindingHandle);
    ITradingAgentExecution execution;
    ITradingAgent tradingAgent = binding.getConfiguration().newTradingAgent();
    if (!isExecutionTypeAvailable(type)) {
      throw new ExecutionCreationException(type.name() + " execution service not available");
    }
    if (type == ExecutionType.LIVE){
      execution = new TradingAgentExecution(tradingAgent, liveExecutionService);
    } else {
      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;
  }
View Full Code Here


    return hierarchyContainer.getTradingAgentConfiguration(tradingAgentConfigurationHandle).getProperties();
  }

  @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();
  }
View Full Code Here

  public RunningStatus getRunningStatus(TradingAgentExecutionHandle executionHandle) {
    return retrieveExecution(executionHandle).getRunningStatus();
  }
 
  private ITradingAgentExecution retrieveExecution(TradingAgentExecutionHandle executionHandle) {
    ITradingAgentExecution execution = hierarchyContainer.getTradingAgentExecution(executionHandle);
    if (execution == null) {
      throw new IllegalArgumentException("Handle: " + execution + " does not correspont to an object");
    }
    return execution;
  }
View Full Code Here

        bindingData.inputSeriesNames = encodeInputSeriesMap(binding.getInputSeries());
        factoryBindingByHandle.put((TradingAgentBindingHandle) bindingHandle, bindingData);
        for (IHierarchyItemHandle executionHandle : bindingInfo.children) {
          HierarchyItem executionInfo = hierarchy.get(executionHandle);
          factoryHierarchy.put(executionHandle, executionInfo);
          ITradingAgentExecution execution = executionByHandle.get(executionHandle);
          ExecutionPersistentData executionData = new ExecutionPersistentData();
          executionData.inputSeriesNames = encodeInputSeriesMap(execution.getInput());
          executionData.outputSeries = execution.getOutput();
          factoryExecutionByHandle.put((TradingAgentExecutionHandle) executionHandle, executionData);
        }
      }
    }
    ObjectOutputStream oos = new ObjectOutputStream(outputStream);
View Full Code Here

TOP

Related Classes of com.quantcomponents.algo.ITradingAgentExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.