Skip to content
Browse files

- added rates packages docs

  • Loading branch information...
maZahaca committed Mar 19, 2019
1 parent cf3da2b commit 3601bb957589b185ae9af5e2ff0a49c05d7efc47
Showing with 28 additions and 0 deletions.
  1. +28 −0 rates/doc.go
@@ -0,0 +1,28 @@
// Copyright 2019 RedCode. All rights reserved.
// This is an example library demonstrating different
// Go language techniques and practices.

Package rates implements Manager and Rates Provider.
This allows your to add multiple rates providers and update it via manager.
All the rates are stored in the memory and can be accessed via GetRates method.
Let's have a look on example of using this package:
fetcher := new(rates.HttpFetcher)
manager := rates.NewManager()
provider := rates.NewCryptoCompare("USD", []string{"GBP", "EUR", "BTC"}, fetcher)
err := manager.AddProvider(provider)
if err != nil {
err = manager.Update()
if err != nil {
rates := manager.GetRates("cryptocompare")
Here we create Manager and register with it CryptoCompare provider, every time
we call Update method the rates are fetched and renewed in the memory.

package rates

0 comments on commit 3601bb9

Please sign in to comment.
You can’t perform that action at this time.