Fixed compatability with PT 2.5 beta UI
This commit is contained in:
parent
a8e018097d
commit
1b2908d8a8
|
@ -335,7 +335,7 @@ namespace Core.Main.DataObjects
|
||||||
|
|
||||||
// check if bot is a shortbot via PT API. Losses on short bot currently showing as gains. Issue #195
|
// check if bot is a shortbot via PT API. Losses on short bot currently showing as gains. Issue #195
|
||||||
// code removed
|
// code removed
|
||||||
|
|
||||||
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
||||||
double soldValueAfterFees = soldValueRaw - (soldValueRaw * ((double)rsld.fee / 100));
|
double soldValueAfterFees = soldValueRaw - (soldValueRaw * ((double)rsld.fee / 100));
|
||||||
sellLogData.SoldValue = soldValueAfterFees;
|
sellLogData.SoldValue = soldValueAfterFees;
|
||||||
|
@ -399,9 +399,11 @@ namespace Core.Main.DataObjects
|
||||||
dcaLogData.SellStrategy = pair.sellStrategy == null ? "" : pair.sellStrategy;
|
dcaLogData.SellStrategy = pair.sellStrategy == null ? "" : pair.sellStrategy;
|
||||||
dcaLogData.IsTrailing = false;
|
dcaLogData.IsTrailing = false;
|
||||||
|
|
||||||
if (pair.buyStrategies != null && processBuyStrategies)
|
// See if they are using PT 2.5 (buyStrategiesData) or 2.4 (buyStrategies)
|
||||||
|
var buyStrats = pair.buyStrategies != null ? pair.buyStrategies : pair.buyStrategiesData.data;
|
||||||
|
if (buyStrats != null && processBuyStrategies)
|
||||||
{
|
{
|
||||||
foreach (var bs in pair.buyStrategies)
|
foreach (var bs in buyStrats)
|
||||||
{
|
{
|
||||||
Strategy buyStrategy = new Strategy();
|
Strategy buyStrategy = new Strategy();
|
||||||
buyStrategy.Type = bs.type;
|
buyStrategy.Type = bs.type;
|
||||||
|
@ -412,16 +414,18 @@ namespace Core.Main.DataObjects
|
||||||
buyStrategy.CurrentValue = bs.currentValue;
|
buyStrategy.CurrentValue = bs.currentValue;
|
||||||
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
||||||
buyStrategy.Decimals = bs.decimals;
|
buyStrategy.Decimals = bs.decimals;
|
||||||
buyStrategy.IsTrailing = ((string)bs.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
buyStrategy.IsTrailing = bs.trailing;
|
||||||
buyStrategy.IsTrue = ((string)bs.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
buyStrategy.IsTrue = bs.strategyResult;
|
||||||
|
|
||||||
dcaLogData.BuyStrategies.Add(buyStrategy);
|
dcaLogData.BuyStrategies.Add(buyStrategy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pair.sellStrategies != null)
|
// See if they are using PT 2.5 (sellStrategiesData) or 2.4 (sellStrategies)
|
||||||
|
var sellStrats = pair.sellStrategies != null ? pair.sellStrategies : pair.sellStrategiesData.data;
|
||||||
|
if (sellStrats != null)
|
||||||
{
|
{
|
||||||
foreach (var ss in pair.sellStrategies)
|
foreach (var ss in sellStrats)
|
||||||
{
|
{
|
||||||
Strategy sellStrategy = new Strategy();
|
Strategy sellStrategy = new Strategy();
|
||||||
sellStrategy.Type = ss.type;
|
sellStrategy.Type = ss.type;
|
||||||
|
@ -432,8 +436,8 @@ namespace Core.Main.DataObjects
|
||||||
sellStrategy.CurrentValue = ss.currentValue;
|
sellStrategy.CurrentValue = ss.currentValue;
|
||||||
sellStrategy.CurrentValuePercentage = ss.currentValuePercentage;
|
sellStrategy.CurrentValuePercentage = ss.currentValuePercentage;
|
||||||
sellStrategy.Decimals = ss.decimals;
|
sellStrategy.Decimals = ss.decimals;
|
||||||
sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
sellStrategy.IsTrailing = ss.trailing;
|
||||||
sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
sellStrategy.IsTrue = ss.strategyResult;
|
||||||
|
|
||||||
dcaLogData.SellStrategies.Add(sellStrategy);
|
dcaLogData.SellStrategies.Add(sellStrategy);
|
||||||
|
|
||||||
|
@ -495,9 +499,14 @@ namespace Core.Main.DataObjects
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rbld.buyStrategies != null)
|
// Parse buy strategies
|
||||||
|
|
||||||
|
// See if they are using PT 2.5 (buyStrategiesData) or 2.4 (buyStrategies)
|
||||||
|
var buyStrats = rbld.buyStrategies != null ? rbld.buyStrategies : rbld.buyStrategiesData.data;
|
||||||
|
|
||||||
|
if (buyStrats != null)
|
||||||
{
|
{
|
||||||
foreach (var bs in rbld.buyStrategies)
|
foreach (var bs in buyStrats)
|
||||||
{
|
{
|
||||||
Strategy buyStrategy = new Strategy();
|
Strategy buyStrategy = new Strategy();
|
||||||
buyStrategy.Type = bs.type;
|
buyStrategy.Type = bs.type;
|
||||||
|
@ -508,8 +517,8 @@ namespace Core.Main.DataObjects
|
||||||
buyStrategy.CurrentValue = bs.currentValue;
|
buyStrategy.CurrentValue = bs.currentValue;
|
||||||
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
||||||
buyStrategy.Decimals = bs.decimals;
|
buyStrategy.Decimals = bs.decimals;
|
||||||
buyStrategy.IsTrailing = ((string)(bs.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
buyStrategy.IsTrailing = bs.trailing;
|
||||||
buyStrategy.IsTrue = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
buyStrategy.IsTrue = bs.strategyResult;
|
||||||
|
|
||||||
// Is SOM?
|
// Is SOM?
|
||||||
buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase);
|
buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
|
@ -261,85 +261,92 @@ namespace Core.ProfitTrailer
|
||||||
public static bool IsValidStrategy(string strategyName, bool checkForAnyInvalid)
|
public static bool IsValidStrategy(string strategyName, bool checkForAnyInvalid)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
// buy/sell strategies beginning with PT 2.3.3 contain the letter followed by a colon and space.
|
|
||||||
if (strategyName.Contains(":"))
|
if (!string.IsNullOrEmpty(strategyName))
|
||||||
{
|
{
|
||||||
result = true;
|
// buy/sell strategies beginning with PT 2.3.3 contain the letter followed by a colon and space.
|
||||||
}
|
if (strategyName.Contains(":"))
|
||||||
if (!checkForAnyInvalid)
|
|
||||||
{
|
|
||||||
switch (strategyName.ToLower())
|
|
||||||
{
|
|
||||||
case "lowbb":
|
|
||||||
case "highbb":
|
|
||||||
case "gain":
|
|
||||||
case "loss":
|
|
||||||
case "smagain":
|
|
||||||
case "emagain":
|
|
||||||
case "hmagain":
|
|
||||||
case "dmagain":
|
|
||||||
case "smaspread":
|
|
||||||
case "emaspread":
|
|
||||||
case "hmaspread":
|
|
||||||
case "dmaspread":
|
|
||||||
case "smacross":
|
|
||||||
case "emacross":
|
|
||||||
case "hmacross":
|
|
||||||
case "dmacross":
|
|
||||||
case "rsi":
|
|
||||||
case "stoch":
|
|
||||||
case "stochrsi":
|
|
||||||
case "stochrsik":
|
|
||||||
case "stochrsid":
|
|
||||||
case "stochrsicross":
|
|
||||||
case "macd":
|
|
||||||
case "obv":
|
|
||||||
case "bbwidth":
|
|
||||||
case "anderson":
|
|
||||||
case "dema":
|
|
||||||
case "hma":
|
|
||||||
case "pdhigh":
|
|
||||||
case "pdlow":
|
|
||||||
case "pdclose":
|
|
||||||
case "signal":
|
|
||||||
case "changepercentage":
|
|
||||||
case "profitpercentage":
|
|
||||||
case "lastdcabuy":
|
|
||||||
case "fixedprice":
|
|
||||||
case "lowatrband":
|
|
||||||
case "highatrband":
|
|
||||||
case "atrpercentage":
|
|
||||||
case "vwappercentage":
|
|
||||||
case "mvwappercentage":
|
|
||||||
case "btcdominance":
|
|
||||||
case "combimagain":
|
|
||||||
case "combimaspread":
|
|
||||||
case "combimacross":
|
|
||||||
case "macdpercentage":
|
|
||||||
result = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (strategyName.IndexOf("max", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("min", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("som", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("price", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("black", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("new", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("insufficient", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("timeout", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("spread", StringComparison.InvariantCultureIgnoreCase) == -1
|
|
||||||
&& strategyName.IndexOf("pairs", StringComparison.InvariantCultureIgnoreCase) == -1)
|
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
if (!checkForAnyInvalid)
|
||||||
|
{
|
||||||
|
switch (strategyName.ToLower())
|
||||||
|
{
|
||||||
|
case "lowbb":
|
||||||
|
case "highbb":
|
||||||
|
case "gain":
|
||||||
|
case "loss":
|
||||||
|
case "smagain":
|
||||||
|
case "emagain":
|
||||||
|
case "hmagain":
|
||||||
|
case "dmagain":
|
||||||
|
case "smaspread":
|
||||||
|
case "emaspread":
|
||||||
|
case "hmaspread":
|
||||||
|
case "dmaspread":
|
||||||
|
case "smacross":
|
||||||
|
case "emacross":
|
||||||
|
case "hmacross":
|
||||||
|
case "dmacross":
|
||||||
|
case "rsi":
|
||||||
|
case "stoch":
|
||||||
|
case "stochrsi":
|
||||||
|
case "stochrsik":
|
||||||
|
case "stochrsid":
|
||||||
|
case "stochrsicross":
|
||||||
|
case "macd":
|
||||||
|
case "obv":
|
||||||
|
case "bbwidth":
|
||||||
|
case "anderson":
|
||||||
|
case "dema":
|
||||||
|
case "hma":
|
||||||
|
case "pdhigh":
|
||||||
|
case "pdlow":
|
||||||
|
case "pdclose":
|
||||||
|
case "signal":
|
||||||
|
case "changepercentage":
|
||||||
|
case "profitpercentage":
|
||||||
|
case "lastdcabuy":
|
||||||
|
case "fixedprice":
|
||||||
|
case "lowatrband":
|
||||||
|
case "highatrband":
|
||||||
|
case "atrpercentage":
|
||||||
|
case "vwappercentage":
|
||||||
|
case "mvwappercentage":
|
||||||
|
case "btcdominance":
|
||||||
|
case "combimagain":
|
||||||
|
case "combimaspread":
|
||||||
|
case "combimacross":
|
||||||
|
case "macdpercentage":
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strategyName.IndexOf("max", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("min", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("som", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("price", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("black", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("new", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("insufficient", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("timeout", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("spread", StringComparison.InvariantCultureIgnoreCase) == -1
|
||||||
|
&& strategyName.IndexOf("pairs", StringComparison.InvariantCultureIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int GetStrategyValueDecimals(string strategyName)
|
public static int GetStrategyValueDecimals(string strategyName)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -397,7 +404,7 @@ namespace Core.ProfitTrailer
|
||||||
if (!isValidStrategy)
|
if (!isValidStrategy)
|
||||||
{
|
{
|
||||||
if (strategy.Name.Contains("TRIGGERED"))
|
if (strategy.Name.Contains("TRIGGERED"))
|
||||||
// remove levels already triggered, to show only currently waiting trigger
|
// remove levels already triggered, to show only currently waiting trigger
|
||||||
{
|
{
|
||||||
strategyText += "";
|
strategyText += "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue