Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
crazzyghost committed Jan 11, 2021
1 parent ad539cb commit 0dc7fb9
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 26 deletions.
27 changes: 17 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.5.0] - 11-01-2021
### Added
- Support for synchronous requests

## [v1.4.2] - 20-10-2020
### Fixed
- [Missing crypto unit date](https://github.com/crazzyghost/alphavantage-java/pull/13)
Expand Down Expand Up @@ -80,15 +84,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Tests for Time Series
- README

[1.4.0]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.4.0
[1.3.1]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.3.1
[1.3.2]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.3.2
[1.3.0]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.3.0
[1.2.1]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.2.1
[1.2.0]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.2.0
[1.1.1]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.1.1
[1.1.0]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.1.0
[1.0.2]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.0.2
[1.0.1]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.0.1
[v1.5.0]: https://github.com/crazzyghost/alphavantage-java/compare/1.4.2...1.5.0
[v1.4.2]: https://github.com/crazzyghost/alphavantage-java/compare/1.4.1...1.4.2
[v1.4.1]: https://github.com/crazzyghost/alphavantage-java/compare/1.4.0...1.4.1
[v1.4.0]: https://github.com/crazzyghost/alphavantage-java/compare/1.3.2...1.4.0
[v1.3.2]: https://github.com/crazzyghost/alphavantage-java/compare/1.3.1...1.3.2
[v1.3.1]: https://github.com/crazzyghost/alphavantage-java/compare/1.3.0...1.3.1
[v1.3.0]: https://github.com/crazzyghost/alphavantage-java/compare/1.2.1...1.3.0
[v1.2.1]: https://github.com/crazzyghost/alphavantage-java/compare/1.2.0...1.2.1
[v1.2.0]: https://github.com/crazzyghost/alphavantage-java/compare/1.1.1...1.2.0
[v1.1.1]: https://github.com/crazzyghost/alphavantage-java/compare/1.1.0...1.1.1
[v1.1.0]: https://github.com/crazzyghost/alphavantage-java/compare/1.0.2...1.1.0
[v1.0.2]: https://github.com/crazzyghost/alphavantage-java/compare/1.0.1...1.0.2
[v1.0.1]: https://github.com/crazzyghost/alphavantage-java/releases/tag/1.0.1
[1.0.0]: https://github.com/crazzyghost/alphavantage-java/tree/9d1cbca8a48899398513494ae6717bec0fa93cfb
[ajt001]: https://github.com/ajt001
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![codecov](https://codecov.io/gh/crazzyghost/alphavantage-java/branch/master/graph/badge.svg)](https://codecov.io/gh/crazzyghost/alphavantage-java)
[![](https://jitpack.io/v/crazzyghost/alphavantage-java.svg)](https://jitpack.io/#crazzyghost/alphavantage-java)

I created this wrapper to make accessing the [AlphaVantage API](https://www.alphavantage.co/) fairly simple and fun by providing a fluent interface with Java.
An easy to use, fluent Java wrapper for accessing the [AlphaVantage API](https://www.alphavantage.co/).

## Getting Started

Expand Down Expand Up @@ -49,15 +49,19 @@ dependencies {

These five steps summarize how to access data using this library

1. `config`ure the wrapper
2. Select a `category`
3. Set the `parameters` for the selected category
4. Add `response callbacks`
5. `fetch` results
Step 1. `config`ure the wrapper

Step 2. Select a `category`

Step 3. Set the `parameters` for the selected category

Step 4. (Optional) Add `response callbacks`

Step 5. `fetch` results

#### 1. `Config`uring the wrapper

Access to the API is through the AlphaVantage Singleton which is accessed using the `static` `api()` method of the class. Initialize the singleton with a `Config` instance once through out your apps lifetime.
Access to the API is through the AlphaVantage Singleton which is accessed using the `static` `api()` method of the class. Initialize the singleton with a `Config` instance once throughout your app's lifetime.

```java
Config cfg = Config.builder()
Expand All @@ -66,7 +70,7 @@ Config cfg = Config.builder()
.build();
```

The config object is then used to initialize the instance. You will use this object to set your api key and configure the http client. Using the wrapper without setting a config or a config key will throw an exception.
Initialize the instance with the config. You will use this object to set your api key and configure the http client. Using the wrapper without setting a config or a config key will throw an exception.

```java
AlphaVantage.api().init(cfg);
Expand Down Expand Up @@ -111,7 +115,7 @@ Start setting parameters by calling an appropriate function method in the select

#### 4. Adding `response callbacks`

To handle responses add the `onSuccess()` or `onFailure()` callbacks.
To handle responses add the `onSuccess()` or `onFailure()` async callbacks. Starting from version 1.5.0, this is an optional step.

```java
public void handleSuccess(TimeSeriesResponse response) {
Expand Down Expand Up @@ -148,4 +152,17 @@ AlphaVantage.api()
.fetch();
```

If you want a synchronous response, call the `fetchSync()` method.

```java
TimeSeriesResponse response = AlphaVantage.api()
.timeSeries()
.intraday()
.forSymbol("IBM")
.interval(Interval.FIVE_MIN)
.outputSize(OutputSize.FULL)
.fetchSync();
```


That's it! :tada: See [site](https://crazzyghost.github.io/alphavantage-java/) and [demo project](https://github.com/crazzyghost/stockmonitor) for more examples & documentation
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v1.5.0] - 11-01-2021

- New: Support for synchronous requests

## v1.4.2 - 20-10-2020

- [Missing crypto unit date](https://github.com/crazzyghost/alphavantage-java/pull/13)
Expand Down
40 changes: 33 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ dependencies {

These five steps summarize how to access data using this library

1. `config`ure the wrapper
2. Select a `category`
3. Set the `parameters` for the selected category
4. Add `response callbacks`
5. `fetch` results
Step 1. `config`ure the wrapper

Step 2. Select a `category`

Step 3. Set the `parameters` for the selected category

Step 4. (Optional) Add `response callbacks`

Step 5. `fetch` results

#### 1. `Config`uring the wrapper

Expand All @@ -74,7 +78,7 @@ Access to the API is through the AlphaVantage Singleton which is accessed using
.timeOut(10)
.build()

The config object is then used to initialize the instance. You will use this object to set your api key and configure the http client.
Use the config object to initialize the api instance. You will use this object to set your api key and configure the http client.

!!! warning
Using the wrapper without setting a config or a config key will throw an exception.
Expand Down Expand Up @@ -142,7 +146,7 @@ Let's select the `TIME_SERIES_INTRADAY` function

#### 4. Adding `response callbacks`

To handle responses add the `onSuccess()` or `onFailure()` callbacks.
To handle responses add the `onSuccess()` or `onFailure()` async callbacks. Starting from version 1.5.0, this is an optional step.

=== "Java"
:::java
Expand Down Expand Up @@ -214,6 +218,28 @@ When you are okay with setting the parameters call the `fetch()` method. Simple!
.onFailure({ e-> hanldeFailure(e) })
.fetch()

You can also use the sychronous fetch method by calling the `fetchSync()` method without callback handlers.

=== "Java"
:::java
TimeSeriesResponse response = AlphaVantage.api()
.timeSeries()
.intraday()
.forSymbol("IBM")
.interval(Interval.FIVE_MIN)
.outputSize(OutputSize.FULL)
.fetch();

=== "Kotlin"
:::java
TimeSeriesResponse response = AlphaVantage.api()
.timeSeries()
.intraday()
.forSymbol("IBM")
.interval(Interval.FIVE_MIN)
.outputSize(OutputSize.FULL)
.fetch()

## Releases

Release history can be found in the [change log](changelog.md).
Expand Down

0 comments on commit 0dc7fb9

Please sign in to comment.