store

package
v0.0.0-...-ab6d9db Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EUR = "EUR"
	RUB = "RUB"
	USD = "USD"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlfaRate

type AlfaRate struct {
	Usd []struct {
		Type  string  `json:"type"`
		Date  string  `json:"date"`
		Value float32 `json:"value"`
		Order string  `json:"order"`
	} `json:"usd"`
	Eur []struct {
		Type  string  `json:"type"`
		Date  string  `json:"date"`
		Value float32 `json:"value"`
		Order string  `json:"order"`
	} `json:"eur"`
	Chf []struct {
		Type  string  `json:"type"`
		Date  string  `json:"date"`
		Value float32 `json:"value"`
		Order string  `json:"order"`
	} `json:"chf"`
	Gbp []struct {
		Type  string  `json:"type"`
		Date  string  `json:"date"`
		Value float32 `json:"value"`
		Order string  `json:"order"`
	} `json:"gbp"`
}

type Rate

type Rate struct {
	Owner        string  `json:"owner"`
	Buy          float32 `json:"buy,omitempty"`
	Sell         float32 `json:"sell,omitempty"`
	ToCurrency   string  `json:"toCurrency"`
	FromCurrency string  `json:"fromCurrency"`
	LastUpdate   int64   `json:"lastUpdate"`
}

func MakeFromAlfa

func MakeFromAlfa(alfaRate *AlfaRate, currency string) *Rate

func MakeFromSber

func MakeFromSber(sberRate *SberRate, amount int, currency string) *Rate

func MakeFromTinkoff

func MakeFromTinkoff(tinkoffRate *TinkoffRate) *Rate

type SberRate

type SberRate struct {
	Base struct {
		Num840 struct {
			Num0 struct {
				IsoCur          string  `json:"isoCur"`
				CurrencyName    string  `json:"currencyName"`
				CurrencyNameEng string  `json:"currencyNameEng"`
				RateType        string  `json:"rateType"`
				CategoryCode    string  `json:"categoryCode"`
				Scale           int     `json:"scale"`
				BuyValue        float32 `json:"buyValue"`
				SellValue       float32 `json:"sellValue"`
				ActiveFrom      int64   `json:"activeFrom"`
				BuyValuePrev    float32 `json:"buyValuePrev"`
				SellValuePrev   float32 `json:"sellValuePrev"`
				AmountFrom      int     `json:"amountFrom"`
				AmountTo        float64 `json:"amountTo"`
			} `json:"0"`
			Num1000 struct {
				IsoCur          string  `json:"isoCur"`
				CurrencyName    string  `json:"currencyName"`
				CurrencyNameEng string  `json:"currencyNameEng"`
				RateType        string  `json:"rateType"`
				CategoryCode    string  `json:"categoryCode"`
				Scale           int     `json:"scale"`
				BuyValue        float32 `json:"buyValue"`
				SellValue       float32 `json:"sellValue"`
				ActiveFrom      int64   `json:"activeFrom"`
				BuyValuePrev    float32 `json:"buyValuePrev"`
				SellValuePrev   float32 `json:"sellValuePrev"`
				AmountFrom      int     `json:"amountFrom"`
				AmountTo        float64 `json:"amountTo"`
			} `json:"1000"`
		} `json:"840"`
		Num978 struct {
			Num0 struct {
				IsoCur          string  `json:"isoCur"`
				CurrencyName    string  `json:"currencyName"`
				CurrencyNameEng string  `json:"currencyNameEng"`
				RateType        string  `json:"rateType"`
				CategoryCode    string  `json:"categoryCode"`
				Scale           int     `json:"scale"`
				BuyValue        float32 `json:"buyValue"`
				SellValue       float32 `json:"sellValue"`
				ActiveFrom      int64   `json:"activeFrom"`
				BuyValuePrev    float32 `json:"buyValuePrev"`
				SellValuePrev   float32 `json:"sellValuePrev"`
				AmountFrom      int     `json:"amountFrom"`
				AmountTo        float64 `json:"amountTo"`
			} `json:"0"`
			Num1000 struct {
				IsoCur          string  `json:"isoCur"`
				CurrencyName    string  `json:"currencyName"`
				CurrencyNameEng string  `json:"currencyNameEng"`
				RateType        string  `json:"rateType"`
				CategoryCode    string  `json:"categoryCode"`
				Scale           int     `json:"scale"`
				BuyValue        float32 `json:"buyValue"`
				SellValue       float32 `json:"sellValue"`
				ActiveFrom      int64   `json:"activeFrom"`
				BuyValuePrev    float32 `json:"buyValuePrev"`
				SellValuePrev   float32 `json:"sellValuePrev"`
				AmountFrom      int     `json:"amountFrom"`
				AmountTo        float64 `json:"amountTo"`
			} `json:"1000"`
		} `json:"978"`
	} `json:"base"`
}

type TinkoffRate

type TinkoffRate struct {
	ResultCode string `json:"resultCode"`
	Payload    struct {
		LastUpdate struct {
			Milliseconds int64 `json:"milliseconds"`
		} `json:"lastUpdate"`
		Rates []struct {
			Category     string `json:"category"`
			FromCurrency struct {
				Code    int    `json:"code"`
				Name    string `json:"name"`
				StrCode string `json:"strCode"`
			} `json:"fromCurrency"`
			ToCurrency struct {
				Code    int    `json:"code"`
				Name    string `json:"name"`
				StrCode string `json:"strCode"`
			} `json:"toCurrency"`
			Buy  float32 `json:"buy,omitempty"`
			Sell float32 `json:"sell,omitempty"`
		} `json:"rates"`
	} `json:"payload"`
	TrackingID string `json:"trackingId"`
}

Jump to

Keyboard shortcuts

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