From 2af1520ecc4bea1fead9d14f3f64452431d65f94 Mon Sep 17 00:00:00 2001 From: Jkorf Date: Tue, 21 Jan 2025 14:00:08 +0100 Subject: [PATCH] Added PriceSignificationFigures to SharedSpotSymbol model --- CryptoExchange.Net/ExchangeHelpers.cs | 1 + .../SharedApis/ResponseModels/SharedSpotSymbol.cs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CryptoExchange.Net/ExchangeHelpers.cs b/CryptoExchange.Net/ExchangeHelpers.cs index 05a4574..66b04eb 100644 --- a/CryptoExchange.Net/ExchangeHelpers.cs +++ b/CryptoExchange.Net/ExchangeHelpers.cs @@ -261,6 +261,7 @@ namespace CryptoExchange.Net if (price != null) { adjustedPrice = AdjustValueStep(0, decimal.MaxValue, symbol.PriceStep, RoundingType.Down, price.Value); + adjustedPrice = symbol.PriceSignificantFigures.HasValue ? RoundToSignificantDigits(adjustedPrice.Value, symbol.PriceSignificantFigures.Value, RoundingType.Closest) : adjustedPrice; adjustedPrice = symbol.PriceDecimals.HasValue ? RoundDown(price.Value, symbol.PriceDecimals.Value) : adjustedPrice; if (adjustedPrice != 0 && adjustedPrice * quantity < symbol.MinNotionalValue) { diff --git a/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotSymbol.cs b/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotSymbol.cs index 0908d0a..818c012 100644 --- a/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotSymbol.cs +++ b/CryptoExchange.Net/SharedApis/ResponseModels/SharedSpotSymbol.cs @@ -46,6 +46,10 @@ /// public int? PriceDecimals { get; set; } /// + /// The max amount of significant figures to use for price. For example with value of 5 these values are valid: 0.00001, 0.12300, 123.53, 12345, but this is not: 12345.1 + /// + public int? PriceSignificantFigures { get; set; } + /// /// Whether the symbol is currently available for trading /// public bool Trading { get; set; }