Code Monkey home page Code Monkey logo

fugle-realtime-go's Introduction

fugle-realtime-go

Build Status Go Report Card codecov Code Climate

Fugle Realtime Go is a go package to query realtime stock data of Taiwan market through API provided by Fugle API

Getting Started

Install the package

$ go get github.com/RainrainWu/fugle-realtime-go

Set up your Fugle API token

$ export FUGLE_API_TOKEN=<YOUR_TOKEN>

Quick demo

package main

import (
	"log"

	"github.com/RainrainWu/fugle-realtime-go/client"
)

func main() {

	myClient, err := client.NewFugleClient()
	if err != nil {
		log.Fatal("failed to init fugle api client")
	}
	result := myClient.Meta("2330", false)
	result.PrettyPrint()
}

Functions

func (client.FugleClient).Chart(symbolID string, oddLot bool) client.FugleAPIResponse

Access the Chart API

func (client.FugleClient).Quote(symbolID string, oddLot bool) client.FugleAPIResponse

Access the Quote API

func (client.FugleClient).Meta(symbolID string, oddLot bool) client.FugleAPIResponse

Access the Meta API

func (client.FugleClient).Dealts(symbolID string, oddLot bool) client.FugleAPIResponse

Access the Dealts API

fugle-realtime-go's People

Contributors

rainrainwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fugle-realtime-go's Issues

回傳結果偵錯

目前傳送api回來的資料沒辦法確認是否錯誤

type FugleClient interface {
	Chart(symbolID string, oddLot bool) FugleAPIResponse
	Quote(symbolID string, oddLot bool) FugleAPIResponse
	Meta(symbolID string, oddLot bool) FugleAPIResponse
	Dealts(symbolID string, oddLot bool) FugleAPIResponse
}

目前api如果錯誤的話會寫log
但是呼叫此api的程式沒辦法知道錯誤
因為回傳是FugleAPIResponse,且用 if response == nil 會發生

invalid operation: response == nil (mismatched types client.FugleAPIResponse and nil)

是否可以改成回傳err?

回傳數字型態錯誤

"meta": {
"isIndex": false,
"nameZhTw": "台積電",
"industryZhTw": "半導體業",
"priceReference": 602, <-- 轉換是用 int
"priceHighLimit": 662, <-- 轉換是用 int
"priceLowLimit": 542, <-- 轉換是用 int
},

當我用0056有小數點的數字會直接變成0
當我改成float後就正常了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.