bestchange

package
v0.0.0-...-a2ff3f5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(token string) *Client

Create bestchange client.

func (*Client) CreateCurrencyMapper

func (c *Client) CreateCurrencyMapper() (map[string]string, error)

Create currency id to currency card mapper.

func (*Client) EstimateOperation

func (c *Client) EstimateOperation(first, second string) (float64, error)

Estimate exchane pair to get actual and reversed exchange rate for pair Example input "TON", "RUB"

func (*Client) PrintTable

func (c *Client) PrintTable(r []Rate)

Give a table representation for received views, can be used for debugging.

func (*Client) Rates

func (c *Client) Rates(first, second string) ([]Rate, error)

Receive exchanger rates from bestchange for 2 currency ID's.

type Currencies

type Currencies struct {
	Currencies []Currency `json:"currencies"`
}

type Currency

type Currency struct {
	ID   int    `json:"id"`
	Code string `json:"code"`
}

type Rate

type Rate struct {
	Rate    string   `json:"rate"`
	RateRev string   `json:"raterev"`
	Inmin   string   `json:"inmin"`
	Inmax   string   `json:"inmax"`
	Reserve string   `json:"reserve"`
	Marks   []string `json:"marks"`
	Changer int      `json:"changer"`
}

Exchanger with specific rate.

type Response

type Response struct {
	Resp []byte
	Time time.Time
}

Jump to

Keyboard shortcuts

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