Skip to content

Commit

Permalink
close #25
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalczyk committed Jul 14, 2020
1 parent 75a8102 commit 10a1f17
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions SolBo/SolBo.Shared/Domain/Statics/LogGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public static string NotificationMessageStart
" Join our <a href=\"https://t.me/joinchat/JmoiyRyhQp5o7Ts1ZezFQA\">Telegram Group</a>.<br><br>" +
" Please visit <a href=\"https://cryptodev.tv\">https://cryptodev.tv</a>";

public static string NotificationTitle(WorkingType workingType, MarketOrderType marketOrderType)
=> $"[{workingType.GetDescription()}] => {marketOrderType.GetDescription()}";
public static string NotificationTitle(WorkingType workingType, MarketOrderType marketOrderType, string symbol)
=> $"[{workingType.GetDescription()}] => {marketOrderType.GetDescription()} [{symbol}]";
public static string NotificationMessage(decimal average, decimal price, decimal percentage)
=> $"Average: {average}, Price: {price}, Percentage change: {percentage}";
=> $"Average: {average}<br>Price: {price}<br>Percentage change: {percentage}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public IRuleResult RuleExecuted(Solbot solbot)
}

Logger.Info(LogGenerator.TradeResultEnd(buyOrderResult.Data.OrderId));

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public IRuleResult RuleExecuted(Solbot solbot)
Logger.Info(LogGenerator.TradeResultEnd(sellOrderResult.Data.OrderId));

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public IRuleResult RuleExecuted(Solbot solbot)
Logger.Info(LogGenerator.TradeResultEnd(stopLossOrderResult.Data.OrderId));

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.PRODUCTION, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public IRuleResult RuleExecuted(Solbot solbot)
result = true;

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ public class SellExecuteMarketTestRule : IMarketRule
}
public IRuleResult RuleExecuted(Solbot solbot)
{
var result = solbot.Communication.Sell.PriceReached && solbot.Actions.BoughtPrice > 0;
var result = solbot.Communication.Sell.PriceReached &&
solbot.Actions.BoughtPrice > 0 &&
solbot.Communication.Price.Current > solbot.Actions.BoughtPrice;

if (result)
{
solbot.Actions.BoughtPrice = 0;
result = true;

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public IRuleResult RuleExecuted(Solbot solbot)
solbot.Actions.StopLossReached = true;

_pushOverNotificationService.Send(
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder),
LogGenerator.NotificationTitle(WorkingType.TEST, MarketOrder, solbot.Strategy.AvailableStrategy.Symbol),
LogGenerator.NotificationMessage(
solbot.Communication.Average.Current,
solbot.Communication.Price.Current,
Expand Down

0 comments on commit 10a1f17

Please sign in to comment.