dolarpy-go
Package to easily consume the Dolarpy API in golang.
https://github.com/melizeche/dolarPy - by melizeche
Install
import "github.com/bitebait/dolarpy-go"
Usage Example
package main
import (
"encoding/json"
"fmt"
"github.com/bitebait/dolarpy-go"
)
func main() {
dolarpy.All() // returns all providers data
dolarpy.Providers() // returns providers names
dolarpy.Reference() // returns reference value from 'bcp'
dolarpy.Purchase("cambioschaco") // returns purchase value from 'cambioschaco' (default: 'bcp)
dolarpy.Sale("cambioschaco") // returns sale value from 'cambioschaco' (default: 'bcp)
// JSON Example
j, _ := json.Marshal(dolarpy.All())
fmt.Println(string(j))
// For Loop Example
data := dolarpy.All()
for key, value := range data {
fmt.Printf("Provider: %s - [Purchase: %.2f Sale: %.2f]\n", key, value["compra"], value["venta"])
}
}
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
This project is licensed under the terms of the MIT License - see the LICENSE file for details