void OnExecutionTicked(BfExecution exec) { try { DebugEx.EnterMethod(); _stateLock.EnterWriteLock(); DebugEx.Trace(); if (State.OnExecutionReceived(exec) && State.OrderState == BfOrderState.Completed) { OnTransactionCompleted(); } } finally { _stateLock.ExitWriteLock(); DebugEx.ExitMethod(); } }
public virtual bool OnExecutionReceived(BfExecution exec) { _wsExecs.Add(exec); var executedSize = _wsExecs.Sum(e => e.Size); if (executedSize > ExecutedSize) { ExecutedSize = executedSize; // ToDo: // marketから価格の精度を取得して丸める。 // ExecutedPrice = _wsExecs.Sum(e => e.Price * e.Size) / executedSize; if (ExecutedSize == Size) { OrderState = BfOrderState.Completed; } NotifyOrderChanged(); return(true); } return(false); }
public override bool OnExecutionReceived(BfExecution exec) { OrderingStatus = RequestingState.Confirmed; var orderUpdated = base.OnExecutionReceived(exec); if (!orderUpdated) { return(false); } if (ExecutedSize < Size) { NotifyStateChanged(BfxOrderTransactionEventKind.PartiallyExecuted, exec.ExecutedTime); } else { NotifyStateChanged(BfxOrderTransactionEventKind.Executed, exec.ExecutedTime); } return(true); }