From 4c2cbb28044182dcb5a0abde944cff7e522f5ff4 Mon Sep 17 00:00:00 2001 From: Tomasz Kowalczyk Date: Wed, 14 Oct 2020 18:59:31 +0200 Subject: [PATCH] #53 poc --- SolBo/SolBo.Agent/SolBo.Agent.csproj | 6 +++--- .../appsettings.solbo-runtime.json | 2 +- SolBo/SolBo.Agent/solbo.json | 20 +++++++++---------- .../Messages/Rules/SymbolMessage.cs | 3 +++ .../Exchange/KucoinAccountExchangeRule.cs | 6 ++++-- .../Production/KucoinBuyExecuteMarketRule.cs | 2 +- .../Sequence/KucoinSymbolSequenceRule.cs | 13 +++++------- SolBo/SolBo.Shared/SolBo.Shared.csproj | 2 +- 8 files changed, 28 insertions(+), 26 deletions(-) diff --git a/SolBo/SolBo.Agent/SolBo.Agent.csproj b/SolBo/SolBo.Agent/SolBo.Agent.csproj index 39c59da..cf37dd9 100644 --- a/SolBo/SolBo.Agent/SolBo.Agent.csproj +++ b/SolBo/SolBo.Agent/SolBo.Agent.csproj @@ -3,9 +3,9 @@ Exe netcoreapp3.1 - 0.3.2.0 - 0.3.2.0 - 0.3.2 + 0.3.3.0 + 0.3.3.0 + 0.3.3 Tomasz Kowalczyk CryptoDev.TV SolBo diff --git a/SolBo/SolBo.Agent/appsettings.solbo-runtime.json b/SolBo/SolBo.Agent/appsettings.solbo-runtime.json index f54528d..b5ab9da 100644 --- a/SolBo/SolBo.Agent/appsettings.solbo-runtime.json +++ b/SolBo/SolBo.Agent/appsettings.solbo-runtime.json @@ -1,5 +1,5 @@ { - "version": "0.3.2", + "version": "0.3.3", "filename": "solbo", "intervalinminutes": 1, "notifications": { diff --git a/SolBo/SolBo.Agent/solbo.json b/SolBo/SolBo.Agent/solbo.json index 91b46d5..05cf7a4 100644 --- a/SolBo/SolBo.Agent/solbo.json +++ b/SolBo/SolBo.Agent/solbo.json @@ -5,17 +5,17 @@ "Available": [ { "Id": 1, - "Symbol": "ALGO-ETH", - "BuyDown": 0.00000200, - "SellUp": 0.00000300, - "Average": 5, - "StopLossDown": 0.00040000, - "FundPercentage": 100, + "Symbol": "UNI-USDT", + "BuyDown": 4.2, + "SellUp": 6.1, + "Average": 3, + "StopLossDown": 12, + "FundPercentage": 90, "ClearOnStartup": false, - "StopLossPauseCycles": 2, - "AverageType": 0, - "SellType": 0, - "CommissionType": 0 + "StopLossPauseCycles": 3, + "AverageType": 1, + "SellType": 1, + "CommissionType": 1 } ] }, diff --git a/SolBo/SolBo.Shared/Messages/Rules/SymbolMessage.cs b/SolBo/SolBo.Shared/Messages/Rules/SymbolMessage.cs index ff943a9..dfafc3d 100644 --- a/SolBo/SolBo.Shared/Messages/Rules/SymbolMessage.cs +++ b/SolBo/SolBo.Shared/Messages/Rules/SymbolMessage.cs @@ -5,6 +5,7 @@ public class SymbolMessage public string BaseAsset { get; set; } public string QuoteAsset { get; set; } public int QuoteAssetPrecision { get; set; } + public int BaseAssetPrecision { get; set; } public decimal MinNotional { get; set; } public decimal StepSize { get; set; } public decimal MaxQuantity { get; set; } @@ -12,5 +13,7 @@ public class SymbolMessage public decimal MaxPrice { get; set; } public decimal MinPrice { get; set; } public decimal TickSize { get; set; } + public decimal QuotePrecision { get; set; } + public decimal BasePrecision { get; set; } } } \ No newline at end of file diff --git a/SolBo/SolBo.Shared/Rules/Mode/Production/Exchange/KucoinAccountExchangeRule.cs b/SolBo/SolBo.Shared/Rules/Mode/Production/Exchange/KucoinAccountExchangeRule.cs index ffc99d0..d8c3023 100644 --- a/SolBo/SolBo.Shared/Rules/Mode/Production/Exchange/KucoinAccountExchangeRule.cs +++ b/SolBo/SolBo.Shared/Rules/Mode/Production/Exchange/KucoinAccountExchangeRule.cs @@ -40,15 +40,17 @@ public IRuleResult RuleExecuted(Solbot solbot) basee = accountType.FirstOrDefault(q => q.Currency == solbot.Communication.Symbol.BaseAsset); } + var baseAvailable = basee != null ? basee.Available : 0m; + if (accountType.AnyAndNotNull()) { solbot.Communication.AvailableAsset = new AvailableAssetMessage { Quote = quote.Available, - Base = basee.Available + Base = baseAvailable }; - baseMsg = $"{solbot.Communication.Symbol.BaseAsset}:{basee.Available}"; + baseMsg = $"{solbot.Communication.Symbol.BaseAsset}:{baseAvailable}"; quoteMsg = $"{solbot.Communication.Symbol.QuoteAsset}:{quote.Available}"; result = true; diff --git a/SolBo/SolBo.Shared/Rules/Mode/Production/KucoinBuyExecuteMarketRule.cs b/SolBo/SolBo.Shared/Rules/Mode/Production/KucoinBuyExecuteMarketRule.cs index 5d7f5a2..3c58a8e 100644 --- a/SolBo/SolBo.Shared/Rules/Mode/Production/KucoinBuyExecuteMarketRule.cs +++ b/SolBo/SolBo.Shared/Rules/Mode/Production/KucoinBuyExecuteMarketRule.cs @@ -28,7 +28,7 @@ public IRuleResult RuleExecuted(Solbot solbot) if (solbot.Communication.Buy.IsReady) { - var funds = (solbot.Communication.Buy.AvailableFund * 0.95m).ToKucoinRound(); + var funds = solbot.Communication.Buy.AvailableFund; var buyOrderResult = _kucoinClient.PlaceOrder( solbot.Strategy.AvailableStrategy.Symbol, diff --git a/SolBo/SolBo.Shared/Rules/Sequence/KucoinSymbolSequenceRule.cs b/SolBo/SolBo.Shared/Rules/Sequence/KucoinSymbolSequenceRule.cs index eeb8668..e6ca15a 100644 --- a/SolBo/SolBo.Shared/Rules/Sequence/KucoinSymbolSequenceRule.cs +++ b/SolBo/SolBo.Shared/Rules/Sequence/KucoinSymbolSequenceRule.cs @@ -31,22 +31,19 @@ public IRuleResult RuleExecuted(Solbot solbot) if (!(symbol is null) && symbol.EnableTrading) { - int count = BitConverter.GetBytes(decimal.GetBits(symbol.PriceIncrement)[3])[2]; - solbot.Communication = new Communication { Symbol = new SymbolMessage { BaseAsset = symbol.BaseCurrency, QuoteAsset = symbol.QuoteCurrency, - QuoteAssetPrecision = count, - //MinNotional = symbol.MinNotionalFilter.MinNotional, + BasePrecision = symbol.BaseIncrement, + QuotePrecision = symbol.QuoteIncrement, + BaseAssetPrecision = BitConverter.GetBytes(decimal.GetBits(symbol.BaseIncrement)[3])[2], + QuoteAssetPrecision = BitConverter.GetBytes(decimal.GetBits(symbol.QuoteIncrement)[3])[2], StepSize = symbol.PriceIncrement, MaxQuantity = symbol.QuoteMaxSize, - MinQuantity = symbol.QuoteMinSize, - TickSize = symbol.QuoteIncrement - //MaxPrice = symbol.QuoteMaxSize, - //MinPrice = symbol.QuoteMinSize + MinQuantity = symbol.QuoteMinSize } }; result.Success = true; diff --git a/SolBo/SolBo.Shared/SolBo.Shared.csproj b/SolBo/SolBo.Shared/SolBo.Shared.csproj index 4b751ab..c413dc7 100644 --- a/SolBo/SolBo.Shared/SolBo.Shared.csproj +++ b/SolBo/SolBo.Shared/SolBo.Shared.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 0.3.2 + 0.3.3 https://github.com/CryptoDevTV/SolBo https://cryptodev.tv Tomasz Kowalczyk