chinabond

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package chinabond 接口封装 https://yield.chinabond.com.cn/cbweb-mn/yield_main?locale=zh_CN

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChinaBond

type ChinaBond struct {
	// http 客户端
	HTTPClient *http.Client
}

ChinaBond 中国债券信息网

func NewChinaBond

func NewChinaBond() ChinaBond

NewChinaBond 创建 ChinaBond 实例

func (ChinaBond) QueryAAACompanyBondSyl

func (c ChinaBond) QueryAAACompanyBondSyl(ctx context.Context) float64

QueryAAACompanyBondSyl AAA公司债当期收益率

func (ChinaBond) QueryCurrentSyl

func (c ChinaBond) QueryCurrentSyl(ctx context.Context, bondName string) (float64, error)

QueryCurrentSyl 返回债券当期收益率 债券名称:https://yield.chinabond.com.cn/cbweb-mn/yield_main?locale=zh_CN

func (ChinaBond) QueryFxsyl

func (c ChinaBond) QueryFxsyl(ctx context.Context, treeItemID, date string) ([][]float64, error)

QueryFxsyl 查询指定债券在指定日期的收益率 treeItemID 为QueryTree中对应债券的id date为string格式的指定日期:YYYY-mm-dd

func (ChinaBond) QueryTree

func (c ChinaBond) QueryTree(ctx context.Context) (map[string]string, error)

QueryTree 查询债券曲线树数据,返回key为债券曲线名称,value为曲线名称对应的随机id

type RespQueryFxsyl

type RespQueryFxsyl struct {
	YcChartDataList []struct {
		YcDefID    string      `json:"ycDefId"`
		YcDefName  string      `json:"ycDefName"`
		YcYWName   interface{} `json:"ycYWName"`
		Worktime   string      `json:"worktime"`
		SeriesData [][]float64 `json:"seriesData"`
		IsPoint    bool        `json:"isPoint"`
		HyCurve    bool        `json:"hyCurve"`
		Point      bool        `json:"point"`
	} `json:"ycChartDataList"`
	ChartDataList interface{} `json:"chartDataList"`
	UpThrow       int         `json:"upThrow"`
	DownThrow     int         `json:"downThrow"`
	UpOffset      int         `json:"upOffset"`
	DownOffset    int         `json:"downOffset"`
}

RespQueryFxsyl 债券收益率接口返回结果 SeriesData: [ [期限年数, 收益率], ... ]

type RespQueryTree

type RespQueryTree []TreeItem

RespQueryTree 债券曲线树 https://yield.chinabond.com.cn/cbweb-mn/yc/queryTree?locale=zh_CN 接口返回结果

type TreeItem

type TreeItem struct {
	ID       string      `json:"id"`
	PID      string      `json:"pId"`
	Name     string      `json:"name"`
	IsParent string      `json:"isParent"`
	Open     string      `json:"open"`
	Checked  bool        `json:"checked"`
	Font     interface{} `json:"font"`
}

TreeItem 债券曲线树节点

Jump to

Keyboard shortcuts

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