diff --git a/CryptoGramBot.Tests/ProfitAndLossTests.cs b/CryptoGramBot.Tests/ProfitAndLossTests.cs index 39c97e6..8d148a9 100644 --- a/CryptoGramBot.Tests/ProfitAndLossTests.cs +++ b/CryptoGramBot.Tests/ProfitAndLossTests.cs @@ -80,7 +80,7 @@ private Trade CreateTrade(string ccy1, string ccy2, decimal commision, decimal l Quantity = quanity, Side = side, Limit = limit, - TimeStamp = timeStamp + Timestamp = timeStamp }; return trade; } diff --git a/CryptoGramBot/Configuration/BinanceConfig.cs b/CryptoGramBot/Configuration/BinanceConfig.cs index 2fb00e0..30f2110 100644 --- a/CryptoGramBot/Configuration/BinanceConfig.cs +++ b/CryptoGramBot/Configuration/BinanceConfig.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CryptoGramBot.Configuration +namespace CryptoGramBot.Configuration { public class BinanceConfig : IConfig { diff --git a/CryptoGramBot/Configuration/TelegramConfig.cs b/CryptoGramBot/Configuration/TelegramConfig.cs index 2d8adb2..38e8679 100644 --- a/CryptoGramBot/Configuration/TelegramConfig.cs +++ b/CryptoGramBot/Configuration/TelegramConfig.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CryptoGramBot.Configuration +namespace CryptoGramBot.Configuration { public class TelegramConfig { diff --git a/CryptoGramBot/Data/CryptoGramBotDbContext.cs b/CryptoGramBot/Data/CryptoGramBotDbContext.cs index aa95d77..3de6bf4 100644 --- a/CryptoGramBot/Data/CryptoGramBotDbContext.cs +++ b/CryptoGramBot/Data/CryptoGramBotDbContext.cs @@ -1,9 +1,7 @@ -using System.IO; -using CryptoGramBot.Helpers; +using CryptoGramBot.Helpers; using CryptoGramBot.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Configuration; namespace CryptoGramBot.Data { diff --git a/CryptoGramBot/Data/DbInitializer.cs b/CryptoGramBot/Data/DbInitializer.cs index b0d1f29..e99852c 100644 --- a/CryptoGramBot/Data/DbInitializer.cs +++ b/CryptoGramBot/Data/DbInitializer.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace CryptoGramBot.Data diff --git a/CryptoGramBot/EventBus/Commands/SendBalanceInfoCommand.cs b/CryptoGramBot/EventBus/Commands/SendBalanceInfoCommand.cs index 7d66878..626c9da 100644 --- a/CryptoGramBot/EventBus/Commands/SendBalanceInfoCommand.cs +++ b/CryptoGramBot/EventBus/Commands/SendBalanceInfoCommand.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using CryptoGramBot.Models; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/AddLastCheckedHandler.cs b/CryptoGramBot/EventBus/Handlers/AddLastCheckedHandler.cs index b95d011..c8b41c2 100644 --- a/CryptoGramBot/EventBus/Handlers/AddLastCheckedHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/AddLastCheckedHandler.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/Binance/BinanceNewOrderCheckHandler.cs b/CryptoGramBot/EventBus/Handlers/Binance/BinanceNewOrderCheckHandler.cs index edf3bad..c7924f8 100644 --- a/CryptoGramBot/EventBus/Handlers/Binance/BinanceNewOrderCheckHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Binance/BinanceNewOrderCheckHandler.cs @@ -96,7 +96,7 @@ private async Task SendOpenOrdersNotifications(DateTime lastChecked) sb.Append($"New {openOrder.Exchange} OPEN order\n"); sb.Append($"{StringContants.StrongOpen}{openOrder.Side} {openOrder.Base}-{openOrder.Terms}{StringContants.StrongClose}\n"); sb.Append($"Price: {openOrder.Price}\n"); - sb.Append($"Quanitity: {openOrder.Quantity}"); + sb.Append($"Quantity: {openOrder.Quantity}"); await _bus.SendAsync(new SendMessageCommand(sb)); } } diff --git a/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexBagAndDustHandler.cs b/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexBagAndDustHandler.cs index 9ffbad4..22bb3ca 100644 --- a/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexBagAndDustHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexBagAndDustHandler.cs @@ -4,7 +4,6 @@ using CryptoGramBot.EventBus.Events; using CryptoGramBot.Helpers; using CryptoGramBot.Models; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using CryptoGramBot.Services.Exchanges; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexNewOrderCheckHandler.cs b/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexNewOrderCheckHandler.cs index 9a3b455..25470d4 100644 --- a/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexNewOrderCheckHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Bittrex/BittrexNewOrderCheckHandler.cs @@ -81,7 +81,7 @@ private async Task SendOpenOrdersNotifications(DateTime lastChecked) sb.Append($"New {openOrder.Exchange} OPEN order\n"); sb.Append($"{StringContants.StrongOpen}{openOrder.Side} {openOrder.Base}-{openOrder.Terms}{StringContants.StrongClose}\n"); sb.Append($"Price: {openOrder.Price}\n"); - sb.Append($"Quanitity: {openOrder.Quantity}"); + sb.Append($"Quantity: {openOrder.Quantity}"); await _bus.SendAsync(new SendMessageCommand(sb)); } } diff --git a/CryptoGramBot/EventBus/Handlers/Coinigy/CoinigyBalanceHandler.cs b/CryptoGramBot/EventBus/Handlers/Coinigy/CoinigyBalanceHandler.cs index 0a855aa..c3714ea 100644 --- a/CryptoGramBot/EventBus/Handlers/Coinigy/CoinigyBalanceHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Coinigy/CoinigyBalanceHandler.cs @@ -1,11 +1,8 @@ -using System; -using System.Linq; -using System.Threading.Tasks; +using System.Threading.Tasks; using CryptoGramBot.Configuration; using CryptoGramBot.EventBus.Commands; using CryptoGramBot.EventBus.Events; using CryptoGramBot.Helpers; -using CryptoGramBot.Services; using CryptoGramBot.Services.Exchanges; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/LastCheckedHandler.cs b/CryptoGramBot/EventBus/Handlers/LastCheckedHandler.cs index 86dc51c..506846b 100644 --- a/CryptoGramBot/EventBus/Handlers/LastCheckedHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/LastCheckedHandler.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexBalanceCheckHandler.cs b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexBalanceCheckHandler.cs index b1cea55..d29042f 100644 --- a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexBalanceCheckHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexBalanceCheckHandler.cs @@ -1,10 +1,8 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using CryptoGramBot.Configuration; using CryptoGramBot.EventBus.Commands; using CryptoGramBot.EventBus.Events; using CryptoGramBot.Helpers; -using CryptoGramBot.Services; using CryptoGramBot.Services.Exchanges; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexNewOrderCheckHandler.cs b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexNewOrderCheckHandler.cs index b5d2c2e..6ceabd0 100644 --- a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexNewOrderCheckHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexNewOrderCheckHandler.cs @@ -95,7 +95,7 @@ private async Task SendOpenOrdersNotifications(DateTime lastChecked) sb.Append($"New {openOrder.Exchange} OPEN order\n"); sb.Append($"{StringContants.StrongOpen}{openOrder.Side} {openOrder.Base}-{openOrder.Terms}{StringContants.StrongClose}\n"); sb.Append($"Price: {openOrder.Price}\n"); - sb.Append($"Quanitity: {openOrder.Quantity}"); + sb.Append($"Quantity: {openOrder.Quantity}"); await _bus.SendAsync(new SendMessageCommand(sb)); } } diff --git a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexResetAllTradesHandler.cs b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexResetAllTradesHandler.cs index 0d0a6cf..d507afc 100644 --- a/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexResetAllTradesHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/Poloniex/PoloniexResetAllTradesHandler.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using CryptoGramBot.Helpers; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using CryptoGramBot.Services.Exchanges; using Enexure.MicroBus; diff --git a/CryptoGramBot/EventBus/Handlers/SaveAndFindNewTradesHandler.cs b/CryptoGramBot/EventBus/Handlers/SaveAndFindNewTradesHandler.cs index 5e4c5f8..9f442e8 100644 --- a/CryptoGramBot/EventBus/Handlers/SaveAndFindNewTradesHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/SaveAndFindNewTradesHandler.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Threading.Tasks; using CryptoGramBot.Models; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using Enexure.MicroBus; @@ -40,7 +39,7 @@ public SaveAndFindNewTradesHandler(DatabaseService databaseService) public async Task Handle(FindNewTradeQuery query) { var newTrades = await _databaseService.AddTrades(query.OrderHistory); - IOrderedEnumerable orderedEnumerable = newTrades.OrderBy(x => x.TimeStamp); + IOrderedEnumerable orderedEnumerable = newTrades.OrderBy(x => x.Timestamp); return new FindNewTradesResponse(orderedEnumerable); } } diff --git a/CryptoGramBot/EventBus/Handlers/SendFileHandler.cs b/CryptoGramBot/EventBus/Handlers/SendFileHandler.cs index 4885eb4..029aade 100644 --- a/CryptoGramBot/EventBus/Handlers/SendFileHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/SendFileHandler.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; +using System.IO; using System.Threading.Tasks; using CryptoGramBot.Configuration; using CryptoGramBot.Services; diff --git a/CryptoGramBot/EventBus/Handlers/TradeNotificationHandler.cs b/CryptoGramBot/EventBus/Handlers/TradeNotificationHandler.cs index ff46aab..40ae7e1 100644 --- a/CryptoGramBot/EventBus/Handlers/TradeNotificationHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/TradeNotificationHandler.cs @@ -49,7 +49,7 @@ public async Task Handle(TradeNotificationCommand command) var sb = new StringBuffer(); - sb.Append(string.Format("{0}\n", (newTrade.TimeStamp + TimeSpan.FromHours(_config.TimeOffset)).ToString("g"))); + sb.Append(string.Format("{0}\n", (newTrade.Timestamp + TimeSpan.FromHours(_config.TimeOffset)).ToString("g"))); sb.Append(string.Format("New {0} order\n", newTrade.Exchange)); sb.Append(string.Format("{3}{0} {1}-{2}{4}\n", newTrade.Side.ToString(), newTrade.Base, newTrade.Terms, StringContants.StrongOpen, StringContants.StrongClose)); sb.Append(string.Format("Quantity: {0}\n", newTrade.QuantityOfTrade.ToString("##0.###########"))); diff --git a/CryptoGramBot/EventBus/Handlers/TradeProfitHandler.cs b/CryptoGramBot/EventBus/Handlers/TradeProfitHandler.cs index 8a277b3..0282468 100644 --- a/CryptoGramBot/EventBus/Handlers/TradeProfitHandler.cs +++ b/CryptoGramBot/EventBus/Handlers/TradeProfitHandler.cs @@ -2,7 +2,6 @@ using System; using System.Threading.Tasks; using CryptoGramBot.Helpers; -using CryptoGramBot.Services; using CryptoGramBot.Services.Data; using CryptoGramBot.Services.Pricing; diff --git a/CryptoGramBot/Extensions/Binance/OrderExtension.cs b/CryptoGramBot/Extensions/Binance/OrderExtension.cs index 4e158e5..cea3ba4 100644 --- a/CryptoGramBot/Extensions/Binance/OrderExtension.cs +++ b/CryptoGramBot/Extensions/Binance/OrderExtension.cs @@ -4,7 +4,7 @@ public static class OrderExtension { public static bool IsOpen(this Order order) { - if(order == null) + if (order == null) { return false; } diff --git a/CryptoGramBot/Extensions/MessageBusExtension.cs b/CryptoGramBot/Extensions/MessageBusExtension.cs index 3d0f010..3fd55df 100644 --- a/CryptoGramBot/Extensions/MessageBusExtension.cs +++ b/CryptoGramBot/Extensions/MessageBusExtension.cs @@ -1,5 +1,4 @@ -using CryptoGramBot.Configuration; -using CryptoGramBot.EventBus; +using CryptoGramBot.EventBus; using CryptoGramBot.EventBus.Commands; using CryptoGramBot.EventBus.Events; using CryptoGramBot.EventBus.Handlers; @@ -8,7 +7,6 @@ using CryptoGramBot.EventBus.Handlers.Bittrex; using CryptoGramBot.EventBus.Handlers.Coinigy; using CryptoGramBot.EventBus.Handlers.Poloniex; -using CryptoGramBot.Services; using Enexure.MicroBus; namespace CryptoGramBot.Extensions diff --git a/CryptoGramBot/Helpers/Constants.cs b/CryptoGramBot/Helpers/Constants.cs index 9740585..6899d18 100644 --- a/CryptoGramBot/Helpers/Constants.cs +++ b/CryptoGramBot/Helpers/Constants.cs @@ -1,5 +1,4 @@ using System; -using System.IO; namespace CryptoGramBot.Helpers { diff --git a/CryptoGramBot/Helpers/Convertors/BinanceConverter.cs b/CryptoGramBot/Helpers/Convertors/BinanceConverter.cs index 60f0e2e..38f434f 100644 --- a/CryptoGramBot/Helpers/Convertors/BinanceConverter.cs +++ b/CryptoGramBot/Helpers/Convertors/BinanceConverter.cs @@ -82,7 +82,7 @@ public static List BinanceToTrades(IEnumerable response, st Limit = completedOrder.Price, Quantity = completedOrder.Quantity, QuantityRemaining = 0, - TimeStamp = completedOrder.Time(), + Timestamp = completedOrder.Time(), Side = completedOrder.IsBuyer ? TradeSide.Buy : TradeSide.Sell }; diff --git a/CryptoGramBot/Helpers/Convertors/BittrexConvertor.cs b/CryptoGramBot/Helpers/Convertors/BittrexConvertor.cs index dac5702..1b4d795 100644 --- a/CryptoGramBot/Helpers/Convertors/BittrexConvertor.cs +++ b/CryptoGramBot/Helpers/Convertors/BittrexConvertor.cs @@ -102,7 +102,7 @@ public static List BittrexToTrades(BittrexOrder[] bittrexTrades, ILogger Limit = completedOrder.Limit, Quantity = completedOrder.Quantity, QuantityRemaining = completedOrder.QuantityRemaining, - TimeStamp = completedOrder.Closed.GetValueOrDefault(), + Timestamp = completedOrder.Closed.GetValueOrDefault(), Side = completedOrder.OrderType == OrderTypeExtended.LimitBuy ? TradeSide.Buy : TradeSide.Sell }; @@ -192,7 +192,7 @@ private static Trade ConvertBittrexCsvToCompletedOrder(IReadOnlyList csv Limit = Decimal.Parse(csvCurrentRecord[4]), Commission = Decimal.Parse(csvCurrentRecord[5]), Cost = Decimal.Parse(csvCurrentRecord[6]) * Decimal.Parse(csvCurrentRecord[3]), - TimeStamp = DateTime.Parse(csvCurrentRecord[8], CultureInfo.CreateSpecificCulture("en-US")) + Timestamp = DateTime.Parse(csvCurrentRecord[8], CultureInfo.CreateSpecificCulture("en-US")) }; if (csvCurrentRecord[2] == "LIMIT_BUY") diff --git a/CryptoGramBot/Helpers/Convertors/PoloniexConvertor.cs b/CryptoGramBot/Helpers/Convertors/PoloniexConvertor.cs index 09278fc..b4a5331 100644 --- a/CryptoGramBot/Helpers/Convertors/PoloniexConvertor.cs +++ b/CryptoGramBot/Helpers/Convertors/PoloniexConvertor.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using CryptoGramBot.Models; using Jojatekok.PoloniexAPI.TradingTools; using Jojatekok.PoloniexAPI.WalletTools; @@ -79,7 +76,7 @@ public static List PoloniexToTrades(IList trades) Terms = ccy[1], ExchangeId = completedOrder.IdOrder.ToString(), Limit = Convert.ToDecimal(completedOrder.PricePerCoin), - TimeStamp = completedOrder.Time, + Timestamp = completedOrder.Time, }; var baseAmount = Convert.ToDecimal(completedOrder.AmountBase); diff --git a/CryptoGramBot/Helpers/Helpers.cs b/CryptoGramBot/Helpers/Helpers.cs index 1e8bdee..0aff6e6 100644 --- a/CryptoGramBot/Helpers/Helpers.cs +++ b/CryptoGramBot/Helpers/Helpers.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace CryptoGramBot.Helpers diff --git a/CryptoGramBot/Helpers/MultiFieldIgnoreOrderComparer.cs b/CryptoGramBot/Helpers/MultiFieldIgnoreOrderComparer.cs index 671c7ef..2678401 100644 --- a/CryptoGramBot/Helpers/MultiFieldIgnoreOrderComparer.cs +++ b/CryptoGramBot/Helpers/MultiFieldIgnoreOrderComparer.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CryptoGramBot.Helpers { diff --git a/CryptoGramBot/Helpers/StringContants.cs b/CryptoGramBot/Helpers/StringContants.cs index 76bd989..9094110 100644 --- a/CryptoGramBot/Helpers/StringContants.cs +++ b/CryptoGramBot/Helpers/StringContants.cs @@ -11,7 +11,7 @@ public static class StringContants "30 or more open binance orders available to send. Will not send them to avoid spam."; public static string BinanceMoreThan30Trades = - "There are more than 30 binance trades to send. Not going to send them to avoid spamming you"; + "There are more than 30 binance trades to send. Not going to send them to avoid spamming you."; public static string BinanceMoreThan30Withdrawals = "30 or more binance withdrawals available to send. Will not send them to avoid spam."; @@ -23,7 +23,7 @@ public static class StringContants "30 or more open bittrex orders available to send. Will not send them to avoid spam."; public static string BittrexMoreThan30Trades = - "There are more than 30 bittrex trades to send. Not going to send them to avoid spamming you"; + "There are more than 30 bittrex trades to send. Not going to send them to avoid spamming you."; public static string BittrexMoreThan30Withdrawals = "30 or more bittrex withdrawals available to send. Will not send them to avoid spam."; @@ -32,13 +32,13 @@ public static class StringContants public static string CommonCommands = $"{StringContants.StrongOpen}Common commands{StringContants.StrongClose}\n"; - public static string CouldNotProcessCommand = "Could not process your command. Check your logs"; + public static string CouldNotProcessCommand = "Could not process your command. Check your logs."; public static string CouldNotProcessFile = "Could not process file."; public static string CouldNotWorkOutPair = "Could not work out what the pair you typed was"; public static string DatabaseLocation = "Data Source=" + Directory.GetCurrentDirectory() + "/database/cryptogrambot.sqlite;cache=shared"; - public static string DidNotRecieveFile = "Did not receive a file"; + public static string DidNotReceiveFile = "Did not receive a file"; public static string Help = $"{StringContants.StrongOpen}Help{StringContants.StrongClose}\n\n"; - public static string No24HourOfData = "Could not calculate percentages. Probably because we don't have 24 hours of data yet"; + public static string No24HourOfData = "Could not calculate percentages. Probably because we don't have 24 hours of data yet."; public static string PairProfitError = "Something went wrong. Probably because you entered in a dud currency or I have no trade details"; public static string PoloCommands = $"\n{StringContants.StrongOpen}Poloniex commands{StringContants.StrongClose})\n"; diff --git a/CryptoGramBot/Models/BalanceHistory.cs b/CryptoGramBot/Models/BalanceHistory.cs index 1818851..c20c456 100644 --- a/CryptoGramBot/Models/BalanceHistory.cs +++ b/CryptoGramBot/Models/BalanceHistory.cs @@ -1,6 +1,5 @@ using System; using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; namespace CryptoGramBot.Models { diff --git a/CryptoGramBot/Models/BalanceInformation.cs b/CryptoGramBot/Models/BalanceInformation.cs index 21f70bc..ef9f3a6 100644 --- a/CryptoGramBot/Models/BalanceInformation.cs +++ b/CryptoGramBot/Models/BalanceInformation.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace CryptoGramBot.Models { diff --git a/CryptoGramBot/Models/CoinigyAccount.cs b/CryptoGramBot/Models/CoinigyAccount.cs index 462a814..cd53e22 100644 --- a/CryptoGramBot/Models/CoinigyAccount.cs +++ b/CryptoGramBot/Models/CoinigyAccount.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; namespace CryptoGramBot.Models { diff --git a/CryptoGramBot/Models/Currency.cs b/CryptoGramBot/Models/Currency.cs index 93254a7..8167e03 100644 --- a/CryptoGramBot/Models/Currency.cs +++ b/CryptoGramBot/Models/Currency.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CryptoGramBot.Models +namespace CryptoGramBot.Models { public class Currency { diff --git a/CryptoGramBot/Models/Deposit.cs b/CryptoGramBot/Models/Deposit.cs index ef5434c..96e870d 100644 --- a/CryptoGramBot/Models/Deposit.cs +++ b/CryptoGramBot/Models/Deposit.cs @@ -1,10 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Poloniex; namespace CryptoGramBot.Models { diff --git a/CryptoGramBot/Models/Setting.cs b/CryptoGramBot/Models/Setting.cs index 505eb49..d076e3e 100644 --- a/CryptoGramBot/Models/Setting.cs +++ b/CryptoGramBot/Models/Setting.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CryptoGramBot.Models +namespace CryptoGramBot.Models { public class Setting { diff --git a/CryptoGramBot/Models/Trade.cs b/CryptoGramBot/Models/Trade.cs index 4991ecb..284bc9a 100644 --- a/CryptoGramBot/Models/Trade.cs +++ b/CryptoGramBot/Models/Trade.cs @@ -16,6 +16,6 @@ public class Trade public decimal QuantityRemaining { get; set; } public TradeSide Side { get; set; } public string Terms { get; set; } - public DateTime TimeStamp { get; set; } + public DateTime Timestamp { get; set; } } } \ No newline at end of file diff --git a/CryptoGramBot/Models/TradeSide.cs b/CryptoGramBot/Models/TradeSide.cs index 9a65700..1a38305 100644 --- a/CryptoGramBot/Models/TradeSide.cs +++ b/CryptoGramBot/Models/TradeSide.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CryptoGramBot.Models +namespace CryptoGramBot.Models { public enum TradeSide { diff --git a/CryptoGramBot/Models/Withdrawal.cs b/CryptoGramBot/Models/Withdrawal.cs index 62d52b4..87f9e6c 100644 --- a/CryptoGramBot/Models/Withdrawal.cs +++ b/CryptoGramBot/Models/Withdrawal.cs @@ -1,10 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Poloniex; namespace CryptoGramBot.Models { diff --git a/CryptoGramBot/Program.cs b/CryptoGramBot/Program.cs index 531f13b..a1b83c2 100644 --- a/CryptoGramBot/Program.cs +++ b/CryptoGramBot/Program.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.Configuration; using Serilog; using Serilog.Events; -using Serilog.Sinks.SystemConsole.Themes; using Microsoft.AspNetCore.Hosting; namespace CryptoGramBot diff --git a/CryptoGramBot/Services/Data/DatabaseService.cs b/CryptoGramBot/Services/Data/DatabaseService.cs index 84eaa68..e103a0a 100644 --- a/CryptoGramBot/Services/Data/DatabaseService.cs +++ b/CryptoGramBot/Services/Data/DatabaseService.cs @@ -125,7 +125,7 @@ public async Task> AddTrades(IEnumerable trades) foreach (var trade in trades) { var foundTrade = _context.Trades.FirstOrDefault( - x => x.TimeStamp == trade.TimeStamp && + x => x.Timestamp == trade.Timestamp && x.Base == trade.Base && x.Exchange == trade.Exchange && x.Quantity == trade.Quantity && @@ -298,7 +298,7 @@ public async Task GetBuyAveragePrice(string ccy1, string ccy2, string e var contextTrades = _context.Trades; var onlyBuys = await contextTrades .Where(x => x.Base == ccy1 && x.Terms == ccy2 && x.Exchange == exchange && x.Side == TradeSide.Buy) - .OrderByDescending(x => x.TimeStamp) + .OrderByDescending(x => x.Timestamp) .ToListAsync(); var price = ProfitCalculator.GetAveragePrice(onlyBuys, quantity); @@ -321,8 +321,8 @@ public async Task GetBuyAveragePrice(string ccy1, string ccy2, string e public async Task GetLastBoughtAsync(string queryBaseCcy, string queryTerms, string exchange) { var lastBought = await _context.Trades.Where(x => x.Base == queryBaseCcy && x.Terms == queryTerms && x.Exchange == exchange && x.Side == TradeSide.Buy) - .OrderByDescending(x => x.TimeStamp) - .Select(x => x.TimeStamp) + .OrderByDescending(x => x.Timestamp) + .Select(x => x.Timestamp) .FirstOrDefaultAsync(); return lastBought; diff --git a/CryptoGramBot/Services/Exchanges/BittrexService.cs b/CryptoGramBot/Services/Exchanges/BittrexService.cs index 16f91a7..532890b 100644 --- a/CryptoGramBot/Services/Exchanges/BittrexService.cs +++ b/CryptoGramBot/Services/Exchanges/BittrexService.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using Bittrex.Net; using Bittrex.Net.Objects; -using Bittrex.Net.RateLimiter; using CryptoGramBot.Configuration; using CryptoGramBot.Helpers; using CryptoGramBot.Models; diff --git a/CryptoGramBot/Services/Exchanges/IPriceService.cs b/CryptoGramBot/Services/Exchanges/IPriceService.cs index 71751a3..4c2daa2 100644 --- a/CryptoGramBot/Services/Exchanges/IPriceService.cs +++ b/CryptoGramBot/Services/Exchanges/IPriceService.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CryptoGramBot.Models; namespace CryptoGramBot.Services { diff --git a/CryptoGramBot/Services/Exchanges/PoloniexService.cs b/CryptoGramBot/Services/Exchanges/PoloniexService.cs index 8d22897..a4ecd5b 100644 --- a/CryptoGramBot/Services/Exchanges/PoloniexService.cs +++ b/CryptoGramBot/Services/Exchanges/PoloniexService.cs @@ -10,7 +10,6 @@ using Jojatekok.PoloniexAPI.WalletTools; using Microsoft.Extensions.Logging; using Deposit = CryptoGramBot.Models.Deposit; -using IOrder = Jojatekok.PoloniexAPI.TradingTools.IOrder; using Order = Jojatekok.PoloniexAPI.TradingTools.Order; using Trade = CryptoGramBot.Models.Trade; using Withdrawal = CryptoGramBot.Models.Withdrawal; diff --git a/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceCacheService.cs b/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceCacheService.cs index 229d749..0895a5f 100644 --- a/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceCacheService.cs +++ b/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceCacheService.cs @@ -164,8 +164,6 @@ public void SetSymbolPrice(string symbol, decimal? value) _memoryCache.Set($"{SYMBOL_PRICE}{symbol}", value, TimeSpan.FromMinutes(CACHE_TIME_IN_MINUTES)); } - - #endregion } } diff --git a/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceWebsocketService.cs b/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceWebsocketService.cs index d01e2c0..4a57272 100644 --- a/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceWebsocketService.cs +++ b/CryptoGramBot/Services/Exchanges/WebSockets/Binance/BinanceWebsocketService.cs @@ -440,7 +440,7 @@ private void OnAccountTradeUpdate(AccountTradeUpdateEventArgs e) if (immutableAccountTrades != null) { - _log.LogDebug($"new account trade recieved {e.Trade?.Id}", e); + _log.LogDebug($"new account trade received {e.Trade?.Id}", e); var mutableTrades = immutableAccountTrades.ToBuilder(); @@ -465,7 +465,7 @@ private void OnAccountTradeUpdate(AccountTradeUpdateEventArgs e) private void OnAccountUpdate(AccountUpdateEventArgs e) { - _log.LogDebug($"account info update recieved", e); + _log.LogDebug($"account info update received", e); _cache.SetAccountInfo(e.AccountInfo); @@ -485,7 +485,7 @@ private void UpdateOrders(Order updatedOrder, string symbol) if (immutableOrders != null) { - _log.LogDebug($"new order recieved {updatedOrder?.Id}", updatedOrder, symbol); + _log.LogDebug($"new order received {updatedOrder?.Id}", updatedOrder, symbol); var mutableOrders = immutableOrders.ToBuilder(); diff --git a/CryptoGramBot/Services/Pricing/PriceService.cs b/CryptoGramBot/Services/Pricing/PriceService.cs index 2ec35c9..9d64814 100644 --- a/CryptoGramBot/Services/Pricing/PriceService.cs +++ b/CryptoGramBot/Services/Pricing/PriceService.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using CryptoGramBot.Helpers; using CryptoGramBot.Services.Exchanges; diff --git a/CryptoGramBot/Services/StartupCheckingService.cs b/CryptoGramBot/Services/StartupCheckingService.cs index 9246a53..7fe7bf9 100644 --- a/CryptoGramBot/Services/StartupCheckingService.cs +++ b/CryptoGramBot/Services/StartupCheckingService.cs @@ -4,7 +4,6 @@ using FluentScheduler; using CryptoGramBot.EventBus.Events; using CryptoGramBot.EventBus.Handlers; -using CryptoGramBot.EventBus.Handlers.Binance; using CryptoGramBot.EventBus.Handlers.Coinigy; using CryptoGramBot.Helpers; using Enexure.MicroBus; diff --git a/CryptoGramBot/Services/Telegram/TelegramBittrexFileUploadService.cs b/CryptoGramBot/Services/Telegram/TelegramBittrexFileUploadService.cs index 5e11e5a..7f3af18 100644 --- a/CryptoGramBot/Services/Telegram/TelegramBittrexFileUploadService.cs +++ b/CryptoGramBot/Services/Telegram/TelegramBittrexFileUploadService.cs @@ -27,7 +27,7 @@ public async Task AreWeFileHandling(Document document) if (document == null) { var message = new StringBuffer(); - message.Append(StringContants.DidNotRecieveFile); + message.Append(StringContants.DidNotReceiveFile); await _bus.SendAsync(new SendMessageCommand(message)); BittrexFileUploadState.Reset(); return true; diff --git a/CryptoGramBot/Services/Telegram/TelegramBot.cs b/CryptoGramBot/Services/Telegram/TelegramBot.cs index c5e4631..5edb3d9 100644 --- a/CryptoGramBot/Services/Telegram/TelegramBot.cs +++ b/CryptoGramBot/Services/Telegram/TelegramBot.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using CryptoGramBot.Configuration; using CryptoGramBot.Services.Telegram; @@ -12,12 +12,12 @@ namespace CryptoGramBot.Services public class TelegramBot { private readonly ILogger _log; - private readonly TelegramMessageRecieveService _telegramMessageRecieveService; + private readonly TelegramMessageReceiveService _telegramMessageReceiveService; private TelegramBotClient _bot; - public TelegramBot(TelegramMessageRecieveService telegramMessageRecieveService, ILogger log) + public TelegramBot(TelegramMessageReceiveService telegramMessageReceiveService, ILogger log) { - _telegramMessageRecieveService = telegramMessageRecieveService; + _telegramMessageReceiveService = telegramMessageReceiveService; _log = log; } @@ -53,7 +53,7 @@ public void StartBot(TelegramConfig config) ChatId = config.ChatId; _bot = new TelegramBotClient(config.BotToken); // Start the bot so we can start receiving messages - _telegramMessageRecieveService.StartReceivingMessages(_bot); + _telegramMessageReceiveService.StartReceivingMessages(_bot); } catch (Exception ex) { @@ -62,4 +62,4 @@ public void StartBot(TelegramConfig config) } } } -} \ No newline at end of file +} diff --git a/CryptoGramBot/Services/Telegram/TelegramMessageRecieveService.cs b/CryptoGramBot/Services/Telegram/TelegramMessageRecieveService.cs index 5fa5626..a1fb77f 100644 --- a/CryptoGramBot/Services/Telegram/TelegramMessageRecieveService.cs +++ b/CryptoGramBot/Services/Telegram/TelegramMessageRecieveService.cs @@ -14,9 +14,9 @@ namespace CryptoGramBot.Services.Telegram { - public class TelegramMessageRecieveService + public class TelegramMessageReceiveService { - private static ILogger _log; + private static ILogger _log; private readonly IMicroBus _bus; private readonly TelegramConfig _config; private readonly TelegramBittrexFileUploadService _fileImportService; @@ -24,13 +24,13 @@ public class TelegramMessageRecieveService private readonly TelegramMessageSendingService _sendingService; private TelegramBotClient _bot; - public TelegramMessageRecieveService( + public TelegramMessageReceiveService( IMicroBus bus, TelegramMessageSendingService sendingService, TelegramBittrexFileUploadService fileImportService, TelegramPairProfitService pairProfitService, TelegramConfig config, - ILogger log) + ILogger log) { _bus = bus; _sendingService = sendingService; diff --git a/CryptoGramBot/Services/TradeExportService.cs b/CryptoGramBot/Services/TradeExportService.cs index f631264..ba5093b 100644 --- a/CryptoGramBot/Services/TradeExportService.cs +++ b/CryptoGramBot/Services/TradeExportService.cs @@ -83,7 +83,7 @@ public async Task GetTradeExport() } excelWorksheet.Cells["A" + i].Value = trade.ExchangeId; - excelWorksheet.Cells["B" + i].Value = trade.TimeStamp; + excelWorksheet.Cells["B" + i].Value = trade.Timestamp; excelWorksheet.Cells["C" + i].Value = trade.Base; excelWorksheet.Cells["D" + i].Value = trade.Terms; excelWorksheet.Cells["E" + i].Value = trade.Side; diff --git a/CryptoGramBot/Startup.cs b/CryptoGramBot/Startup.cs index d776876..74c6eb8 100644 --- a/CryptoGramBot/Startup.cs +++ b/CryptoGramBot/Startup.cs @@ -38,7 +38,7 @@ public class Startup #endregion - #region Properites + #region Properties public IConfiguration Configuration { get; } @@ -122,7 +122,7 @@ public void ConfigureServices(IServiceCollection services) containerBuilder.RegisterType().As().SingleInstance(); containerBuilder.RegisterType().As().SingleInstance(); containerBuilder.RegisterType(); - containerBuilder.RegisterType().SingleInstance(); + containerBuilder.RegisterType().SingleInstance(); containerBuilder.RegisterType(); containerBuilder.RegisterType().SingleInstance(); containerBuilder.RegisterType(); @@ -149,7 +149,7 @@ public void ConfigureServices(IServiceCollection services) var loggerFactory = Container.Resolve(); var log = loggerFactory.CreateLogger(); - log.LogInformation($"Services\nCoinigy: {coinigyEnabled}\nBittrex: {bittrexEnabled}\nBinance: {binanceEnabled}\nPoloniex: {poloniexEnabled}"); + log.LogInformation($"Services\nCoinigy: {coinigyEnabled}\nBinance: {binanceEnabled}\nBittrex: {bittrexEnabled}\nPoloniex: {poloniexEnabled}"); ConfigureConfig(Container, Configuration, log); } @@ -159,18 +159,6 @@ public void ConfigureServices(IServiceCollection services) private static void ConfigureConfig(IContainer container, IConfiguration configuration, ILogger log) { - try - { - var config = container.Resolve(); - configuration.GetSection("Coinigy").Bind(config); - log.LogInformation("Created coinigy config"); - } - catch (Exception) - { - log.LogError("Error in reading coinigy config"); - throw; - } - try { var config = container.Resolve(); @@ -197,13 +185,13 @@ private static void ConfigureConfig(IContainer container, IConfiguration configu try { - var config = container.Resolve(); - configuration.GetSection("Bittrex").Bind(config); - log.LogInformation("Created bittrex Config"); + var config = container.Resolve(); + configuration.GetSection("Coinigy").Bind(config); + log.LogInformation("Created coinigy config"); } catch (Exception) { - log.LogError("Error in reading bittrex config"); + log.LogError("Error in reading coinigy config"); throw; } @@ -219,6 +207,18 @@ private static void ConfigureConfig(IContainer container, IConfiguration configu throw; } + try + { + var config = container.Resolve(); + configuration.GetSection("Bittrex").Bind(config); + log.LogInformation("Created bittrex Config"); + } + catch (Exception) + { + log.LogError("Error in reading bittrex config"); + throw; + } + try { var config = container.Resolve(); @@ -233,7 +233,7 @@ private static void ConfigureConfig(IContainer container, IConfiguration configu } private void CheckWhatIsEnabled( - out bool coinigyEnabled, + out bool coinigyEnabled, out bool bittrexEnabled, out bool poloniexEnabled, out bool binanceEnabled) @@ -244,9 +244,9 @@ private static void ConfigureConfig(IContainer container, IConfiguration configu string poloniexEnabledString = Configuration.GetSection("Poloniex").GetValue("Enabled", "false"); coinigyEnabled = bool.Parse(coinigyEnabledString); + binanceEnabled = bool.Parse(binanceEnabledString); bittrexEnabled = bool.Parse(bittrexEnabledString); poloniexEnabled = bool.Parse(poloniexEnabledString); - binanceEnabled = bool.Parse(binanceEnabledString); } private async Task OnStarting() diff --git a/CryptoGramBot/appsettings.json b/CryptoGramBot/appsettings.json index 30bd319..ec57b32 100644 --- a/CryptoGramBot/appsettings.json +++ b/CryptoGramBot/appsettings.json @@ -6,20 +6,22 @@ "TradingCurrency": "BTC", "IgnoreDustInTradingCurrency": "0.001" }, + "Telegram": { + "BotToken": "INSERT HERE", + "ChatId": "INSERT HERE" + }, "Coinigy": { "Enabled": "true", - "SendHourlyUpdates": "false", - "DailyNotifications": "", "Key": "INSERT HERE", "Secret": "INSERT HERE", - "Endpoint": "https://api.coinigy.com/api/v1/" - }, - "Telegram": { - "BotToken": "INSERT HERE", - "ChatId": "INSERT HERE" + "Endpoint": "https://api.coinigy.com/api/v1/", + "SendHourlyUpdates": "false", + "DailyNotifications": "" }, "Bittrex": { "Enabled": "true", + "Key": "INSERT HERE", + "Secret": "INSERT HERE", "SellNotifications": "true", "BuyNotifications": "true", "DepositNotification": "true", @@ -27,12 +29,12 @@ "OpenOrderNotification": "true", "DustNotification": "0.001", "LowBtcNotification": "0.001", - "BagNotification": "30", - "Key": "INSERT HERE", - "Secret": "INSERT HERE" + "BagNotification": "30" }, "Binance": { "Enabled": "true", + "Key": "INSERT HERE", + "Secret": "INSERT HERE", "SendHourlyUpdates": "false", "DailyNotifications": "17:00", "SellNotifications": "true", @@ -41,19 +43,17 @@ "WithdrawalNotification": "true", "OpenOrderNotification": "true", "LowBtcNotification": "0.001", - "BagNotification": "30", - "Key": "INSERT HERE", - "Secret": "INSERT HERE" + "BagNotification": "30" }, "Poloniex": { "Enabled": "true", + "Key": "INSERT HERE", + "Secret": "INSERT HERE", "SendHourlyUpdates": "true", "SellNotifications": "true", "DepositNotification": "true", "WithdrawalNotification": "true", "DustNotification": "0.001", - "BagNotification": "30", - "Key": "INSERT HERE", - "Secret": "INSERT HERE" + "BagNotification": "30" } }