public void AssetPairIsReversedTest() { var reversed = assetPair.Invert(); Assert.True(assetPair.IsInverted(reversed)); Assert.True(reversed.IsInverted(assetPair)); }
public void AssetPairIsInvertedTest() { var inverted = _btcusd.Invert(); Assert.True(_btcusd.IsInverted(inverted)); Assert.True(inverted.IsInverted(_btcusd)); }
public double GetRate(string neededAssetId, AssetPair assetPair, double price) { var inverted = assetPair.IsInverted(neededAssetId); int accuracy = inverted ? assetPair.Accuracy : assetPair.InvertedAccuracy; var rate = inverted ? price : 1 / price; return(rate.TruncateDecimalPlaces(accuracy)); }