Updated to be able to easily create a release, and enabled keepalives on HTTP requests

This commit is contained in:
djbadders 2018-08-12 16:34:01 +01:00
parent b282c364b7
commit d227ca172d
19 changed files with 1299 additions and 0 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ _backups
LocalProfitTrailer LocalProfitTrailer
PTMagic/settings.*.json PTMagic/settings.*.json
Monitor/appsettings.json Monitor/appsettings.json
Release/
# Created by https://www.gitignore.io/api/visualstudio,visualstudiocode,phpstorm # Created by https://www.gitignore.io/api/visualstudio,visualstudiocode,phpstorm

View File

@ -17,6 +17,7 @@ namespace Core.MarketAnalyzer {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json"; request.ContentType = "application/json";
request.UserAgent = "PTMagic.Import"; request.UserAgent = "PTMagic.Import";
request.KeepAlive = true;
try { try {
HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse(); HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse();
@ -44,6 +45,7 @@ namespace Core.MarketAnalyzer {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json"; request.ContentType = "application/json";
request.UserAgent = "PTMagic.Import"; request.UserAgent = "PTMagic.Import";
request.KeepAlive = true;
try { try {
HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse(); HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse();
@ -80,6 +82,7 @@ namespace Core.MarketAnalyzer {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json"; request.ContentType = "application/json";
request.UserAgent = "PTMagic.Import"; request.UserAgent = "PTMagic.Import";
request.KeepAlive = true;
try { try {
HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse(); HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse();
@ -107,6 +110,7 @@ namespace Core.MarketAnalyzer {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json"; request.ContentType = "application/json";
request.UserAgent = "PTMagic.Import"; request.UserAgent = "PTMagic.Import";
request.KeepAlive = true;
try { try {
HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse(); HttpWebResponse httpResponse = (HttpWebResponse)request.GetResponse();

View File

@ -0,0 +1,9 @@
{
"PTMagicBasePath": "YOUR PT MAGIC PATH", // Path to your Profit Trailer Magic main directory (use double backslashes for windows like C:\\PTMagic\\)
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info" >
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="File" fileName="${basedir}/_logs/${shortdate}.txt"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7" />
<target xsi:type="ColoredConsole" name="Console"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Info" writeTo="Console" />
<logger name="*" minlevel="Info" writeTo="File" />
</rules>
</nlog>

View File

@ -0,0 +1,241 @@
{
"AnalyzerSettings": {
"MarketAnalyzer": {
"StoreDataMaxHours": 24, // Number of hours to store market data
"IntervalMinutes": 5, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"MarketTrends": [
{
"Name": "CMC24h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 1440 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
{
"Name": "Exchange1h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 60,
"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. (Allowed values are: Fiat, Market)
},
{
"Name": "Exchange12h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 720,
"TrendCurrency": "Market"
},
{
"Name": "Exchange24h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 1440,
"TrendCurrency": "Market"
}
]
},
"GlobalSettings": [ // Global settings for Profit Trailer properties
{
"SettingName": "EndOfTheWorld", // UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"Triggers": [ // Your triggers for this setting
{
"MarketTrendName": "Exchange1h", // Reference to the market trend specified above
"MaxChange": 0 // Maximum trend change % for this setting to get triggered
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": -1
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -5
}
],
"PairsProperties": { // Properties for PAIRS.PROPERTIES
"ALL_sell_only_mode": true,
"ALL_trailing_profit": 0.1
},
"DCAProperties": { // Properties for DCA.PROPERTIES
"trailing_profit": 0.1
}
},
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -3,
"MinChange": -5
}
],
"PairsProperties": {
"ALL_buy_value": -1.1,
"ALL_trailing_buy": 0.39,
"ALL_trailing_profit": 0.1
},
"DCAProperties": {
"trailing_buy": 0.1
}
},
{
"SettingName": "BearSighted",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -1,
"MinChange": -3
}
],
"PairsProperties": {
"ALL_buy_value": -0.9,
"ALL_trailing_profit": 0.15
},
"DCAProperties": {
"trailing_profit": 0.15
}
},
{
"SettingName": "ReadyForLiftOff",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 1,
"MaxChange": 3
}
],
"PairsProperties": {
"ALL_trailing_buy": 0.2,
"ALL_sell_value": 1.1
},
"DCAProperties": {
"sell_value": 1.1
}
},
{
"SettingName": "ToTheMoon",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 1
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 3
}
],
"PairsProperties": {
"ALL_trailing_buy": 0.15,
"ALL_sell_value": 1.3
},
"DCAProperties": {
"sell_value": 1.3
}
},
{
"SettingName": "Default",
"PairsProperties": {
"File": "PAIRS.properties"
},
"DCAProperties": {
"File": "DCA.properties"
},
"IndicatorsProperties": {
"File": "INDICATORS.properties"
}
}
],
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
{
"SettingName": "BlacklistNewCoins",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"AgeDaysLowerThan": 14
}
],
"PairsProperties": {
"ALL_trading_enabled": false,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
},
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market trend compared relative to the market trend / Absolute = Single market trend viewn on its own
"MinChange": 10
},
{
"MarketTrendName": "Exchange12h",
"MarketTrendRelation": "Relative",
"MinChange": 10
},
{
"MarketTrendName": "Exchange24h",
"MarketTrendRelation": "Relative",
"MinChange": 10
}
],
"PairsProperties": {
"ALL_trailing_profit_OFFSETPERCENT": -10,
"ALL_sell_value_OFFSETPERCENT": -30,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
},
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Absolute",
"MaxChange": -5
}
],
"PairsProperties": {
"ALL_trailing_profit_OFFSETPERCENT": -10,
"ALL_sell_value_OFFSETPERCENT": -30,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
}
]
}
}

