本文整理汇总了C#中MadViper.POrder.UpdateCancelMessage方法的典型用法代码示例。如果您正苦于以下问题:C# POrder.UpdateCancelMessage方法的具体用法?C# POrder.UpdateCancelMessage怎么用?C# POrder.UpdateCancelMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MadViper.POrder
的用法示例。
在下文中一共展示了POrder.UpdateCancelMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KtbSpotTest
void KtbSpotTest()
{
String spot10yrCode = KtbSpotUtil.Ins().KtbSpot_10yr.Code;
{
TradingDirection longShort = TradingDirection.Long;
string code = spot10yrCode;
long reqCount = CommonConst._100_000_000;
double reqPrice = 8000;
Account account = AccountManager.Ins().CreateSimBondAccount();
IOrderLimit orderLimit = new DefaultOrderLimit(account);
orderLimit = new LimOrderLimit(orderLimit);
account.SetOrderLimit(orderLimit);
RawMarketData rmdClone = new RawMarketData(spot10yrCode, Detail.ProductType.KtbSpot);
rmdClone.BidPrice1 = 8000;
rmdClone.AskPrice1 = 8001;
POrder target = new POrder(longShort, code, reqCount, reqPrice, account, rmdClone);
bool success = POrderUtil.RequestOrder(target, null);
Assert.AreEqual(true, success);
target.UpdateCancelMessage(target.ReqCount);
POrder_UnittestUtil.ClearOrder(target);
}
}
示例2: CancelRemainsRightNow
public static void CancelRemainsRightNow(POrder order)
{
order.UpdateCancelMessage(order.ReqCount - Math.Abs(order.GetSignedContractedCount()));
}
示例3: KtbFutureTest
void KtbFutureTest()
{
String future10yrCode = KtbFutureUtil.Ins().KtbFuture_10yr_1.Code;
{
TradingDirection longShort = TradingDirection.Long;
string code = future10yrCode;
long reqCount = 10;
double reqPrice = 105.10;
Account account = AccountManager.Ins().CreateSimFOAccount();
IOrderLimit orderLimit = new DefaultOrderLimit(account);
orderLimit = new LimOrderLimit(orderLimit);
account.SetOrderLimit(orderLimit);
RawMarketData rmdClone = new RawMarketData(future10yrCode, Detail.ProductType.KtbFuture);
rmdClone.BidPrice1 = 105.10;
rmdClone.AskPrice1 = 105.15;
POrder target = new POrder(longShort, code, reqCount, reqPrice, account, rmdClone);
bool success = POrderUtil.RequestOrder(target, null);
Assert.AreEqual(true, success);
target.UpdateCancelMessage(target.ReqCount);
POrder_UnittestUtil.ClearOrder(target);
}
}
示例4: TestPOrderLongBlockManagerBondSpot
public void TestPOrderLongBlockManagerBondSpot()
{
// 채권 매수 매도 생성 등 테스트
Account simAccount = StrategyManager.Ins().GetAccount("SimBond");
POrderLongBlockManager manager = simAccount.LongBlockManager;
String codeNoTail = BondUtil.GetCodeNoTail(BondUtil.HouseBond_1.Code);
// 일반 등록
String codeNormal = BondUtil.GetCodeWithMarketType(BondUtil.HouseBond_1.Code, MarketType._0_Bond_일반);
RmdManager.Ins().BondSpot.Register(codeNormal);
RawMarketData rmdNormal = RmdManager.Ins().BondSpot.GetData(codeNormal);
const long kReqNormalCount = CommonConst._1_000 * CommonConst._1_000 * CommonConst._1_000;
// 1. 매수전
long possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(0, possibleShortCount);
POrder o = new POrder(TradingDirection.Long, codeNormal, kReqNormalCount, 8888, simAccount, rmdNormal, MarketType._0_Bond_일반, false);
o.Update(kReqNormalCount, 8888, true);
// 2. 매수 완료
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(kReqNormalCount, possibleShortCount);
// 소액 등록
String codeSmall = BondUtil.GetCodeWithMarketType(BondUtil.HouseBond_1.Code, MarketType._1_Bond_소액);
RmdManager.Ins().BondSpot.Register(codeSmall);
RawMarketData rmdSmall = RmdManager.Ins().BondSpot.GetData(codeSmall);
const long kReqSmallCount = CommonConst._1_000;
o = new POrder(TradingDirection.Short, codeSmall, kReqSmallCount, 8888, simAccount, rmdSmall, MarketType._1_Bond_소액, false);
// 3. 매도 주문
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(kReqNormalCount - kReqSmallCount, possibleShortCount);
// 4. 매도 주문 일부체결
o.Update(kReqSmallCount / 2, 8888, false);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(kReqNormalCount - kReqSmallCount, possibleShortCount);
// 5. 매도 주문 완료
o.Update(kReqSmallCount / 2, 8888, false);
o.UpdateCancelMessage(o.ReqCount - o.ContractedCount);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(kReqNormalCount - kReqSmallCount / 2, possibleShortCount);
o.Update(kReqSmallCount, 8888, true);
long curPossibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
// 6. 매수 일부 완료, 매도 주문
POrder oLong = new POrder(TradingDirection.Long, codeNormal, kReqNormalCount, 8888, simAccount, rmdNormal, MarketType._0_Bond_일반, false);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(curPossibleShortCount, possibleShortCount);
oLong.Update(kReqSmallCount / 2, 8888, false);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(curPossibleShortCount + kReqSmallCount / 2, possibleShortCount);
oLong.Update(oLong.ReqCount, 8888, true);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(codeNoTail);
Assert.AreEqual(curPossibleShortCount + kReqNormalCount, possibleShortCount);
}
示例5: TestPOrderLongBlockManagerKtbSpot
public void TestPOrderLongBlockManagerKtbSpot()
{
Account simAccount = StrategyManager.Ins().GetAccount("SimBond");
POrderLongBlockManager manager = simAccount.LongBlockManager;
String code = KtbSpotUtil.Ins().KtbSpot_10yr.Code;
//매수전
long possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(code);
Assert.AreEqual(0, possibleShortCount);
RawMarketData rmd = new RawMarketData(code, Detail.ProductType.KtbSpot);
//매수 1억
POrder o = new POrder(TradingDirection.Long, code, CommonConst._100_000_000, 8888,
simAccount, rmd);
o.Update(CommonConst._100_000_000, 8888, true);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(code);
Assert.AreEqual(CommonConst._100_000_000, possibleShortCount);
o = new POrder(TradingDirection.Short, code, CommonConst._100_000_000, 8888, simAccount, rmd);
// 3. 매도 주문
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(code);
Assert.AreEqual(0, possibleShortCount);
// 4. 매도 주문 일부체결
o.Update(CommonConst._10_000_000, 8888, false);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(code);
Assert.AreEqual(0, possibleShortCount);
// 5. 매도 주문 완료
o.UpdateCancelMessage(CommonConst._100_000_000 - CommonConst._10_000_000);
possibleShortCount = manager.GetPossibleShortCountUsingCodeNoTail(code);
Assert.AreEqual(CommonConst._100_000_000 - CommonConst._10_000_000, possibleShortCount);
}
示例6: GetSignedMaxPossibleExposureCount100kTest
public void GetSignedMaxPossibleExposureCount100kTest()
{
String elwCode = GetFirstElwCode(100);
ElwInfo ei = ElwUtil.GetElwInfo(elwCode);
long elwCountOfOneOption = ElwOptionUtil.GetElwCountOfOneOption(elwCode);
Account simAccountElw = AccountManager.Ins().CreateSimSpotAccount();
RawMarketData rmdElw = new RawMarketData(elwCode, Detail.ProductType.ELW);
Account simAccountFO = AccountManager.Ins().CreateSimFOAccount();
String optionCode = ElwOptionUtil.ToOptionCode(elwCode);
KospiOptionInfo koi = OptionUtil.GetKOI(optionCode);
Detail.ProductType pt = OptionUtil.ConvertToDetailProductType(koi.CallPut);
RawMarketData rmdOption = new RawMarketData(optionCode, pt);
// elw 1000,000개 매수 상태로 설정
POrder preOrderElw = new POrder(TradingDirection.Long, elwCode, 1000000, 10, simAccountElw, rmdElw);
preOrderElw.OrderNumber = 0;
Assert.AreEqual(preOrderElw.IsInputValidated, true);
preOrderElw.Update(preOrderElw.ReqCount, 10, true);
List<POrder> arr = new List<POrder>();
POrder elwOrder1 = new POrder(TradingDirection.Long, elwCode, elwCountOfOneOption, 10, simAccountElw, rmdElw);
elwOrder1.OrderNumber = 0;
Assert.AreEqual(elwOrder1.IsInputValidated, true);
POrder elwOrder2 = new POrder(TradingDirection.Short, elwCode, elwCountOfOneOption, 10, simAccountElw, rmdElw);
elwOrder2.OrderNumber = 0;
Assert.AreEqual(elwOrder2.IsInputValidated, true);
arr.Add(elwOrder1);
arr.Add(elwOrder2);
// 0인지 검사 한번 한다.
{
long actual = ElwOptionUtil.GetSignedMaxPossibleExposureCount100k(arr);
long expected = 0;
Assert.AreEqual(expected, actual);
}
// 옵션도 한번 더해본다.
POrder optionOrder1 = new POrder(TradingDirection.Long, optionCode, 1, 10, simAccountFO, rmdOption);
optionOrder1.OrderNumber = 0;
Assert.AreEqual(optionOrder1.IsInputValidated, true);
arr.Add(optionOrder1);
// 100,000 인지 검사 한번 한다.
{
long actual = ElwOptionUtil.GetSignedMaxPossibleExposureCount100k(arr);
long expected = 100000;
Assert.AreEqual(expected, actual);
}
// 옵션 매도를 한번 더해본다. 수량은 2개
POrder optionOrder2 = new POrder(TradingDirection.Short, optionCode, 2, 10, simAccountFO, rmdOption);
optionOrder2.OrderNumber = 0;
Assert.AreEqual(optionOrder2.IsInputValidated, true);
arr.Add(optionOrder2);
// -100,000 인지 검사 한번 한다.
{
long actual = ElwOptionUtil.GetSignedMaxPossibleExposureCount100k(arr);
long expected = -100000;
Assert.AreEqual(expected, actual);
}
elwOrder1.Update(elwOrder1.ReqCount, 10, true);
// -100,000 인지 검사 한번 한다.
{
long actual = ElwOptionUtil.GetSignedMaxPossibleExposureCount100k(arr);
long expected = -100000;
Assert.AreEqual(expected, actual);
}
elwOrder2.UpdateCancelMessage(elwOrder2.ReqCount);
// 0 인지 검사 한번 한다.
{
long actual = ElwOptionUtil.GetSignedMaxPossibleExposureCount100k(arr);
long expected = 0;
Assert.AreEqual(expected, actual);
}
}
示例7: GetSignedContractedCount100kTest1
public void GetSignedContractedCount100kTest1()
{
String elwCode = GetFirstElwCode(100);
ElwInfo ei = ElwUtil.GetElwInfo(elwCode);
long elwCountOfOneOption = ElwOptionUtil.GetElwCountOfOneOption(elwCode);
Account simAccountElw = AccountManager.Ins().CreateSimSpotAccount();
RawMarketData rmdElw = RmdManager.Ins().GetData(elwCode);
double elwPrice = 10;
long elwCount = 3000;
SetAsValidValue(rmdElw, TradingDirection.Long, elwPrice);
Account simAccountFO = AccountManager.Ins().CreateSimFOAccount();
String optionCode = ElwOptionUtil.ToOptionCode(elwCode);
KospiOptionInfo koi = OptionUtil.GetKOI(optionCode);
Detail.ProductType pt = OptionUtil.ConvertToDetailProductType(koi.CallPut);
RawMarketData rmdOption = RmdManager.Ins().GetData(optionCode);
double optionPrice = 0.1;
long optionCount = 3;
SetAsValidValue(rmdOption, TradingDirection.Short, optionPrice);
List<POrder> arr = new List<POrder>();
POrder elwOrder = new POrder(TradingDirection.Long, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
Assert.AreEqual(elwOrder.IsInputValidated, true);
arr.Add(elwOrder);
{
long expected = 0;
long actual;
actual = ElwOptionUtil.GetSignedContractedCount100k(arr);
Assert.AreEqual(expected, actual);
}
elwOrder.Update(1000, elwPrice, false);
{
long expected = 100000;
long actual;
actual = ElwOptionUtil.GetSignedContractedCount100k(arr);
Assert.AreEqual(expected, actual);
}
POrder optionOrder = new POrder(TradingDirection.Short, optionCode, optionCount, optionPrice, simAccountFO, rmdOption);
Assert.AreEqual(optionOrder.IsInputValidated, true);
arr.Add(optionOrder);
{
long expected = 100000;
long actual;
actual = ElwOptionUtil.GetSignedContractedCount100k(arr);
Assert.AreEqual(expected, actual);
}
optionOrder.Update(2, optionPrice, false);
{
long expected = -100000;
long actual;
actual = ElwOptionUtil.GetSignedContractedCount100k(arr);
Assert.AreEqual(expected, actual);
}
elwOrder.UpdateCancelMessage(elwOrder.ReqCount - elwOrder.ContractedCount);
optionOrder.Update(optionOrder.ReqCount, optionPrice, true);
{
long expected = -200000;
long actual;
actual = ElwOptionUtil.GetSignedContractedCount100k(arr);
Assert.AreEqual(expected, actual);
}
}
示例8: GetParticleElwCountTest1
public void GetParticleElwCountTest1()
{
String elwCode = GetFirstElwCode(100);
ElwInfo ei = ElwUtil.GetElwInfo(elwCode);
long elwCountOfOneOption = ElwOptionUtil.GetElwCountOfOneOption(elwCode);
Account simAccountElw = AccountManager.Ins().CreateSimSpotAccount();
RawMarketData rmdElw = RmdManager.Ins().GetData(elwCode);
double elwPrice = 10;
long elwCount = 3000;
SetAsValidValue(rmdElw, TradingDirection.Long, elwPrice);
Account simAccountFO = AccountManager.Ins().CreateSimFOAccount();
String optionCode = ElwOptionUtil.ToOptionCode(elwCode);
KospiOptionInfo koi = OptionUtil.GetKOI(optionCode);
Detail.ProductType pt = OptionUtil.ConvertToDetailProductType(koi.CallPut);
RawMarketData rmdOption = RmdManager.Ins().GetData(optionCode);
double optionPrice = 0.1;
long optionCount = 3;
SetAsValidValue(rmdOption, TradingDirection.Short, optionPrice);
POrder bufferOrder = new POrder(
TradingDirection.Long, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
POrder_UnittestUtil.GetFakeOrderNumber(bufferOrder);
bufferOrder.Update(bufferOrder.ReqCount, elwPrice, true);
{
POrder o = new POrder(TradingDirection.Long, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
Assert.AreEqual(o.IsInputValidated, true);
o.Update(o.ReqCount, elwPrice, true);
}
List<POrder> arr = new List<POrder>();
POrder optionOrder = new POrder(
TradingDirection.Short, optionCode, optionCount, optionPrice, simAccountFO, rmdOption);
Assert.AreEqual(optionOrder.IsInputValidated, true);
arr.Add(optionOrder);
{
long expected = 0;
long actual;
actual = ElwOptionUtil.GetSignedParticleElwCount(ei, arr);
Assert.AreEqual(expected, actual);
}
{
POrder elwOrder = new POrder(
TradingDirection.Short, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
Assert.AreEqual(elwOrder.IsInputValidated, true);
arr.Add(elwOrder);
{
long expected = 0;
long actual;
actual = ElwOptionUtil.GetSignedParticleElwCount(ei, arr);
Assert.AreEqual(expected, actual);
}
elwOrder.OrderNumber = 0;
elwOrder.Update(10, elwPrice, false);
elwOrder.UpdateCancelMessage(elwOrder.ReqCount - elwOrder.ContractedCount);
{
long expected = -10;
long actual;
actual = ElwOptionUtil.GetSignedParticleElwCount(ei, arr);
Assert.AreEqual(expected, actual);
}
arr.Remove(elwOrder);
}
{
POrder elwOrder = new POrder(
TradingDirection.Short, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
elwOrder.OrderNumber = 0;
Assert.AreEqual(elwOrder.IsInputValidated, true);
arr.Add(elwOrder);
{
long expected = 0;
long actual;
actual = ElwOptionUtil.GetSignedParticleElwCount(ei, arr);
Assert.AreEqual(expected, actual);
}
elwOrder.Update(990, elwPrice, false);
elwOrder.UpdateCancelMessage(elwOrder.ReqCount - elwOrder.ContractedCount);
{
long expected = -990;
long actual;
actual = ElwOptionUtil.GetSignedParticleElwCount(ei, arr);
Assert.AreEqual(expected, actual);
}
arr.Remove(elwOrder);
}
{
POrder elwOrder = new POrder(
TradingDirection.Short, elwCode, elwCount, elwPrice, simAccountElw, rmdElw);
Assert.AreEqual(elwOrder.IsInputValidated, true);
arr.Add(elwOrder);
{
//.........这里部分代码省略.........