Skip to content

guneyin/gobist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

123eb22 · Feb 13, 2025

History

25 Commits
Mar 2, 2023
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025
Mar 2, 2023
Feb 12, 2025
Jan 22, 2023
Oct 26, 2024
Feb 13, 2025
Feb 13, 2025
Feb 13, 2025

Repository files navigation

gobist - GO library for BIST (Borsa Istanbul)

This project aims to provide some useful tools to fetch stock data for BIST via Yahoo Finance API

Installation

$ go get github.com/guneyin/gobist

Example

func main() {
    bist := gobist.New()
    
    tBegin, _ := time.Parse(time.DateOnly, "2023-09-25")
    tEnd, _ := time.Parse(time.DateOnly, "2024-10-25")
    
    q, err := bist.GetQuoteWithHistory([]string{"TUPRS", "BIMAS", "VESBE", "THYAO"}, tBegin, tEnd)
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Println(fmt.Sprintf("%-10s %-30s %-20s %-20s %-20s %-15s %-30s", "Symbol", "Name", "Current Price", "History Begin", "History End", "Change", "Error"))
    for _, item := range q.Items {
        fmt.Println(fmt.Sprintf("%-10s %-30s %-20f %-20f %-20f %-15f %-30s",
        item.Symbol, item.Name, item.Price, item.History.Begin.Price, item.History.End.Price, item.History.Change.ByRatio, item.Error))
    }
}