View File

@ -0,0 +1,39 @@
{
"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
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
"StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor
"AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting
"FloodProtectionMinutes": 15, // 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
},
"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": 5000, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers
"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
"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
"MaxMonthlySummaries": 10 // The amount of "Last Months" being shown in your Sales Analyzer
},
"Backup": {
"IsEnabled": true, // Enables a backup procedure for your properties files. Before every switch PTMagic will backup the current properties
"MaxHours": 12 // Max number of hours to keep backup files
},
"Telegram": {
"IsEnabled": false, // Enables PT Magic to send Telegram messages
"BotToken": "", // Your Telegram bot token
"ChatId": 0, // Your Telegram Chat ID
"SilentMode": false // If SilentMode is active, no notification sound or vibration will happen when the bot sends a Telegram message
}
}
}

View File

@ -0,0 +1,9 @@
{
"PTMagicBasePath": "YOUR PT MAGIC PATH", // Path to your Profit Trailer Magic main directory (use double backslashes for windows like C:\\PTMagic\\)
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info" >
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="File" fileName="${basedir}/_logs/${shortdate}.txt"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7" />
<target xsi:type="ColoredConsole" name="Console"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Info" writeTo="Console" />
<logger name="*" minlevel="Info" writeTo="File" />
</rules>
</nlog>

View File

@ -0,0 +1,242 @@
{
"AnalyzerSettings": {
"MarketAnalyzer": {
"StoreDataMaxHours": 24, // Number of hours to store market data
"IntervalMinutes": 1, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"MarketTrends": [
{
"Name": "CMC24h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 1440 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
{
"Name": "Exchange1h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 60,
"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. (Allowed values are: Fiat, Market)
"IgnoredMarkets": "BNBBTC" // Comma separated list of markets you want to be ignored in this market trend.
},
{
"Name": "Exchange12h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 720,
"TrendCurrency": "Market",
"IgnoredMarkets": "BNBBTC"
},
{
"Name": "Exchange24h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 1440,
"TrendCurrency": "Market",
"IgnoredMarkets": "BNBBTC"
}
]
},
"GlobalSettings": [ // Global settings for Profit Trailer properties
{
"SettingName": "EndOfTheWorld", // UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"Triggers": [ // Your triggers for this setting
{
"MarketTrendName": "Exchange12h", // Reference to the market trend specified above
"MaxChange": -1 // Maximum trend change % for this setting to get triggered
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -5
}
],
"PairsProperties": { // Properties for PAIRS.PROPERTIES
"ALL_sell_only_mode": true,
"ALL_trailing_profit_OFFSETPERCENT": -50
},
"DCAProperties": { // Properties for DCA.PROPERTIES
"trailing_profit_OFFSETPERCENT": -50
}
},
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -3,
"MinChange": -5
}
],
"PairsProperties": {
"ALL_buy_value_OFFSETPERCENT": -10,
"ALL_trailing_buy_OFFSETPERCENT": 10,
"ALL_trailing_profit_OFFSETPERCENT": -25
},
"DCAProperties": {
"trailing_buy_OFFSETPERCENT": -25
}
},
{
"SettingName": "BearSighted",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -1,
"MinChange": -3
}
],
"PairsProperties": {
"ALL_buy_value_OFFSETPERCENT": -5,
"ALL_trailing_profit_OFFSETPERCENT": -10
},
"DCAProperties": {
"trailing_profit_OFFSETPERCENT": -10
}
},
{
"SettingName": "ReadyForLiftOff",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 1,
"MaxChange": 3
}
],
"PairsProperties": {
"ALL_trailing_buy_OFFSETPERCENT": -25,
"ALL_sell_value_OFFSETPERCENT": 10
},
"DCAProperties": {
"sell_value_OFFSETPERCENT": 10
}
},
{
"SettingName": "ToTheMoon",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 1
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 3
}
],
"PairsProperties": {
"ALL_trailing_buy_OFFSETPERCENT": -50,
"ALL_sell_value_OFFSETPERCENT": 25
},
"DCAProperties": {
"sell_value_OFFSETPERCENT": 25
}
},
{
"SettingName": "Default",
"PairsProperties": {
"File": "PAIRS.PROPERTIES"
},
"DCAProperties": {
"File": "DCA.PROPERTIES"
},
"IndicatorsProperties": {
"File": "INDICATORS.PROPERTIES"
}
}
],
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
{
"SettingName": "BlacklistNewCoins",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"AgeDaysLowerThan": 14
}
],
"PairsProperties": {
"ALL_trading_enabled": false,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
},
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market trend compared relative to the market trend / Absolute = Single market trend viewn on its own
"MinChange": 5
},
{
"MarketTrendName": "Exchange12h",
"MarketTrendRelation": "Relative",
"MinChange": 5
},
{
"MarketTrendName": "Exchange24h",
"MarketTrendRelation": "Relative",
"MinChange": 5
}
],
"PairsProperties": {
"ALL_trailing_profit_OFFSETPERCENT": -10,
"ALL_sell_value_OFFSETPERCENT": -30,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
},
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Absolute",
"MaxChange": -5
}
],
"PairsProperties": {
"ALL_trailing_profit_OFFSETPERCENT": -10,
"ALL_sell_value_OFFSETPERCENT": -30,
"ALL_sell_only_mode": true,
"ALL_DCA_enabled": false
}
}
]
}
}

