using System;
namespace Krs.Ats.IBNet
{
///
/// Execution details returned by Interactive Brokers
///
[Serializable()]
public class Execution
{
#region Private Variables
private String accountNumber;
private int clientId;
private String exchange;
private String executionId;
private int liquidation;
private int orderId;
private int permId;
private double price;
private int shares;
private ExecutionSide side;
private String time;
private int cumQuantity;
private decimal avgPrice;
private String orderRef;
#endregion
#region Constructors
///
/// Default Constructor
///
public Execution()
{
}
///
/// Full Constructor
///
/// The order id.
/// TWS orders have a fixed client id of "0."
/// Unique order execution id.
/// The order execution time.
/// The customer account number.
/// Exchange that executed the order.
/// Specifies if the transaction was a sale or a purchase.
/// The number of shares filled.
/// The order execution price.
/// The TWS id used to identify orders, remains the same over TWS sessions.
/// Identifies the position as one to be liquidated last should the need arise.
/// Cumulative quantity. Used in regular trades, combo trades and legs of the combo.
/// Average price. Used in regular trades, combo trades and legs of the combo.
/// Order Reference
public Execution(int orderId, int clientId, String executionId, String time, String accountNumber,
String exchange, ExecutionSide side, int shares, double price, int permId, int liquidation,
int cumQuantity, decimal avgPrice, string orderRef)
{
this.orderId = orderId;
this.clientId = clientId;
this.executionId = executionId;
this.time = time;
this.accountNumber = accountNumber;
this.exchange = exchange;
this.side = side;
this.shares = shares;
this.price = price;
this.permId = permId;
this.liquidation = liquidation;
this.cumQuantity = cumQuantity;
this.avgPrice = avgPrice;
this.orderRef = orderRef;
}
#endregion
#region Properties
///
/// The order id.
///
/// TWS orders have a fixed order id of "0."
public int OrderId
{
get { return orderId; }
set { orderId = value; }
}
///
/// The id of the client that placed the order.
///
/// TWS orders have a fixed client id of "0."
public int ClientId
{
get { return clientId; }
set { clientId = value; }
}
///
/// Unique order execution id.
///
public string ExecutionId
{
get { return executionId; }
set { executionId = value; }
}
///
/// The order execution time.
///
public string Time
{
get { return time; }
set { time = value; }
}
///
/// The customer account number.
///
public string AccountNumber
{
get { return accountNumber; }
set { accountNumber = value; }
}
///
/// Exchange that executed the order.
///
public string Exchange
{
get { return exchange; }
set { exchange = value; }
}
///
/// Specifies if the transaction was a sale or a purchase.
///
/// Valid values are:
///
/// - Bought
/// - Sold
///
///
public ExecutionSide Side
{
get { return side; }
set { side = value; }
}
///
/// The number of shares filled.
///
public int Shares
{
get { return shares; }
set { shares = value; }
}
///
/// The order execution price.
///
public double Price
{
get { return price; }
set { price = value; }
}
///
/// The TWS id used to identify orders, remains the same over TWS sessions.
///
public int PermId
{
get { return permId; }
set { permId = value; }
}
///
/// Identifies the position as one to be liquidated last should the need arise.
///
public int Liquidation
{
get { return liquidation; }
set { liquidation = value; }
}
///
/// Cumulative Quantity
///
public int CumQuantity
{
get { return cumQuantity; }
set { cumQuantity = value; }
}
///
/// Average Price
///
public decimal AvgPrice
{
get { return avgPrice; }
set { avgPrice = value; }
}
public string OrderRef
{
get { return orderRef; }
set { orderRef = value; }
}
#endregion
}
}