本文整理汇总了C#中MadViper.POrder类的典型用法代码示例。如果您正苦于以下问题:C# POrder类的具体用法?C# POrder怎么用?C# POrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
POrder类属于MadViper命名空间,在下文中一共展示了POrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPartialContractCount
public long GetPartialContractCount(POrder o)
{
RawMarketData rmd = RmdManager.Ins().GetData(o.Code);
if (o.LongShort == TradingDirection.Long)
{
// 매수인데 현재 AskPrice가 매수가보다 낮다. 모두 체결되었다고 가정한다.
if (rmd.AskPrice1 > 0 && rmd.AskPrice1 <= o.ReqPrice)
{
return o.ReqCount;
}
else
{
// 그렇지 않다면 체결되지 않았다.
return 0;
}
}
else
{
// 매도인데 현재 BidPrice가 요청가보다 높다. 모두 체결되었다.
if (rmd.BidPrice1 >= o.ReqPrice)
{
return o.ReqCount;
}
else
{
// 그렇지 않다면 체결되지 않았다.
return 0;
}
}
}
示例2: SweepUnit_OE
public SweepUnit_OE(
POrder goalOrder,
Account accountFO,
Account accountSpot,
OptionTribe ot,
ISweeper parent,
Boolean bConservativeOptionPolicyOn,
int muteSec)
{
ID = SweepUnitIDManager.NextID++;
_parent = parent;
GoalOrder = goalOrder;
RealOrders = new List<POrder>();
_ot = ot;
_mute = new Timer(muteSec, ""); // 2초
_candidateCodes = ElwOptionUtil.GetSameCandidateCodes(goalOrder.Code);
_accountSpot = accountSpot;
_accountFO = accountFO;
_bConservativeOptionPolicyOn = bConservativeOptionPolicyOn;
if (!RequestInitOrder())
{
GoalOrder.Free();
}
_State = State._1_MuteFewSecs;
ShowState();
}
示例3: IsOK
public Boolean IsOK(POrder o)
{
if (o.LongShort == TradingDirection.Long)
{
// 가격이 longUpperLimit(12,000)보다 작아야 한다.
if (o.ReqPrice < _longUpperLimit)
{
// ok
}
else
{
logger.Error("Order price {0:n2} > long upper limit {1:n2}", o.ReqPrice, _longUpperLimit);
Util.KillWithNotice("Order price > long upper limit");
return false;
}
}
else
{
// 가격이 shortLowerLimit(8,000)보다 커야 한다.
if (o.ReqPrice > _shortLowerLimit)
{
// ok
}
else
{
logger.Error("Order price {0:n2} < short lower limit {1:n2}", o.ReqPrice, _shortLowerLimit);
Util.KillWithNotice("Order price < short lower limit");
return false;
}
}
return _orderLimit.IsOK(o);
}
示例4: IsOK
public Boolean IsOK(POrder o)
{
// Pass Test
logger.Error("여기는 실주문 프로그램에서는 오면 안되는 지점입니다.");
Util.KillWithNotice("여기는 실주문 프로그램에서는 오면 안되는 지점입니다. 유닛테스트는 OK");
return false;
}
示例5: GetAvgPrice
public static double GetAvgPrice(POrder o1, POrder o2)
{
double value = (o1.AvgContractPrice * o1.ContractedCount) + (o2.AvgContractPrice * o2.ContractedCount);
long count = o1.ContractedCount + o2.ContractedCount;
return value / count;
}
示例6: IsOK
public Boolean IsOK(POrder o)
{
if (_account == null)
{
logger.Error("[DefaultOrderLimit] account가 null이다. {0} != {1}", o.Code, o.RMDClone);
Util.KillWithNotice("[DefaultOrderLimit] account가 null이다.");
return false;
}
if (!Util.IsCorrectCodeMatch(o.Code, o.RMDClone))
{
logger.Error("[DefaultOrderLimit] Order.Code != RMD.Code, ({0} != {1})", o.Code, o.RMDClone);
logger.Error("ERROR ORDER[{0}]", o.ToString());
Util.KillWithNotice("[DefaultOrderLimit] error");
return false;
}
if (!POrderLegalManager.Ins().IsLegalOrder(o, true))
{
logger.Error("[DefaultOrderLimit] Legal Problem ({0})", o.Code);
logger.Error("ERROR ORDER[{0}]", o.ToString());
Util.KillWithNotice("[DefaultOrderLimit] Legal Problem");
return false;
}
return true;
}
示例7: Sweeper_Door
public Sweeper_Door(POrder o, SweeperController_Door parent, int roundCount)
{
_enteredOrder = o;
_parent = parent;
this.ID = IDGenerator++;
this.RoundCount = roundCount;
}
示例8: SweepUnit_FO
public SweepUnit_FO(
long signedGoalCountFO,
String code,
double initEnterPrice,
POrder initOrder,
Account accountFO,
ISweeper parent,
int muteSec)
{
this.ID = SweepUnitIDManager.NextID++;
this.InitEnterPrice = initEnterPrice;
this.InitSignedGoalCount = this.CurSignedTargetCount = signedGoalCountFO;
this.Code = code;
this._initOrder = initOrder;
this.AccountFO = accountFO;
this._parent = parent;
this._muteSec = muteSec;
this.InitLongShort = InitSignedGoalCount > 0 ? TradingDirection.Long : TradingDirection.Short;
this._mute = new Timer(muteSec, "");
this._bResumed = false;
this._bCompleteQuickly = false;
this.RealOrders = new List<POrder>();
RequestInitOrder();
}
示例9: 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);
}
}
示例10: IsOK
public Boolean IsOK(POrder o)
{
RawMarketData rmd = o.RMDClone;
double opa = ProductUtil.Ins().GetOnePointAmount(o.Code);
double value = Math.Abs(opa * o.ReqCount * Math.Max(rmd.CurPrice, o.ReqPrice));
if (_maxValue < _curValue + value)
{
try
{
logger.Error("[ValuePerMinuteOrderLimit] {0} < {1} + {2}", _maxValue, _curValue, value);
Util.KillWithNotice("[ValuePerMinuteOrderLimit] error");
logger.Error("ERROR ORDER[{0}]", o.ToString());
Util.KillWithNotice("ERROR ORDER");
}
catch (System.Exception ex)
{
logger.Error(ex.ToString());
Util.KillWithNotice(ex.ToString());
}
return false;
}
return _decorator.IsOK(o);
}
示例11: S4_CancelRemains_PositionTakerState
public S4_CancelRemains_PositionTakerState(PositionTakerController parent, POrder thisTurnOrder)
{
_parent = parent;
this.ThisTurnOrder = thisTurnOrder;
this.ThisTurnOrder.CancelRemains();
}
示例12: TestPOrderLegalData
public void TestPOrderLegalData()
{
string code = "201EC260";
RawMarketData rmd = new RawMarketData(code, Detail.ProductType.CallOption);
rmd.BidPrice1 = 0.81000001F;
rmd.BidCount1 = 1000;
rmd.AskPrice1 = 0.81999999F;
rmd.AskCount1 = 1000;
Account simAccount = AccountManager.Ins().CreateSimFOAccount();
POrder o0 = new POrder(TradingDirection.Long, code, 1, 0.81, simAccount, rmd);
POrderLegalManager.Ins().Add(o0);
{
POrder o2 = new POrder(TradingDirection.Long, code, 1, 0.81, simAccount, rmd);
Boolean success = POrderLegalManager.Ins().Remove(o2);
Assert.AreEqual(success, false);
}
{
POrder o = new POrder(TradingDirection.Short, code, 1, 0.8099998, simAccount, rmd);
POrder_Accessor oAccessor = new POrder_Accessor(o);
oAccessor.ReqPrice = 0.810006;
Boolean legal = POrderLegalManager.Ins().IsLegalOrder(o, false);
Assert.AreEqual(legal, false);
o.SetAsLegalPrice();
legal = POrderLegalManager.Ins().IsLegalOrder(o, false);
Assert.AreEqual(legal, true);
Util.LogOutCriticalError("\t\t # Non exist code search 1 permitted.");
Boolean success = POrderLegalManager.Ins().Remove(o);
Assert.AreEqual(success, false);
POrderLegalManager.Ins().Add(o);
POrder o2 = new POrder(TradingDirection.Short, code, 1, 0.8099998, simAccount, rmd);
success = POrderLegalManager.Ins().Remove(o2);
Assert.AreEqual(success, false);
// test reverse
{
POrder o3 = new POrder(TradingDirection.Long, code, 1, 0.83, simAccount, rmd);
POrder_Accessor oAccessor3 = new POrder_Accessor(o3);
oAccessor3.ReqPrice = 0.83;
legal = POrderLegalManager.Ins().IsLegalOrder(o3, false);
Assert.AreEqual(legal, false);
POrderLegalManager.Ins().Remove(o3);
}
POrderLegalManager.Ins().Remove(o2);
POrderLegalManager.Ins().Remove(o);
}
POrderLegalManager.Ins().Remove(o0);
}
示例13: AddPOrderAsCC_WithChangeSign
public void AddPOrderAsCC_WithChangeSign(POrder o)
{
CodeCount cc = new CodeCount();
cc.Code = o.Code;
cc.Count = o.GetSignedContractedCount() * (-1);
_ccs.Add(cc);
}
示例14: Contract_CallBack
public Boolean Contract_CallBack(POrder order)
{
if (SweepUnit.Contract_CallBack(order))
{
return true;
}
return false;
}
示例15: SimPOrder
public SimPOrder(POrder pOrder, long period)
{
_pOrder = pOrder;
_State = State.접수;
SchedulingTime = DateTime.Now.AddMilliseconds(period);
PartialContractScheduledCount = 0;
CurTotalContractedCount = 0;
}