New Analyzer Logic

This commit is contained in:
HojouFotytu 2024-01-28 19:52:37 +09:00
parent 1669534044
commit a54f819182
10 changed files with 412 additions and 276 deletions

9
.vscode/tasks.json vendored
View File

@ -10,7 +10,7 @@
"PTMagic"
],
"group": {
"kind":"build",
"kind": "build",
"isDefault": true
},
"presentation": {
@ -104,6 +104,13 @@
"focus": true
},
"problemMatcher": "$msCompile"
},
{
"type": "dotnet",
"task": "build",
"group": "build",
"problemMatcher": [],
"label": "dotnet: build"
}
]
}

View File

@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0" />
<PackageReference Include="SharpZipLib" Version="*" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
<PackageReference Include="Telegram.Bot" Version="*" />
</ItemGroup>

View File

@ -156,6 +156,7 @@ namespace Core.Main.DataObjects.PTMagicData
{
public string SettingName { get; set; }
public string TriggerConnection { get; set; } = "AND";
public string TriggerLogic { get; set; } = "";
public List<Trigger> Triggers { get; set; } = new List<Trigger>();
public Dictionary<string, object> PairsProperties { get; set; } = new Dictionary<string, object>();
public Dictionary<string, object> DCAProperties { get; set; } = new Dictionary<string, object>();
@ -165,6 +166,9 @@ namespace Core.Main.DataObjects.PTMagicData
public class SingleMarketSetting
{
public string SettingName { get; set; }
public string TriggerLogic { get; set; } = "AND";
public string TriggerConnection { get; set; } = "AND";
[DefaultValue("AND")]
@ -196,6 +200,9 @@ namespace Core.Main.DataObjects.PTMagicData
public class Trigger
{
[DefaultValue("")]
public string Letter { get; set; } = "";
[DefaultValue("")]
public string MarketTrendName { get; set; } = "";
@ -220,6 +227,9 @@ namespace Core.Main.DataObjects.PTMagicData
public class OffTrigger
{
[DefaultValue("")]
public string Letter { get; set; } = "";
[DefaultValue("")]
public string MarketTrendName { get; set; } = "";
@ -400,21 +410,6 @@ namespace Core.Main.DataObjects.PTMagicData
public double Last24hVolume { get; set; } = 0;
}
// public class SellLogData
// {
// public double SoldAmount { get; set; }
// public DateTime SoldDate { get; set; }
// public int BoughtTimes { get; set; }
// public string Market { get; set; }
// public double ProfitPercent { get; set; }
// public double Profit { get; set; }
// public double AverageBuyPrice { get; set; }
// public double TotalCost { get; set; }
// public double SoldPrice { get; set; }
// public double SoldValue { get; set; }
// public double TotalSales { get; set; }
// }
public class StatsData
{
public double SalesToday { get; set; }

View File

@ -4,6 +4,8 @@ using System.Collections.Concurrent;
using System.Threading;
using System.IO;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using Core.Helper;
using Core.Main.DataObjects.PTMagicData;
using Core.MarketAnalyzer;
@ -1322,6 +1324,7 @@ namespace Core.Main
private void CheckGlobalSettingsTriggers(ref GlobalSetting triggeredSetting, ref List<string> matchedTriggers)
{
this.Log.DoLogInfo("Checking global settings triggers...");
foreach (GlobalSetting globalSetting in this.PTMagicConfiguration.AnalyzerSettings.GlobalSettings)
{
// Reset triggers for each setting
@ -1330,20 +1333,21 @@ namespace Core.Main
if (globalSetting.Triggers.Count > 0)
{
this.Log.DoLogInfo("Checking triggers for '" + globalSetting.SettingName + "'...");
List<bool> triggerResults = new List<bool>();
Dictionary<string, bool> triggerResults = new Dictionary<string, bool>();
foreach (Trigger trigger in globalSetting.Triggers)
{
MarketTrend marketTrend = this.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.MarketTrends.Find(mt => mt.Name == trigger.MarketTrendName);
if (marketTrend != null)
{
// Get market trend change for trigger
if (this.AverageMarketTrendChanges.ContainsKey(marketTrend.Name))
{
double averageMarketTrendChange = this.AverageMarketTrendChanges[marketTrend.Name];
if (averageMarketTrendChange >= trigger.MinChange && averageMarketTrendChange < trigger.MaxChange)
{
bool isTriggered = averageMarketTrendChange >= trigger.MinChange && averageMarketTrendChange < trigger.MaxChange;
triggerResults[trigger.Letter] = isTriggered;
if (isTriggered)
{
// Trigger met!
this.Log.DoLogInfo("Trigger '" + trigger.MarketTrendName + "' triggered! TrendChange = " + averageMarketTrendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%");
@ -1359,37 +1363,38 @@ namespace Core.Main
}
matchedTriggers.Add(triggerContent);
triggerResults.Add(true);
}
else
{
this.Log.DoLogDebug("Trigger '" + trigger.MarketTrendName + "' not triggered. TrendChange = " + averageMarketTrendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%");
triggerResults.Add(false);
}
}
else
{
this.Log.DoLogError("Trigger '" + trigger.MarketTrendName + "' not found in this.AverageMarketTrendChanges[] (" + SystemHelper.ConvertListToTokenString(this.AverageMarketTrendChanges.Keys.ToList(), ",", true) + "). Unable to load recent trends?");
triggerResults.Add(false);
}
}
else
{
this.Log.DoLogWarn("Market Trend '" + trigger.MarketTrendName + "' not found! Trigger ignored!");
triggerResults.Add(false);
}
}
// Check if all triggers have to get triggered or just one
// Check if the TriggerConnection field exists
if (!string.IsNullOrEmpty(globalSetting.TriggerConnection))
{
// Check if TriggerConnection is using the old logic
if (globalSetting.TriggerConnection.ToLower() == "and" || globalSetting.TriggerConnection.ToLower() == "or")
{
// Old logic
bool settingTriggered = false;
switch (globalSetting.TriggerConnection.ToLower())
{
case "and":
settingTriggered = triggerResults.FindAll(tr => tr == false).Count == 0;
settingTriggered = triggerResults.Values.All(tr => tr);
break;
case "or":
settingTriggered = triggerResults.FindAll(tr => tr == true).Count > 0;
settingTriggered = triggerResults.Values.Any(tr => tr);
break;
}
@ -1400,6 +1405,39 @@ namespace Core.Main
break;
}
}
else
{
// New logic
string triggerLogic = globalSetting.TriggerConnection;
foreach (var triggerResult in triggerResults)
{
triggerLogic = triggerLogic.Replace(triggerResult.Key, triggerResult.Value.ToString().ToLower());
}
try
{
bool settingTriggered = (bool)System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(System.Linq.Dynamic.Core.ParsingConfig.Default, new ParameterExpression[0], typeof(bool), triggerLogic).Compile().DynamicInvoke();
// Setting got triggered -> Activate it!
if (settingTriggered)
{
triggeredSetting = globalSetting;
break;
}
}
catch (Exception ex)
{
this.Log.DoLogError($"ERROR: Trigger Connection for global setting {globalSetting.SettingName} is invalid or missing. Program halted.");
Environment.Exit(1); // Stop the program
}
}
}
else
{
this.Log.DoLogError($"ERROR: Trigger Connection for global setting {globalSetting.SettingName} is missing. Program halted.");
Environment.Exit(1); // Stop the program
}
}
}
}

View File

@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Mvc;
using Core.Main;
using Core.Helper;
using Core.Main.DataObjects.PTMagicData;
using Microsoft.Extensions.Primitives;
namespace Monitor.Pages
{

View File

@ -22,4 +22,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8.0" />
</ItemGroup>
</Project>

View File

@ -1,7 +1,6 @@
//
// The settings below offer a basic example of some of the options available when using PTMagic.
// You should take your time and adjust these settings according to your own personal preferences, and settings.
//
// You should take your time and adjust these settings according to your own personal preferences.
// Always test your PTMagic settings by running a Profit Trailer bot in TESTMODE, to make sure
// it is performing as you expect.
//
@ -13,17 +12,19 @@
"MarketAnalyzer": {
"StoreDataMaxHours": 48, // Number of hours to store market data
"IntervalMinutes": 2, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC, if you are trading against BTC) from market trend analysis
"MarketTrends": [
{
"Name": "1h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "Exchange", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 60, // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
"TrendCurrency": "Market", // Trend Currency to build the trend against. If set to "Fiat", the trend will take the USD value of your main currency into account to build the trend. "Market" will build a trend against your base currency, such as BTC or USDT.
"TrendCurrency": "Market", // Trend Currency to build the trend against. If set to "Fiat", the trend will
// take the USD value of your main currency into account to build the trend.
// "Market" will build a trend against your base currency, such as BTC or USDT.
"TrendThreshold": 15, // Any coin that is above 15% or below -15% for this timeframe will not be used when calculating the market average.
"DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer?
"DisplayOnMarketAnalyzerList": false // Disply this trend on the PTM Monitor market analyzer?
"DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer
"DisplayOnMarketAnalyzerList": false // Disply this trend for all coins on the PTM Monitor market analyzer
},
{
"Name": "6h",
@ -62,44 +63,60 @@
"GlobalSettings": [ // Global settings for Profit Trailer properties
//
// ===================================================================================
// Each setting here is checked in order. If it is true, the analysis stops. If it is false, it moves on to check the next setting.
// This way, you don't need to define ranges for each setting, just the minimums or maximums.
// -----------------------------
{
"SettingName": "EndOfTheWorld", // ANY UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR.
//If you give each trigger a letter, then you can use more robust boolean logic, such as: (A && B) || (B && C)
"Triggers": [ // Your triggers for this setting. You can use any of your defined trends from above
{
"Letter": "A", // OPTIONAL: Give your triggers letters, so you can use more robust boolean logic, such as: (A && B) || (C && D)
"MarketTrendName": "1h", // Reference to the market trend specified above
"MaxChange": 0 // The maximum value for this trigger to be true. (Any value below "0" will trigger this)
"MaxChange": 0 // The maximum value for this trigger. (Any value below "0" will trigger this)
},
{
"Letter": "B",
"MarketTrendName": "12h",
"MaxChange": -2
},
{
"Letter": "C",
"MarketTrendName": "24h",
"MaxChange": -5
}
],
"PairsProperties": { // Changes you wish to make to your PAIRS.properties settings
"PairsProperties": { // Properties for PAIRS.PROPERTIES
// Any valid setting from https://wiki.profittrailer.com/en/config can be used here.
// You can use a specific value, or apply a discrete OFFSET or OFFSETPERCENT to the value in your default PAIRS setting.
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_trailing_profit_OFFSETPERCENT": -50
},
"DCAProperties": { // Changes you wish to make to your DCA.properties settings
"DCAProperties": { // Properties for DCA.PROPERTIES
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -75
},
"IndicatorsProperties": { // Changes you wish to make to your INDICATORS.properties settings
}
},
// -----------------------------
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"TriggerConnection": "AND", // You can use complex boolean logic for some settings, and not others
"Triggers": [
{
"MarketTrendName": "1h",
"MaxChange": 0,
"MinChange": -5 // You can use Maxchange and Minchange together to create a range.
},
{
"MarketTrendName": "12h",
"MaxChange": 0
},
{
"MarketTrendName": "24h", // Any value between -5 and -3 will make this trigger true.
"MaxChange": -3,
"MinChange": -5 // The minimum value for this trigger to be true. (Any value above "-5" will trigger this)
}
],
"PairsProperties": {
@ -230,33 +247,50 @@
}
}
],
//
// ================================ COIN-SPECIFIC SETTINGS ================================
//
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
// Any setting from https://wiki.profittrailer.com/en/config marked as COIN (coin-specific) can be used here.
// Only coins that meet the triggered conditions will have the settings applied.
// A variety of SMS can be employed to check for long-term down trends, sideways trends, over-extended uptrends, etc.
// If more than one SMS is true, the settings of the last applied SMS over-rides any prior SMS
// If StopProcessWhenTriggered is false, as the analyzer goes down the list multiple settings
// can be applied to a single coin. This can allow for more complex logic and settings.
// However, if two settings apply the same property, the property from the last setting
// on the list will be the one that is used.
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
//"StopProcessWhenTriggered": true, // No SMS after this will be analyzed or applied if this SMS is true
//"AllowedGlobalSettings": "Default", // You can specify that this setting will only apply when a specific Global setting is active
//"IgnoredGlobalSettings": "Default", // You can specify that this setting will NOT apply when a specific Global setting is active
"SettingName": "BlacklistCoins",
"StopProcessWhenTriggered": true,
"TriggerConnection": "OR", // Just like Global Settings, you can use complex boolean logic for some settings, and not others
"Triggers": [
{
"AgeDaysLowerThan": 21
}
],
"PairsProperties": {
"DEFAULT_trading_enabled": false, // Any setting from PT that begins with DEFAULT_ can be used here.
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
// -----------------------------
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "A || B || C",
"Triggers": [
{
"Letter": "A",
"MarketTrendName": "1h",
"MarketTrendRelation": "Relative", // Relative = The single market trend is compared to the overall trend of the entire market
// Absolute = The Single market trend is considered on its own
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = The trend of the coin market
// is compared to the average trend of all other coins in the market market.
// Absolute = Single market trend is considered on it's own, without reference to the market.
"MinChange": 8
},
{
"Letter": "B",
"MarketTrendName": "12h",
"MarketTrendRelation": "Relative",
"MinChange": 10
},
{
"Letter": "C",
"MarketTrendName": "24h",
"MarketTrendRelation": "Relative",
"MinChange": 12
@ -269,10 +303,11 @@
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": "true",
"DEFAULT_DCA_enabled": "false"
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
// -----------------------------
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
@ -289,8 +324,8 @@
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": "true",
"DEFAULT_DCA_enabled": "false"
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
}
]

View File

@ -2,33 +2,44 @@
"GeneralSettings": {
"Application": {
"IsEnabled": true, // Enables the PTMagic bot (needs restart to take effect)
"TestMode": false, // If TestMode is active, no properties files will be changed
"TestMode": true, // If TestMode is active, no properties files will be changed
"ProfitTrailerLicense": "ptlicense1asdf234fljlasdf014325ehm", // Your Profit Trailer license key (needed to change your settings)
"ProfitTrailerLicenseXtra": "", // Licenses for additional bots for PTM to update (optional - comma separated list)
"ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings)
"ProfitTrailerMonitorURLXtra": "", // URLs for additional bots you want PTM to update (optional - comma separated list)
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
//"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute
"InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them
//"FreeCurrencyConverterAPIKey": "" // If "MainFiatCurrency" above is anything other than USD, you must obtain an API key from https://free.currencyconverterapi.com/free-api-key
"Exchange": "BinanceFutures", // The exchange your are running Profit Trailer on
"FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from
// getting switched back and forth every minute
"InstanceName": "MyBTCbot", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages.
//In case you are running more than one bot, you may set different names to separate them
"CoinMarketCapAPIKey": "", //CoinMarketCap Api
},
"Monitor": {
"IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start
"OpenBrowserOnStart": false, // If active, a browser window will open as soon as you start the monitor
"Port": 8080, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"AnalyzerChart": "", // By default the chart on the Market Analyzer page will use your default currency against USD. You can change that here. (eg., BTCEUR)
"OpenBrowserOnStart": true, // If active, a browser window will open as soon as you start the monitor
"Port": 8080, // The port you want to run your PTMagic monitor on, to connect via browser. The url will be your IP:Port or localhost:Port
"AnalyzerChart": "", // By default the chart on the Market Analyzer page will use your market currency against USD.
//You can change that here. (eg., BTCEUR)
"LiveTCVTimeframeMinutes": 10, // The timeframe for the live TCV chart on the dashboard
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points in minutes
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers in hours
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
"RefreshSeconds": 30, // The refresh interval of your monitor main page
"LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it
"BagAnalyzerRefreshSeconds": 60,
"BuyAnalyzerRefreshSeconds": 60,
"MaxDashboardBuyEntries": 5, // The number of coins in your Possible Buy List on the dashboard. Set to 0 to hide the list completely
"MaxDashboardBagEntries": 9999, // The number of coins in your Positions List on the dashboard.
"MaxTopMarkets": 20, // The amount of top markets being shown in your Sales Analyzer
"MaxDailySummaries": 10, // The amount of "Last Days" being shown in your Sales Analyzer
"MaxDCAPairs": 25, // For DCA calculations in the DCA Analyzer.
"DefaultDCAMode": "Advanced", // The default DCA mode to use in the DCA Analyzer. Options are "Simple" or "Advanced"
"MaxSettingsLogEntries": 500, // The number of entries in the Global Settings Log on the Status & Summary page
"MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer
"LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it
"TVCustomLayout": "EbSR85R8", // A TradingView layout to use when clicking on a pair name while using TradingView as your platform
// When saving a custom layout in TV, you will get a URL like this: https://www.tradingview.com/chart/EbSR85R8/
"TvStudyA": "BB@tv-basicstudies", // See available STUDIES at https://www.tradingview.com/wiki/Widget:TradingView_Widget
"TvStudyB": "",
"TvStudyC": "",

View File

@ -1,7 +1,6 @@
//
// The settings below offer a basic example of some of the options available when using PTMagic.
// You should take your time and adjust these settings according to your own personal preferences, and settings.
//
// You should take your time and adjust these settings according to your own personal preferences.
// Always test your PTMagic settings by running a Profit Trailer bot in TESTMODE, to make sure
// it is performing as you expect.
//
@ -13,17 +12,19 @@
"MarketAnalyzer": {
"StoreDataMaxHours": 48, // Number of hours to store market data
"IntervalMinutes": 2, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC, if you are trading against BTC) from market trend analysis
"MarketTrends": [
{
"Name": "1h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "Exchange", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 60, // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
"TrendCurrency": "Market", // Trend Currency to build the trend against. If set to "Fiat", the trend will take the USD value of your main currency into account to build the trend. "Market" will build a trend against your base currency, such as BTC or USDT.
"TrendCurrency": "Market", // Trend Currency to build the trend against. If set to "Fiat", the trend will
// take the USD value of your main currency into account to build the trend.
// "Market" will build a trend against your base currency, such as BTC or USDT.
"TrendThreshold": 15, // Any coin that is above 15% or below -15% for this timeframe will not be used when calculating the market average.
"DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer?
"DisplayOnMarketAnalyzerList": false // Disply this trend on the PTM Monitor market analyzer?
"DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer
"DisplayOnMarketAnalyzerList": false // Disply this trend for all coins on the PTM Monitor market analyzer
},
{
"Name": "6h",
@ -62,44 +63,60 @@
"GlobalSettings": [ // Global settings for Profit Trailer properties
//
// ===================================================================================
// Each setting here is checked in order. If it is true, the analysis stops. If it is false, it moves on to check the next setting.
// This way, you don't need to define ranges for each setting, just the minimums or maximums.
// -----------------------------
{
"SettingName": "EndOfTheWorld", // ANY UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR.
//If you give each trigger a letter, then you can use more robust boolean logic, such as: (A && B) || (B && C)
"Triggers": [ // Your triggers for this setting. You can use any of your defined trends from above
{
"Letter": "A", // OPTIONAL: Give your triggers letters, so you can use more robust boolean logic, such as: (A && B) || (C && D)
"MarketTrendName": "1h", // Reference to the market trend specified above
"MaxChange": 0 // The maximum value for this trigger to be true. (Any value below "0" will trigger this)
"MaxChange": 0 // The maximum value for this trigger. (Any value below "0" will trigger this)
},
{
"Letter": "B",
"MarketTrendName": "12h",
"MaxChange": -2
},
{
"Letter": "C",
"MarketTrendName": "24h",
"MaxChange": -5
}
],
"PairsProperties": { // Changes you wish to make to your PAIRS.properties settings
"PairsProperties": { // Properties for PAIRS.PROPERTIES
// Any valid setting from https://wiki.profittrailer.com/en/config can be used here.
// You can use a specific value, or apply a discrete OFFSET or OFFSETPERCENT to the value in your default PAIRS setting.
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_trailing_profit_OFFSETPERCENT": -50
},
"DCAProperties": { // Changes you wish to make to your DCA.properties settings
"DCAProperties": { // Properties for DCA.PROPERTIES
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -75
},
"IndicatorsProperties": { // Changes you wish to make to your INDICATORS.properties settings
}
},
// -----------------------------
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"TriggerConnection": "AND", // You can use complex boolean logic for some settings, and not others
"Triggers": [
{
"MarketTrendName": "1h",
"MaxChange": 0,
"MinChange": -5 // You can use Maxchange and Minchange together to create a range.
},
{
"MarketTrendName": "12h",
"MaxChange": 0
},
{
"MarketTrendName": "24h", // Any value between -5 and -3 will make this trigger true.
"MaxChange": -3,
"MinChange": -5 // The minimum value for this trigger to be true. (Any value above "-5" will trigger this)
}
],
"PairsProperties": {
@ -230,33 +247,50 @@
}
}
],
//
// ================================ COIN-SPECIFIC SETTINGS ================================
//
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
// Any setting from https://wiki.profittrailer.com/en/config marked as COIN (coin-specific) can be used here.
// Only coins that meet the triggered conditions will have the settings applied.
// A variety of SMS can be employed to check for long-term down trends, sideways trends, over-extended uptrends, etc.
// If more than one SMS is true, the settings of the last applied SMS over-rides any prior SMS
// If StopProcessWhenTriggered is false, as the analyzer goes down the list multiple settings
// can be applied to a single coin. This can allow for more complex logic and settings.
// However, if two settings apply the same property, the property from the last setting
// on the list will be the one that is used.
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
//"StopProcessWhenTriggered": true, // No SMS after this will be analyzed or applied if this SMS is true
//"AllowedGlobalSettings": "Default", // You can specify that this setting will only apply when a specific Global setting is active
//"IgnoredGlobalSettings": "Default", // You can specify that this setting will NOT apply when a specific Global setting is active
"SettingName": "BlacklistCoins",
"StopProcessWhenTriggered": true,
"TriggerConnection": "OR", // Just like Global Settings, you can use complex boolean logic for some settings, and not others
"Triggers": [
{
"AgeDaysLowerThan": 21
}
],
"PairsProperties": {
"DEFAULT_trading_enabled": false, // Any setting from PT that begins with DEFAULT_ can be used here.
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
// -----------------------------
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "A || B || C",
"Triggers": [
{
"Letter": "A",
"MarketTrendName": "1h",
"MarketTrendRelation": "Relative", // Relative = The single market trend is compared to the overall trend of the entire market
// Absolute = The Single market trend is considered on its own
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = The trend of the coin market
// is compared to the average trend of all other coins in the market market.
// Absolute = Single market trend is considered on it's own, without reference to the market.
"MinChange": 8
},
{
"Letter": "B",
"MarketTrendName": "12h",
"MarketTrendRelation": "Relative",
"MinChange": 10
},
{
"Letter": "C",
"MarketTrendName": "24h",
"MarketTrendRelation": "Relative",
"MinChange": 12
@ -269,10 +303,11 @@
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": "true",
"DEFAULT_DCA_enabled": "false"
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
// -----------------------------
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
@ -289,8 +324,8 @@
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": "true",
"DEFAULT_DCA_enabled": "false"
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
}
]

View File

@ -2,33 +2,44 @@
"GeneralSettings": {
"Application": {
"IsEnabled": true, // Enables the PTMagic bot (needs restart to take effect)
"TestMode": false, // If TestMode is active, no properties files will be changed
"TestMode": true, // If TestMode is active, no properties files will be changed
"ProfitTrailerLicense": "ptlicense1asdf234fljlasdf014325ehm", // Your Profit Trailer license key (needed to change your settings)
"ProfitTrailerLicenseXtra": "", // Licenses for additional bots for PTM to update (optional - comma separated list)
"ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings)
"ProfitTrailerMonitorURLXtra": "", // URLs for additional bots you want PTM to update (optional - comma separated list)
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
//"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute
"InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them
"Exchange": "BinanceFutures", // The exchange your are running Profit Trailer on
"FloodProtectionMinutes": 0, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from
// getting switched back and forth every minute
"InstanceName": "MyBTCbot", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages.
//In case you are running more than one bot, you may set different names to separate them
"CoinMarketCapAPIKey": "", //CoinMarketCap Api
},
"Monitor": {
"IsPasswordProtected": true, // Defines if your monitor will be asking to setup a password on its first start
"OpenBrowserOnStart": false, // If active, a browser window will open as soon as you start the monitor
"Port": 8080, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"AnalyzerChart": "", // By default the chart on the Market Analyzer page will use your default currency against USD. You can change that here. (eg., BTCEUR)
"OpenBrowserOnStart": true, // If active, a browser window will open as soon as you start the monitor
"Port": 8080, // The port you want to run your PTMagic monitor on, to connect via browser. The url will be your IP:Port or localhost:Port
"AnalyzerChart": "", // By default the chart on the Market Analyzer page will use your market currency against USD.
//You can change that here. (eg., BTCEUR)
"LiveTCVTimeframeMinutes": 10, // The timeframe for the live TCV chart on the dashboard
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points in minutes
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers in hours
"ProfitsMaxTimeframeDays": 30, // This will enable you to define the timeframe for your dashboard profits graph in days
"RefreshSeconds": 30, // The refresh interval of your monitor main page
"LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it
"BagAnalyzerRefreshSeconds": 60,
"BuyAnalyzerRefreshSeconds": 60,
"MaxDashboardBuyEntries": 5, // The number of coins in your Possible Buy List on the dashboard. Set to 0 to hide the list completely
"MaxDashboardBagEntries": 9999, // The number of coins in your Positions List on the dashboard.
"MaxTopMarkets": 20, // The amount of top markets being shown in your Sales Analyzer
"MaxDailySummaries": 10, // The amount of "Last Days" being shown in your Sales Analyzer
"MaxDCAPairs": 25, // For DCA calculations in the DCA Analyzer.
"DefaultDCAMode": "Advanced", // The default DCA mode to use in the DCA Analyzer. Options are "Simple" or "Advanced"
"MaxSettingsLogEntries": 500, // The number of entries in the Global Settings Log on the Status & Summary page
"MaxMonthlySummaries": 10, // The amount of "Last Months" being shown in your Sales Analyzer
"LinkPlatform": "TradingView", // The platform to which the pair name will link if you click on it
"TVCustomLayout": "EbSR85R8", // A TradingView layout to use when clicking on a pair name while using TradingView as your platform
// When saving a custom layout in TV, you will get a URL like this: https://www.tradingview.com/chart/EbSR85R8/
"TvStudyA": "BB@tv-basicstudies", // See available STUDIES at https://www.tradingview.com/wiki/Widget:TradingView_Widget
"TvStudyB": "",
"TvStudyC": "",