Skip to content

Commit

Permalink
#53 poc
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalczyk committed Oct 14, 2020
1 parent a9e2672 commit 4c2cbb2
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 26 deletions.
6 changes: 3 additions & 3 deletions SolBo/SolBo.Agent/SolBo.Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>0.3.2.0</AssemblyVersion>
<FileVersion>0.3.2.0</FileVersion>
<Version>0.3.2</Version>
<AssemblyVersion>0.3.3.0</AssemblyVersion>
<FileVersion>0.3.3.0</FileVersion>
<Version>0.3.3</Version>
<Authors>Tomasz Kowalczyk</Authors>
<Company>CryptoDev.TV</Company>
<Product>SolBo</Product>
Expand Down
2 changes: 1 addition & 1 deletion SolBo/SolBo.Agent/appsettings.solbo-runtime.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.2",
"version": "0.3.3",
"filename": "solbo",
"intervalinminutes": 1,
"notifications": {
Expand Down
20 changes: 10 additions & 10 deletions SolBo/SolBo.Agent/solbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions SolBo/SolBo.Shared/Messages/Rules/SymbolMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ 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; }
public decimal MinQuantity { get; set; }
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; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 5 additions & 8 deletions SolBo/SolBo.Shared/Rules/Sequence/KucoinSymbolSequenceRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion SolBo/SolBo.Shared/SolBo.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>0.3.2</Version>
<Version>0.3.3</Version>
<RepositoryUrl>https://github.com/CryptoDevTV/SolBo</RepositoryUrl>
<PackageProjectUrl>https://cryptodev.tv</PackageProjectUrl>
<Copyright>Tomasz Kowalczyk</Copyright>
Expand Down

0 comments on commit 4c2cbb2

Please sign in to comment.