stockchart

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

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

Go to latest
Published: Sep 3, 2015 License: BSD-3-Clause Imports: 7 Imported by: 0

README

stockchart GoDoc

stock chart from yahoo finance japan

chart

Installation

$ go get github.com/pdevty/stockchart

Usage

package main

import (
	"fmt"
	"github.com/pdevty/stockchart"
	"io/ioutil"
	"os"
)

func main() {
	// params json format
	// brand id,name from yahoo finance japan
	params := `[
		{"id":"7618","name":"ピーシーデポ"},
		{"id":"6157","name":"日進工具"},
		{"id":"7821","name":"前田工繊"},
		{"id":"7917","name":"藤森工業"},
		{"id":"4681","name":"リゾートトラスト"},
		{"id":"4301","name":"アミューズ"},
		{"id":"4290","name":"プレステージ"},
		{"id":"2780","name":"コメ兵"},
		{"id":"2695","name":"くらコーポレーション"},
		{"id":"2695","name":"内外トランスライン"}
	]`
	// new
	sc, err := stockchart.New(params)
	if err != nil {
		panic(err)
	}
	// return chart html
	fmt.Println(sc.Html())
	// return chart csv
	fmt.Println(sc.Csv())
	// create chart html file
	ioutil.WriteFile("index.html",
		[]byte(sc.Html()), os.ModePerm)
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Documentation

Overview

package main

import (

"fmt"
"github.com/pdevty/stockchart"
"io/ioutil"
"os"

)

func main() {
  // params json format
  // brand id,name from yahoo finance japan
  params := `[
    {"id":"7618","name":"ピーシーデポ"},
    {"id":"6157","name":"日進工具"},
    {"id":"7821","name":"前田工繊"},
    {"id":"7917","name":"藤森工業"},
    {"id":"4681","name":"リゾートトラスト"},
    {"id":"4301","name":"アミューズ"},
    {"id":"4290","name":"プレステージ"},
    {"id":"2780","name":"コメ兵"},
    {"id":"2695","name":"くらコーポレーション"},
    {"id":"2695","name":"内外トランスライン"}
  ]`
  // new
  sc, err := stockchart.New(params)
  if err != nil {
    panic(err)
  }
  // return chart html
  fmt.Println(sc.Html())
  // return chart csv
  fmt.Println(sc.Csv())
  // create chart html file
  ioutil.WriteFile("index.html",
    []byte(sc.Html()), os.ModePerm)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brand

type Brand struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Brands

type Brands []Brand

type Client

type Client struct {
	Header string
	Body   map[string]string
}

func New

func New(params string) (*Client, error)

func (*Client) Csv

func (c *Client) Csv() string

func (*Client) Html

func (c *Client) Html() string

type Data

type Data struct {
	Id   string
	Name string
	Data [][]string
}

type Map

type Map struct {
	Key   string
	Value string
}

type Maps

type Maps []Map

func (Maps) Len

func (m Maps) Len() int

func (Maps) Less

func (m Maps) Less(i, j int) bool

func (Maps) Swap

func (m Maps) Swap(i, j int)

Jump to

Keyboard shortcuts

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