本文整理汇总了C#中QuickFix.Price类的典型用法代码示例。如果您正苦于以下问题:C# QuickFix.Price类的具体用法?C# QuickFix.Price怎么用?C# QuickFix.Price使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuickFix.Price类属于命名空间,在下文中一共展示了QuickFix.Price类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getPrice
public QuickFix.Price getPrice()
{
QuickFix.Price value = new QuickFix.Price();
getField(value); return value;
}
示例2: submitOrder
/// <summary>
/// submit an order to IB using a incomming FIX new order single
/// </summary>
/// <param name="myMsg"></param>
private void submitOrder(KaiTrade.Interfaces.IMessage myMsg)
{
QuickFix.Message myQFOrder = null;
try
{
// Extract the raw FIX Message from the inbound message
string strOrder = myMsg.Data;
// Use QuickFix to handle the message
myQFOrder = new QuickFix.Message(strOrder);
// Use product manager to validate the product specified on
// the order exists for this adapter
// Get the product associated with the FIX message
//QuickFix.Symbol symbol = new QuickFix.Symbol();
//myQFOrder.getField(symbol);
QuickFix.Side mySide = new QuickFix.Side();
QuickFix.OrdType myOrdType = new QuickFix.OrdType();
QuickFix.OrderQty myOrderQty = new QuickFix.OrderQty();
QuickFix.Price myPrice = new QuickFix.Price();
QuickFix.StopPx myStopPx = new QuickFix.StopPx();
QuickFix.Account myAccount = new QuickFix.Account();
QuickFix.ClOrdID myClOrdID = new QuickFix.ClOrdID();
QuickFix.TimeInForce myTimeInForce = new QuickFix.TimeInForce();
// the account code is mandatory
if (myQFOrder.isSetField(myAccount))
{
myQFOrder.getField(myAccount);
}
else
{
this.SendAdvisoryMessage("IB TWS: you need to provide a valid account");
throw new Exception("IB TWS: you need to provide a valid account");
}
myQFOrder.getField(myClOrdID);
// Get the Order type
myQFOrder.getField(myOrdType);
// Get the QTY
myQFOrder.getField(myOrderQty);
// get the Side of the order
myQFOrder.getField(mySide);
// Set order duration
myQFOrder.getField(myTimeInForce);
// Prices
if (myQFOrder.isSetField(myPrice))
{
myQFOrder.getField(myPrice);
}
if (myQFOrder.isSetField(myStopPx))
{
myQFOrder.getField(myStopPx);
}
// get the contract
TWSLib.IContract myContract = getIBContract(myQFOrder);
if (myContract == null)
{
this.SendAdvisoryMessage("IB TWS: cannot find a valid contract");
throw new Exception("IB TWS: cannot find a valid contract");
}
// create an IB Order
TWSLib.IOrder myIBOrder = m_Host.TWS.createOrder();
myIBOrder.whatIf = 0;
myIBOrder.account = myAccount.getValue();
if(myOrdType.getValue() == QuickFix.OrdType.LIMIT)
{
myIBOrder.orderType = "LMT";
myIBOrder.lmtPrice = myPrice.getValue();
}
else if(myOrdType.getValue() == QuickFix.OrdType.MARKET)
{
myIBOrder.orderType = "MKT";
}
else if (myOrdType.getValue() == QuickFix.OrdType.STOP)
{
myIBOrder.orderType = "STP";
myIBOrder.auxPrice = myStopPx.getValue();
if (myPrice.getValue() == -1)
{
myIBOrder.lmtPrice = myStopPx.getValue();
}
//.........这里部分代码省略.........