-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f0c2cc3
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Google-Finance | ||
Fetching stock Data from Google Finance API. This is just for informational purpose as Google does not actively support finance API now. | ||
|
||
# Usage | ||
There are two functions that you should know. | ||
```java | ||
Stock getStockDetails(String exchange, String ticker) throws IOException; | ||
List<Stock> getStockDetails(String exchange, String[] tickers) throws IOException; | ||
``` | ||
The data is to be inserted in data.properties file. You can have a single quote or multiple quotes. | ||
For multiple quotes, use comma separated tickers and use java's ```String.split()``` and pass it to ``` getStockDetails(String exchange, String[] tickers)``` to get a list of stocks. | ||
```java | ||
Properties props = new Properties(); | ||
String basePath = MainClass.class.getResource("/").getPath(); | ||
InputStream is = new FileInputStream(basePath+"data.properties"); | ||
props.load(is); | ||
String exchange = props.getProperty("exchange"); | ||
String tickers = props.getProperty("ticker"); | ||
``` | ||
The above code lines will get you the exchange and ticker data from properties file. | ||
|