https://github.com/gozeloglu/currency-tcmb
TCMB(Central Bank of the Republic of Türkiye) currency API written in Go.
https://github.com/gozeloglu/currency-tcmb
api currency go golang tcmb tcmb-api
Last synced: 4 days ago
JSON representation
TCMB(Central Bank of the Republic of Türkiye) currency API written in Go.
- Host: GitHub
- URL: https://github.com/gozeloglu/currency-tcmb
- Owner: gozeloglu
- License: mit
- Created: 2023-04-18T20:59:58.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-25T11:57:40.000Z (about 3 years ago)
- Last Synced: 2025-01-04T20:16:40.532Z (over 1 year ago)
- Topics: api, currency, go, golang, tcmb, tcmb-api
- Language: Go
- Homepage: https://pkg.go.dev/github.com/gozeloglu/currency-tcmb
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# currency-tcmb
`currency-tcmb` is a Go API for the Central Bank of the Republic of Türkiye(TCMB) currency data. It fetches the data from the [URL](https://www.tcmb.gov.tr/kurlar/today.xml),
parses the XML, and returns necessary information. It returns today's data.
## Installation
```shell
go get github.com/gozeloglu/currency-tcmb
```
## Usage
```go
func main() {
tcmb := currency.New() // It fetches and parses the XML data in background
usdCurrency := tcmb.FromCurrencyCode(currency.USD) // Get USD currency against TRY
fmt.Println(usdCurrency.BanknoteBuying())
fmt.Println(usdCurrency.BanknoteSelling())
}
```
You can retrieve the historical currency by passing `WithDate()` option.
```go
tcmb := currency.New(WithDate(1, time.September, 2021)) // It fetches 01 September 2021 currency data.
```
## LICENSE
[MIT](LICENSE)