View File

@ -0,0 +1,39 @@
{
"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
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
"StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor
"AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting
"FloodProtectionMinutes": 15, // 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
},
"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": 5000, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers
"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
"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
"MaxMonthlySummaries": 10 // The amount of "Last Months" being shown in your Sales Analyzer
},
"Backup": {
"IsEnabled": true, // Enables a backup procedure for your properties files. Before every switch PTMagic will backup the current properties
"MaxHours": 12 // Max number of hours to keep backup files
},
"Telegram": {
"IsEnabled": false, // Enables PT Magic to send Telegram messages
"BotToken": "", // Your Telegram bot token
"ChatId": 0, // Your Telegram Chat ID
"SilentMode": false // If SilentMode is active, no notification sound or vibration will happen when the bot sends a Telegram message
}
}
}

View File

@ -0,0 +1,9 @@
{
"PTMagicBasePath": "YOUR PT MAGIC PATH", // Path to your Profit Trailer Magic main directory (use double backslashes for windows like C:\\PTMagic\\)
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info" >
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="File" fileName="${basedir}/_logs/${shortdate}.txt"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7" />
<target xsi:type="ColoredConsole" name="Console"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Info" writeTo="Console" />
<logger name="*" minlevel="Info" writeTo="File" />
</rules>
</nlog>

View File

@ -0,0 +1,239 @@
{
"AnalyzerSettings": {
"MarketAnalyzer": {
"StoreDataMaxHours": 24, // Number of hours to store market data
"IntervalMinutes": 5, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"MarketTrends": [
{
"Name": "CMC24h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 1440 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
{
"Name": "Exchange1h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 60,
"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. (Allowed values are: Fiat, Market)
},
{
"Name": "Exchange12h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 720,
"TrendCurrency": "Market"
},
{
"Name": "Exchange24h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 1440,
"TrendCurrency": "Market"
}
]
},
"GlobalSettings": [ // Global settings for Profit Trailer properties
{
"SettingName": "EndOfTheWorld", // UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"Triggers": [ // Your triggers for this setting
{
"MarketTrendName": "Exchange1h", // Reference to the market trend specified above
"MaxChange": 0 // Maximum trend change % for this setting to get triggered
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": -1
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -5
}
],
"PairsProperties": { // Properties for PAIRS.PROPERTIES
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_trailing_profit_OFFSETPERCENT": -50
},
"DCAProperties": { // Properties for DCA.PROPERTIES
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -50
}
},
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -3,
"MinChange": -5
}
],
"PairsProperties": {
"DEFAULT_A_buy_value_OFFSETPERCENT": -10,
"DEFAULT_B_buy_value_OFFSETPERCENT": -10,
"DEFAULT_trailing_buy_OFFSETPERCENT": 10,
"DEFAULT_trailing_profit_OFFSETPERCENT": -25
},
"DCAProperties": {
"DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -25
}
},
{
"SettingName": "BearSighted",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -1,
"MinChange": -3
}
],
"PairsProperties": {
"DEFAULT_A_buy_value_OFFSETPERCENT": -5,
"DEFAULT_B_buy_value_OFFSETPERCENT": -5,
"DEFAULT_trailing_profit_OFFSETPERCENT": -10
},
"DCAProperties": {
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -10
}
},
{
"SettingName": "ReadyForLiftOff",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 1,
"MaxChange": 3
}
],
"PairsProperties": {
"DEFAULT_trailing_buy_OFFSETPERCENT": -25,
"DEFAULT_A_sell_value_OFFSETPERCENT": 10
},
"DCAProperties": {
"DEFAULT_DCA_A_sell_value_OFFSETPERCENT": 10
}
},
{
"SettingName": "ToTheMoon",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 1
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 3
}
],
"PairsProperties": {
"DEFAULT_trailing_buy_OFFSETPERCENT": -50,
"DEFAULT_A_sell_value_OFFSETPERCENT": 25
},
"DCAProperties": {
"DEFAULT_DCA_A_sell_value_OFFSETPERCENT": 25
}
},
{
"SettingName": "Default",
"PairsProperties": {
"File": "PAIRS.properties"
},
"DCAProperties": {
"File": "DCA.properties"
},
"IndicatorsProperties": {
"File": "INDICATORS.properties"
}
}
],
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
{
"SettingName": "BlacklistNewCoins",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"AgeDaysLowerThan": 14
}
],
"PairsProperties": {
"DEFAULT_trading_enabled": false,
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market trend compared relative to the market trend / Absolute = Single market trend viewn on its own
"MinChange": 10
},
{
"MarketTrendName": "Exchange12h",
"MarketTrendRelation": "Relative",
"MinChange": 10
},
{
"MarketTrendName": "Exchange24h",
"MarketTrendRelation": "Relative",
"MinChange": 10
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Absolute",
"MaxChange": -5
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
}
]
}
}

