service

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataType = []string{"lday", "minline", "fzline"}
View Source
var PreprocessType = []string{"parse", "minmax", "standard"}

Functions

func ReflectResponseData

func ReflectResponseData(fields []string, data []interface{}) (body []byte, err error)

重组数据为[]byte以方便映射struct

func StockBasic

func StockBasic(params ShareRequest) (tsData []*entity.Share, err error)

获取基础信息数据,包括股票代码、名称、上市日期、退市日期等

Types

type BalanceSheetService

type BalanceSheetService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetBalanceSheetService

func GetBalanceSheetService() *BalanceSheetService

func (*BalanceSheetService) BalanceSheet

func (ts *BalanceSheetService) BalanceSheet(params SheetRequest) (tsRsp *TushareResponse, err error)

获取上市公司资产负债表,用户需要至少800积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*BalanceSheetService) GetSeqName

func (this *BalanceSheetService) GetSeqName() string

func (*BalanceSheetService) NewEntities

func (this *BalanceSheetService) NewEntities(data []byte) (interface{}, error)

func (*BalanceSheetService) NewEntity

func (this *BalanceSheetService) NewEntity(data []byte) (interface{}, error)

type CashFlowService

type CashFlowService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetCashFlowService

func GetCashFlowService() *CashFlowService

func (*CashFlowService) CashFlow

func (ts *CashFlowService) CashFlow(params SheetRequest) (tsRsp *TushareResponse, err error)

获取新股上市列表数据,单次最大2000条,总量不限制,用户需要至少120积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*CashFlowService) GetSeqName

func (this *CashFlowService) GetSeqName() string

func (*CashFlowService) NewEntities

func (this *CashFlowService) NewEntities(data []byte) (interface{}, error)

func (*CashFlowService) NewEntity

func (this *CashFlowService) NewEntity(data []byte) (interface{}, error)

type ExpressService

type ExpressService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetExpressService

func GetExpressService() *ExpressService

func (*ExpressService) Express

func (ts *ExpressService) Express(params FinanceRequest) (tsRsp *TushareResponse, err error)

获取上市公司业绩快报,用户需要至少800积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*ExpressService) GetSeqName

func (this *ExpressService) GetSeqName() string

func (*ExpressService) NewEntities

func (this *ExpressService) NewEntities(data []byte) (interface{}, error)

func (*ExpressService) NewEntity

func (this *ExpressService) NewEntity(data []byte) (interface{}, error)

type FinanceRequest

type FinanceRequest struct {
	TsCode    string `json:"ts_code,omitempty"`    // str	Y	股票代码
	AnnDate   string `json:"ann_date,omitempty" `  // str	N	公告日期
	StartDate string `json:"start_date,omitempty"` // str	N	公告开始日期
	EndDate   string `json:"end_date,omitempty"`   // str	N	公告结束日期
	Period    string `json:"period,omitempty"`     // str	N	报告期(每个季度最后一天的日期,比如20171231表示年报)
}

type FinancialIndicatorService

type FinancialIndicatorService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetFinancialIndicatorService

func GetFinancialIndicatorService() *FinancialIndicatorService

func (*FinancialIndicatorService) FinancialIndicator

func (ts *FinancialIndicatorService) FinancialIndicator(params FinanceRequest) (tsRsp *TushareResponse, err error)

获取上市公司财务指标数据,为避免服务器压力,现阶段每次请求最多返回60条记录,可通过设置日期多次请求获取更多数据,用户需要至少800积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*FinancialIndicatorService) GetSeqName

func (this *FinancialIndicatorService) GetSeqName() string

func (*FinancialIndicatorService) NewEntities

func (this *FinancialIndicatorService) NewEntities(data []byte) (interface{}, error)

func (*FinancialIndicatorService) NewEntity

func (this *FinancialIndicatorService) NewEntity(data []byte) (interface{}, error)

type ForecastRequest

type ForecastRequest struct {
	TsCode    string `json:"ts_code,omitempty"`    // str	Y	股票代码
	AnnDate   string `json:"ann_date,omitempty"`   // str	N	公告日期
	StartDate string `json:"start_date,omitempty"` // str	N	公告开始日期
	EndDate   string `json:"end_date,omitempty"`   // str	N	公告结束日期
	Period    string `json:"period,omitempty"`     // str	N	报告期(每个季度最后一天的日期,比如20171231表示年报)
	Type      string `json:"type,omitempty"`       // str	N	预告类型(预增/预减/扭亏/首亏/续亏/续盈/略增/略减)
}

type ForecastService

type ForecastService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetForecastService

func GetForecastService() *ForecastService

func (*ForecastService) Forecast

