Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 524 Bytes

README.md

File metadata and controls

38 lines (28 loc) · 524 Bytes

tinkoff-quotes

tinkoff investments quotes stream

package main

import ( "log" "os" "time"

"github.com/alexeykaravan/tinkoff-quotes"

)

func main() { quotesChanal := make(chan tinkoff.Quote, 1024)

t := tinkoff.New("")

curr, err := t.GetStocks()
if err != nil {
	log.Fatal(err)
}

go func() {
	timer := time.NewTicker(5 * time.Second)

	err := t.SubscribeForQuotes(curr, quotesChanal)
	if err != nil {
		log.Println(err)
	}

	<-timer.C
}()

for quote := range quotesChanal {
	log.Println(quote)
}

}