sina

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MultiSearchMaxNum = 8 // 单次支持最多查询的证券数量
)
View Source
const (
	SinaReferer = "https://finance.sina.com.cn"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicCorp

type BasicCorp struct {
	Code            string // 证券代码
	ExCode          string // 带交易所的证券代码
	HistoryName     string // 简称历史
	Name            string
	EnName          string
	ExChange        string  // 交易所
	Price           float64 // 发行价格
	Date            string  // 上市时间
	WebSite         string  // 公司网址
	RegisterAddress string  // 注册地址
	BusinessAddress string  // 办公地址
	MainBussiness   string  // 主营业务
}

BasicCorp 公司基本信息

func QueryBasicCorp

func QueryBasicCorp(exCode string) (*BasicCorp, error)

QueryBasicCorp 根据证券代码获取公司信息

type BasicSecurity

type BasicSecurity struct {
	Name         string             // 证券名称
	SecurityType types.SecurityType // 证券类型:股票 stock,基金 fund
	Code         string             // 证券代码
	ExCode       string             // 证券带交易所编码 SH600036
	ExChange     string             // 交易所
}

BasicSecurity 基本证券信息

func MultiSearch

func MultiSearch(keys []string) []BasicSecurity

MultiSearch 根据关键字查询多个证券信息 最多支持 8 条证券信息查询

func Search(key string) []BasicSecurity

Search 根据关键字查询证券信息

type CorpProfile

type CorpProfile struct {
	Code            string
	ExCode          string
	Name            string  // 公司名称
	HistoryName     string  // 简称历史
	ListingPrice    float64 // 发行价格
	ListingDate     string  // 上市时间
	Category        string  // 行业分类
	WebSite         string  // 公司网址
	RegisterAddress string  // 注册地址
	BusinessAddress string  // 办公地址
	MainBusiness    string  // 主营业务
	Current         float64 // 当前价格
	PB              float64 // 市净率
	PeTTM           float64 // 市盈率TTM
	MarketCap       float64 // 总市值
	TradedMarketCap float64 // 流通市值
}

func Profile

func Profile(opts *types.InfoOptions) (*CorpProfile, error)

Profile 根据证券代码获取证券的基本信息,exCode SH600036

type Dividend

type Dividend struct {
	PublicDate     string  // 公告日期
	RecordDate     string  // 登记日期
	DividendedDate string  // 除息日期
	Shares         float64 // 送股数量
	AddShares      float64 // 转增股票数量
	Bonus          float64 // 红利
}

分红送转信息

func QueryDividends

func QueryDividends(code string) ([]Dividend, error)

QueryDividends 查询分红送转信息

type SecurityQuote

type SecurityQuote struct {
	TradeDate string // 交易日期 "2023-06-02"
	Code      string
	ExCode    string
	Name      string
	Current   float64 // 当前价格
	Open      float64
	YClose    float64 // 上个交易日收盘价
	High      float64
	Low       float64
	Volume    float64 // 成交金额 单位:元
	TurnOver  int64   // 成交数量 单位:股
	Time      string  // 交易日期 "2023-06-02"
}

SecurityQuote 证券行情

func Info

func Info(exCode string) (*SecurityQuote, *sinaPartProfile, error)

Info 请求证券信息 TODO: 拆分成 2 个函数 A 股 var hq_str_sh688047="龙芯中科,106.000,99.680,119.620,119.620,104.500,119.620,0.000,8256723,938310086.000,25600,119.620,7255,119.610,3033,119.600,1767,119.570,6300,119.550,0,0.000,0,0.000,0,0.000,0,0.000,0,0.000,2024-09-30,15:00:01,00,"; var hq_str_sh688047_i="A,lxzk,-0.8200,-1.1566,-0.5900,8.2671,94.6804,40100,27964.4729,27964.4729,0,CNY,-3.2944,-4.6378,60.0600,1,-6.9400,2.1959,-2.3813,133.21,67.89,0.2,龙芯中科,K|D|0|40100|4100,119.62|79.74,20240630|-119064971.81,700.7400|90.1790,|,,1/1,EQA,,0.00,110.610|119.620|99.680,半导体,龙芯中科,7,417392977.82"; 港股 var hq_str_hk00700="TENCENT,腾讯控股,508.500,510.000,514.500,507.000,512.000,2.000,0.392,512.00000,512.50000,7662280393,14986877,0.000,0.000,542.266,345.980,2025/05/27,16:08"; var hq_str_hk00700_i="EQTY,MAIN,542.266,345.980,2.9127,0,0,9189794319,0,9189794319,0,195076015710.40,51819945047.20,5.69,1,腾讯控股,3.700,0.5,100,腾讯控股,50028.230,209573020603.860,216730058624.020,1216841671768.900,,,0.8788,122.528696,,413.391|473.070|518.000,4.756824,2.589747,51,HKD";

func QueryQuoteList added in v0.2.8

func QueryQuoteList(exCodes []string) ([]*SecurityQuote, error)

QueryQuoteList 查询多个证券行情 exCode SH600036 HK00700 exCodes = {"$AMD", "SH600036", "HK09992"}

func QuerySecQuote

func QuerySecQuote(exCode string) (*SecurityQuote, error)

QuerySecQuote 查询证券行情 exCode SH600036 HK00700

func QuoteWs

func QuoteWs(exCodes []string) ([]*SecurityQuote, error)

QuoteWs 通过 websocket 请求多个证券行情信息 exCodes = {"$AMD", "SH600036", "HK09992"}

Jump to

Keyboard shortcuts

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