All Projects → patriques82 → Alphavantage4j

patriques82 / Alphavantage4j

Licence: apache-2.0
(Repository is not maintained anymore) A Java wrapper to get stock data and stock indicators from the Alpha Vantage API

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Alphavantage4j

Dbg Pds
Deutsche Boerse's Financial Trading Public Data Set
Stars: ✭ 124 (+5.08%)
Mutual labels:  financial-data, stock-data
pytickersymbols
Fundamental stock data and yahoo/google ticker symbols for several indices.
Stars: ✭ 69 (-41.53%)
Mutual labels:  stock-data, financial-data
Simplestockanalysispython
Stock Analysis Tutorial in Python
Stars: ✭ 126 (+6.78%)
Mutual labels:  financial-data, stock-data
Awesome Quant
A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance)
Stars: ✭ 8,205 (+6853.39%)
Mutual labels:  financial-data, stock-data
Algobot
A C++ stock market algorithmic trading bot
Stars: ✭ 78 (-33.9%)
Mutual labels:  financial-data, stock-data
Fetching Financial Data
Fetching financial data for technical & fundamental analysis and algorithmic trading from a variety of python packages and sources.
Stars: ✭ 137 (+16.1%)
Mutual labels:  financial-data, stock-data
Pandas Datareader
Extract data from a wide range of Internet sources into a pandas DataFrame.
Stars: ✭ 2,183 (+1750%)
Mutual labels:  financial-data, stock-data
Stocky
Machine Learning Stock Trading Risk Analysis (Spring 2017)
Stars: ✭ 27 (-77.12%)
Mutual labels:  stock-data, financial-data
Finance Go
📊 Financial markets data library implemented in go.
Stars: ✭ 392 (+232.2%)
Mutual labels:  financial-data, stock-data
IEX CPP API
Unofficial C++ Lib for the IEXtrading API
Stars: ✭ 34 (-71.19%)
Mutual labels:  stock-data, financial-data
Yfinance
Download market data from Yahoo! Finance's API
Stars: ✭ 6,148 (+5110.17%)
Mutual labels:  financial-data, stock-data
Jqdatasdk
简单易用的量化金融数据包(easy utility for getting financial market data of China)
Stars: ✭ 457 (+287.29%)
Mutual labels:  financial-data, stock-data
Yahoofinancials
A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
Stars: ✭ 509 (+331.36%)
Mutual labels:  financial-data, stock-data
Contractmanager
ContractManager is a contract management software for the Jameica platform.
Stars: ✭ 10 (-91.53%)
Mutual labels:  financial-data
Systemicrisk
A framework for systemic risk valuation and analysis.
Stars: ✭ 72 (-38.98%)
Mutual labels:  financial-data
Finance4py
股市技術分析小工具
Stars: ✭ 8 (-93.22%)
Mutual labels:  stock-data
Technicalindicators
A javascript technical indicators written in typescript with pattern recognition right in the browser
Stars: ✭ 1,328 (+1025.42%)
Mutual labels:  stock-data
Personae
📈 Personae is a repo of implements and environment of Deep Reinforcement Learning & Supervised Learning for Quantitative Trading.
Stars: ✭ 1,140 (+866.1%)
Mutual labels:  stock-data
Tidyquant
Bringing financial analysis to the tidyverse
Stars: ✭ 635 (+438.14%)
Mutual labels:  financial-data
Tda Api
A TD Ameritrade API client for Python. Includes historical data for equities and ETFs, options chains, streaming order book data, complex order construction, and more.
Stars: ✭ 608 (+415.25%)
Mutual labels:  financial-data

Build Status codecov license

alphavantage4j

A Java wrapper to get stock data and stock indicators from the Alpha Vantage API.

Introduction

