currency

package
v0.0.0-...-a2c5123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 5 Imported by: 0

README

GoCryptoTrader package Currency

Build Status Software License GoDoc Coverage Status Go Report Card

This currency package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Current Features for currency

  • Currency package contains a full suite of packages that provide:
    • Foreign exchange data fetching for FIAT currencies
    • Currency Pair generation
    • Symbol mapping
    • Translation between currencies that have similar strings e.g. XBT, BTC
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

View Source
const (
	// DefaultBaseCurrency is the base currency used for conversion
	DefaultBaseCurrency = "USD"
	// DefaultCurrencies has the default minimum of FIAT values
	DefaultCurrencies = "USD,AUD,EUR,CNY"
	// DefaultCryptoCurrencies has the default minimum of crytpocurrency values
	DefaultCryptoCurrencies = "BTC,LTC,ETH,DOGE,DASH,XRP,XMR"
)

Variables

View Source
var (
	FXRates map[string]float64

	FiatCurrencies   []string
	CryptoCurrencies []string

	BaseCurrency string
	FXProviders  *forexprovider.ForexProviders
)

Manager is the overarching type across this package

Functions

func ConvertCurrency

func ConvertCurrency(amount float64, from, to string) (float64, error)

ConvertCurrency for example converts $1 USD to the equivalent Japanese Yen or vice versa.

func GetExchangeRates

func GetExchangeRates() map[string]float64

GetExchangeRates returns the currency exchange rates

func IsCryptoFiatPair

func IsCryptoFiatPair(p pair.CurrencyPair) bool

IsCryptoFiatPair checks to see if the pair is a crypto fiat pair e.g. BTCUSD

func IsCryptoPair

func IsCryptoPair(p pair.CurrencyPair) bool

IsCryptoPair checks to see if the pair is a crypto pair e.g. BTCLTC

func IsCryptocurrency

func IsCryptocurrency(currency string) bool

IsCryptocurrency checks if the currency passed is an enabled CRYPTO currency.

func IsDefaultCryptocurrency

func IsDefaultCryptocurrency(currency string) bool

IsDefaultCryptocurrency checks if the currency passed in matches the default cryptocurrency

func IsDefaultCurrency

func IsDefaultCurrency(currency string) bool

IsDefaultCurrency checks if the currency passed in matches the default fiat currency

func IsFiatCurrency

func IsFiatCurrency(currency string) bool

IsFiatCurrency checks if the currency passed is an enabled fiat currency

func IsFiatPair

func IsFiatPair(p pair.CurrencyPair) bool

IsFiatPair checks to see if the pair is a fiat pair e.g. EURUSD

func SeedCurrencyData

func SeedCurrencyData(currencies string) error

SeedCurrencyData returns rates correlated with suported currencies

func SetDefaults

func SetDefaults()

SetDefaults sets the default currency provider and settings for currency conversion used outside of the bot setting

func Update

func Update(input []string, cryptos bool)

Update updates the local crypto currency or base currency store

Types

This section is empty.

Directories

Path Synopsis
Package forexprovider utilises foreign exchange API services to manage relational FIAT currencies
Package forexprovider utilises foreign exchange API services to manage relational FIAT currencies

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL