示例#1
0
        private void BuildBuyLogData(dynamic rawBuyLogData)
        {
            foreach (var rbld in rawBuyLogData)
            {
                BuyLogData buyLogData = new BuyLogData()
                {
                    IsTrailing = false, IsTrue = false, IsSom = false, TrueStrategyCount = 0
                };
                buyLogData.Market        = rbld.market;
                buyLogData.ProfitPercent = rbld.profit;
                buyLogData.CurrentPrice  = rbld.currentPrice;
                buyLogData.PercChange    = rbld.percChange;
                buyLogData.Volume24h     = rbld.volume;

                if (rbld.positive != null)
                {
                    buyLogData.IsTrailing = ((string)(rbld.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
                    buyLogData.IsTrue     = ((string)(rbld.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
                }
                else
                {
                    if (rbld.buyStrategies != null)
                    {
                        foreach (var bs in rbld.buyStrategies)
                        {
                            Strategy buyStrategy = new Strategy();
                            buyStrategy.Type                   = bs.type;
                            buyStrategy.Name                   = bs.name;
                            buyStrategy.EntryValue             = bs.entryValue;
                            buyStrategy.EntryValueLimit        = bs.entryValueLimit;
                            buyStrategy.TriggerValue           = bs.triggerValue;
                            buyStrategy.CurrentValue           = bs.currentValue;
                            buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
                            buyStrategy.Decimals               = bs.decimals;
                            buyStrategy.IsTrailing             = ((string)(bs.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
                            buyStrategy.IsTrue                 = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;

                            // Is SOM?
                            buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase);

                            // Is the pair trailing?
                            buyLogData.IsTrailing = buyLogData.IsTrailing || buyStrategy.IsTrailing;
                            buyLogData.IsTrue     = buyLogData.IsTrue || buyStrategy.IsTrue;

                            // True status strategy count total
                            buyLogData.TrueStrategyCount += buyStrategy.IsTrue ? 1 : 0;

                            // Add
                            buyLogData.BuyStrategies.Add(buyStrategy);
                        }
                    }
                }

                _buyLog.Add(buyLogData);
            }
        }
示例#2
0
        private void BuildBuyLogData(List <buyLogData> rawBuyLogData, PTMagicConfiguration systemConfiguration)
        {
            foreach (buyLogData rbld in rawBuyLogData)
            {
                BuyLogData buyLogData = new BuyLogData();
                buyLogData.Market             = rbld.market;
                buyLogData.ProfitPercent      = rbld.profit;
                buyLogData.TriggerValue       = rbld.triggerValue;
                buyLogData.CurrentValue       = rbld.currentValue;
                buyLogData.CurrentPrice       = rbld.currentPrice;
                buyLogData.PercChange         = rbld.percChange;
                buyLogData.BuyStrategy        = rbld.buyStrategy;
                buyLogData.CurrentLowBBValue  = rbld.BBLow;
                buyLogData.CurrentHighBBValue = rbld.BBHigh;
                buyLogData.BBTrigger          = rbld.BBTrigger;

                if (buyLogData.BuyStrategy == null)
                {
                    buyLogData.BuyStrategy = "";
                }

                if (rbld.positive != null)
                {
                    buyLogData.IsTrailing = rbld.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
                    buyLogData.IsTrue     = rbld.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
                }
                else
                {
                    if (rbld.buyStrategies != null)
                    {
                        foreach (PTStrategy bs in rbld.buyStrategies)
                        {
                            Strategy buyStrategy = new Strategy();
                            buyStrategy.Type                   = bs.type;
                            buyStrategy.Name                   = bs.name;
                            buyStrategy.EntryValue             = bs.entryValue;
                            buyStrategy.EntryValueLimit        = bs.entryValueLimit;
                            buyStrategy.TriggerValue           = bs.triggerValue;
                            buyStrategy.CurrentValue           = bs.currentValue;
                            buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
                            buyStrategy.Decimals               = bs.decimals;
                            buyStrategy.IsTrailing             = bs.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
                            buyStrategy.IsTrue                 = bs.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;

                            buyLogData.BuyStrategies.Add(buyStrategy);
                        }
                    }
                }

                _buyLog.Add(buyLogData);
            }
        }