Java Code Examples for org.knowm.xchange.currency.CurrencyPair#BTC_USD
The following examples show how to use
org.knowm.xchange.currency.CurrencyPair#BTC_USD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpreadServiceTest.java From arbitrader with MIT License | 5 votes |
@Test public void testSummary() { Spread spread = new Spread( CurrencyPair.BTC_USD, longExchange, shortExchange, null, null, BigDecimal.valueOf(-0.005), BigDecimal.valueOf(0.005)); spreadService.publish(spread); spreadService.summary(); }
Example 2
Source File: ExchangeServiceTest.java From arbitrader with MIT License | 5 votes |
@Test public void testConvertExchangePairBase() { CurrencyPair currencyPair = CurrencyPair.BTC_USD; CurrencyPair converted = exchangeService.convertExchangePair(exchange, currencyPair); assertEquals(CurrencyPair.BTC_USDT, converted); }
Example 3
Source File: OkCoinTradeService.java From zheshiyigeniubidexiangmu with MIT License | 5 votes |
/** * OKEX does not support trade history in the usual way, it only provides a aggregated view on a * per order basis of how much the order has been filled and the average price. Individual trade * details are not available. As a consequence of this, the trades supplied by this method will * use the order ID as their trade ID, and will be subject to being amended if a partially filled * order if further filled. Supported parameters are {@link TradeHistoryParamCurrencyPair} and * {@link TradeHistoryParamPaging}, if not supplied then the query will default to BTC/USD or * BTC/CNY (depending on session configuration) and the last 200 trades. */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Integer pageLength = null, pageNumber = null; if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging paging = (TradeHistoryParamPaging) params; pageLength = paging.getPageLength(); pageNumber = paging.getPageNumber(); } if (pageNumber == null) { pageNumber = 1; // pages start from 1 } if (pageLength == null) { pageLength = 200; // 200 is the maximum number } CurrencyPair pair = null; if (params instanceof TradeHistoryParamCurrencyPair) { pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (pair == null) { pair = useIntl ? CurrencyPair.BTC_USD : CurrencyPair.BTC_CNY; } OkCoinOrderResult orderHistory = getOrderHistory( OkCoinAdapters.adaptSymbol(pair), ORDER_STATUS_FILLED, pageNumber.toString(), pageLength.toString()); return OkCoinAdapters.adaptTrades(orderHistory); }
Example 4
Source File: OkCoinAdapters.java From zheshiyigeniubidexiangmu with MIT License | 5 votes |
public static UserTrades adaptTradeHistory( OkCoinFuturesTradeHistoryResult[] okCoinFuturesTradeHistoryResult) { List<UserTrade> trades = new ArrayList<>(); long lastTradeId = 0; for (OkCoinFuturesTradeHistoryResult okCoinFuturesTrade : okCoinFuturesTradeHistoryResult) { // if (okCoinFuturesTrade.getType().equals(OkCoinFuturesTradeHistoryResult.TransactionType.)) // { // skip account deposits and withdrawals. OrderType orderType = okCoinFuturesTrade.getType().equals(TransactionType.sell) ? OrderType.ASK : OrderType.BID; BigDecimal originalAmount = BigDecimal.valueOf(okCoinFuturesTrade.getAmount()); BigDecimal price = okCoinFuturesTrade.getPrice(); Date timestamp = new Date(okCoinFuturesTrade.getTimestamp()); long transactionId = okCoinFuturesTrade.getId(); if (transactionId > lastTradeId) { lastTradeId = transactionId; } final String tradeId = String.valueOf(transactionId); final String orderId = String.valueOf(okCoinFuturesTrade.getId()); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; BigDecimal feeAmont = BigDecimal.ZERO; UserTrade trade = new UserTrade( orderType, originalAmount, currencyPair, price, timestamp, tradeId, orderId, feeAmont, Currency.getInstance(currencyPair.counter.getCurrencyCode())); trades.add(trade); } return new UserTrades(trades, lastTradeId, TradeSortType.SortByID); }
Example 5
Source File: BitfinexTradeService.java From zheshiyigeniubidexiangmu with MIT License | 4 votes |
@Override public TradeHistoryParams createTradeHistoryParams() { return new BitfinexTradeHistoryParams(new Date(0), 50, CurrencyPair.BTC_USD); }
Example 6
Source File: OkCoinFuturesTradeService.java From zheshiyigeniubidexiangmu with MIT License | 4 votes |
@Override public OkCoinFuturesTradeHistoryParams createTradeHistoryParams() { return new OkCoinFuturesTradeHistoryParams(50, 0, CurrencyPair.BTC_USD, futuresContract, null); }