public class NewsFilter extends Object implements Serializable
Sample builder usage:
NewsFilter filter = NewsFilter.newBuilder() .withSources("Business Wire") .withOrigins(NewsOrigin.valueOf("mt", "CBS")) .withSymbols("AAPL", "MSFT") .withLimit(50) .withTimeout(60_000L) .build();
Modifier and Type | Class and Description |
---|---|
static class |
NewsFilter.Builder |
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_DATE_LIMIT
Default date limit - deep past
|
static long |
DEFAULT_INTERVAL_LIMIT
Default interval limit - unlimited
|
static int |
DEFAULT_LIMIT
Default limit for the news count returned in one chunk.
|
static long |
DEFAULT_TIMEOUT
Default time period to wait while polling for news.
|
static NewsFilter |
EMPTY_FILTER
Empty filter with all params set by default.
|
static String |
FILTER_DATE_LIMIT |
static String |
FILTER_FEED
Deprecated.
|
static String |
FILTER_INTERVAL_LIMIT |
static String |
FILTER_LIMIT |
static String |
FILTER_ORIGIN |
static Set<String> |
FILTER_PARAMETERS
Set of all available fields for the filter.
|
static String |
FILTER_SOURCE
Deprecated.
|
static String |
FILTER_SYMBOL |
static String |
FILTER_TIMEOUT |
Modifier | Constructor and Description |
---|---|
protected |
NewsFilter(Map<String,Set<String>> params,
int originLimits) |
Modifier and Type | Method and Description |
---|---|
NewsFilter.Builder |
builder() |
protected static Set<NewsOrigin> |
calculateOrigins(Set<String> os,
Set<String> fs,
Set<String> ss) |
static NewsFilter |
emptyFilter() |
long |
getDateLimit()
Returns date of the oldest news to return, as UTC time in ms (same as
System.currentTimeMillis() ). |
Set<String> |
getFeeds()
Deprecated.
Use
getOrigins() instead. |
long |
getIntervalLimit()
Returns age of the oldest news to return, in milliseconds.
|
int |
getLimit()
Returns maximum number of news to return as requested by client.
|
Set<NewsOrigin> |
getOrigins()
Returns set of all origins to filter on, or
null otherwise. |
Set<String> |
getParam(String name) |
Map<String,Set<String>> |
getParams()
Returns all filter parameters as a map.
|
Set<String> |
getSources()
Deprecated.
Use
getOrigins() instead. |
Set<String> |
getSymbols()
Returns set of instrument symbols to filter on, or
null otherwise. |
long |
getTimeout()
Sets the timeout in millis to wait while polling for news.
|
protected void |
initialize(int originsLimit)
Initialize and validate all required fields.
|
static NewsFilter |
limitFilter(int limit) |
static NewsFilter.Builder |
newBuilder() |
String |
toString() |
@Deprecated public static final String FILTER_FEED
getFeeds()
,
Constant Field Values@Deprecated public static final String FILTER_SOURCE
getSources()
,
Constant Field Valuespublic static final String FILTER_ORIGIN
NewsFilter@getOrigins()
,
Constant Field Valuespublic static final String FILTER_SYMBOL
getSymbols()
,
Constant Field Valuespublic static final String FILTER_LIMIT
getLimit()
,
Constant Field Valuespublic static final String FILTER_DATE_LIMIT
getDateLimit()
,
Constant Field Valuespublic static final String FILTER_INTERVAL_LIMIT
getIntervalLimit()
,
Constant Field Valuespublic static final String FILTER_TIMEOUT
getTimeout()
,
Constant Field Valuespublic static final Set<String> FILTER_PARAMETERS
public static final NewsFilter EMPTY_FILTER
public static final int DEFAULT_LIMIT
public static final long DEFAULT_TIMEOUT
public static final long DEFAULT_DATE_LIMIT
public static final long DEFAULT_INTERVAL_LIMIT
public static NewsFilter.Builder newBuilder()
public static NewsFilter limitFilter(int limit)
public static NewsFilter emptyFilter()
public NewsFilter.Builder builder()
@Deprecated public Set<String> getFeeds()
getOrigins()
instead.null
otherwise.
These feeds will be converted to origins
in form of <feed>:*
.
@Deprecated public Set<String> getSources()
getOrigins()
instead.null
otherwise.
These sources will be converted to origins
in form of *:<source>:*
.
public Set<NewsOrigin> getOrigins()
public Set<String> getSymbols()
null
otherwise.public int getLimit()
public long getDateLimit()
System.currentTimeMillis()
).
Note that server can restrict history due to entitlements.public long getIntervalLimit()
public long getTimeout()
protected void initialize(int originsLimit)
Copyright © 2022 Devexperts. All rights reserved.