currency_rate

package
v0.0.0-...-2946602 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_RETRY = 3

Variables

View Source
var CurrencyNameMap = make(map[string]string)

CurrencyNameMap 货币中文名和缩写对照

View Source
var CurrencyNameReverseMap = make(map[string]string)

CurrencyNameReverseMap 缩写到货币中文名对照

View Source
var CurrencyRateMap = make(map[string]CurrencyRate)

CurrencyRateMap 各货币与人民币汇率表

View Source
var Interval = time.Minute * 3

Functions

func GetCurrencyList

func GetCurrencyList()

GetCurrencyList 获取货币列表 下面是以Get请求为例的测试链接 TODO 测一下 GET https://sapi.k780.com/?app=finance.rate_curlist&curType=rateRealtime&appkey=64165&sign=39fa1b9f58cb3fcbaea198b869d9c243

Types

type CurrencyRate

type CurrencyRate struct {
	Ratenm string `json:"ratenm"`
	Rate   string `json:"rate"`
	Update string `json:"update"`
}

type CurrencyRateResponse

type CurrencyRateResponse struct {
	Success string `json:"success"`
	Result  struct {
		Status string `json:"status"`
		Scur   string `json:"scur"`
		Tcur   string `json:"tcur"`
		Ratenm string `json:"ratenm"`
		Rate   string `json:"rate"`
		Update string `json:"update"`
	} `json:"result"`
}

func GetCurrencyRate

func GetCurrencyRate(sourceCurrency, targetCurrency string) CurrencyRateResponse

GetCurrencyRate 获取某一货币的汇率 下面是以Get请求为例的测试链接 GET http://api.k780.com?app=finance.rate&scur=AED&tcur=CNY&appkey=64165&sign=39fa1b9f58cb3fcbaea198b869d9c243

Jump to

Keyboard shortcuts

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