View File

@ -0,0 +1,43 @@
{
"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
"ProfitTrailerMajorVersion": 2, // Major version of your Profit Trailer (If you are using 1.2.x the major version is "1", if you are using 2.x the major version is "2" and so on)
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
"ProfitTrailerLicense": "YOUR PROFIT TRAILER LICENSE KEY", // Your Profit Trailer license key (needed to change your settings for PT 2.0 and above)
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above)
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings for PT 2.0 and above)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
"StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor
"AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting
"FloodProtectionMinutes": 15, // 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
},
"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": 5000, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers
"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
"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
"MaxMonthlySummaries": 10 // The amount of "Last Months" being shown in your Sales Analyzer
},
"Backup": {
"IsEnabled": true, // Enables a backup procedure for your properties files. Before every switch PTMagic will backup the current properties
"MaxHours": 12 // Max number of hours to keep backup files
},
"Telegram": {
"IsEnabled": false, // Enables PT Magic to send Telegram messages
"BotToken": "", // Your Telegram bot token
"ChatId": 0, // Your Telegram Chat ID
"SilentMode": false // If SilentMode is active, no notification sound or vibration will happen when the bot sends a Telegram message
}
}
}

View File

@ -0,0 +1,9 @@
{
"PTMagicBasePath": "YOUR PT MAGIC PATH", // Path to your Profit Trailer Magic main directory (use double backslashes for windows like C:\\PTMagic\\)
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info" >
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="File" fileName="${basedir}/_logs/${shortdate}.txt"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="7" />
<target xsi:type="ColoredConsole" name="Console"
layout="${date} ${level:uppercase=true} - ${message} ${exception:format=type,message,stacktrace}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Info" writeTo="Console" />
<logger name="*" minlevel="Info" writeTo="File" />
</rules>
</nlog>

View File

@ -0,0 +1,242 @@
{
"AnalyzerSettings": {
"MarketAnalyzer": {
"StoreDataMaxHours": 24, // Number of hours to store market data
"IntervalMinutes": 1, // Interval in minutes for PTMagic to check market trends and triggers
"ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis
"MarketTrends": [
{
"Name": "CMC24h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 1440 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
{
"Name": "Exchange1h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 60,
"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. (Allowed values are: Fiat, Market)
"IgnoredMarkets": "BNBBTC" // Comma separated list of markets you want to be ignored in this market trend.
},
{
"Name": "Exchange12h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 720,
"TrendCurrency": "Market",
"IgnoredMarkets": "BNBBTC"
},
{
"Name": "Exchange24h",
"Platform": "Exchange",
"MaxMarkets": 50,
"TrendMinutes": 1440,
"TrendCurrency": "Market",
"IgnoredMarkets": "BNBBTC"
}
]
},
"GlobalSettings": [ // Global settings for Profit Trailer properties
{
"SettingName": "EndOfTheWorld", // UNIQUE name of your setting
"TriggerConnection": "AND", // Define if triggers will be connected by AND or OR
"Triggers": [ // Your triggers for this setting
{
"MarketTrendName": "Exchange12h", // Reference to the market trend specified above
"MaxChange": -1 // Maximum trend change % for this setting to get triggered
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -5
}
],
"PairsProperties": { // Properties for PAIRS.PROPERTIES
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_trailing_profit_OFFSETPERCENT": -50
},
"DCAProperties": { // Properties for DCA.PROPERTIES
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -50
}
},
{
"SettingName": "TankingDown",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -3,
"MinChange": -5
}
],
"PairsProperties": {
"DEFAULT_A_buy_value_OFFSETPERCENT": -10,
"DEFAULT_B_buy_value_OFFSETPERCENT": -10,
"DEFAULT_trailing_buy_OFFSETPERCENT": 10,
"DEFAULT_trailing_profit_OFFSETPERCENT": -25
},
"DCAProperties": {
"DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -25
}
},
{
"SettingName": "BearSighted",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MaxChange": 1
},
{
"MarketTrendName": "Exchange12h",
"MaxChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MaxChange": -1,
"MinChange": -3
}
],
"PairsProperties": {
"DEFAULT_A_buy_value_OFFSETPERCENT": -5,
"DEFAULT_B_buy_value_OFFSETPERCENT": -5,
"DEFAULT_trailing_profit_OFFSETPERCENT": -10
},
"DCAProperties": {
"DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -10
}
},
{
"SettingName": "ReadyForLiftOff",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 0
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 1,
"MaxChange": 3
}
],
"PairsProperties": {
"DEFAULT_trailing_buy_OFFSETPERCENT": -25,
"DEFAULT_A_sell_value_OFFSETPERCENT": 10
},
"DCAProperties": {
"DEFAULT_DCA_A_sell_value_OFFSETPERCENT": 10
}
},
{
"SettingName": "ToTheMoon",
"TriggerConnection": "AND",
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MinChange": -1
},
{
"MarketTrendName": "Exchange12h",
"MinChange": 1
},
{
"MarketTrendName": "Exchange24h",
"MinChange": 3
}
],
"PairsProperties": {
"DEFAULT_trailing_buy_OFFSETPERCENT": -50,
"DEFAULT_A_sell_value_OFFSETPERCENT": 25
},
"DCAProperties": {
"DEFAULT_DCA_A_sell_value_OFFSETPERCENT": 25
}
},
{
"SettingName": "Default",
"PairsProperties": {
"File": "PAIRS.PROPERTIES"
},
"DCAProperties": {
"File": "DCA.PROPERTIES"
},
"IndicatorsProperties": {
"File": "INDICATORS.PROPERTIES"
}
}
],
"SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties
{
"SettingName": "BlacklistNewCoins",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"AgeDaysLowerThan": 14
}
],
"PairsProperties": {
"DEFAULT_trading_enabled": false,
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
{
"SettingName": "PumpNDumpProtection",
"TriggerConnection": "OR",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market trend compared relative to the market trend / Absolute = Single market trend viewn on its own
"MinChange": 5
},
{
"MarketTrendName": "Exchange12h",
"MarketTrendRelation": "Relative",
"MinChange": 5
},
{
"MarketTrendName": "Exchange24h",
"MarketTrendRelation": "Relative",
"MinChange": 5
}
],
"PairsProperties": {
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
},
{
"SettingName": "FreefallBlock",
"TriggerConnection": "OR",
"StopProcessWhenTriggered": true,
"Triggers": [
{
"MarketTrendName": "Exchange1h",
"MarketTrendRelation": "Absolute",
"MaxChange": -5
}
],
"PairsProperties": {
"DEFAULT_trailing_profit_OFFSETPERCENT": -10,
"DEFAULT_A_sell_value_OFFSETPERCENT": -30,
"DEFAULT_sell_only_mode_enabled": true,
"DEFAULT_DCA_enabled": false
}
}
]
}
}

