Example #1
0
        private async Task ReconcileStock(long sharesPerPosition, StrategysStock strategy)
        {
            _logger.LogDebug($"Assigning {sharesPerPosition} shares of {strategy.StockSymbol} to {strategy.Strategy}");

            var postition = await _trackingRepository.GetOrCreateEmptyPosition(strategy);

            await _trackingRepository.AddOrder(strategy, new Order
            {
                MarketPrice     = 0, //This is zero because this strategy did not buy or sell this stock so it should not count for or against it.
                OrderPlacedTime = DateTime.UtcNow,
                SharesBought    = sharesPerPosition - postition.NumberOfShares,
            });
        }