Alpha Vantage delivers a free API for real time financial data and most used finance indicators. This library implements a wrapper to the free API provided by Alpha Vantage (http://www.alphavantage.co/). It requires an api key, that can be requested on http://www.alphavantage.co/support/#api-key. You can have a look at all the api calls available in their documentation http://www.alphavantage.co/documentation.

Gradle installation

repositories {
    maven {
        url  "https://dl.bintray.com/patriques82/maven" 
    }
}
dependencies {
    compile 'org.patriques:alphavantage4j:1.4'
}

Usage

Now that you set up your project and have your api key you can start using the service. Here are a few examples of how you can use the service.

Time Series example

public class App {
  public static void main(String[] args) {
    String apiKey = "50M3AP1K3Y";
    int timeout = 3000;
    AlphaVantageConnector apiConnector = new AlphaVantageConnector(apiKey, timeout);
    TimeSeries stockTimeSeries = new TimeSeries(apiConnector);
    
    try {
      IntraDay response = stockTimeSeries.intraDay("MSFT", Interval.ONE_MIN, OutputSize.COMPACT);
      Map<String, String> metaData = response.getMetaData();
      System.out.println("Information: " + metaData.get("1. Information"));
      System.out.println("Stock: " + metaData.get("2. Symbol"));
      
      List<StockData> stockData = response.getStockData();
      stockData.forEach(stock -> {
        System.out.println("date:   " + stock.getDateTime());
        System.out.println("open:   " + stock.getOpen());
        System.out.println("high:   " + stock.getHigh());
        System.out.println("low:    " + stock.getLow());
        System.out.println("close:  " + stock.getClose());
        System.out.println("volume: " + stock.getVolume());
      });
    } catch (AlphaVantageException e) {
      System.out.println("something went wrong");
    }
  }
}

Foreign Exchange example

public class App {
  public static void main(String[] args) {
    String apiKey = "50M3AP1K3Y";
    int timeout = 3000;
    AlphaVantageConnector apiConnector = new AlphaVantageConnector(apiKey, timeout);
    ForeignExchange foreignExchange = new ForeignExchange(apiConnector);

    try {
      CurrencyExchange currencyExchange = foreignExchange.currencyExchangeRate("USD", "SEK");
      CurrencyExchangeData currencyExchangeData = currencyExchange.getData();

      System.out.println("from currency code: " + currencyExchangeData.getFromCurrencyCode());
      System.out.println("from currency name: " + currencyExchangeData.getFromCurrencyName());
      System.out.println("to currency code:   " + currencyExchangeData.getToCurrencyCode());
      System.out.println("to currency name:   " + currencyExchangeData.getToCurrencyName());
      System.out.println("exchange rate:      " + currencyExchangeData.getExchangeRate());
      System.out.println("last refresh:       " + currencyExchangeData.getTime());
    } catch (AlphaVantageException e) {
      System.out.println("something went wrong");
    }
  }
}

Digital/Crypto Currencies example

public class App {
  public static void main(String[] args) {
    String apiKey = "50M3AP1K3Y";
    int timeout = 3000;
    AlphaVantageConnector apiConnector = new AlphaVantageConnector(apiKey, timeout);
    DigitalCurrencies digitalCurrencies = new DigitalCurrencies(apiConnector);

    try {
      IntraDay response = digitalCurrencies.intraDay("BTC", Market.USD);
      Map<String, String> metaData = response.getMetaData();
      System.out.println("Information: " + metaData.get("1. Information"));
      System.out.println("Digital Currency Code: " + metaData.get("2. Digital Currency Code"));

      List<SimpelDigitalCurrencyData> digitalData = response.getDigitalData();
      digitalData.forEach(data -> {
        System.out.println("date:       " + data.getDateTime());
        System.out.println("price A:    " + data.getPriceA());
        System.out.println("price B:    " + data.getPriceB());
        System.out.println("volume:     " + data.getVolume());
        System.out.println("market cap: " + data.getMarketCap());
      });
    } catch (AlphaVantageException e) {
      System.out.println("something went wrong");
    }
  }
}

Technical Indicators example

public class App {
  public static void main(String[] args) {
    String apiKey = "50M3AP1K3Y";
    int timeout = 3000;
    AlphaVantageConnector apiConnector = new AlphaVantageConnector(apiKey, timeout);
    TechnicalIndicators technicalIndicators = new TechnicalIndicators(apiConnector);

    try {
      MACD response = technicalIndicators.macd("MSFT", Interval.DAILY, TimePeriod.of(10), SeriesType.CLOSE, null, null, null);
      Map<String, String> metaData = response.getMetaData();
      System.out.println("Symbol: " + metaData.get("1: Symbol"));
      System.out.println("Indicator: " + metaData.get("2: Indicator"));

      List<MACDData> macdData = response.getData();
      macdData.forEach(data -> {
        System.out.println("date:           " + data.getDateTime());
        System.out.println("MACD Histogram: " + data.getHist());
        System.out.println("MACD Signal:    " + data.getSignal());
        System.out.println("MACD:           " + data.getMacd());
      });
    } catch (AlphaVantageException e) {
      System.out.println("something went wrong");
    }
  }
}

Sector Performances example

public class App {
  public static void main(String[] args) {
    String apiKey = "50M3AP1K3Y";
    int timeout = 3000;
    AlphaVantageConnector apiConnector = new AlphaVantageConnector(apiKey, timeout);
    SectorPerformances sectorPerformances = new SectorPerformances(apiConnector);

    try {
      Sectors response = sectorPerformances.sector();
      Map<String, String> metaData = response.getMetaData();
      System.out.println("Information: " + metaData.get("Information"));
      System.out.println("Last Refreshed: " + metaData.get("Last Refreshed"));

      List<SectorData> sectors = response.getSectors();
      sectors.forEach(data -> {
        System.out.println("key:           " + data.getKey());
        System.out.println("Consumer Discretionary: " + data.getConsumerDiscretionary());
        System.out.println("Consumer Staples:       " + data.getConsumerStaples());
        System.out.println("Energy:                 " + data.getEnergy());
        System.out.println("Financials:             " + data.getFinancials());
        System.out.println("Health Care:            " + data.getHealthCare());
        System.out.println("Industrials:            " + data.getIndustrials());
        System.out.println("Information Technology: " + data.getInformationTechnology());
        System.out.println("Materials:              " + data.getMaterials());
        System.out.println("Real Estate:            " + data.getRealEstate());
      });
    } catch (AlphaVantageException e) {
      System.out.println("something went wrong");
    }
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].