コード例 #1
0
ファイル: LiveBroker.cs プロジェクト: tevert/Trader
        public async Task <bool> InitializeAsync(Assets asset1Type, Assets asset2Type)
        {
            this.asset1Type            = asset1Type;
            this.asset2Type            = asset2Type;
            (this.asset1, this.asset2) = await exchange.Initialize(asset1Type, asset2Type);

            DateTime startTime;
            Sample   startSample = null;
            Sample   endSample   = null;

            do
            {
                var sample = await exchange.GetCurrentPrice();

                if (startSample == null)
                {
                    startSample = sample;
                    startTime   = sample.DateTime;
                }

                endSample = sample;
            } while (endSample.DateTime - startSample.DateTime < TimeSpan.FromMinutes(10));

            initialized = true;
            return(startSample.Value < endSample.Value);
        }