예제 #1
0
        /// <summary>
        /// Получаем последнюю команду от нейросети
        /// </summary>
        /// <param name="fileName">Название файла-хранилища команд</param>
        /// <returns></returns>
        public static TradeTaskRequest ReadLastCommand(string fileName)
        {
            TradeTaskRequest lastCommand = new TradeTaskRequest();

            try
            {
                Stopwatch watch            = Stopwatch.StartNew();
                var       teaCurrencyPairs = new List <TradeTaskRequest>();
                using (var tf = TeaFile <TradeTaskRequest> .OpenRead(fileName))
                {
                    lastCommand = tf.Items.Last();
                }
            }
            catch (Exception ex)
            {
                // TODO log
            }
            return(lastCommand);
        }
예제 #2
0
        internal static void InitDbCommand(string fileNameCommand)
        {
            TradeTaskRequest lastCommand = new TradeTaskRequest()
            {
                command      = CommandType.Buy,
                currencyPair = MoneyPair.btc_usd,
                Id           = 1,
                requestTime  = DateTime.Now
            };

            try
            {
                using (var tf = TeaFile <TradeTaskRequest> .Create(fileNameCommand))
                {
                    tf.Write(lastCommand);
                }
            }
            catch (Exception ex)
            {
                // TODO log
            }
        }