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(); } }