moex

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 7 Imported by: 1

README

Golang client for Moscow Exchange ISS API

Go Reference Test codecov

Golang client for the Moscow Exchange ISS API.

Example

First, ensure the library is installed and up to date by running

go get -u github.com/ivanglie/go-moex-client

This is a very simple app that just displays Chinese Yuan Renminbi to Russian Ruble conversion.

package main

import (
	"fmt"

	moex "github.com/ivanglie/go-moex-client"
)

func main() {
	client := moex.NewClient()
	rate, err := client.GetRate(moex.CNYRUB)
	if err != nil {
		panic(err)
	}
	fmt.Println(rate)
}

See main.go.

References

For more information check out the following links:

Documentation

Index

Constants

View Source
const (
	USDRUB = "USD000UTSTOM"
	EURRUB = "EUR_RUB__TOM"
	GBPRUB = "GBPRUB_TOM"
	CNYRUB = "CNYRUB_TOM"
)

Codes

Variables

View Source
var Debug = false

Debug mode If this variable is set to true, debug mode activated for the package

Functions

func SetLogger

func SetLogger(logger Logger) error

SetLogger specifies the logger that the package should use.

Types

type Client

type Client interface {
	GetRate(code string) (float64, error)
	SetFetchFunction(fetchFunction)
}

Client is the interface for the rates service.

func NewClient

func NewClient() Client

NewClient creates a new rates service instance.

type Currency

type Currency struct {
	// contains filtered or unexported fields
}

func (*Currency) String added in v0.0.3

func (s *Currency) String() string

String returns the string representation of the currency.

type Logger

type Logger interface {
	Println(v ...interface{})
	Printf(format string, v ...interface{})
}

Logger is an interface that represents the required methods to log data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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