Skip to content

opencrypter/stocks-exchange-go

Repository files navigation

Stocks.Exchange . Go Sdk/Wrapper

Build Status codecov License: MIT Join the chat at https://gitter.im/opencrypter/stocks-exchange-go

An open source sdk for Stocks.exchange written in Golang.

Installation

After you've configured your local Go package:

go get github.com/opencrypter/stocks-exchange-go

Usage

This SDK is based on the official stocks.exchange api docs

You only have to call the constructor function in order to use it:

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
}

Available api endpoints

Currencies

Get all available currencies with additional info.

Example

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
    currencies, err := stocksExchange.GetCurrencies()
}

Markets

Get all available currency pairs with additional info.

Example

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
    markets , err := stocksExchange.GetMarkets()
}

Market summary

Get currency pair with additional info.

Example

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
    
    query := stocks_exchange.NewGetMarketSummaryQuery("BSM", "BTC")
    marketSummary , err := stocksExchange.GetMarketSummary(query)
}

Tickers

Use it to get the recommended retail exchange rates for all currency pairs.

Example

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
    tickers , err := stocksExchange.GetTickers()
}

Prices

Use it to get the new retail exchange rates for all currency pairs.

Example

package main

import "github.com/opencrypter/stocks-exchange-go"

func main() {
    stocksExchange := stocks_exchange.New("Your-api-key", "Your secret api-key")
    prices, err := stocksExchange.GetPrices()
}

Tests

All is covered 100%. You can run all tests as normally you do it:

go test -test.v

License

MIT licensed. See the LICENSE file for details.