public ProcessNotificationVM() { m_messages = new ObservableQueue <MessageVM>(100); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(m_messages, m_lock); m_Progress = 0; m_message = "Loading TaskProcessor..."; }
public void Setup() { this.tradingData = new TradingDataContext(); this.signalQueue = new ObservableQueue <Signal>(); this.strategyHeader = new StrategyHeader(1, "Description", "ST12345-RF-01", "RTS-9.14", 10); this.tradingData.Get <ICollection <StrategyHeader> >().Add(this.strategyHeader); this.spSettings = new StopPointsSettings(this.strategyHeader, 100, false); this.tradingData.Get <ICollection <StopPointsSettings> >().Add(this.spSettings); this.slSettings = new StopLossOrderSettings(this.strategyHeader, 180); this.tradingData.Get <ICollection <StopLossOrderSettings> >().Add(this.slSettings); this.handler = new StrategyStopLossByPointsOnTick(this.strategyHeader, this.tradingData, this.signalQueue, new NullLogger(), true); this.buySignal = new Signal(this.strategyHeader, DateTime.Now, TradeAction.Buy, OrderType.Market, 125000, 0, 0); this.sellSignal = new Signal(this.strategyHeader, DateTime.Now, TradeAction.Sell, OrderType.Market, 125000, 0, 0); Assert.AreEqual(0, this.tradingData.Get <IEnumerable <Signal> >().Count()); Assert.AreEqual(0, this.tradingData.Get <IEnumerable <Order> >().Count()); Assert.AreEqual(0, this.signalQueue.Count); }
public RoyalGameModel(int gamersInRoom) { //инициализируем полей Players = new List <IPlayer>(); gameObjects = new Dictionary <ulong, IGameObject>(); outgoingMessages = new ObservableQueue <IMessage>(); incomingMessages = new ObservableQueue <IMessage>(); AABB frameField = new AABB(); frameField.LowerBound.Set(0, 0); frameField.UpperBound.Set(LengthOfSideMap, LengthOfSideMap); Field = new World(frameField, new Vec2(0, 0), false); var solver = new RoomContactListener(); Field.SetContactListener(solver); CreateFrame(); DeathZone = BuilderGameObject.CreateDeathZone(this, LengthOfSideMap); //создание и добавление в GameObjects и Field статических объектов карты List <RectangleF> occupiedArea = new List <RectangleF>(); CreateDinamicGameObject(occupiedArea); CreatePlayers(gamersInRoom, occupiedArea); handlerIncomingMessages = new Task(Handler_IncomingMessages); handlerIncomingMessages.Start(); }
public void Setup() { this.signalQueue = new ObservableQueue <Signal>(); this.tradingData = new TradingDataContext(); this.lLeg = new List <StrategyHeader>(); this.rLeg = new List <StrategyHeader>(); this.lStrategy = new StrategyHeader(1, "Left leg strategyHeader", "BP12345-RF-01", "SBRF-3.14_FT", 10); this.tradingData.Get <ICollection <StrategyHeader> >().Add(lStrategy); this.lLeg.Add(this.lStrategy); this.rStrategy = new StrategyHeader(2, "Right leg strategyHeader", "BP12345-RF-01", "SBPR-3.13_FT", 11); this.tradingData.Get <ICollection <StrategyHeader> >().Add(rStrategy); this.rLeg.Add(this.rStrategy); this.arbitrageSettings = new ArbitrageSettings(1, this.lLeg, this.rLeg, new SpreadSettings(1.12, 1.25, 1.01)); this.tradingData.Get <ICollection <ArbitrageSettings> >().Add(this.arbitrageSettings); this.lStrategyVolumeChangeStep = new StrategyVolumeChangeStep(this.lStrategy, 2); this.tradingData.Get <ICollection <StrategyVolumeChangeStep> >().Add(this.lStrategyVolumeChangeStep); ArbitrageOpenPositionOnSpreadValue handler = new ArbitrageOpenPositionOnSpreadValue(this.arbitrageSettings, this.lStrategy, this.tradingData, this.signalQueue, new NullLogger()); }
public void EnqueueItem() { _handle = new EventWaitHandle(false, EventResetMode.ManualReset); var test = new ObservableQueue<string>(); test.ItemEnqueued += Queue_ItemEnqueued; test.Enqueue("test"); Assert.IsTrue(_handle.WaitOne(10)); }
public MessagingViewModel(MessageManager msgMgr) { m_MsgQ = new ObservableQueue <IBasicMessage>(); m_MsgMgr = msgMgr; m_CmdHandlers = new Dictionary <MessageType, ICommand>(); m_MsgSenderId = msgMgr.RegisterMessageQueue(m_MsgQ); m_MsgQ.ItemEnqueued += OnExternalMsgReceived; }
public void Collections_SetUp() { this.queue = new ObservableQueue <string>(); this.observer = new MockQueueObserver(this.queue); this.queue.RegisterObserver(this.observer); }
public StrategyStopLossByPointsOnTick(StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger, bool measureFromSignalPrice = false) : base(strategyHeader, tradingData, signalQueue, logger, measureFromSignalPrice) { }
public void Save(ObservableQueue <ActivityMessage> queue) { var list = queue.ToList(); var serializator = new SerializatorIso <List <ActivityMessage> >(); serializator.Serialize(FileName, list); }
public PlaceStrategyTakeProfitByPointsOnTrade(StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger, bool measureFromSignalPrice = false) : base(strategyHeader, tradingData, signalQueue, logger, measureFromSignalPrice) { }
private string GetSendJson(ObservableQueue <ActivityMessage> pendingData) { var messageMapper = new MessageMapper(encryptor); var messages = messageMapper.MapCollection(pendingData.ToList()); var jsonSerializer = new JsonSerializer(); return(jsonSerializer.Serialize(messages)); }
private bool DispatchAll(ObservableQueue <ActivityMessage> pendingData) { string sendJson = GetSendJson(pendingData); string userName = GetUserName(); bool result = SendData(userName, sendJson); return(result); }
public BuyOnTick(StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger) : base(tradingData.Get <ObservableCollection <Tick> >()) { this.strategyHeader = strategyHeader; this.tradingData = tradingData; this.signalQueue = signalQueue; this.logger = logger; }
public void Setup() { this.tradingData = new TradingDataContext(); this.signalQueue = new ObservableQueue <Signal>(); this.orderQueue = new ObservableQueue <Order>(); this.orderManager = new MockOrderManager(); TraderBase traderBase = new TraderBase(this.tradingData, this.signalQueue, this.orderQueue, this.orderManager, new AlwaysTimeToTradeSchedule(), new NullLogger()); }
public OrderQueueProcessor(IOrderManager manager, IDataContext tradingData, ObservableQueue <Order> orderQueue, ILogger logger) { this.manager = manager; this.tradingData = tradingData; this.orderQueue = orderQueue; this.logger = logger; this.orderQueue.RegisterObserver(this); }
public SendItemOnSignal(ObservableQueue <Signal> signalQueue) { this.signalQueue = signalQueue; this.signalQueue.RegisterObserver(this); //this.orderQueue = orderQueue; //this.tradingData = tradingData; //this.schedule = schedule; //this.logger = logger; }
public void EnqueueItem() { _handle = new EventWaitHandle(false, EventResetMode.ManualReset); var test = new ObservableQueue <string>(); test.ItemEnqueued += Queue_ItemEnqueued; test.Enqueue("test"); Assert.IsTrue(_handle.WaitOne(10)); }
/// <summary> /// Initializes a new instance of the <see cref="InputStream{TFrame}"/> class. /// </summary> /// <param name="stream">The multimedia stream.</param> /// <param name="owner">The container that owns the stream.</param> public InputStream(AVStream *stream, InputContainer owner) : base(stream) { OwnerFile = owner; PacketQueue = new ObservableQueue <MediaPacket>(); Type = typeof(TFrame) == typeof(VideoFrame) ? MediaType.Video : MediaType.None; Info = new StreamInfo(stream, owner); }
public Caffe() { VisitorsQueue = new ObservableQueue <Visitor>(); Tables = new Table[Constants.tablesCount]; for (var i = 0; i < Tables.Length; i++) { Tables[i] = new Table(string.Format("столик №{0}", i + 1)); } }
public MainWindowViewModel() { Window = null; _logs = new ObservableQueue <string>(MaxLogNum); _videoConverter = new ObservableCollection <VideoConvert>(); _progressBarValue = 0; _ctsGetDisk = new CancellationTokenSource(); StartGetDiskUsage(_ctsGetDisk.Token); InitRooms(CurrentConfig.Rooms); }
public void Inputs_Setup() { this.tradingData = new TradingDataContext(); this.signalQueue = new ObservableQueue <Signal>(); this.strategyHeader = new StrategyHeader(1, "Strategy 1", "BP12345-RF-01", "RTS-9.13_FT", 10); this.tradingData.Get <ICollection <StrategyHeader> >().Add(this.strategyHeader); BuyOnTick handler = new BuyOnTick(this.strategyHeader, this.tradingData, this.signalQueue, new NullLogger()); }
public void ShouldNotDequeueItemWhenEmpty() { // arrange var target = new ObservableQueue<string>(); // act Assert.Throws<InvalidOperationException>( () => target.Dequeue() ); // assert }
public BreakOutOnTick(StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger) : base(tradingData.Get <ObservableCollection <Tick> >()) { this.strategyHeader = strategyHeader; this.tradingData = tradingData; this.signalQueue = signalQueue; this.logger = logger; this.barSettings = this.tradingData.Get <IEnumerable <BarSettings> >().SingleOrDefault(s => s.StrategyId == this.strategyHeader.Id); }
public TransferManager(ITransferAuthenticator authenticator) { //Set authenticator: auth = authenticator; _queued = new ObservableQueue <Transfer>(); _active = new ObservableCollection <Transfer>(); _queued.CollectionChanged += OnQueuedChanged; _active.CollectionChanged += OnInvokedChanged; }
public ReversMaOnBar0(StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger) : base(tradingData.Get <ObservableCollection <Bar> >()) { this.strategyHeader = strategyHeader; this.tradingData = tradingData; this.signalQueue = signalQueue; this.logger = logger; this.Ma1Handlers = new List <ItemAddedNotification <double> >(); this.Ma2Handlers = new List <ItemAddedNotification <double> >(); }
public void Setup() { this.tradingData = new TradingDataContext(); this.signalQueue = new ObservableQueue <Signal>(); this.orderQueue = new ObservableQueue <Order>(); this.schedule = new AlwaysTimeToTradeSchedule(); SignalQueueProcessor processor = new SignalQueueProcessor(this.signalQueue, this.orderQueue, this.tradingData, this.schedule, new NullLogger()); AddStrategies(); }
public ArbitrageOpenPositionOnSpreadValue(ArbitrageSettings arbitrageSettings, StrategyHeader strategyHeader, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger) : base(tradingData.Get <ObservableCollection <SpreadValue> >()) { this.arbitrageSetings = arbitrageSettings; this.strategyHeader = strategyHeader; this.tradingData = tradingData; this.signalQueue = signalQueue; this.logger = logger; this.isLeftLegStrategy = arbitrageSettings.LeftLeg.Any(s => s.Id == strategyHeader.Id); }
public DriveThruViewModel() { _items = new ObservableCollection <string>(); _orders = new ObservableQueue <OrderViewModel>(); SubmitOrderCommand = new SubmitOrderCommand(this); GiveOrderCommand = new GiveOrderCommand(this); _items.Add("Chicken"); _items.Add("Salad"); _items.Add("Fruit Cup"); }
public void ConstructorShouldCopySequence() { // arrange var expected = new[] { "1", "2", "3" }; // act var target = new ObservableQueue<string>( expected ); // assert Assert.Equal( 3, target.Count ); Assert.True( expected.All( i => target.Contains( i ) ) ); }
public void Setup() { this.tradingData = new TradingDataContext(); this.signalQueue = new ObservableQueue <Signal>(); this.orderQueue = new ObservableQueue <Order>(); this.orderManager = new MockOrderManager(); TraderBase traderBase = new TraderBase(this.tradingData, this.signalQueue, this.orderQueue, this.orderManager, new AlwaysTimeToTradeSchedule(), new NullLogger()); this.strategyHeader = new StrategyHeader(1, "strategyHeader", "BP12345-RF-01", "RTS-9.13_FT", 10); AddStrategy(this.strategyHeader); }
public ViewBase(int viewId, string viewName, MessageManager msgMgr) { m_ViewId = viewId; m_ViewName = viewName; m_ViewMsgMgr = msgMgr; m_MsgQ = new ObservableQueue <IBasicMessage>(); m_CmdHandlers = new Dictionary <MessageType, ICommand>(); m_SenderId = msgMgr.RegisterMessageQueue(m_MsgQ); m_MsgQ.ItemEnqueued += OnExternalMsgReceived; }
public StopLossOnBar(StrategyHeader strategyHeader, double points, IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger) : base(strategyHeader, points, tradingData, signalQueue, logger) { }
public StrategiesPlaceTakeProfitByPointsOnTradeHandlers(IDataContext tradingData, ObservableQueue <Signal> signalQueue, ILogger logger, bool measureStopFromSignal = false) { this.tradingData = tradingData; this.signalQueue = signalQueue; this.logger = logger; this.measureStopFromSignal = measureStopFromSignal; ActivateHandlers(); }
public void ShouldEnqueueItemWithEvents() { // arrange var expected = "1"; var target = new ObservableQueue<string>(); // act Assert.PropertyChanged( target, "Count", () => target.Enqueue( expected ) ); // assert Assert.Equal( 1, target.Count ); Assert.Equal( expected, target.Peek() ); }
public void ShouldPeekItem() { // arrange var target = new ObservableQueue<string>(); target.Enqueue( "2" ); target.Enqueue( "1" ); target.Enqueue( "3" ); // act var actual = target.Peek(); // assert Assert.Equal( "2", actual ); }
public void ShouldDequeueItemWithEvents() { // arrange var expected = "1"; string actual = null; var target = new ObservableQueue<string>(); target.Enqueue( expected ); // act Assert.PropertyChanged( target, "Count", () => actual = target.Dequeue() ); // assert Assert.Equal( 0, target.Count ); Assert.Equal( expected, actual ); }
public void ShouldContainItem( string value, bool expected ) { // arrange var target = new ObservableQueue<string>(); target.Enqueue( "One" ); target.Enqueue( "Two" ); target.Enqueue( "Three" ); // act var actual = target.Contains( value ); // assert Assert.Equal( expected, actual ); }
public void ShouldCopyToLargeArray() { // arrange var expected = new[] { "1", "2" }; var target = new ObservableQueue<string>( expected ); target.Enqueue( "1" ); target.Enqueue( "2" ); var actual = new string[4]; // act target.CopyTo( actual, 2 ); // assert Assert.True( actual.Skip( 2 ).SequenceEqual( expected ) ); }
public void ShouldConvertToArray() { // arrange var target = new ObservableQueue<string>(); var expected = new[] { "1", "2", "3" }; target.Enqueue( "1" ); target.Enqueue( "2" ); target.Enqueue( "3" ); // act var actual = target.ToArray(); // assert Assert.True( expected.SequenceEqual( actual ) ); }
public void ShouldTrimExcess() { // arrange var target = new ObservableQueue<string>( 10 ); target.Enqueue( "1" ); target.Enqueue( "2" ); target.Enqueue( "3" ); // act target.TrimExcess(); // assert // no exception }
public void ShouldCopyToSizedArray() { // arrange var expected = new[] { "1", "2" }; var target = new ObservableQueue<string>( expected ); target.Enqueue( "1" ); target.Enqueue( "2" ); var actual = new string[2]; // act target.CopyTo( actual, 0 ); // assert Assert.True( expected.SequenceEqual( actual ) ); }
public void ShouldGrowAutomatically() { var target = new ObservableQueue<string>( 3 ); for ( var i = 0; i < 10; i++ ) target.Enqueue( ( i + 1 ).ToString() ); target.Clear(); target.TrimExcess(); }
public void ShouldEnumerate() { var target = new ObservableQueue<string>(); target.Enqueue( "1" ); target.Enqueue( "2" ); target.Enqueue( "3" ); var items1 = (IEnumerable<string>) target; foreach ( var item in items1 ) Console.WriteLine( item ); var items2 = (IEnumerable) target; foreach ( string item in items2 ) Console.WriteLine( item ); }
public void ShouldClearWithEvents() { // arrange var target = new ObservableQueue<string>(); target.Enqueue( "1" ); // act Assert.PropertyChanged( target, "Count", target.Clear ); // assert Assert.Equal( 0, target.Count ); }
public void ShouldCopyToWhenICollection() { // arrange var target = new ObservableQueue<string>(); var collection = (ICollection) target; var expected = new[] { "1", "2" }; var actual = new string[2]; target.Enqueue( "1" ); target.Enqueue( "2" ); // act collection.CopyTo( actual, 0 ); // assert Assert.True( expected.SequenceEqual( actual ) ); }