Coder Social home page Coder Social logo

go-xrate's Introduction

go-xrate

go-xrate is a small lib for getting cryptocurrency rates from several Exchanges around the world.

Install

To install, just run

go get github.com/swipecoin/go-xrate

It doesn't rely on any external lib :D

Supported Exchanges

As of now, only exchanges from Brazil are supported. But the code is prepared to work with multiple countries, fiat currencies and cryptocurrencies.

Here's the supported list (We are constantly adding more and more):

Supported Cryptocurrencies

  • BTC: Bitcoin
  • LTC: Litecoin
  • BCH: Bitcoin Cash

Usage

It's really simple to get started.

First, you import the package:
// Here we are importing from the brazilian package of exchanges
import (
    xrbr "go-xrate/exchanges/br"
)
Then, instantiate a new ExchangeCrawler and call the specific method for the cryptocurrency you want:
// FoxBit - Bitcoin
xrbr.NewFoxBitCrawler().BTC()
  
// OR 
// Mercado Bitcoin - Bitcoin Cash
xrbr.NewMercadoBitcoinCrawler().BCH()
 
// OR 
// Mercado Bitcoin - Litecoin
xrbr.NewMercadoBitcoinCrawler().LTC()
 
// OR 
// BitcoinTrade - Bitcoin
xrbr.NewBitcoinTradeCrawler().BTC()
 
// OR 
// Bitcoin To You - Bitcoin
xrbr.NewBitcoinToYouCrawler().BTC()

API

NewFoxBitCrawler() FoxBitCrawler

Creates and returns a new FoxBitCrawler

Methods:
  • BTC() CryptoCurrencyTicker

NewMercadoBitcoinCrawler() MercadoBitcoinCrawler

Creates and returns a new MercadoBitcoinCrawler

Methods:
  • BTC() CryptoCurrencyTicker
  • LTC() CryptoCurrencyTicker
  • BCH() CryptoCurrencyTicker

NewBitcoinTradeCrawler() BitcoinTradeCrawler

Creates and returns a new BitcoinTradeCrawler

Methods:
  • BTC() CryptoCurrencyTicker

NewBitcoinToYouCrawler() BitcoinToYouCrawler

Creates and returns a new BitcoinToYouCrawler

Methods:
  • BTC() CryptoCurrencyTicker

Methods response

All ExchangeCrawler methods return a CryptoCurrencyTicker, with fields:

  • Acronym: Cryptocurrency acronym. (BTC, BCH or LTC)
  • FiatCurrencyAcronym: Fiat currency acronym. (BRL or USD)
  • Last: Price of the last order
  • High24h: Price of the highest order in the last 24 hours
  • Low24h: Price of the lowest order in the last 24 hours
  • Volume24h: Trading volume in the last 24 hours
  • VolumeFiat24h: Fiat trading volume in the last 24 hours (Not supported by all)
  • RecentBuyOrder: Price of the most recent buy order
  • RecentSellOrder: Price of the most recent sell order

In the case of a exchange not supporting a specific field, we fill it with a 'falsy' value. (E.g. float32 -> 0.0)

TODO

  • More Exchanges (From both Brazil and other countries)
  • Tests
  • Better error handling
  • Other useful statistics from a specific cryptocurrency and/or exchange

Contribution

Please feel free to contribute with both suggestions and new code :D

go-xrate's People

Contributors

edunuzzi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.