本文整理汇总了C#中MadViper.POrder.CancelRemains方法的典型用法代码示例。如果您正苦于以下问题:C# POrder.CancelRemains方法的具体用法?C# POrder.CancelRemains怎么用?C# POrder.CancelRemains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MadViper.POrder
的用法示例。
在下文中一共展示了POrder.CancelRemains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CancelRemainsTest
public void CancelRemainsTest()
{
long reqCount = 3;
double reqPrice = 220.0;
Account account = AccountManager.Ins().CreateSimFOAccount();
IOrderLimit orderLimit = new DefaultOrderLimit(account);
orderLimit = new CountBidAskRangeOrderLimit(orderLimit);
orderLimit = new PriceBidAskRangeOrderLimit(orderLimit);
orderLimit = new LimOrderLimit(orderLimit);
account.SetOrderLimit(orderLimit);
SimHTS target = account.Hts as SimHTS;
string code = KospiFutureUtil.Ins().KFI.Code;
string price = reqPrice.ToString("n0");
string quantity = Convert.ToString(reqCount);
RawMarketData rmd = RmdManager.Ins().GetData(KospiFutureUtil.Ins().KFI.Code);
rmd.BidPrice1 = 220;
rmd.AskPrice1 = 225;
rmd.BidCount1 = 100;
rmd.AskCount1 = 101;
{
POrder o = new POrder(TradingDirection.Long, code, reqCount, reqPrice, account, rmd);
Assert.AreEqual(o.IsInputValidated, true);
bool expected = true;
bool actual;
actual = account.RequestOrder(o);
Assert.AreEqual(expected, actual);
SimPOrder simOrder = new SimPOrder(o, 1500);
simOrder.Execute();
StringPacket inOrderPacket = simOrder.GetContractPacket(SimPOrder.접수);
target.ReceiveDTRealEventHandler(inOrderPacket.GetStream());
account.HandleCallBackData();
o.CancelRemains();
StringPacket cancelPacket = simOrder.GetCancelPacket();
target.ReceiveDTRealEventHandler(cancelPacket.GetStream());
account.HandleCallBackData();
Assert.AreEqual(o.IsDone(), true);
Assert.AreEqual(o.CanceledCount, o.ReqCount);
POrderLegalManager.Ins().Remove(o);
POrderBidAskCountManager.Ins().Unregister(o);
}
{
POrder o = new POrder(TradingDirection.Long, code, reqCount, reqPrice, account, rmd);
Assert.AreEqual(o.IsInputValidated, true);
bool expected = true;
bool actual;
actual = account.RequestOrder(o);
Assert.AreEqual(expected, actual);
SimPOrder simOrder = new SimPOrder(o, 1500);
simOrder.Execute();
StringPacket inOrderPacket = simOrder.GetContractPacket(SimPOrder.접수);
target.ReceiveDTRealEventHandler(inOrderPacket.GetStream());
simOrder.CurTotalContractedCount = reqCount;
StringPacket contractCompletePacket = simOrder.GetContractPacket(SimPOrder.전량체결);
target.ReceiveDTRealEventHandler(contractCompletePacket.GetStream());
o.CancelRemains();
account.HandleCallBackData();
Assert.AreEqual(o.IsDone(), true);
Assert.AreEqual(o.CanceledCount, 0);
Assert.AreEqual(o.ContractedCount, o.ReqCount);
POrderLegalManager.Ins().Remove(o);
POrderBidAskCountManager.Ins().Unregister(o);
}
}
示例2: CancelDangerousOrders_Raw
Boolean CancelDangerousOrders_Raw(POrder order)
{
String elwCode = order.Code;
double reqPrice = order.ReqPrice;
ElwInfo ei = ElwUtil.GetElwInfo(elwCode);
if (ei == null)
{
Trace.Assert(false);
}
// 만기 확인
OptionTribe ot = ElwOptionUtil.GetOptionTribeFromCode(elwCode);
if (ot == null)
{
Trace.Assert(false);
}
double strike = ot.Strike;
CallPutFlag cp = ot.CP;
// 바로 옆 옵션을 reference로 사용한다.
double doorStrike = GetDoorStrike(strike, cp, 1.0);
KospiOptionInfo targetKOI = OptionUtil.GetKOI(strike, cp, ot.Maturity);
KospiOptionInfo doorKOI = OptionUtil.GetKOI(doorStrike, cp, ot.Maturity);
if (doorKOI == null)
{
Trace.Assert(false);
}
else
{
Boolean bDangerous = CancelDangerousOrders_Raw(order, ei, targetKOI, doorKOI);
if (bDangerous)
{
order.CancelRemains();
EmailManager.Ins().AddEmail(
String.Format("Dangerous Door Canceled... {0}", order.ToString()));
}
return bDangerous;
}
return false;
}