Package com.quantcomponents.algo

Examples of com.quantcomponents.algo.TradingAgentBinding


  }

  @Override
  public TradingAgentBindingHandle createBinding(TradingAgentConfigurationHandle configurationHandle, Map<String, ? extends ISeries<Date, Double, ISeriesPoint<Date, Double>>> inputSeries, String name) {
    TradingAgentConfiguration configuration = retrieveConfiguration(configurationHandle);
    TradingAgentBinding binding = new TradingAgentBinding(configuration, inputSeries);
    TradingAgentBindingHandle handle = new TradingAgentBindingHandle(name == null || name.equals("") ? binding.toString() : name);
    hierarchyContainer.putTradingAgentBinding(handle, binding, configurationHandle);
    return handle;
  }
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  @Override
  public Map<String, ISeries<Date, Double, ISeriesPoint<Date, Double>>> getBindingInputSeries(TradingAgentBindingHandle bindingHandle) {
    TradingAgentBinding binding = retrieveBinding(bindingHandle);
    return binding == null ? null : (Map<String, ISeries<Date, Double, ISeriesPoint<Date, Double>>>) binding.getInputSeries();
  }
View Full Code Here

    return binding == null ? null : (Map<String, ISeries<Date, Double, ISeriesPoint<Date, Double>>>) binding.getInputSeries();
  }
 
  @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 execution;
  }
 
  private TradingAgentBinding retrieveBinding(TradingAgentBindingHandle bindingHandle) {
    TradingAgentBinding binding = hierarchyContainer.getTradingAgentBinding(bindingHandle);
    if (binding == null) {
      throw new IllegalArgumentException("Handle: " + bindingHandle + " does not correspont to an object");
    }
    return binding;
  }
View Full Code Here

      factoryHierarchy.put(configurationHandle, configurationInfo);
      factoryConfigurationByHandle.put((TradingAgentConfigurationHandle) configurationHandle, configurationByHandle.get(configurationHandle).getProperties());
      for (IHierarchyItemHandle bindingHandle : configurationInfo.children) {
        HierarchyItem bindingInfo = hierarchy.get(bindingHandle);
        factoryHierarchy.put(bindingHandle, bindingInfo);
        TradingAgentBinding binding = bindingByHandle.get(bindingHandle);
        BindingPersistentData bindingData = new BindingPersistentData();
        bindingData.configurationHandle = configurationHandle;
        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);
View Full Code Here

      handleIdentities.put(entry.getKey(), entry.getKey());
    }
   
    for (Map.Entry<TradingAgentBindingHandle, BindingPersistentData> entry : factoryBindingByHandle.entrySet()) {
      TradingAgentConfiguration configuration = configurationByHandle.get(entry.getValue().configurationHandle);
      TradingAgentBinding binding = new TradingAgentBinding(configuration, decodeInputSeriesMap(entry.getValue().inputSeriesNames));
      bindingByHandle.put(entry.getKey(), binding);
      handleIdentities.put(entry.getKey(), entry.getKey());
    }
   
    for (Map.Entry<TradingAgentExecutionHandle, ExecutionPersistentData> entry : factoryExecutionByHandle.entrySet()) {
View Full Code Here

TOP

Related Classes of com.quantcomponents.algo.TradingAgentBinding

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.