forex

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

Package forex defines common forex-related types used throughout gelder.

Index

Constants

This section is empty.

Variables

View Source
var (
	AUDCAD = CurrencyPair{Base: currency.AUD, Quote: currency.CAD}
	AUDJPY = CurrencyPair{Base: currency.AUD, Quote: currency.JPY}
	AUDNZD = CurrencyPair{Base: currency.AUD, Quote: currency.NZD}
	AUDUSD = CurrencyPair{Base: currency.AUD, Quote: currency.USD}
	CHFJPY = CurrencyPair{Base: currency.CHF, Quote: currency.JPY}
	EURAUD = CurrencyPair{Base: currency.EUR, Quote: currency.AUD}
	EURCAD = CurrencyPair{Base: currency.EUR, Quote: currency.CAD}
	EURCHF = CurrencyPair{Base: currency.EUR, Quote: currency.CHF}
	EURGBP = CurrencyPair{Base: currency.EUR, Quote: currency.GBP}
	EURJPY = CurrencyPair{Base: currency.EUR, Quote: currency.JPY}
	EURUSD = CurrencyPair{Base: currency.EUR, Quote: currency.USD}
	GBPCHF = CurrencyPair{Base: currency.GBP, Quote: currency.CHF}
	GBPJPY = CurrencyPair{Base: currency.GBP, Quote: currency.JPY}
	GBPUSD = CurrencyPair{Base: currency.GBP, Quote: currency.USD}
	NZDUSD = CurrencyPair{Base: currency.NZD, Quote: currency.USD}
	USDCAD = CurrencyPair{Base: currency.USD, Quote: currency.CAD}
	USDCHF = CurrencyPair{Base: currency.USD, Quote: currency.CHF}
	USDJPY = CurrencyPair{Base: currency.USD, Quote: currency.JPY}
)

nolint[golint]

Functions

This section is empty.

Types

type CurrencyPair

type CurrencyPair struct {
	Base  currency.Unit
	Quote currency.Unit
}

Pair represents a currency pair consisting of a base currency and a quote currency.

func Parse

func Parse(str string) (pair CurrencyPair, err error)

Parse parses a currency pair represented as two ISO currencies (e.g EURCHF).

func ParseDelimited

func ParseDelimited(str string, del string) (pair CurrencyPair, err error)

ParseDelimited parses an currency pair represented as two ISO currencies (e.g EURCHF) separated by a delimiter.

func (CurrencyPair) String

func (p CurrencyPair) String() string

String returns a string representation of the currency pair.

func (CurrencyPair) StringDelimited

func (p CurrencyPair) StringDelimited(del string) string

StringDelimited returns a string representation of the currency pair with base and quote separated by a delimiter.

type Price

type Price struct {
	Bid decimal.Decimal
	Ask decimal.Decimal
}

Price represents the bid and ask price of an instrument.

func (Price) String

func (p Price) String() string

String returns a string representation of the price.

type Quote

type Quote struct {
	Pair  CurrencyPair
	Price Price
	Time  time.Time
}

Quote represents the price of a currency pair at a particular point in time.

Jump to

Keyboard shortcuts

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