src/Bitmex.Client.Websocket/Utils/BitmexConverter.cs
/// <summary>
/// Convert decimal value into BTC, according to from currency.
/// For example: 'XBt' will be converted like value/10^8
/// </summary>
/// <param name="from">Currency (XBt, XBT, BTC, etc)</param>
/// <param name="value">Original value</param>
/// <returns>Converted value</returns>
Convert decimal value into BTC, according to from currency.
For example: 'XBt' will be converted like value/10^8
Convert decimal value into BTC according to from currency . For example : ' XBt ' will be converted like value / 10^8
public static decimal ConvertToBtc(string from, decimal value)
        {
            var safe = (from ?? string.Empty).Trim();
            if (safe == "XBt")
            {
                return ConvertFromSatoshiToBtcDecimal(value);
            }
            if (string.IsNullOrWhiteSpace(safe) || safe.ToLower() == "btc" || safe.ToLower() == "xbt")
                return value;
            throw new BitmexException($"Can't convert from '{safe}' to BTC (decimal)");
        }
public static decimal ConvertToBtc ( string from , decimal value ) { var safe = ( from ?? string . Empty ) . Trim ( ) ; if ( safe == " " ) { return ConvertFromSatoshiToBtcDecimal ( value ) ; } if ( string . IsNullOrWhiteSpace ( safe ) || safe . ToLower ( ) == " " || safe . ToLower ( ) == " " ) return value ; throw new BitmexException ( $" Can't convert from ' { safe } ' to BTC (decimal) " ) ; }
Convert decimal value into BTC, according to from currency.
Convert decimal value into BTC according to from currency .
None
from
string
Currency (XBt, XBT, BTC, etc)
Currency ( XBt XBT BTC etc )
value
decimal
None