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_TIMEFRAME
Default time period for filtering out the most recent news.
|
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_ACTUAL_ONLY |
static String |
FILTER_CHAIN_ID |
static String |
FILTER_DATE_LIMIT
Deprecated.
|
static String |
FILTER_FEED
Deprecated.
|
static String |
FILTER_INCLUDE_BODY |
static String |
FILTER_INCLUDE_EXTRA_ATTRIBUTES |
static String |
FILTER_INCLUDE_RAW_NEWS |
static String |
FILTER_INTERVAL_LIMIT
Deprecated.
|
static String |
FILTER_LATEST_PER_SYMBOL |
static String |
FILTER_LIMIT
Deprecated.
|
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_TIMEFRAME |
static String |
FILTER_TIMEOUT
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
NewsFilter(Map<String,Set<String>> params,
Map<String,String> tags,
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() |
Set<String> |
getChainIds()
Returns chainId to filter on, or
null otherwise. |
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. |
Map<String,String> |
getTags() |
long |
getTimeframe()
Returns true, when need to include raw data in news.
|
long |
getTimeout()
Sets the timeout in millis to wait while polling for news.
|
boolean |
includeBody()
Returns true, when need to include body in news.
|
boolean |
includeExtraAttributes()
Returns true, when need to include extra attributes in news.
|
boolean |
includeRawNews()
Returns true, when need to include raw data in news.
|
protected void |
initialize(int originsLimit)
Initialize and validate all required fields.
|
boolean |
isActualOnly()
Returns true, when showing only the most recent version of the news.
|
boolean |
isLatestPerSymbol()
Returns true, when showing only the latest news per symbol.
|
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 Values@Deprecated public static final String FILTER_LIMIT
getLimit()
,
Constant Field Values@Deprecated public static final String FILTER_DATE_LIMIT
getDateLimit()
,
Constant Field Values@Deprecated public static final String FILTER_INTERVAL_LIMIT
getIntervalLimit()
,
Constant Field Values@Deprecated public static final String FILTER_TIMEOUT
getTimeout()
,
Constant Field Valuespublic static final String FILTER_CHAIN_ID
getChainIds()
,
Constant Field Valuespublic static final String FILTER_ACTUAL_ONLY
isActualOnly()
,
Constant Field Valuespublic static final String FILTER_INCLUDE_EXTRA_ATTRIBUTES
includeExtraAttributes()
,
Constant Field Valuespublic static final String FILTER_INCLUDE_BODY
includeBody()
,
Constant Field Valuespublic static final String FILTER_INCLUDE_RAW_NEWS
includeRawNews()
,
Constant Field Valuespublic static final String FILTER_LATEST_PER_SYMBOL
()
,
Constant Field Valuespublic static final String FILTER_TIMEFRAME
getTimeframe()
,
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 final long DEFAULT_TIMEFRAME
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 boolean isActualOnly()
public boolean isLatestPerSymbol()
public boolean includeBody()
public boolean includeExtraAttributes()
public boolean includeRawNews()
public long getTimeframe()
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 © 2024 Devexperts. All rights reserved.