Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
reteps authored Jan 16, 2018
1 parent 12406d4 commit 5b29248
Showing 1 changed file with 6 additions and 55 deletions.
61 changes: 6 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# go-coinmarketcap

# coinmarketcap
--
import "github.com/miguelmota/go-coinmarketcap"

Coin Market Cap API in golang
import "github.com/reteps/go-coinmarketcap"

Coin Market Cap API + Scraper in golang

## Usage

Expand Down Expand Up @@ -86,61 +86,12 @@ GlobalMarketData struct
func GetMarketData() (GlobalMarketData, error)
```

# Examples
#### func CoinMarkets

```go
package main

import (
"fmt"
"log"
"time"

coinApi "github.com/miguelmota/go-coinmarketcap"
)

func main() {
// Get global market data
marketInfo, err := coinApi.GetMarketData()
if err != nil {
log.Println(err)
} else {
fmt.Println(marketInfo)
}

// Get info about coin
coinInfo, err := coinApi.GetCoinData("ethereum")
if err != nil {
log.Println(err)
} else {
fmt.Println(coinInfo)

}
// Get top 10 coins
top10, err := coinApi.GetAllCoinData(10)
if err != nil {
log.Println(err)
} else {
fmt.Println(top10)
}

var threeMonths int64 = (60 * 60 * 24 * 90)
now := time.Now()
secs := now.Unix()
start := secs - threeMonths
end := secs

// Get graph data for coin
coinGraphData, err := coinApi.GetCoinGraphData("ethereum", start, end)
if err != nil {
log.Println(err)
} else {
fmt.Println(coinGraphData)
}

}
func CoinMarkets(coin string) ([]Markets, error)
```

# License

MIT
MIT

0 comments on commit 5b29248

Please sign in to comment.