Skip to content

torbenconto/plutus

Repository files navigation

logo

Plutus

A stock data centered golang library

GitHub Release GitHub commit activity CodeFactor Codacy Badge GitHub License Lines of codeGitHub repo size

Quick Start

Download the library into your existing golang project

    go get -u github.com/torbenconto/plutus/v2

Basic Usage

import "github.com/torbenconto/plutus/v2"
stock, err := plutus.GetQuote("AMD")
if err != nil {
	fmt.Printf("An error occured: %e", err)
}
fmt.Printf("The current price of AMD is: %f", stock.RegularMarketPrice)

Historical Data

import "github.com/torbenconto/plutus/v2"
import _range "github.com/torbenconto/plutus/v2/range"
import "github.com/torbenconto/plutus/v2/interval"

// Create a new historical data object using the ticker of the stock you want data on as well as the range and interval of the data.
stock, err := plutus.GetHistoricalQuote("AMD", _range.FiveDay, interval.OneMin)
if err != nil {
    fmt.Printf("An error occured: %e", err)
}

// Returns a list of all the data points as structs containing the time in unix time and the price of the stock at that time.
for _, data := range stock.Data {
    fmt.Println(data.Time, data.Open, data.Close, data.High, data.Low, data.Volume)
}

Dividends

import "github.com/torbenconto/plutus/v2"

info, err := plutus.GetDividendInfo("T")
if err != nil {
	fmt.Printf("An error occured: %s\n", err)
}

REST api

The repo containing the api and information about it is contained here plutus-api

Example based documentation

Please use the provided examples to guide you to using plutus to it's full potential.

Tests

To run the tests for the library, simply run the following command in the root of the project.

    go test ./...

Notes

Please only use this module for personal use. Don't overload my deployment or ill get really sad 🥲.

About

A golang stock data library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages