public class Stock extends Object
Modifier and Type | Method and Description |
---|---|
String |
getCurrency()
Get the currency of the stock
|
StockDividend |
getDividend()
Returns the dividend data available for this stock.
|
StockDividend |
getDividend(boolean refresh)
Returns the dividend data available for this stock.
|
List<HistoricalDividend> |
getDividendHistory()
This method will return historical dividends from this stock.
|
List<HistoricalDividend> |
getDividendHistory(Calendar from)
Requests the historical dividends for this stock with the following characteristics.
|
List<HistoricalDividend> |
getDividendHistory(Calendar from,
Calendar to)
Requests the historical dividends for this stock with the following characteristics.
|
List<HistoricalQuote> |
getHistory()
This method will return historical quotes from this stock.
|
List<HistoricalQuote> |
getHistory(Calendar from)
Requests the historical quotes for this stock with the following characteristics.
|
List<HistoricalQuote> |
getHistory(Calendar from,
Calendar to)
Requests the historical quotes for this stock with the following characteristics.
|
List<HistoricalQuote> |
getHistory(Calendar from,
Calendar to,
Interval interval)
Requests the historical quotes for this stock with the following characteristics.
|
List<HistoricalQuote> |
getHistory(Calendar from,
Interval interval)
Requests the historical quotes for this stock with the following characteristics.
|
List<HistoricalQuote> |
getHistory(Interval interval)
Requests the historical quotes for this stock with the following characteristics.
|
String |
getName()
Get the full name of the stock
|
StockQuote |
getQuote()
Returns the basic quotes data available for this stock.
|
StockQuote |
getQuote(boolean refresh)
Returns the basic quotes data available for this stock.
|
List<HistoricalSplit> |
getSplitHistory()
This method will return historical splits from this stock.
|
List<HistoricalSplit> |
getSplitHistory(Calendar from)
Requests the historical splits for this stock with the following characteristics.
|
List<HistoricalSplit> |
getSplitHistory(Calendar from,
Calendar to)
Requests the historical splits for this stock with the following characteristics.
|
StockStats |
getStats()
Returns the statistics available for this stock.
|
StockStats |
getStats(boolean refresh)
Returns the statistics available for this stock.
|
String |
getStockExchange()
Get the exchange on which the stock is traded
|
String |
getSymbol() |
boolean |
isValid()
Checks if the returned name is null.
|
void |
print() |
void |
setCurrency(String currency) |
void |
setDividend(StockDividend dividend) |
void |
setDividendHistory(List<HistoricalDividend> dividendHistory) |
void |
setHistory(List<HistoricalQuote> history) |
void |
setName(String name) |
void |
setQuote(StockQuote quote) |
void |
setSplitHistory(List<HistoricalSplit> splitHistory) |
void |
setStats(StockStats stats) |
void |
setStockExchange(String stockExchange) |
String |
toString() |
public Stock(String symbol)
public boolean isValid()
public StockQuote getQuote()
getQuote(boolean)
public StockQuote getQuote(boolean refresh) throws IOException
When the quote data gets refreshed, it will automatically also refresh the statistics and dividend data of the stock from Yahoo Finance in the same request.
refresh
- indicates whether the data should be requested again to Yahoo FinanceIOException
- when there's a connection problempublic void setQuote(StockQuote quote)
public StockStats getStats()
getStats(boolean)
public StockStats getStats(boolean refresh) throws IOException
When the statistics get refreshed, it will automatically also refresh the quote and dividend data of the stock from Yahoo Finance in the same request.
refresh
- indicates whether the data should be requested again to Yahoo FinanceIOException
- when there's a connection problempublic void setStats(StockStats stats)
public StockDividend getDividend()
getDividend(boolean)
public StockDividend getDividend(boolean refresh) throws IOException
When the dividend data get refreshed, it will automatically also refresh the quote and statistics data of the stock from Yahoo Finance in the same request.
refresh
- indicates whether the data should be requested again to Yahoo FinanceIOException
- when there's a connection problempublic void setDividend(StockDividend dividend)
public List<HistoricalQuote> getHistory() throws IOException
If the historical quotes are not available yet, the following characteristics will be used for the request:
There are several more methods available that allow you to define some characteristics of the historical data. Calling one of those methods will result in a new request being sent to Yahoo Finance.
IOException
- when there's a connection problemgetHistory(yahoofinance.histquotes.Interval)
,
getHistory(java.util.Calendar)
,
getHistory(java.util.Calendar, java.util.Calendar)
,
getHistory(java.util.Calendar, yahoofinance.histquotes.Interval)
,
getHistory(java.util.Calendar, java.util.Calendar, yahoofinance.histquotes.Interval)
public List<HistoricalQuote> getHistory(Interval interval) throws IOException
interval
- the interval of the historical dataIOException
- when there's a connection problemgetHistory()
public List<HistoricalQuote> getHistory(Calendar from) throws IOException
from
- start date of the historical dataIOException
- when there's a connection problemgetHistory()
public List<HistoricalQuote> getHistory(Calendar from, Interval interval) throws IOException
from
- start date of the historical datainterval
- the interval of the historical dataIOException
- when there's a connection problemgetHistory()
public List<HistoricalQuote> getHistory(Calendar from, Calendar to) throws IOException
from
- start date of the historical datato
- end date of the historical dataIOException
- when there's a connection problemgetHistory()
public List<HistoricalQuote> getHistory(Calendar from, Calendar to, Interval interval) throws IOException
from
- start date of the historical datato
- end date of the historical datainterval
- the interval of the historical dataIOException
- when there's a connection problemgetHistory()
public void setHistory(List<HistoricalQuote> history)
public List<HistoricalDividend> getDividendHistory() throws IOException
If the historical dividends are not available yet, the following characteristics will be used for the request:
There are several more methods available that allow you to define some characteristics of the historical data. Calling one of those methods will result in a new request being sent to Yahoo Finance.
IOException
- when there's a connection problemgetDividendHistory(java.util.Calendar)
,
getDividendHistory(java.util.Calendar, java.util.Calendar)
public List<HistoricalDividend> getDividendHistory(Calendar from) throws IOException
from
- start date of the historical dataIOException
- when there's a connection problemgetDividendHistory()
public List<HistoricalDividend> getDividendHistory(Calendar from, Calendar to) throws IOException
from
- start date of the historical datato
- end date of the historical dataIOException
- when there's a connection problemgetDividendHistory()
public void setDividendHistory(List<HistoricalDividend> dividendHistory)
public List<HistoricalSplit> getSplitHistory() throws IOException
If the historical splits are not available yet, the following characteristics will be used for the request:
There are several more methods available that allow you to define some characteristics of the historical data. Calling one of those methods will result in a new request being sent to Yahoo Finance.
IOException
- when there's a connection problemgetSplitHistory(java.util.Calendar)
,
getSplitHistory(java.util.Calendar, java.util.Calendar)
public List<HistoricalSplit> getSplitHistory(Calendar from) throws IOException
from
- start date of the historical dataIOException
- when there's a connection problemgetSplitHistory()
public List<HistoricalSplit> getSplitHistory(Calendar from, Calendar to) throws IOException
from
- start date of the historical datato
- end date of the historical dataIOException
- when there's a connection problemgetSplitHistory()
public void setSplitHistory(List<HistoricalSplit> splitHistory)
public String getSymbol()
public String getName()
public void setName(String name)
public String getCurrency()
public void setCurrency(String currency)
public String getStockExchange()
public void setStockExchange(String stockExchange)
public void print()
Copyright © 2022. All rights reserved.