View File

@ -0,0 +1,43 @@
{
"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
"ProfitTrailerMajorVersion": 2, // Major version of your Profit Trailer (If you are using 1.2.x the major version is "1", if you are using 2.x the major version is "2" and so on)
"ProfitTrailerPath": "YOUR PROFIT TRAILER PATH", // Path to your Profit Trailer main directory (use double backslashes for windows like C:\\ProfitTrailer\\)
"ProfitTrailerLicense": "YOUR PROFIT TRAILER LICENSE KEY", // Your Profit Trailer license key (needed to change your settings for PT 2.0 and above)
"ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above)
"ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings for PT 2.0 and above)
"Exchange": "Bittrex", // The exchange your are running Profit Trailer on
"StartBalance": 0, // The balance you had in your wallet when you started working with Profit Trailer
"TimezoneOffset": "+0:00", // Your timezone offset from UTC time
"MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor
"AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting
"FloodProtectionMinutes": 15, // 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
},
"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": 5000, // The port you want to run your monitor on
"RootUrl": "/", // The root Url of your monitor
"GraphIntervalMinutes": 60, // The interval for the monitor market trend graph to draw points
"GraphMaxTimeframeHours": 24, // This will enable you to define the timeframe that your graph for market trends covers
"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
"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
"MaxMonthlySummaries": 10 // The amount of "Last Months" being shown in your Sales Analyzer
},
"Backup": {
"IsEnabled": true, // Enables a backup procedure for your properties files. Before every switch PTMagic will backup the current properties
"MaxHours": 12 // Max number of hours to keep backup files
},
"Telegram": {
"IsEnabled": false, // Enables PT Magic to send Telegram messages
"BotToken": "", // Your Telegram bot token
"ChatId": 0, // Your Telegram Chat ID
"SilentMode": false // If SilentMode is active, no notification sound or vibration will happen when the bot sends a Telegram message
}
}
}

View File

@ -0,0 +1,18 @@
REM Create a PTM release
IF EXIST ..\Release GOTO NOWINRELEASE
MD ..\Release
:NOWINRELEASE
IF EXIST ..\Release\Latest GOTO NOWINLATEST
MD ..\Release\Latest
:NOWINLATEST
REM Remove previous release
CD ..\Release\Latest
DEL /F /S /Y *
REM Copy release files
MKDIR PTMagic
XCOPY /Y /S ..\..\PTMagic\_defaults\_default* .\
XCOPY /Y /S ..\..\PTMagic\bin\Release\PublishOutput .\PTMagic