func (ts *ForecastService) Forecast(params ForecastRequest) (tsRsp *TushareResponse, err error)

获取业绩预告数据,用户需要至少800积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*ForecastService) GetSeqName

func (this *ForecastService) GetSeqName() string

func (*ForecastService) NewEntities

func (this *ForecastService) NewEntities(data []byte) (interface{}, error)

func (*ForecastService) NewEntity

func (this *ForecastService) NewEntity(data []byte) (interface{}, error)

type IncomeService

type IncomeService struct {
	service.OrmBaseService
}

* 同步表结构,服务继承基本服务的方法

func GetIncomeService

func GetIncomeService() *IncomeService

func (*IncomeService) GetSeqName

func (this *IncomeService) GetSeqName() string

func (*IncomeService) Income

func (ts *IncomeService) Income(params SheetRequest) (tsRsp *TushareResponse, err error)

获取上市公司财务利润表数据,用户需要至少800积分才可以调取,具体请参阅积分获取办法 https://tushare.pro/document/1?doc_id=13

func (*IncomeService) NewEntities

func (this *IncomeService) NewEntities(data []byte) (interface{}, error)

func (*IncomeService) NewEntity

func (this *IncomeService) NewEntity(data []byte) (interface{}, error)

type PreprocessPara

type PreprocessPara struct {
	entity.ProcessLog
	// contains filtered or unexported fields
}

type ShareRequest

type ShareRequest struct {
	TsCode     string `json:"ts_code,omitempty"`     // N	股票代码
	ListStatus string `json:"list_status,omitempty"` // N	上市状态: L上市 D退市 P暂停上市,默认L
	Exchange   string `json:"exchange,omitempty"`    // N	交易所 SSE上交所 SZSE深交所 HKEX港交所(未上线)
	IsHs       string `json:"is_hs,omitempty"`       // N  是否沪深港通标的,N否 H沪股通 S深股通
}

type SheetRequest

type SheetRequest struct {
	TsCode     string `json:"ts_code,omitempty"`     // str	Y	股票代码
	AnnDate    string `json:"ann_date,omitempty"`    // str	N	公告日期
	StartDate  string `json:"start_date,omitempty"`  // str	N	公告开始日期
	EndDate    string `json:"end_date,omitempty"`    // str	N	公告结束日期
	Period     string `json:"period,omitempty"`      // str	N	报告期(每个季度最后一天的日期,比如20171231表示年报)
	ReportType string `json:"report_type,omitempty"` // str	N	报告类型: 参考下表说明
	CompType   string `json:"comp_type,omitempty"`   // str	N	公司类型:1一般工商业 2银行 3保险 4证券
}

主要报表类型说明 代码 类型 说明 1 合并报表 上市公司最新报表(默认) 2 单季合并 单一季度的合并报表 3 调整单季合并表 调整后的单季合并报表(如果有) 4 调整合并报表 本年度公布上年同期的财务报表数据,报告期为上年度 5 调整前合并报表 数据发生变更,将原数据进行保留,即调整前的原数据 6 母公司报表 该公司母公司的财务报表数据 7 母公司单季表 母公司的单季度表 8 母公司调整单季表 母公司调整后的单季表 9 母公司调整表 该公司母公司的本年度公布上年同期的财务报表数据 10 母公司调整前报表 母公司调整之前的原始财务报表数据 11 调整前合并报表 调整之前合并报表原数据 12 母公司调整前报表 母公司报表发生变更前保留的原数据

type TushareData

type TushareData struct {
	Fields []string        `json:"fields,omitempty"`
	Items  [][]interface{} `json:"items,omitempty"`
}

* code: 接口返回码,2002表示权限问题。

msg:错误信息,比如“系统内部错误”,“没有权限”等

data:数据,data里包含fields和items字段,分别为字段和数据内容

type TushareRequest

type TushareRequest struct {
	ApiName string      `json:"api_name,omitempty"`
	Token   string      `json:"token,omitempty"`
	Params  interface{} `json:"params,omitempty"`
	Fields  string      `json:"fields,omitempty"`
}

func (*TushareRequest) CheckValid

func (ts *TushareRequest) CheckValid() error

type TushareResponse

type TushareResponse struct {
	Code int          `json:"code,omitempty"`
	Msg  string       `json:"msg,omitempty"`
	Data *TushareData `json:"data,omitempty"`
}

func FastPost

func FastPost(tushareRequest *TushareRequest) (*TushareResponse, error)

func Post

func Post(tushareRequest *TushareRequest) (tsRsp *TushareResponse, err error)

func (*TushareResponse) CheckValid

func (ts *TushareResponse) CheckValid() error

Jump to

Keyboard shortcuts

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