/** * Returns an entry from a given column name as a LocalDate (possibly null). Throws an IllegalArgumentException if the name is not defined * in the header definition. Throws a DateTimeParseException if the underlying data is not a date in ISO local date format (YYYY-MM-DD). * * @param column the column name of the entry, not null * @return the entry, can be null if the value is null or empty */ public LocalDate getLocalDate(final String column) { int index = _headerDefinition.columnIndex(column); return getLocalDate(index); }
/** * Returns an entry from a given column name as a Double (possibly null). Throws an IllegalArgumentException if the name is not defined in * the header definition. Throws a NumberFormatException if the underlying data cannot be parsed as a double precision floating point * number. * * @param column the column name of the entry, not null * @return the entry, can be null if the value is null or empty */ public Double getDouble(final String column) { int index = _headerDefinition.columnIndex(column); return getDouble(index); }
/** * {@inheritDoc} */ public MetaDataResult ofMetaData(final JSONObject rawData) { return MetaDataResult.of(rawData); } /**
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); TabularResult tabularResult = session.getDataSet( DataSetRequest.Builder .of("WIKI/AAPL") .withFrequency(Frequency.QUARTERLY) .withColumn(CLOSE_COLUMN) .withTransform(Transform.NORMALIZE) .build()); System.out.println(tabularResult.toPrettyPrintedString()); }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); SearchResult searchResult = session.search(new SearchRequest.Builder().withQuery("Apple").withMaxPerPage(2).build()); System.out.println("Current page:" + searchResult.getCurrentPage()); System.out.println("Documents per page:" + searchResult.getDocumentsPerPage()); System.out.println("Total matching documents:" + searchResult.getTotalDocuments()); for (MetaDataResult document : searchResult.getMetaDataResultList()) { System.out.println("Quandl code " + document.getQuandlCode() + " matched"); System.out.println("Available columns are: " + document.getHeaderDefinition()); } }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); TabularResult tabularResult = session.getDataSet( DataSetRequest.Builder.of("WIKI/AAPL").build()); System.out.println(tabularResult.toPrettyPrintedString()); }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); SearchResult searchResult = session.search(new SearchRequest.Builder().withQuery("Apple").withMaxPerPage(2).build()); System.out.println(searchResult.toPrettyPrintedString()); }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); MetaDataResult metaData = session.getMetaData(MetaDataRequest.of("WIKI/AAPL")); System.out.println(metaData.toPrettyPrintedString()); }
/** * The main body of the code. */ private void run() { QuandlSession session = QuandlSession.create(); MetaDataResult metaData = session.getMetaData(MultiMetaDataRequest.of("WIKI/AAPL", "DOE/RWTC", "WIKI/MSFT")); System.out.println(metaData.toPrettyPrintedString()); }
/** * Create a builder set to search for all. * @return a Builder, set to search for all */ public static Builder ofAll() { return new Builder(); }
/** * Build an instance of QuandlOptions using the parameters in this builder instance. * * @return an instance of QuandlOptions */ public SessionOptions build() { return new SessionOptions(this); } }
/** * Process a metadata request into a descriptive title string. * @param request the meta data request * @return the title string */ public String processMetaDataRequest(final MetaDataRequest request) { return request.getQuandlCode(); } /**
/** * Create a retry policy that retries a fixed number of times with a fixed interval. * * @param maxRetries the maximum allowable number of retries * @param backOffPeriod the period to wait before retrying, in milliseconds * @return the retry policy */ public static RetryPolicy createFixedRetryPolicy(final int maxRetries, final long backOffPeriod) { return new FixedRetryPolicy(maxRetries, backOffPeriod); }
/** * Create a retry policy that retries with a provided set of back off periods. This allows the user to perform an exponential backoff, for * example. * * @param backOffPeriods an array of times to wait between retries, in milliseconds * @return the retry policy */ public static RetryPolicy createSequenceRetryPolicy(final long[] backOffPeriods) { return new SequenceRetryPolicy(backOffPeriods); }
/** * Returns an entry from a given column name as a String (possibly null). Throws an IllegalArgumentException if the name is not defined in * the header definition. Empty is returned as the empty String rather than null. * * @param column the column name of the entry, not null * @return the entry, can be null */ public String getString(final String column) { return _values[_headerDefinition.columnIndex(column)]; }
/** * Specify no auth token. * * @return a Builder object for chaining, call build() to complete */ public static Builder withoutAuthToken() { return new Builder(null); }
/** * Build the request object. * * @return the immutable build object */ public MultiDataSetRequest build() { return new MultiDataSetRequest(this); } }
/** * Create a retry policy that never retries. * * @return the retry policy */ public static RetryPolicy createNoRetryPolicy() { return new NoRetryPolicy(); }
/** * Build the request object. * * @return the immutable build object */ public DataSetRequest build() { return new DataSetRequest(this); } }
@Override public String toString() { if (isSingleColumnRequest()) { return "QuandlCodeRequest[quandlCode=" + _quandlCode + ", columnNumber=" + _columnNumber + "]"; } else { return "QuandlCodeRequest[quandlCode=" + _quandlCode + ", all columns]"; } }