Created
November 30, 2021 06:33
-
-
Save satishbabariya/67483674178fe546836c858049395772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"github.com/piquette/finance-go/quote" | |
) | |
func main() { | |
ticker := time.NewTicker(1 * time.Second) | |
done := make(chan bool) | |
for { | |
select { | |
case <-done: | |
return | |
case t := <-ticker.C: | |
go nalco(t) | |
} | |
} | |
} | |
func nalco(t time.Time) { | |
q, err := quote.Get("NATIONALUM.NS") | |
if err != nil { | |
// Uh-oh. | |
panic(err) | |
} | |
// Success! | |
regularMarketPrice := q.RegularMarketPrice | |
date := time.Unix(int64(q.RegularMarketTime), 0) | |
fmt.Println(fmt.Sprintf("%d:%d:%d", date.Hour(), date.Minute(), date.Second()), regularMarketPrice) | |
} |
Author
satishbabariya
commented
Nov 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment