Esempio n. 1
0
        public void PublishOnTickEvent(Symbol symbol, cAlgo.API.Positions _positions, cAlgo.API.PendingOrders _orders, DateTime timeStamp, bool isBackTesting = false)
        {
            MessageConverter.ParseOpenPositions(_positions, out Positions positions);
            MessageConverter.ParsePendingOrders(_orders, out Orders orders);

            Tick tick = new Tick()
            {
                Code      = symbol.Code,
                Ask       = symbol.Ask,
                Bid       = symbol.Bid,
                Digits    = symbol.Digits,
                PipSize   = symbol.PipSize,
                TickSize  = symbol.TickSize,
                Spread    = symbol.Spread, //Calculated as the difference between the last bid and last offer prices received
                TimeStamp = timeStamp.ToBinary()
            };

            Publisher.TickEvent(tick, positions, orders, isBackTesting);
        }
Esempio n. 2
0
 public void PublishOnPositionClosed(cAlgo.API.Position _postion, double closePrice, cAlgo.API.Positions _positions, cAlgo.API.PendingOrders _orders, DateTime closeTime, bool isBackTesting = false)
 {
     MessageConverter.ParseOpenPositions(_positions, out Positions positions);
     MessageConverter.ParsePendingOrders(_orders, out Orders orders);
     MessageConverter.ParseClosedPosition(_postion, closePrice, closeTime, out Position position);
     Publisher.PositionClosedEvent(position, positions, orders, isBackTesting);
 }