当前位置: 首页>>代码示例>>Java>>正文


Java Fiat.parseFiat方法代码示例

本文整理汇总了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());
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:9,代码来源:WalletTest.java

示例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));
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:8,代码来源:Price.java

示例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));
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:8,代码来源:Volume.java

示例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);
    }
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:14,代码来源:BSFormatter.java

示例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);
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:33,代码来源:TradesChartsViewModelTest.java


注:本文中的org.bitcoinj.utils.Fiat.parseFiat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。