public static void registerDefaults ( ) throws BitfinexClientException { try { final URL url = new URL ( SYMBOL_URL ) ; final String symbolJson = Resources . toString ( url , Charsets . UTF_8 ) ; final JSONArray jsonArray = new JSONArray ( symbolJson ) ; for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { final JSONObject currency = jsonArray . getJSONObject ( i ) ; final String pair = currency . getString ( "pair" ) ; if ( pair . length ( ) != 6 ) { throw new BitfinexClientException ( "The currency pair is not 6 chars long: " + pair ) ; } final double minOrderSize = currency . getDouble ( "minimum_order_size" ) ; final String currency1 = pair . substring ( 0 , 3 ) . toUpperCase ( ) ; final String currency2 = pair . substring ( 3 , 6 ) . toUpperCase ( ) ; register ( currency1 , currency2 , minOrderSize ) ; } } catch ( IOException e ) { throw new BitfinexClientException ( e ) ; } }
Load and register all known currencies