示例#1
0
        public Guid StartNewTrader(List <string> pairs, List <ITraderRule> traderRules)
        {
            var currentTransactionId    = Guid.NewGuid();
            var cancellationTokenSource = new CancellationTokenSource();
            var task = Task.Run(
                () => _trader.TradeAsync(currentTransactionId, pairs, 10, 20, IntervalType.FiveMinutes, cancellationTokenSource.Token)
                , cancellationTokenSource.Token);

            _currentTransactions.Add(
                new Tuple <Guid, Task, CancellationTokenSource>(currentTransactionId, task, cancellationTokenSource)
                );
            return(currentTransactionId);
        }