private void StatementCompleted() { this._currentMetaData = null; this._visibleColumnCount = 0; this._schemaTable = null; this._currentPosition = PositionState.AfterRows; }
public BackOffStrategiesExecutor(PositionState positionState, Tracker tracker, IBackOffInstructionsInitializer backOffInstructionInitializer) : base(tracker) { _positionState = positionState; instructions = backOffInstructionInitializer.GetInstructions(); }
internal void Init(BitmexUser account) { var obj = Controller.GetPositionState(account, _instrument); if (obj != null) { if (obj.Opened == 1) { var msg = String.Format("The application has been launched on the '{0}'", obj.HostName); throw new InvalidOperationException(msg); } else { var type = Assembly.GetExecutingAssembly().GetType(obj.StateName); PositionState = (IPositionState)Activator.CreateInstance(type, this, obj.Instrument); PositionState.Init(obj); _stopObj = obj; StartWatchingPrice = obj.StartWatchPrice; StopPrice = obj.StopPrice; } } else { ResetState(); } }
public OperationResult Mark(MarkerType markerType) { if (State == PositionState.Empty) { switch (markerType) { case MarkerType.X: State = PositionState.X; break; case MarkerType.O: State = PositionState.O; break; default: break; } return(OperationResult.BuildSuccess()); } else { return(OperationResult.BuildFailure(ErrorType.PositionStateIsNotEmpty)); } }
public Position(int id, PositionState state, DateTime updated, string note) { Id = id; State = state; Updated = updated; Note = note; }
private void Multiplayer_ModMessageReceived(object sender, ModMessageReceivedEventArgs e) { if (e.FromModID != ModEntry.Instance.PongId) { return; } if (e.Type == typeof(GameState).Name && !this.isLeader) { GameState newState = e.ReadAs <GameState>(); double diff = GetTimestamp() - newState.CurrentTime; newState.BallVelocityState.Invert(); newState.BallPositionState.Invert(); newState.PaddlePositionState.Invert(); this.state.SetState(newState); //diff milli seconds, 60 frames per second -> need to run diff * 60 //for (int i = 0; i < (diff * 60) / 1000; i++) // this.Update(); //if ((int)((diff * 60) / 1000) > 0) // ModEntry.Instance.Monitor.Log($"Follower updated {(int)((diff * 60) / 1000)} times"); } else if (e.Type == typeof(PositionState).Name && this.isLeader) { PositionState newState = e.ReadAs <PositionState>(); newState.Invert(); this.followerPaddlePosition.SetState(newState); } }
public LineMappingEntry(int unmappedLine) { this.UnmappedLine = unmappedLine; this.MappedLine = unmappedLine; this.MappedPathOpt = null; this.State = PositionState.Unmapped; }
// Given a directive and the previous entry, create a new entry. protected override LineMappingEntry GetEntry( DirectiveTriviaSyntax directiveNode, SourceText sourceText, LineMappingEntry previous ) { Debug.Assert(ShouldAddDirective(directiveNode)); var directive = (LineDirectiveTriviaSyntax)directiveNode; // Get line number of NEXT line, hence the +1. var directiveLineNumber = sourceText.Lines.IndexOf(directive.SpanStart) + 1; // The default for the current entry does the same thing as the previous entry, except // resetting hidden. var unmappedLine = directiveLineNumber; var mappedLine = previous.MappedLine + directiveLineNumber - previous.UnmappedLine; var mappedPathOpt = previous.MappedPathOpt; PositionState state = PositionState.Unmapped; // Modify the current entry based on the directive. SyntaxToken lineToken = directive.Line; if (!lineToken.IsMissing) { switch (lineToken.Kind()) { case SyntaxKind.HiddenKeyword: state = PositionState.Hidden; break; case SyntaxKind.DefaultKeyword: mappedLine = unmappedLine; mappedPathOpt = null; state = PositionState.Unmapped; break; case SyntaxKind.NumericLiteralToken: // skip both the mapped line and the filename if the line number is not valid if (!lineToken.ContainsDiagnostics) { object?value = lineToken.Value; if (value is int) { // convert one-based line number into zero-based line number mappedLine = ((int)value) - 1; } if (directive.File.Kind() == SyntaxKind.StringLiteralToken) { mappedPathOpt = (string?)directive.File.Value; } state = PositionState.Remapped; } break; } } return(new LineMappingEntry(unmappedLine, mappedLine, mappedPathOpt, state)); }
private async Task <EntityDto> ToEntityDto(Guid e) { var entity = GrainFactory.GetGrain <IEntity>(e); PositionState position = await GrainFactory.Get <IPosition>(e).GetData(); float?maxSpeed = null; float?hp = null; if (await entity.Has <IUnit>()) { var unit = GrainFactory.Get <IUnit>(e); hp = await unit.GetHp(); maxSpeed = await MapService.GetEntityActualMaxSpeed(entity); } var dto = new EntityDto { Name = await entity.GetName(), Pos = position, Id = e, Hp = hp, MaxSpeed = maxSpeed }; return(dto); }
public CharacterContext(Direction dir, PositionState posState, State state, VulnState vulnState, int remainingJumps) { this.remainingJumps = remainingJumps; this.dir = dir; this.posState = posState; this.state = state; this.vulnState = vulnState; }
public Robot(IInstructionExecutor instructionExecutor, LinkedList <Instructions> instructions, PositionState positionState) { _instructions = instructions; _instructionExecutor = instructionExecutor; _positionState = positionState; }
void Start() { GameManager.Instance.OnGameOver += OnGameOver; GameManager.Instance.OnRestartGame += OnRestartGame; animator = GetComponent <Animator>(); position = PositionState.Center; animator.SetTrigger(GameController.IsMale ? "MalePlayer" : "FemalePlayer"); }
public LineMappingEntry(int unmappedLine) { this.UnmappedLine = unmappedLine; this.MappedLine = unmappedLine; this.MappedSpan = default; this.UnmappedCharacterOffset = null; this.MappedPathOpt = null; this.State = PositionState.Unmapped; }
public void OnStartRendering(Entity entity) { positionState = entity.GetState <PositionState>(); moodBubble = Instantiate(AssetLoader.LoadAsset(Prefabs.MoodBubbleUI)); moodBubble.transform.SetParent(interfaceMonobehaviour.DyanmicUIRoot.transform); moodBubble.SetActive(false); moodBubbleRectTransform = moodBubble.GetComponent <RectTransform>(); entity.GetState <MoodState>().MoodEvent += OnMoodUpdated; }
/// <summary> /// Gets the state of the position. /// </summary> /// <returns>The position value.</returns> /// <param name="posKey">Position key identifier.</param> public float GetPositionState(uint posKey) { if (!PositionState.ContainsKey(posKey)) { return(0); } return(PositionState[posKey]); }
public override CommandResult ExecuteCommand(PositionState positionState, Tracker tracker) { if (TryToConsumeBattery(positionState)) { tracker.TryAddingToCleaned(positionState.X, positionState.Y); return(new CommandResult(true)); } return(new CommandResult(false, true)); }
protected bool TryToConsumeBattery(PositionState positionState) { if (positionState.LeftBattery - ConsumeBattery < 0) { return(false); } positionState.LeftBattery -= ConsumeBattery; return(true); }
public WorldObject(Vector2 Pos, Vector2 Velocity, Vector2 Size, Texture2D tex, ObjectShape Shape) { pos = Pos; velocity = Velocity; size = Size; positionMask = PositionState.NotSet; texture = tex; shape = Shape; rotationAngle = 0.0f; }
public void SetPositionState(PositionState state) { if (this.positionState != state) { this.positionState = state; //Debug.Log("Set state to " + state); this.movementForce = this.stateSettings[state].force * this.player.GetRigidbody().mass; this.player.GetRigidbody().drag = this.stateSettings[state].drag; } }
internal SqlDataReaderSmi(SmiEventStream eventStream, SqlCommand parent, CommandBehavior behavior, SqlInternalConnectionSmi connection, SmiEventSink parentSink) : base(parent, behavior) { this._eventStream = eventStream; this._currentConnection = connection; this._readerEventSink = new ReaderEventSink(this, parentSink); this._currentPosition = PositionState.BeforeResults; this._isOpen = true; this._indexMap = null; this._visibleColumnCount = 0; }
internal SqlDataReaderSmi(SmiEventStream eventStream, SqlCommand parent, CommandBehavior behavior, SqlInternalConnectionSmi connection, SmiEventSink parentSink) : base(parent, behavior) { this._eventStream = eventStream; this._currentConnection = connection; this._readerEventSink = new ReaderEventSink(this, parentSink); this._currentPosition = PositionState.BeforeResults; this._isOpen = true; this._indexMap = null; this._visibleColumnCount = 0; }
public LineMappingEntry( int unmappedLine, int mappedLine, string?mappedPathOpt, PositionState state) { this.UnmappedLine = unmappedLine; this.MappedLine = mappedLine; this.MappedPathOpt = mappedPathOpt; this.State = state; }
public override CommandResult ExecuteCommand(PositionState positionState, Tracker tracker) { if (!TryToConsumeBattery(positionState)) { return(new CommandResult(false, true)); } positionState.Facing = (Facing)((int)(++positionState.Facing) % (Enum.GetValues(typeof(Facing)).Length)); return(new CommandResult(true)); }
public Board(Position position) { positionStates = new PositionState[, ] { { PositionState.Free, PositionState.Free, PositionState.Free }, { PositionState.Free, PositionState.Free, PositionState.Free }, { PositionState.Free, PositionState.Free, PositionState.Free }, }; Position = position; }
public bool IsInOrChangingToPositionState(PositionState p) { if (!IsMoving && ObjectPositionState == p) { return(true); } if (IsMoving && ObjectPositionState != p) //Assumes only two PositionState values. So will only work if states remain as original & transformed only. { return(true); } return(false); }
/// <summary> /// Update method shall be called every cycle of execution of simulation /// The period of execution shall be provided as argument in ms /// </summary> public void Update(int period) { if (TempoCommand > 0) { TempoCommand -= period; if (TempoCommand <= 0) { State = lastCommandState; } } }
/// <summary> /// Command the point in new position by setting a delay - must be followed by Update method to /// update the status up to point position is obtained /// </summary> /// <param name="commandState"></param> public void CommandPosition(PositionState commandState) { if (State == commandState || State == PositionState.Moving) { return; } else { lastCommandState = commandState; TempoCommand = MovementDelay; State = PositionState.Moving; } }
public LineMappingEntry( int unmappedLine, LinePositionSpan mappedSpan, int?unmappedCharacterOffset, string?mappedPathOpt) { this.UnmappedLine = unmappedLine; this.MappedLine = -1; this.MappedSpan = mappedSpan; this.UnmappedCharacterOffset = unmappedCharacterOffset; this.MappedPathOpt = mappedPathOpt; this.State = PositionState.RemappedSpan; }
private void UpdatePosition() { if ((Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) && (position == PositionState.Center || position == PositionState.Right)) { position = position == PositionState.Center ? PositionState.Left : PositionState.Center; transform.position = new Vector3(transform.position.x - positionDelta, transform.position.y, transform.position.z); } if ((Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) && (position == PositionState.Center || position == PositionState.Left)) { position = position == PositionState.Center ? PositionState.Right : PositionState.Center; transform.position = new Vector3(transform.position.x + positionDelta, transform.position.y, transform.position.z); } }
public void OnStartRendering(Entity entity) { if (Interface.Instance == null) { return; } positionState = entity.GetState <PositionState>(); nameTag = Instantiate(AssetLoader.LoadAsset(Prefabs.NameTagUI)); nameTag.transform.SetParent(Interface.Instance.DyanmicUIRoot.transform); nameTag.GetComponent <Text>().text = entity.GetState <NameState>().Name; nameTagRectTransform = nameTag.GetComponent <RectTransform>(); offset = new Vector3(0, entity.GetState <NameState>().VerticalOffset, 0); }
protected void Init() { health = maxHealth; jumpsRemaining = numAirJumps; direction = Direction.Right; state = State.Free; vulnState = VulnState.Neutral; positionState = PositionState.Grounded; UpdateAvailableActions(); currentAction = GetAction(); velocity = new Vector2(); StartCoroutine("Act"); StartCoroutine("AerialMovement"); }
private Stats stats; // Overall stats #endregion Fields #region Constructors public Unit(String name, Stats stats, Vector2 position) { this.name = name; this.stats = stats; this.currentStats = stats; this.position = position; this.attackState = false; this.positionState = PositionState.Stay; this.positionTarget = this; //movement = new MoveTimer(0,6.0f, position, position, stats.speed); movement = new MoveTimer(0,6.0f, position, position, currentStats.speed); }
public MoveInfo(GameObject target, PositionState state, bool shift = false) { bool left = PositionState.Left == state; position = target.transform.position; originalX = position.x; if (shift) { position.x = position.x + ((left ? 1 : -1) * UnityEngine.Screen.width); target.transform.position = position; } stepTarget = position.x + ((left ? -1 : 1) * UnityEngine.Screen.width); this.target = target; }
/// <summary> /// Game World Constructor. /// </summary> /// <param name="rect">Rectangle in which to draw this object.</param> /// <param name="vel">Velocity this object initially moves with.</param> /// <param name="tex">Texture with which to draw this object.</param> /// <param name="shape">Shape of this object for collision purposes.</param> public WorldObject(Rectangle rect, Texture2D tex, ObjectShape newShape) : base(rect, tex) { rotationAngle = 0.0f; lastUpdated = 0; positionMask = PositionState.NotSet; velocity = Vector2.Zero; drawStyle = WorldObjectDrawStyle.StretchToFit; collisionRect = drawRect; shape = newShape; boundObjects = new LinkedList<WorldObject>(); hasGravity = false; }
public void initializeSquirrelPC () { this.squirrelName = "none"; this.squirrelPlayerName = "none"; // the username of the player this.squirrelType = 0; // 1 = gray, 2 = red this.squirrelRunValue = 2; this.squirrelJumpValue = 2; this.squirrelClimbValue = 2; this.squirrelMaxHealthValue = 4; this.squirrelCurrentHealthValue = this.squirrelMaxHealthValue; this.squirrelAcornsInHand = 50; this.spriteWornOnHead = null; this.spriteWornOnBody = null; this.spriteWornOnFeet = null; this.positionState = PositionState.OnGround; }
internal bool isGoal(PositionState state) { return this[state] == 2; }
private void defaultInit() { rotationAngle = 0.0f; lastUpdated = 0; positionMask = PositionState.NotSet; velocity = Vector2.Zero; collisionRect = DrawFrame(); }
public virtual void Update(GameTime gameTime) { if (hasGravity && velocity.Y < terminalVelocity) velocity.Y += gravity; if (hasGravity && velocity.Y > terminalVelocity) velocity.Y = terminalVelocity; pos += velocity; if (pos.Y + size.Y > 480) { pos.Y = 480 - size.Y; velocity.Y = 0; positionMask = PositionState.OnFloor; } }
/*! * Method WorldObject * Description Default contsructor for WorldObject. Allows subclasses to do all initialization. */ public WorldObject() { positionMask = PositionState.NotSet; }
public override void ProcessRangeChange(PositionState state, ScenePresence client, float range) { foreach( Interaction i in InteractionList) { foreach( ProximityTrigger trig in i.triggerList.GetTriggers(typeof(ProximityTrigger))) { if( trig.Range == range ){ List<Response> message = i.responses.GetResponse(); foreach( Response r in message ){ switch(r.Volume){ case Response.VolumeType.Global: ChatHandler.DeliverWorldMessage(Name, r.Channel, r.Text); break; case Response.VolumeType.Region: ChatHandler.DeliverRegionMessage(client.Scene.RegionInfo.RegionID, Name, r.Channel, r.Text); break; case Response.VolumeType.Shout: case Response.VolumeType.Say: case Response.VolumeType.Whisper: ChatHandler.DeliverPrimMessage(tracker.Target, Name, r.Channel, r.Volume, r.Text); break; case Response.VolumeType.Private: ChatHandler.DeliverPrivateMessage(client.UUID, Name, r.Text); break; } } break; } } } }
public Chatbag(string name, UUID target) : this(name) { tracker = PositionTracker.Instance.addTracker(target); tracker.OnRangeChange += ProcessRangeChange; }
public virtual void ProcessRangeChange(PositionState state, ScenePresence client, float range) { }
private void RowAvailable(ITypedGettersV3 row) { this._currentColumnValuesV3 = row; this._currentPosition = PositionState.OnRow; }
private void MetaDataAvailable(SmiQueryMetaData[] md, bool nextEventIsRow) { this._currentMetaData = md; this._hasRows = nextEventIsRow; this._fieldNameLookup = null; this._currentPosition = PositionState.BeforeRows; this._indexMap = new int[this._currentMetaData.Length]; int index = 0; for (int i = 0; i < this._currentMetaData.Length; i++) { if (!this._currentMetaData[i].IsHidden.IsTrue) { this._indexMap[index] = i; index++; } } this._visibleColumnCount = index; }
public void setPositionState(PositionState P) { positionMask = P; }
/// <summary> /// Обновляет в БД записи о сделках, внося изменения указанные пользователем (например, в представлении 'SafePositionEdit') /// Метод применяется для редактирования 'безопасных' свойств. /// В цикле перебираются все свойства "POSITION_CLOSED" или "POSITION" и имя каждого свойства в итерации сравнивается с именами в "propertyMetaData" /// </summary> /// <param name="strId">перечисленные через запятую, уникальные идентификаторы позиций, которые нужно обновить</param> /// <param name="propertyMetaData">Список свойств (главное - их имена) и их значений для обновления</param> /// <param name="state"></param> public bool UpdateSavePositionItem(string strId, List<SystemProperty> propertyMetaData, PositionState state) { var id = strId.ToIntArrayUniform(); try { using (var ctx = DatabaseContext.Instance.Make()) { switch (state) { case PositionState.Closed: var closePositonProps = typeof(POSITION_CLOSED).GetProperties(); foreach (var position in ctx.POSITION_CLOSED.Where(x => id.Contains(x.ID)).ToList()) { foreach (var fieldMeta in propertyMetaData) { var prop = closePositonProps.FirstOrDefault(p => p.Name.ToLower() == fieldMeta.SystemName.ToLower()); if (prop != null) { var value = Converter.GetNullableObjectFromString(fieldMeta.Value, prop.PropertyType); prop.SetValue(position, value); } } } break; case PositionState.Opened: var openPositionProps = typeof(POSITION).GetProperties(); foreach (var position in ctx.POSITION.Where(x => id.Contains(x.ID)).ToList()) { foreach (var fieldMeta in propertyMetaData) { var prop = openPositionProps.FirstOrDefault(p => p.Name.ToLower() == fieldMeta.SystemName.ToLower()); if (prop != null) { var value = Converter.GetNullableObjectFromString(fieldMeta.Value, prop.PropertyType); prop.SetValue(position, value); } } } break; } ctx.SaveChanges(); } return true; } catch (Exception ex) { Logger.Error("UpdateSavePositionItem()", ex); return false; } }
public void setPositionState(PositionState state) { positionMask = state; }
public bool CanGo(PositionState pos) { if ( !( (pos.X >= 0 && pos.X < Width) &&(pos.Y >= 0 && pos.Y < Height))) { return false; } else { return !(this[pos.X, pos.Y] == -1); } }
private void StatementCompleted() { this._currentMetaData = null; this._visibleColumnCount = 0; this._schemaTable = null; this._currentPosition = PositionState.AfterRows; }
//x,y :: i,jの変換をわかりやすくしてくれるだけ。 public int this[PositionState pos] { get{ return this.map[pos.Y, pos.X]; } }
internal bool HasSupports(out bool hasTraction, out PositionState state, out ContactData supportContact) { float maxDepth = -float.MaxValue; int deepestIndex = -1; if (tractionContacts.Count > 0) { //It has traction! //But is it too deep? //Find the deepest contact. for (int i = 0; i < tractionContacts.Count; i++) { if (tractionContacts.Elements[i].PenetrationDepth > maxDepth) { maxDepth = tractionContacts.Elements[i].PenetrationDepth; deepestIndex = i; } } hasTraction = true; supportContact = tractionContacts.Elements[deepestIndex]; } else if (supportContacts.Count > 0) { //It has support! //But is it too deep? //Find the deepest contact. for (int i = 0; i < supportContacts.Count; i++) { if (supportContacts.Elements[i].PenetrationDepth > maxDepth) { maxDepth = supportContacts.Elements[i].PenetrationDepth; deepestIndex = i; } } hasTraction = false; supportContact = supportContacts.Elements[deepestIndex]; } else { hasTraction = false; state = PositionState.NoHit; supportContact = new ContactData(); return false; } //Check the depth. if (maxDepth > CollisionDetectionSettings.AllowedPenetration) { //It's too deep. state = PositionState.TooDeep; } else if (maxDepth < 0) { //The depth is negative, meaning it's separated. This shouldn't happen with the initial implementation of the character controller, //but this case could conceivably occur in other usages of a system like this (or in a future version of the character), //so go ahead and handle it. state = PositionState.NoHit; } else { //The deepest contact appears to be very nicely aligned with the ground! //It's fully supported. state = PositionState.Accepted; } return true; }
internal bool isStart(PositionState state) { return this[state] == 1; }
/// <summary> /// Редактирование 'опасных' полей сделок /// </summary> /// <param name="strId">Уникальные идентификаторы редактируемых сделок</param> /// <param name="currentState">Статус редактируемых сделок</param> /// <param name="newTicker">Новое значение инструмента</param> /// <param name="newSide">Новое значение типа сделки</param> /// <param name="newVolume">Новое значение объёма сделки</param> /// <param name="newEnterPrice">Новое значение цены входа</param> /// <param name="newExitPrice">Новое значение цены выхода</param> public bool EditDangerDeal(string strId, PositionState currentState, string newTicker, int? newSide, int? newVolume, float? newEnterPrice, float? newExitPrice) { var id = strId.ToIntArrayUniform(); using (var ctx = DatabaseContext.Instance.Make()) { var selOrders = new List<MarketOrder>(); // ReSharper disable LoopCanBeConvertedToQuery if (currentState == PositionState.Closed) { foreach (var order in ctx.POSITION_CLOSED.Where(x => id.Contains(x.ID))) selOrders.Add(LinqToEntity.DecorateOrder(order)); } else foreach (var order in ctx.POSITION.Where(x => id.Contains(x.ID))) selOrders.Add(LinqToEntity.DecorateOrder(order)); // ReSharper restore LoopCanBeConvertedToQuery // Группируем все сделки по счётам var selOrderGroupByAccount = selOrders.GroupBy(x => x.AccountID); // Идём по счетам в группе foreach (var selOrderGroup in selOrderGroupByAccount) { var acc = accountRepository.GetAccount(selOrderGroup.Key); try { // Идём по сделкам в счёте foreach (var order in selOrderGroup) { decimal? sl = null; if (order.StopLoss.HasValue) sl = Convert.ToDecimal(order.StopLoss); decimal? tp = null; if (order.TakeProfit.HasValue) tp = Convert.ToDecimal(order.TakeProfit); var timeEnter = order.TimeEnter; var timeExit = order.TimeExit; var price = newEnterPrice.HasValue ? newEnterPrice : order.PriceEnter; var priceExit = newExitPrice.HasValue ? newExitPrice : order.PriceExit; var volume = newVolume.HasValue ? newVolume : order.Volume; var symbol = !string.IsNullOrEmpty(newTicker) && newTicker.ToLower() != "null" ? newTicker : order.Symbol; var side = newSide.HasValue ? newSide : order.Side; var state = order.State; #region MarketOrder ordClosed = null; if (state == PositionState.Closed) { // посчитать профит по сделке ordClosed = order.MakeCopy(); ordClosed.State = PositionState.Closed; ordClosed.PriceExit = priceExit.Value; ordClosed.TimeExit = timeExit.Value; string errorStr = null; if (!priceExit.HasValue || !DealProfitCalculator.CalculateOrderProfit(ordClosed, acc.Currency, priceExit.Value, out errorStr)) { if (!string.IsNullOrEmpty(errorStr)) Logger.Error("Сделка " + order.ID + " не будет закрыта : " + errorStr); else Logger.Error("Сделка " + order.ID + ". не будет закрыта : не указана priceExit."); continue; } } try { //Если сделка из 'открытых' if (state != PositionState.Closed) { // поправить открытую позицию var pos = ctx.POSITION.First(p => p.ID == order.ID); pos.PriceEnter = Convert.ToDecimal(price.Value); pos.TimeEnter = timeEnter; pos.Stoploss = sl; pos.Takeprofit = tp; pos.Volume = volume.Value; pos.Symbol = symbol; pos.Side = side.Value; pos.State = (int) state; } else { #region поправить закрытую позу и скорректировать результат var pos = ctx.POSITION_CLOSED.First(p => p.ID == order.ID); pos.PriceEnter = Convert.ToDecimal(price.Value); pos.TimeEnter = timeEnter; pos.Stoploss = sl; pos.Takeprofit = tp; pos.Volume = volume.Value; pos.Symbol = symbol; pos.Side = side.Value; pos.PriceExit = Convert.ToDecimal(priceExit.Value); pos.TimeExit = timeExit.Value; pos.ResultDepo = (decimal) ordClosed.ResultDepo; pos.ResultBase = (decimal) ordClosed.ResultBase; pos.ResultPoints = (decimal) ordClosed.ResultPoints; #endregion // поправить проводку и баланс UpdateBalanceChange(ctx, ordClosed, false); } } catch (Exception ex) { Logger.Error("Ошибка при редактировании сделки " + order.ID, ex); } #endregion Logger.Info("Сделка " + order.ID + " отредактирована удачно."); } // коммит ctx.SaveChanges(); } catch (Exception ex) { Logger.Error("EditDangerDeal", ex); return false; } if (currentState == PositionState.Closed) ReCalculateAccountBalance(ctx, acc.ID); } return true; } }
private void BatchCompleted() { this._currentPosition = PositionState.AfterResults; this._eventStream.Close(this._readerEventSink); }