Package org.knowm.xchange.bitstamp
Class BitstampAdapters
java.lang.Object
org.knowm.xchange.bitstamp.BitstampAdapters
Various adapters for converting from Bitstamp DTOs to XChange DTOs
-
Method Summary
Modifier and TypeMethodDescriptionstatic AccountInfoadaptAccountInfo(BitstampBalance bitstampBalance, String userName) Adapts a BitstampBalance to an AccountInfostatic InstrumentMetaDataadaptCurrencyPairInfo(BitstampPairInfo pairInfo) static Map<Instrument,InstrumentMetaData> adaptCurrencyPairs(Collection<BitstampPairInfo> bitstampPairInfo) static List<FundingRecord>adaptFundingHistory(List<BitstampUserTransaction> userTransactions) static ExchangeMetaDataadaptMetaData(List<BitstampPairInfo> rawSymbols, ExchangeMetaData metaData) static BitstampGenericOrderadaptOrder(String orderId, BitstampOrderStatusResponse bitstampOrderStatusResponse, List<Instrument> exchangeSymbols) There is no method to discern market versus limit order type - so this returns a generic BitstampGenericOrder as a statusstatic OrderBookadaptOrderBook(BitstampOrderBook bitstampOrderBook, CurrencyPair currencyPair) Adapts a org.knowm.xchange.bitstamp.api.model.OrderBook to a OrderBook Objectstatic Order.OrderStatusadaptOrderStatus(BitstampOrderStatus bitstampOrderStatus) static TickeradaptTicker(BitstampTicker bitstampTicker, CurrencyPair currencyPair) Adapts a BitstampTicker to a Ticker Objectstatic TradeadaptTrade(BitstampTransaction tx, CurrencyPair currencyPair, int timeScale) Adapts a Transaction to a Trade Objectstatic UserTradesadaptTradeHistory(BitstampUserTransaction[] bitstampUserTransactions) Adapt the user's tradesstatic TradesadaptTrades(BitstampTransaction[] transactions, CurrencyPair currencyPair) Adapts a Transaction[] to a Trades Objectstatic voidcheckArgument(boolean argument, String msgPattern, Object... msgArgs) static LimitOrdercreateOrder(CurrencyPair currencyPair, List<BigDecimal> priceAndAmount, Order.OrderType orderType) static List<LimitOrder>createOrders(CurrencyPair currencyPair, Order.OrderType orderType, List<List<BigDecimal>> orders) static Map.Entry<String,BigDecimal> findNonzeroAmount(BitstampUserTransaction transaction)
-
Method Details
-
adaptAccountInfo
Adapts a BitstampBalance to an AccountInfo- Parameters:
bitstampBalance- The Bitstamp balanceuserName- The user name- Returns:
- The account info
-
adaptOrderBook
public static OrderBook adaptOrderBook(BitstampOrderBook bitstampOrderBook, CurrencyPair currencyPair) Adapts a org.knowm.xchange.bitstamp.api.model.OrderBook to a OrderBook Object- Parameters:
bitstampOrderBook- orderbookcurrencyPair- (e.g. BTC/USD)- Returns:
- The XChange OrderBook
-
createOrders
public static List<LimitOrder> createOrders(CurrencyPair currencyPair, Order.OrderType orderType, List<List<BigDecimal>> orders) -
createOrder
public static LimitOrder createOrder(CurrencyPair currencyPair, List<BigDecimal> priceAndAmount, Order.OrderType orderType) -
checkArgument
-
adaptTrades
Adapts a Transaction[] to a Trades Object- Parameters:
transactions- The Bitstamp transactionscurrencyPair- (e.g. BTC/USD)- Returns:
- The XChange Trades
-
adaptTrade
Adapts a Transaction to a Trade Object- Parameters:
tx- The Bitstamp transactioncurrencyPair- (e.g. BTC/USD)timeScale- polled order books provide a timestamp in seconds, stream in ms- Returns:
- The XChange Trade
-
adaptTicker
Adapts a BitstampTicker to a Ticker Object- Parameters:
bitstampTicker- The exchange specific tickercurrencyPair- (e.g. BTC/USD)- Returns:
- The ticker
-
adaptTradeHistory
Adapt the user's trades- Parameters:
bitstampUserTransactions-- Returns:
-
findNonzeroAmount
public static Map.Entry<String,BigDecimal> findNonzeroAmount(BitstampUserTransaction transaction) throws ExchangeException - Throws:
ExchangeException
-
adaptFundingHistory
public static List<FundingRecord> adaptFundingHistory(List<BitstampUserTransaction> userTransactions) -
adaptOrderStatus
-
adaptOrder
public static BitstampGenericOrder adaptOrder(String orderId, BitstampOrderStatusResponse bitstampOrderStatusResponse, List<Instrument> exchangeSymbols) There is no method to discern market versus limit order type - so this returns a generic BitstampGenericOrder as a status- Parameters:
bitstampOrderStatusResponse-exchangeSymbols-- Returns:
-
adaptCurrencyPairs
public static Map<Instrument,InstrumentMetaData> adaptCurrencyPairs(Collection<BitstampPairInfo> bitstampPairInfo) -
adaptCurrencyPairInfo
-
adaptMetaData
public static ExchangeMetaData adaptMetaData(List<BitstampPairInfo> rawSymbols, ExchangeMetaData metaData)
-