本文整理汇总了Java中org.bitcoinj.utils.Fiat.parseFiat方法的典型用法代码示例。如果您正苦于以下问题:Java Fiat.parseFiat方法的具体用法?Java Fiat.parseFiat怎么用?Java Fiat.parseFiat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bitcoinj.utils.Fiat
的用法示例。
在下文中一共展示了Fiat.parseFiat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendRequestExchangeRate
import org.bitcoinj.utils.Fiat; //导入方法依赖的package包/类
@Test
public void sendRequestExchangeRate() throws Exception {
receiveATransaction(wallet, myAddress);
SendRequest sendRequest = SendRequest.to(myAddress, Coin.COIN);
sendRequest.exchangeRate = new ExchangeRate(Fiat.parseFiat("EUR", "500"));
wallet.completeTx(sendRequest);
assertEquals(sendRequest.exchangeRate, sendRequest.tx.getExchangeRate());
}
示例2: parse
import org.bitcoinj.utils.Fiat; //导入方法依赖的package包/类
public static Price parse(String currencyCode, String inputValue) {
final String cleaned = inputValue.replace(",", ".");
if (CurrencyUtil.isFiatCurrency(currencyCode))
return new Price(Fiat.parseFiat(currencyCode, cleaned));
else
return new Price(Altcoin.parseAltcoin(currencyCode, cleaned));
}
示例3: parse
import org.bitcoinj.utils.Fiat; //导入方法依赖的package包/类
public static Volume parse(String inputValue, String currencyCode) {
final String cleaned = inputValue.replace(",", ".");
if (CurrencyUtil.isFiatCurrency(currencyCode))
return new Volume(Fiat.parseFiat(currencyCode, cleaned));
else
return new Volume(Altcoin.parseAltcoin(currencyCode, cleaned));
}
示例4: parseToFiat
import org.bitcoinj.utils.Fiat; //导入方法依赖的package包/类
protected Fiat parseToFiat(String input, String currencyCode) {
if (input != null && input.length() > 0) {
try {
return Fiat.parseFiat(currencyCode, cleanDoubleInput(input));
} catch (Exception e) {
log.warn("Exception at parseToFiat: " + e.toString());
return Fiat.valueOf(currencyCode, 0);
}
} else {
return Fiat.valueOf(currencyCode, 0);
}
}
示例5: testGetCandleData
import org.bitcoinj.utils.Fiat; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
@Test
public void testGetCandleData() {
model.selectedTradeCurrencyProperty.setValue(new FiatCurrency("EUR"));
long low = Fiat.parseFiat("EUR", "500").value;
long open = Fiat.parseFiat("EUR", "520").value;
long close = Fiat.parseFiat("EUR", "580").value;
long high = Fiat.parseFiat("EUR", "600").value;
long average = Fiat.parseFiat("EUR", "550").value;
long amount = Coin.parseCoin("4").value;
long volume = Fiat.parseFiat("EUR", "2200").value;
boolean isBullish = true;
Set<TradeStatistics2> set = new HashSet<>();
final Date now = new Date();
set.add(new TradeStatistics2(offer, Price.parse("EUR", "520"), Coin.parseCoin("1"), new Date(now.getTime()), null));
set.add(new TradeStatistics2(offer, Price.parse("EUR", "500"), Coin.parseCoin("1"), new Date(now.getTime() + 100), null));
set.add(new TradeStatistics2(offer, Price.parse("EUR", "600"), Coin.parseCoin("1"), new Date(now.getTime() + 200), null));
set.add(new TradeStatistics2(offer, Price.parse("EUR", "580"), Coin.parseCoin("1"), new Date(now.getTime() + 300), null));
CandleData candleData = model.getCandleData(model.roundToTick(now, TradesChartsViewModel.TickUnit.DAY).getTime(), set);
assertEquals(open, candleData.open);
assertEquals(close, candleData.close);
assertEquals(high, candleData.high);
assertEquals(low, candleData.low);
assertEquals(average, candleData.average);
assertEquals(amount, candleData.accumulatedAmount);
assertEquals(volume, candleData.accumulatedVolume);
assertEquals(isBullish, candleData.isBullish);
}