goiex

package module
v0.0.0-...-c81c9b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2020 License: MIT Imports: 3 Imported by: 0

README

.. image:: https://travis-ci.com/AndrewRPorter/goiex.svg?branch=master
    :target: https://travis-ci.com/AndrewRPorter/goiex
    
=====
goiex
=====

**Note: the IEX** `api <https://iextrading.com/developers/docs/>`_ **now requires a key for authentication, thus breaking this project.**

A go interface for accessing IEX finanical information. Data provided for free 
by `IEX <https://iextrading.com/developer/>`_. View `IEX’s Terms of Use 
<https://iextrading.com/api-exhibit-a/>`_.


Installation
------------

.. code::
   
      go get github.com/AndrewRPorter/goiex

Usage
-----

.. code:: go

   package main
   
   import (
      "fmt"
      "github.com/AndrewRPorter/goiex"
   )

   func main() {   
      s, err := goiex.Get("AAPL")
      
      if err != nil {
         fmt.Errorf("Unable to fetch ticker: %s", "AAPL")
      }
      
      fmt.Println(s.Price)
      
      // fetch company information
      c, err := s.GetCompany()
      
      if err != nil {
         fmt.Errorf("Unable to fetch company data for: %s", s.Symbol)
      }
      fmt.Println(c.Description)
   }
   
**Available Methods**

- ``Get()``
- ``GetCompany()``

**Available Fields**

- ``Symbol``
- ``CompanyName``
- ``Exchange``
- ``Sector``
- ``Open``
- ``Close``
- ``High``
- ``Low``
- ``Volume``
- ``Price``
- ``Change``
- ``ChangePercent``
- ``AverageVolume``
- ``MarketCap``
- ``PeRatio``
- ``YearHigh``
- ``YearLow``
- ``YtdChange``

- ``Symbol``
- ``CompanyName``
- ``Exchange``
- ``Industry``
- ``Website``
- ``Description``
- ``CEO``
- ``Sector``

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Company

type Company struct {
	Symbol      string
	CompanyName string
	Exchange    string
	Industry    string
	Website     string
	Description string
	CEO         string
	Sector      string
}

Company provides and interface for accessing company data parsed from IEX

type Stock

type Stock struct {
	Symbol        string
	CompanyName   string
	Exchange      string `json:"primaryExchange"`
	Sector        string
	Open          float64
	Close         float64
	High          float64
	Low           float64
	Volume        int     `json:"latestVolume"`
	Price         float64 `json:"latestPrice"`
	Change        float64
	ChangePercent float64
	AverageVolume int `json:"avgTotalVolume"`
	MarketCap     int
	PeRatio       float64
	YearHigh      float64 `json:"week52High"`
	YearLow       float64 `json:"week52Low"`
	YtdChange     float64
}

Stock provides an interface for accessing ticker data parsed from IEX

func Get

func Get(ticker string) (Stock, error)

Get interpolates Stock struct with JSON request data from IEX

func (Stock) GetCompany

func (s Stock) GetCompany() (Company, error)

GetCompany interpolates Company struct with JSON requests data from IEX

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL