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


Java Trades类代码示例

本文整理汇总了Java中com.xeiam.xchange.dto.marketdata.Trades的典型用法代码示例。如果您正苦于以下问题:Java Trades类的具体用法?Java Trades怎么用?Java Trades使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Trades类属于com.xeiam.xchange.dto.marketdata包,在下文中一共展示了Trades类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetHistory

import com.xeiam.xchange.dto.marketdata.Trades; //导入依赖的package包/类
@Test
public void testGetHistory() throws Exception {
    ArrayList<UserTrade> trades = new ArrayList<UserTrade>();
    trades.add(new UserTrade.Builder().build());

    when(pollingTradeService.getTradeHistory(any(DefaultTradeHistoryParamsTimeSpan.class)))
            .thenReturn(new UserTrades(trades, Trades.TradeSortType.SortByTimestamp));
    when(timeRetrieveService.getAndSyncQueryTime())
            .thenReturn(new Date());

    List<UserTrade> history = simpleRecentTradesService.getHistory();

    assertNotNull(history);
    verify(pollingTradeService).getTradeHistory(any(DefaultTradeHistoryParamsTimeSpan.class));
    verify(timeRetrieveService).getAndSyncQueryTime();
    assertEquals(trades, history);

}
 
开发者ID:SeanRobb,项目名称:exchange-monitor,代码行数:19,代码来源:SimpleRecentTradesServiceTest.java

示例2: testGetHistory

import com.xeiam.xchange.dto.marketdata.Trades; //导入依赖的package包/类
@Test
public void testGetHistory() throws Exception {
    Date queryTime = new Date();
    UserTrade expectedTrade = new UserTrade.Builder()
            .id("1")
            .timestamp(new DateTime(queryTime).plusMinutes(1).toDate())
            .build();
    UserTrade notExpectedTrade = new UserTrade.Builder()
            .id("2")
            .timestamp(new DateTime(queryTime).minusMinutes(1).toDate())
            .build();

    List<UserTrade> trades = new ArrayList<UserTrade>();
    trades.add(expectedTrade);
    trades.add(notExpectedTrade);

    ArrayList<CurrencyPair> currencyPairs = new ArrayList<CurrencyPair>();
    currencyPairs.add(CurrencyPair.BTC_AUD);
    currencyPairs.add(CurrencyPair.BTC_BRL);
    currencyPairs.add(CurrencyPair.BTC_CHF);

    when(timeRetrieveService.getAndSyncQueryTime())
            .thenReturn(queryTime);
    when(pollingTradeService.getExchangeSymbols())
            .thenReturn(currencyPairs);
    when(pollingTradeService.getTradeHistory(any(DefaultTradeHistoryParamCurrencyPair.class)))
            .thenReturn(new UserTrades(trades, Trades.TradeSortType.SortByTimestamp));

    List<UserTrade> history = currencyPairRecentTradeService.getHistory();

    verify(timeRetrieveService).getAndSyncQueryTime();
    verify(pollingTradeService).getExchangeSymbols();
    verify(pollingTradeService, times(currencyPairs.size())).getTradeHistory(any(DefaultTradeHistoryParamCurrencyPair.class));
    assertEquals(3, history.size());
    assertTrue(history.contains(expectedTrade));
    assertFalse(history.contains(notExpectedTrade));
}
 
开发者ID:SeanRobb,项目名称:exchange-monitor,代码行数:38,代码来源:CurrencyPairRecentTradeServiceTest.java

示例3: generic

import com.xeiam.xchange.dto.marketdata.Trades; //导入依赖的package包/类
private static List<Trade> generic(Exchange exchange) throws IOException {

        // Interested in the public polling market data feed (no authentication)
        PollingMarketDataService marketDataService = exchange
                .getPollingMarketDataService();

        // Get the latest trade data for BTC/USD
        Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD);

        return trades.getTrades();
    }
 
开发者ID:KosherBacon,项目名称:JavaBitcoinTrader,代码行数:12,代码来源:BTCETickGenerator.java

示例4: generic

import com.xeiam.xchange.dto.marketdata.Trades; //导入依赖的package包/类
private static void generic(Exchange exchange) throws IOException {

        // Interested in the public polling market data feed (no authentication)
        PollingMarketDataService marketDataService = exchange
                .getPollingMarketDataService();

        // Get the latest trade data for BTC/USD
        Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD);

        System.out.println(trades.toString());
    }
 
开发者ID:KosherBacon,项目名称:JavaBitcoinTrader,代码行数:12,代码来源:MainTrader.java

示例5: dumpBitstampData

import com.xeiam.xchange.dto.marketdata.Trades; //导入依赖的package包/类
/**
 * Dump Bitstamp trades.
 */
public static void dumpBitstampData() {
    try
    {
        Trades trades = marketDataService.getTrades(Currencies.BTC, Currencies.USD);
        for (Trade t : trades.getTrades()) {
            System.out.println(t);
        }
    }
    catch (IOException ex)
    {
        Logger.getLogger(AlgorithmComparator.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:talkvip,项目名称:Bitraac,代码行数:17,代码来源:ExchangeMarket.java


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