idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
9,300
public static BitstampGenericOrder adaptOrder ( String orderId , BitstampOrderStatusResponse bitstampOrderStatusResponse ) { BitstampOrderTransaction [ ] bitstampTransactions = bitstampOrderStatusResponse . getTransactions ( ) ; CurrencyPair currencyPair = adaptCurrencyPair ( bitstampTransactions [ 0 ] ) ; Date date = ...
There is no method to discern market versus limit order type - so this returns a generic BitstampGenericOrder as a status
9,301
public static OrderBook adaptOrderbook ( BitcoiniumOrderbook bitcoiniumOrderbook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , bitcoiniumOrderbook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , Order . OrderType . BID , bit...
Adapts a BitcoiniumOrderbook to a OrderBook Object
9,302
public static Ticker adaptTicker ( BTCTurkTicker btcTurkTicker ) { CurrencyPair pair = btcTurkTicker . getPair ( ) ; BigDecimal high = btcTurkTicker . getHigh ( ) ; BigDecimal last = btcTurkTicker . getLast ( ) ; Date timestamp = new Date ( btcTurkTicker . getTimestamp ( ) ) ; BigDecimal bid = btcTurkTicker . getBid ( ...
Adapts a BTCTurkTicker to a Ticker Object
9,303
public static Trade adaptTrade ( BTCTurkTrades btcTurkTrade , CurrencyPair currencyPair ) { return new Trade ( null , btcTurkTrade . getAmount ( ) , currencyPair , btcTurkTrade . getPrice ( ) , btcTurkTrade . getDate ( ) , btcTurkTrade . getTid ( ) . toString ( ) ) ; }
Adapts a BTCTurkTrade to a Trade Object
9,304
public static OrderBook adaptOrderBook ( BTCTurkOrderBook btcTurkOrderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , btcTurkOrderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , Order . OrderType . BID , btcTurkOrder...
Adapts org . knowm . xchange . btcturk . dto . marketdata . BTCTurkOrderBook to a OrderBook Object
9,305
private static LimitOrder withAmount ( LimitOrder limitOrder , BigDecimal tradeableAmount ) { OrderType type = limitOrder . getType ( ) ; CurrencyPair currencyPair = limitOrder . getCurrencyPair ( ) ; String id = limitOrder . getId ( ) ; Date date = limitOrder . getTimestamp ( ) ; BigDecimal limit = limitOrder . getLim...
Returns a copy of limitOrder with tradeableAmount replaced .
9,306
public void update ( LimitOrder limitOrder ) { update ( getOrders ( limitOrder . getType ( ) ) , limitOrder ) ; updateDate ( limitOrder . getTimestamp ( ) ) ; }
Given a new LimitOrder it will replace a matching limit order in the orderbook if one is found or add the new LimitOrder if one is not . timeStamp will be updated if the new timestamp is non - null and in the future .
9,307
private void update ( List < LimitOrder > asks , LimitOrder limitOrder ) { int idx = Collections . binarySearch ( asks , limitOrder ) ; if ( idx >= 0 ) { asks . remove ( idx ) ; asks . add ( idx , limitOrder ) ; } else { asks . add ( - idx - 1 , limitOrder ) ; } }
Replace the amount for limitOrder s price in the provided list .
9,308
public void update ( OrderBookUpdate orderBookUpdate ) { LimitOrder limitOrder = orderBookUpdate . getLimitOrder ( ) ; List < LimitOrder > limitOrders = getOrders ( limitOrder . getType ( ) ) ; int idx = Collections . binarySearch ( limitOrders , limitOrder ) ; if ( idx >= 0 ) { limitOrders . remove ( idx ) ; } else { ...
Given an OrderBookUpdate it will replace a matching limit order in the orderbook if one is found or add a new if one is not . timeStamp will be updated if the new timestamp is non - null and in the future .
9,309
public static Wallet adaptWallet ( GatecoinBalance [ ] gatecoinBalances ) { ArrayList < Balance > balances = new ArrayList < > ( ) ; for ( GatecoinBalance balance : gatecoinBalances ) { Currency ccy = Currency . getInstance ( balance . getCurrency ( ) ) ; balances . add ( new Balance . Builder ( ) . currency ( ccy ) . ...
Adapts a GatecoinBalance to a Wallet
9,310
public String withdraw ( String asset , String address , BigDecimal amount ) throws IOException , BinanceException { String name = address . length ( ) <= 10 ? address : address . substring ( 0 , 10 ) ; return withdraw ( asset , address , amount , name , null , getTimestamp ( ) ) ; }
lack of current documentation
9,311
public Ticker getTicker ( CurrencyPair currencyPair , Object ... args ) throws IOException { return BitZAdapters . adaptTicker ( getBitZTicker ( BitZUtils . toPairString ( currencyPair ) ) , currencyPair ) ; }
X - Change Generic Services
9,312
public Map < Long , WexTradeHistoryResult > getBTCETradeHistory ( Long from , Long count , Long fromId , Long endId , WexAuthenticated . SortOrder order , Long since , Long end , String pair ) throws IOException { WexTradeHistoryReturn btceTradeHistory = btce . TradeHistory ( apiKey , signatureCreator , exchange . getN...
All parameters are nullable
9,313
public Map < Long , WexTransHistoryResult > getBTCETransHistory ( Long from , Long count , Long fromId , Long endId , WexAuthenticated . SortOrder order , Long since , Long end ) throws IOException { WexTransHistoryReturn btceTransHistory = btce . TransHistory ( apiKey , signatureCreator , exchange . getNonceFactory ( ...
Get Map of transaction history from Wex exchange . All parameters are nullable
9,314
public WexOrderInfoResult getBTCEOrderInfo ( Long orderId ) throws IOException { WexOrderInfoReturn btceOrderInfo = btce . OrderInfo ( apiKey , signatureCreator , exchange . getNonceFactory ( ) , orderId ) ; checkResult ( btceOrderInfo ) ; return btceOrderInfo . getReturnValue ( ) . values ( ) . iterator ( ) . next ( )...
Get order info from Wex exchange .
9,315
public static AccountInfo adaptAccountInfo ( CoingiBalances coingiBalances , String userName ) { List < Balance > balances = new ArrayList < > ( ) ; for ( CoingiBalance coingiBalance : coingiBalances . getList ( ) ) { BigDecimal total = coingiBalance . getAvailable ( ) . add ( coingiBalance . getBlocked ( ) ) . add ( c...
Adapts a CoingiBalances to an AccountInfo
9,316
public Ticker getTicker ( CurrencyPair currencyPair , Object ... args ) throws IOException { String marketName = DSXAdapters . currencyPairToMarketName ( currencyPair ) ; String accountType = null ; try { if ( args != null ) { accountType = ( String ) args [ 0 ] ; } } catch ( ArrayIndexOutOfBoundsException e ) { } DSXT...
Get ticker from exchange
9,317
public CoinbasePrice getCoinbaseBuyPrice ( Currency base , Currency counter ) throws IOException { return coinbase . getBuyPrice ( Coinbase . CB_VERSION_VALUE , base + "-" + counter ) . getData ( ) ; }
Unauthenticated resource that tells you the price to buy one unit .
9,318
public CoinbasePrice getCoinbaseSellPrice ( Currency base , Currency counter ) throws IOException { return coinbase . getSellPrice ( Coinbase . CB_VERSION_VALUE , base + "-" + counter ) . getData ( ) ; }
Unauthenticated resource that tells you the amount you can get if you sell one unit .
9,319
public BitZKline getKline ( CurrencyPair currencyPair , BitZKlineResolution resolution , Integer size , String microsecond ) throws IOException { return bitz . getKline ( BitZUtils . toPairString ( currencyPair ) , resolution . code ( ) , size , microsecond ) . getData ( ) ; }
Get Kline data
9,320
public BitZTicker getTicker ( CurrencyPair currencyPair ) throws IOException { BitZTickerResult result = bitz . getTicker ( BitZUtils . toPairString ( currencyPair ) ) ; return result . getData ( ) ; }
Get the Ticker data
9,321
public BitZTickerAll getTickerAll ( CurrencyPair ... currencyPairs ) throws IOException { List < String > symbolList = new ArrayList < > ( currencyPairs . length ) ; Arrays . stream ( currencyPairs ) . forEach ( currencyPair -> symbolList . add ( BitZUtils . toPairString ( currencyPair ) ) ) ; String symbols = symbolLi...
Get the price of all symbol
9,322
public BitZOrders getDepth ( CurrencyPair currencyPair ) throws IOException { BitZOrdersResult result = bitz . getDepth ( BitZUtils . toPairString ( currencyPair ) ) ; return result . getData ( ) ; }
Get depth data
9,323
public BitZTrades getOrder ( CurrencyPair currencyPair ) throws IOException { BitZTradesResult result = bitz . getOrder ( BitZUtils . toPairString ( currencyPair ) ) ; return result . getData ( ) ; }
Get the order
9,324
protected JsonNode formAndSignRequestJson ( Map < String , String > params ) { CoinbeneUtils . signParams ( params ) ; return toJson ( params ) ; }
Sign request JSON .
9,325
protected Map < String , String > getCommonParams ( ) { Map < String , String > params = new TreeMap < > ( ) ; params . put ( "apiid" , apiKey ) ; params . put ( "secret" , secretKey ) ; params . put ( "timestamp" , String . valueOf ( exchange . getNonceFactory ( ) . createValue ( ) ) ) ; return params ; }
Return private API common params .
9,326
public static void adapt ( HttpStatusIOException httpStatusException ) { String msg = "HTTP Status: " + httpStatusException . getHttpStatusCode ( ) ; if ( isNotEmpty ( httpStatusException . getHttpBody ( ) ) ) { ObjectMapper mapper = new ObjectMapper ( ) ; CmcResult result ; try { result = mapper . readValue ( httpStat...
Parse errors from HTTP exceptions
9,327
public AccountInfo getAccountInfo ( ) throws IOException { final RippleAccountBalances account = getRippleAccountBalances ( ) ; final String username = exchange . getExchangeSpecification ( ) . getApiKey ( ) ; return RippleAdapters . adaptAccountInfo ( account , username ) ; }
A wallet s currency will be prefixed with the issuing counterparty address for all currencies other than XRP .
9,328
public Map < String , KrakenLedger > getKrakenLedgerInfo ( ) throws IOException { return getKrakenLedgerInfo ( null , null , null , null ) ; }
Retrieves the full account Ledger which represents all account asset activity .
9,329
public static void signParams ( Map < String , String > params ) { String requestString = params . entrySet ( ) . stream ( ) . sorted ( Comparator . comparing ( Map . Entry :: getKey ) ) . map ( e -> e . getKey ( ) + "=" + e . getValue ( ) ) . map ( String :: toUpperCase ) . collect ( Collectors . joining ( "&" ) ) ; S...
Sign Coinbene private API request parameters .
9,330
public static AccountInfo adaptAccountInfo ( CryptonitBalance cryptonitBalance , String userName ) { List < Balance > balances = new ArrayList < > ( ) ; for ( CryptonitBalance . Balance b : cryptonitBalance . getBalances ( ) ) { Balance xchangeBalance = new Balance ( Currency . getInstance ( b . getCurrency ( ) . toUpp...
Adapts a CryptonitBalance to an AccountInfo
9,331
public static OrderBook adaptOrderBook ( CryptonitOrderBook cryptonitOrderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , OrderType . ASK , cryptonitOrderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , OrderType . BID , cryptonitOrderBook . g...
Adapts a org . knowm . xchange . cryptonit2 . api . model . OrderBook to a OrderBook Object
9,332
public static Ticker adaptTicker ( CryptonitTicker cryptonitTicker , CurrencyPair currencyPair ) { BigDecimal open = cryptonitTicker . getOpen ( ) ; BigDecimal last = cryptonitTicker . getLast ( ) ; BigDecimal bid = cryptonitTicker . getBid ( ) ; BigDecimal ask = cryptonitTicker . getAsk ( ) ; BigDecimal high = crypton...
Adapts a CryptonitTicker to a Ticker Object
9,333
public static CryptonitGenericOrder adaptOrder ( String orderId , CryptonitOrderStatusResponse cryptonitOrderStatusResponse ) { CryptonitOrderTransaction [ ] cryptonitTransactions = cryptonitOrderStatusResponse . getTransactions ( ) ; CurrencyPair currencyPair = null ; Date date = null ; BigDecimal averagePrice = null ...
There is no method to discern market versus limit order type - so this returns a generic CryptonitGenericOrder as a status
9,334
public static OrderBook adaptOrderBook ( CCEXGetorderbook ccexOrderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , ccexOrderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , Order . OrderType . BID , ccexOrderBook . ge...
Adapts a org . knowm . xchange . ccex . api . model . OrderBook to a OrderBook Object
9,335
public static Ticker adaptTicker ( CoinmateTicker coinmateTicker , CurrencyPair currencyPair ) { BigDecimal last = coinmateTicker . getData ( ) . getLast ( ) ; BigDecimal bid = coinmateTicker . getData ( ) . getBid ( ) ; BigDecimal ask = coinmateTicker . getData ( ) . getAsk ( ) ; BigDecimal high = coinmateTicker . get...
Adapts a CoinmateTicker to a Ticker Object
9,336
public static String getBasicAuth ( String user , final String pass ) { return "Basic " + java . util . Base64 . getEncoder ( ) . encodeToString ( ( user + ":" + pass ) . getBytes ( ) ) ; }
Generates a BASE64 Basic Authentication String
9,337
public String requestDepositAddress ( Currency currency , String ... arguments ) throws IOException { GeminiDepositAddressResponse response = super . requestDepositAddressRaw ( currency ) ; return response . getAddress ( ) ; }
This will result in a new address being created each time and is severely rate - limited
9,338
public static OrderBook adaptOrderBook ( CryptopiaOrderBook cryptopiaOrderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , cryptopiaOrderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , Order . OrderType . BID , crypto...
Adapts a CryptopiaOrderBook to an OrderBook Object
9,339
public static Ticker adaptTicker ( CryptopiaTicker cryptopiaTicker , CurrencyPair currencyPair ) { return new Ticker . Builder ( ) . currencyPair ( currencyPair ) . last ( cryptopiaTicker . getLast ( ) ) . bid ( cryptopiaTicker . getBid ( ) ) . ask ( cryptopiaTicker . getAsk ( ) ) . high ( cryptopiaTicker . getHigh ( )...
Adapts a CryptopiaTicker to a Ticker Object
9,340
public CoinbasePrice getCoinbaseBuyPrice ( BigDecimal quantity , String currency ) throws IOException { return coinbase . getBuyPrice ( quantity , currency ) ; }
Unauthenticated resource that tells you the total price to buy some quantity of Bitcoin .
9,341
public CoinbasePrice getCoinbaseSellPrice ( BigDecimal quantity , String currency ) throws IOException { return coinbase . getSellPrice ( quantity , currency ) ; }
Unauthenticated resource that tells you the total amount you can get if you sell some quantity Bitcoin .
9,342
public CoinbaseSpotPriceHistory getCoinbaseHistoricalSpotRates ( Integer page ) throws IOException { return CoinbaseSpotPriceHistory . fromRawString ( coinbase . getHistoricalSpotRates ( page ) ) ; }
Unauthenticated resource that displays historical spot rates for Bitcoin in USD .
9,343
public static OrderBook adaptOrders ( CampBXOrderBook orderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , orderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , Order . OrderType . BID , orderBook . getBids ( ) ) ; re...
CampBXOrderBook to a OrderBook Object
9,344
public static Ticker adaptTicker ( CampBXTicker campbxTicker , CurrencyPair currencyPair ) { BigDecimal last = campbxTicker . getLast ( ) ; BigDecimal bid = campbxTicker . getBid ( ) ; BigDecimal ask = campbxTicker . getAsk ( ) ; return new Ticker . Builder ( ) . currencyPair ( currencyPair ) . last ( last ) . bid ( bi...
Adapts a CampBXTicker to a Ticker Object
9,345
private static int futuresLeverageOfConfig ( ExchangeSpecification exchangeSpecification ) { if ( exchangeSpecification . getExchangeSpecificParameters ( ) . containsKey ( "Futures_Leverage" ) ) { return Integer . valueOf ( ( String ) exchangeSpecification . getExchangeSpecificParameters ( ) . get ( "Futures_Leverage" ...
Extract futures leverage used by spec
9,346
public static FuturesContract futuresContractOfConfig ( ExchangeSpecification exchangeSpecification ) { FuturesContract contract ; if ( exchangeSpecification . getExchangeSpecificParameters ( ) . containsKey ( "Futures_Contract" ) ) { contract = ( FuturesContract ) exchangeSpecification . getExchangeSpecificParameters ...
Extract contract used by spec
9,347
public static OrderBook adaptOrderBook ( BitcoindeOrderbookWrapper bitcoindeOrderbookWrapper , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , Order . OrderType . ASK , bitcoindeOrderbookWrapper . getBitcoindeOrders ( ) . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( c...
Adapt a org . knowm . xchange . bitcoinde . dto . marketdata . BitcoindeOrderBook object to an OrderBook object .
9,348
public static AccountInfo adaptAccountInfo ( BitcoindeAccountWrapper bitcoindeAccount ) { BitcoindeBalance btc = bitcoindeAccount . getData ( ) . getBalances ( ) . getBtc ( ) ; BitcoindeBalance eth = bitcoindeAccount . getData ( ) . getBalances ( ) . getEth ( ) ; BigDecimal eur = bitcoindeAccount . getData ( ) . getFid...
Adapt a org . knowm . xchange . bitcoinde . dto . marketdata . BitcoindeAccount object to an AccountInfo object .
9,349
public static List < LimitOrder > createOrders ( CurrencyPair currencyPair , Order . OrderType orderType , BitcoindeOrder [ ] orders ) { List < LimitOrder > limitOrders = new ArrayList < > ( ) ; for ( BitcoindeOrder order : orders ) { limitOrders . add ( createOrder ( currencyPair , order , orderType , null , null ) ) ...
Create a list of orders from a list of asks or bids .
9,350
public static LimitOrder createOrder ( CurrencyPair currencyPair , BitcoindeOrder bitcoindeOrder , Order . OrderType orderType , String orderId , Date timeStamp ) { return new LimitOrder ( orderType , bitcoindeOrder . getAmount ( ) , currencyPair , orderId , timeStamp , bitcoindeOrder . getPrice ( ) ) ; }
Create an individual order .
9,351
public ItBitOrder [ ] getItBitOrders ( String status , String instrument ) throws IOException { ItBitOrder [ ] orders = itBitAuthenticated . getOrders ( signatureCreator , new Date ( ) . getTime ( ) , exchange . getNonceFactory ( ) , instrument , "1" , "1000" , status , walletId ) ; return orders ; }
Retrieves the set of orders with the given status .
9,352
public static String toUTCString ( Date date ) { SimpleDateFormat sd = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss z" ) ; sd . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; return sd . format ( date ) ; }
Converts a date to a UTC String representation
9,353
public static String formatDate ( Date d ) { return d == null ? null : DATE_FORMAT . format ( d ) ; }
Format a date String for IR
9,354
public static Date parseDate ( String dateString ) { try { return DATE_FORMAT . parse ( dateString ) ; } catch ( ParseException e ) { throw new ExchangeException ( "Illegal date/time format" , e ) ; } }
Format a date String for QuadrigaCx
9,355
public BigDecimal getTransferFeeRate ( ) { if ( transferRate == 0 ) { return BigDecimal . ZERO ; } else { return BigDecimal . valueOf ( transferRate ) . divide ( TRANSFER_RATE_DENOMINATOR ) . subtract ( BigDecimal . ONE ) ; } }
The raw transfer rate is represented as an integer the amount that must be sent in order for 1 billion units to arrive . For example a 20% transfer fee is represented as the value 120000000 . The value cannot be less than 1000000000 . Less than that would indicate giving away money for sending transactions which is exp...
9,356
public boolean cancelOrder ( String orderId ) throws IOException { CurrencyPair cp = ( CurrencyPair ) exchange . getExchangeSpecification ( ) . getExchangeSpecificParameters ( ) . get ( TheRockExchange . CURRENCY_PAIR ) ; if ( cp == null ) { throw new ExchangeException ( "Provide TheRockCancelOrderParams with orderId a...
Not available from exchange since TheRock needs currency pair in order to cancel an order
9,357
public static AccountInfo adaptAccountInfo ( ANXAccountInfo anxAccountInfo ) { AccountInfo accountInfo = new AccountInfo ( anxAccountInfo . getLogin ( ) , percentToFactor ( anxAccountInfo . getTradeFee ( ) ) , ANXAdapters . adaptWallet ( anxAccountInfo . getWallets ( ) ) ) ; return accountInfo ; }
Adapts a ANXAccountInfo to an AccountInfo
9,358
public static LimitOrder adaptOrder ( BigDecimal originalAmount , BigDecimal price , String tradedCurrency , String transactionCurrency , String orderTypeString , String id , Date timestamp ) { OrderType orderType = adaptSide ( orderTypeString ) ; CurrencyPair currencyPair = adaptCurrencyPair ( tradedCurrency , transac...
Adapts a ANXOrder to a LimitOrder
9,359
public static List < LimitOrder > adaptOrders ( List < ANXOrder > anxOrders , String tradedCurrency , String currency , String orderType , String id ) { List < LimitOrder > limitOrders = new ArrayList < > ( ) ; for ( ANXOrder anxOrder : anxOrders ) { limitOrders . add ( adaptOrder ( anxOrder . getAmount ( ) , anxOrder ...
Adapts a List of ANXOrders to a List of LimitOrders
9,360
public static Balance adaptBalance ( ANXWallet anxWallet ) { if ( anxWallet == null ) { return null ; } else { return new Balance ( Currency . getInstance ( anxWallet . getBalance ( ) . getCurrency ( ) ) , anxWallet . getBalance ( ) . getValue ( ) , anxWallet . getAvailableBalance ( ) . getValue ( ) ) ; } }
Adapts a ANX Wallet to a XChange Balance
9,361
public static Wallet adaptWallet ( Map < String , ANXWallet > anxWallets ) { List < Balance > balances = new ArrayList < > ( ) ; for ( ANXWallet anxWallet : anxWallets . values ( ) ) { Balance balance = adaptBalance ( anxWallet ) ; if ( balance != null ) { balances . add ( balance ) ; } } return new Wallet ( balances )...
Adapts a List of ANX Wallets to an XChange Wallet
9,362
public static Trades adaptTrades ( List < ANXTrade > anxTrades ) { List < Trade > tradesList = new ArrayList < > ( ) ; long latestTid = 0 ; for ( ANXTrade anxTrade : anxTrades ) { long tid = anxTrade . getTid ( ) ; if ( tid > latestTid ) { latestTid = tid ; } tradesList . add ( adaptTrade ( anxTrade ) ) ; } return new ...
Adapts ANXTrade s to a Trades Object
9,363
public static Trade adaptTrade ( ANXTrade anxTrade ) { OrderType orderType = adaptSide ( anxTrade . getTradeType ( ) ) ; BigDecimal amount = anxTrade . getAmount ( ) ; BigDecimal price = anxTrade . getPrice ( ) ; CurrencyPair currencyPair = adaptCurrencyPair ( anxTrade . getItem ( ) , anxTrade . getPriceCurrency ( ) ) ...
Adapts a ANXTrade to a Trade Object
9,364
@ SuppressWarnings ( "unchecked" ) private OpenOrders filterOrders ( OpenOrders rawOpenOrders , OpenOrdersParams params ) { if ( params == null ) { return rawOpenOrders ; } List < LimitOrder > openOrdersList = rawOpenOrders . getOpenOrders ( ) ; openOrdersList . removeIf ( openOrder -> ! params . accept ( openOrder ) )...
Bitfinex API does not provide filtering option . So we should filter orders ourselves
9,365
public String abucoinsPaymentMethodForCurrency ( String currency ) throws IOException { String method = null ; AbucoinsPaymentMethod [ ] paymentMethods = getPaymentMethods ( ) ; for ( AbucoinsPaymentMethod apm : paymentMethods ) { if ( apm . getCurrency ( ) . equals ( currency ) ) { method = apm . getType ( ) ; break ;...
Helper method that obtains the payment method for a given currency based on the payment - method information returned from abucoins .
9,366
public static AccountInfo adaptAccountInfo ( LakeBTCAccount lakeBTCAccount ) { LakeBTCProfile profile = lakeBTCAccount . getProfile ( ) ; LakeBTCBalance balance = lakeBTCAccount . getBalance ( ) ; Balance usdBalance = new Balance ( Currency . USD , balance . getUSD ( ) ) ; Balance cnyWBalance = new Balance ( Currency ....
Adapts a LakeBTCAccount to an AccountInfo
9,367
public static String adaptCurrencyPair ( CurrencyPair currencyPair ) { return currencyPair . base . getCurrencyCode ( ) . toLowerCase ( ) + currencyPair . counter . getCurrencyCode ( ) . toLowerCase ( ) ; }
Adapts a currency pair to the keys returned by the tickers map .
9,368
public static Wallet adaptWallet ( BitMarketBalance balance ) { List < Balance > balances = new ArrayList < > ( balance . getAvailable ( ) . size ( ) ) ; for ( Map . Entry < String , BigDecimal > entry : balance . getAvailable ( ) . entrySet ( ) ) { Currency currency = Currency . getInstance ( entry . getKey ( ) ) ; Bi...
Adapts BitMarketBalance to Wallet
9,369
public static Ticker adaptTicker ( BitMarketTicker bitMarketTicker , CurrencyPair currencyPair ) { BigDecimal bid = bitMarketTicker . getBid ( ) ; BigDecimal ask = bitMarketTicker . getAsk ( ) ; BigDecimal high = bitMarketTicker . getHigh ( ) ; BigDecimal low = bitMarketTicker . getLow ( ) ; BigDecimal volume = bitMark...
Adapts BitMarket ticker to Ticker .
9,370
public Wallet getWallet ( ) { if ( wallets . size ( ) != 1 ) { throw new UnsupportedOperationException ( wallets . size ( ) + " wallets in account" ) ; } return getWallet ( wallets . keySet ( ) . iterator ( ) . next ( ) ) ; }
Gets wallet for accounts which don t use multiple wallets with ids
9,371
public static Ticker adaptTicker ( KoineksTicker koineksTicker , CurrencyPair currencyPair ) { switch ( currencyPair . base . getCurrencyCode ( ) ) { case KoineksCurrency . BTC : return getTickerOf ( koineksTicker . getKoineksBTCTicker ( ) , currencyPair . base ) ; case KoineksCurrency . ETH : return getTickerOf ( koin...
Adapts a KoineksTicker to a Ticker Object
9,372
public String placeLimitOrder ( LimitOrder placeOrder ) { OrderType type = placeOrder . getType ( ) ; Currency baseCurrency = placeOrder . getCurrencyPair ( ) . base ; Currency counterCurrency = placeOrder . getCurrencyPair ( ) . counter ; BigDecimal originalAmount = placeOrder . getOriginalAmount ( ) ; BigDecimal limi...
returns OrderHash so you can fetch it and cancel it ... but there is a OrderNumber that you can intercept if you need to .
9,373
public static Ticker adaptTicker ( ParibuTicker paribuTicker , CurrencyPair currencyPair ) { if ( ! currencyPair . equals ( new CurrencyPair ( BTC , TRY ) ) ) { throw new NotAvailableFromExchangeException ( ) ; } BTC_TL btcTL = paribuTicker . getBtcTL ( ) ; if ( btcTL != null ) { BigDecimal last = btcTL . getLast ( ) ;...
Adapts a ParibuTicker to a Ticker Object
9,374
public String requestDepositAddress ( Currency currency , String ... arguments ) throws IOException { try { CoingiDepositWalletRequest request = new CoingiDepositWalletRequest ( ) . setCurrency ( currency . getCurrencyCode ( ) . toUpperCase ( ) ) ; return depositWallet ( request ) . getAddress ( ) ; } catch ( CoingiExc...
This returns the current deposit address . It does not generate a new one! Repeated calls will return the same .
9,375
public static CoinsuperGenericOrder adaptOrder ( String orderId , OrderList orderList ) { BigDecimal averagePrice = new BigDecimal ( orderList . getPriceLimit ( ) ) ; BigDecimal cumulativeAmount = new BigDecimal ( orderList . getQuantity ( ) ) ; BigDecimal totalFee = new BigDecimal ( orderList . getFee ( ) ) ; BigDecim...
There is no method to discern market versus limit order type - so this returns a generic GenericOrder as a status
9,376
public static AccountInfo adaptAccountInfo ( final RippleAccountBalances account , final String username ) { final Map < String , List < Balance > > balances = new HashMap < > ( ) ; for ( final RippleBalance balance : account . getBalances ( ) ) { final String walletId ; if ( balance . getCurrency ( ) . equals ( "XRP" ...
Adapts a Ripple Account to an XChange Wallet object .
9,377
public static OrderBook adaptOrderBook ( final RippleOrderBook rippleOrderBook , final RippleMarketDataParams params , final CurrencyPair currencyPair ) { final String orderBook = rippleOrderBook . getOrderBook ( ) ; final String [ ] splitPair = orderBook . split ( "/" ) ; final String [ ] baseSplit = splitPair [ 0 ] ....
Adapts a Ripple OrderBook to an XChange OrderBook object . Counterparties are not mapped since the application calling this should know and keep track of the counterparties it is using in the polling thread .
9,378
public static OpenOrders adaptOpenOrders ( final RippleAccountOrders rippleOrders , final int scale ) { final List < LimitOrder > list = new ArrayList < > ( rippleOrders . getOrders ( ) . size ( ) ) ; for ( final RippleAccountOrdersBody order : rippleOrders . getOrders ( ) ) { final OrderType orderType ; final RippleAm...
Adapts a Ripple Account Orders object to an XChange OpenOrders object Counterparties set in additional data since there is no other way of the application receiving this information .
9,379
public static boolean findLimitOrder ( List < LimitOrder > orders , LimitOrder order , String id ) { boolean found = false ; for ( LimitOrder openOrder : orders ) { if ( openOrder . getId ( ) . equalsIgnoreCase ( id ) ) { if ( order . getCurrencyPair ( ) . equals ( openOrder . getCurrencyPair ( ) ) && ( order . getOrig...
Find and match an order with id in orders
9,380
public static Ticker adaptTicker ( BitcoinAverageTicker bitcoinAverageTicker , CurrencyPair currencyPair ) { BigDecimal last = bitcoinAverageTicker . getLast ( ) ; BigDecimal bid = bitcoinAverageTicker . getBid ( ) ; BigDecimal ask = bitcoinAverageTicker . getAsk ( ) ; Date timestamp = bitcoinAverageTicker . getTimesta...
Adapts a BitcoinAverageTicker to a Ticker Object
9,381
public static Wallet adaptAccountInfo ( List < BitflyerBalance > balances ) { List < Balance > adaptedBalances = new ArrayList < > ( balances . size ( ) ) ; for ( BitflyerBalance balance : balances ) { adaptedBalances . add ( new Balance ( Currency . getInstance ( balance . getCurrencyCode ( ) ) , balance . getAmount (...
Adapts a list of BitflyerBalance objects to Wallet .
9,382
public static Ticker adaptTicker ( BitflyerTicker ticker , CurrencyPair currencyPair ) { BigDecimal bid = ticker . getBestBid ( ) ; BigDecimal ask = ticker . getBestAsk ( ) ; BigDecimal volume = ticker . getVolume ( ) ; BigDecimal last = ticker . getLtp ( ) ; Date timestamp = ticker . getTimestamp ( ) != null ? Bitflye...
Adapts a BitflyerTicker to a Ticker Object
9,383
public static OrderBook adaptOrderBook ( MercadoBitcoinOrderBook mercadoBitcoinOrderBook , CurrencyPair currencyPair ) { List < LimitOrder > asks = createOrders ( currencyPair , OrderType . ASK , mercadoBitcoinOrderBook . getAsks ( ) ) ; List < LimitOrder > bids = createOrders ( currencyPair , OrderType . BID , mercado...
Adapts a org . knowm . xchange . mercadobitcoin . dto . marketdata . OrderBook to a OrderBook Object
9,384
public static Ticker adaptTicker ( MercadoBitcoinTicker mercadoBitcoinTicker , CurrencyPair currencyPair ) { BigDecimal last = mercadoBitcoinTicker . getTicker ( ) . getLast ( ) ; BigDecimal bid = mercadoBitcoinTicker . getTicker ( ) . getBuy ( ) ; BigDecimal ask = mercadoBitcoinTicker . getTicker ( ) . getSell ( ) ; B...
Adapts a MercadoBitcoinTicker to a Ticker Object
9,385
private void setOReturn ( Object oReturn ) { if ( oReturn != null ) { if ( oReturn instanceof String ) { this . oReturnAsString = ( String ) oReturn ; } else if ( oReturn instanceof List ) { this . oReturn = new ArrayList < > ( ) ; for ( Object obj : ( List ) oReturn ) { if ( obj instanceof LinkedHashMap ) { addNewBitc...
This complete messy it s because the oReturn JSON field can be either an Object or a String or an Array of Objects .
9,386
public static void hasLength ( String input , int length , String message ) { notNull ( input , message ) ; if ( input . trim ( ) . length ( ) != length ) { throw new IllegalArgumentException ( message ) ; } }
Asserts that a String is not null and of a certain length
9,387
public static void hasSize ( Collection < ? > input , int length , String message ) { notNull ( input , message ) ; if ( input . size ( ) != length ) { throw new IllegalArgumentException ( message ) ; } }
Asserts that a Collection is not null and of a certain size
9,388
public static LimitOrder adaptOrder ( BigDecimal amount , BigDecimal price , CurrencyPair currencyPair , OrderType orderType , String id ) { return new LimitOrder ( orderType , amount , currencyPair , id , null , price ) ; }
Adapts a WexOrder to a LimitOrder
9,389
public static Trade adaptTrade ( WexTrade bTCETrade , CurrencyPair currencyPair ) { OrderType orderType = bTCETrade . getTradeType ( ) . equalsIgnoreCase ( "bid" ) ? OrderType . BID : OrderType . ASK ; BigDecimal amount = bTCETrade . getAmount ( ) ; BigDecimal price = bTCETrade . getPrice ( ) ; Date date = DateUtils . ...
Adapts a BTCETradeV3 to a Trade Object
9,390
public static Ticker adaptTicker ( WexTicker bTCETicker , CurrencyPair currencyPair ) { BigDecimal last = bTCETicker . getLast ( ) ; BigDecimal bid = bTCETicker . getSell ( ) ; BigDecimal ask = bTCETicker . getBuy ( ) ; BigDecimal high = bTCETicker . getHigh ( ) ; BigDecimal low = bTCETicker . getLow ( ) ; BigDecimal a...
Adapts a WexTicker to a Ticker Object
9,391
public static LimitOrder adaptOrderInfo ( String orderId , WexOrderInfoResult orderInfo ) { OrderType orderType = orderInfo . getType ( ) == WexOrderInfoResult . Type . buy ? OrderType . BID : OrderType . ASK ; BigDecimal price = orderInfo . getRate ( ) ; Date timestamp = DateUtils . fromMillisUtc ( orderInfo . getTime...
Adapts a WexOrderInfoResult to a LimitOrder
9,392
private static Order . OrderStatus convertOrderStatus ( String status ) { switch ( status ) { case "new" : return Order . OrderStatus . NEW ; case "suspended" : return Order . OrderStatus . STOPPED ; case "partiallyFilled" : return Order . OrderStatus . PARTIALLY_FILLED ; case "filled" : return Order . OrderStatus . FI...
Decodes HitBTC Order status .
9,393
public OkCoinPriceLimit getPriceLimits ( CurrencyPair currencyPair , Object ... args ) throws IOException { if ( args != null && args . length > 0 ) return getFuturesPriceLimits ( currencyPair , ( FuturesContract ) args [ 0 ] ) ; else return getFuturesPriceLimits ( currencyPair , futuresContract ) ; }
Retrieves the max price from the okex imposed by the price limits
9,394
public static Ticker adaptTicker ( IndependentReserveTicker independentReserveTicker , CurrencyPair currencyPair ) { BigDecimal last = independentReserveTicker . getLast ( ) ; BigDecimal bid = independentReserveTicker . getBid ( ) ; BigDecimal ask = independentReserveTicker . getAsk ( ) ; BigDecimal high = independentR...
Adapts a IndependentReserveTicker to a Ticker Object
9,395
public Trades getTrades ( CurrencyPair currencyPair , Object ... args ) throws IOException , RateLimitExceededException { if ( args . length == 0 ) { return CoinbaseProAdapters . adaptTrades ( getCoinbaseProTrades ( currencyPair ) , currencyPair ) ; } else if ( ( args . length == 2 ) && ( args [ 0 ] instanceof Long ) &...
Get trades data for a specific currency pair
9,396
public static Balance zero ( Currency currency ) { return new Balance ( currency , BigDecimal . ZERO , BigDecimal . ZERO , BigDecimal . ZERO , BigDecimal . ZERO , BigDecimal . ZERO , BigDecimal . ZERO , BigDecimal . ZERO ) ; }
Returns a zero balance .
9,397
protected static String utcNow ( ) { Calendar calendar = Calendar . getInstance ( ) ; SimpleDateFormat dateFormat = new SimpleDateFormat ( "EEE, dd MMM yyyy HH:mm:ss z" , Locale . US ) ; dateFormat . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; return dateFormat . format ( calendar . getTime ( ) ) ; }
current date in utc as http header
9,398
public static Ticker adaptTicker ( HuobiTicker huobiTicker , CurrencyPair currencyPair ) { Ticker . Builder builder = new Ticker . Builder ( ) ; builder . open ( huobiTicker . getOpen ( ) ) ; builder . ask ( huobiTicker . getAsk ( ) . getPrice ( ) ) ; builder . bid ( huobiTicker . getBid ( ) . getPrice ( ) ) ; builder ...
Trading fee at Huobi is 0 . 2 %
9,399
public TheRockWithdrawalResponse withdrawDefault ( Currency currency , BigDecimal amount , String destinationAddress ) throws TheRockException , IOException { final TheRockWithdrawal withdrawal = TheRockWithdrawal . createDefaultWithdrawal ( currency . getCurrencyCode ( ) , amount , destinationAddress ) ; return theRoc...
Withdraw using the default method