/*******************************************************************************
* Copyright (c) 2013 Luigi Sgro. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Luigi Sgro - initial API and implementation
******************************************************************************/
package com.quantcomponents.algo;
import java.net.ConnectException;
import com.quantcomponents.core.exceptions.RequestFailedException;
/**
* Low-level interface that groups the methods to send orders to execution services
*/
public interface IOrderReceiver {
/**
* Send an order to the execution service, and retrieve the corresponding order ID from it.
* The order ID should be written to the order instance by the caller.
* @param order an order to be executed. The ID parameter {@link IOrder#getId()} is ignored. This parameter is not changed
* @return an ID for the order, generated by the execution service, to be written to the order instance by the caller
*/
String sendOrder(IOrder order) throws ConnectException, RequestFailedException;
/**
* Sends a bracket order, and retrieves corresponding order IDs for them.
* The children orders are conditionally processed only if the parent order has been executed.
* @param parent parent order
* @param children child orders, activated only after the parent order has been executed
* @return an array of IDs, with the parent order ID in the first position, and the child order IDs in the
* respective following positions
*/
String[] sendBracketOrders(IOrder parent, IOrder[] children) throws ConnectException, RequestFailedException;
}