findata

package
v0.0.0-...-85ff41b Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: GPL-3.0 Imports: 28 Imported by: 0

README

FinData

Financial data from 3rd party provider like yahoo.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Supply
	TagDynamicSupply = "DynamicSupply"

	// Stable Coin
	TagFiatAnchored = "FiatAnchored"

	// Main net
	TagNative = "native"
	TagERC20  = "erc20" // Ethereum ERC20 token
	TagWRC20  = "wrc20" // WanChain WRC20 token
	TagDapp   = "dapp"

	// Industry
	TagCrossChain    = "CrossChain"
	TagPublicChain   = "PublicChain"
	TagSideChain     = "SideChain"
	TagCloudCompute  = "CloudCompute"
	TagOS            = "OS"
	TagIoT           = "IoT"
	TagIM            = "IM"
	TagBigData       = "BigData"
	TagAI            = "AI"
	TagCopyright     = "Copyright"
	TagStorage       = "Storage"
	TagAnonymous     = "Anonymous"
	TagContent       = "Content"
	TagExchange      = "Exchange"
	TagGame          = "Game"
	TagSmartContract = "SmartContract"
	TagNotary        = "Notary" // 公证防伪

	ErrNotIncludedYet = gerrors.New("Not included yet")
	ErrTryAgainLater  = gerrors.New("Try again later, wait network download done")
	ErrNameNotFound   = gerrors.New("UniqueName not found") // 由于平台上某些币的登记名字差别、有没有登记的差别,导致找不到对应页面
	ErrDDosProtection = gerrors.New("DDos Protection")      // http access too frequently
	ErrNoHistoryData  = gerrors.New("No history data")      // 在CMC上某些币有概况,但是历史数据没有登记,比如fcoin-token
	ErrNoIcoInfo      = gerrors.New("No ICO info")          // feixiaohao上有些币的ICO信息未收录
)
View Source
var BTC_USDT_1min_spot_binance = `` /* 1173076-byte string literal not displayed */
View Source
var (
	DowJonesOpenDate, _ = gtime.NewDate(1896, 5, 26)
)
View Source
var MaoTaiKline = `` /* 30737-byte string literal not displayed */

this data is from tushare python library

Functions

func CCGetAll

func CCGetAll(proxy string, timeout time.Duration) ([]fintypes2.Asset, error)

func CCGetKline

func CCGetKline(symbol string, since *time.Time, proxy string) (*fintypes2.CandleSticks, error)

func Convert

func Convert(r *ecbrates.Rates, value float64, from, to ecbrates.Currency) (float64, error)

Convert a value "from" one Currency -> "to" other Currency

func NewTestKlineMaotai

func NewTestKlineMaotai() (*fintypes.CandleSticks, error)

func StockListAll

func StockListAll() (stocks []fintypes.PairP, indexes []fintypes.PairP, err error)

Types

type APIEnvelope

type APIEnvelope map[string]APIMessage

APIEnvelope is the wrapping envelope around a Yahoo Finance API response

type APIError

type APIError struct {
	Code        string `json:"code"`        // "argument-error"
	Description string `json:"description"` // "Missing value for the \"symbols\" argument"
}

APIError represents an error response

type APIMessage

type APIMessage struct {
	Error *APIError `json:"error,omitempty"`
}

APIMessage represents a standard API response

type AssetDataSource

type AssetDataSource interface {
	GetDetails() ([]AssetDetail, error)
}

func NewAssetDataSource

func NewAssetDataSource(platform fintypes.Platform, apiKey, proxy string) (AssetDataSource, error)

type AssetDetail

type AssetDetail struct {
	Asset             fintypes.Asset `json:"Asset" bson:"_id"`
	MaxSupply         float64        `json:"MaxSupply,omitempty" bson:"MaxSupply,omitempty"`
	TotalSupply       float64        `json:"TotalSupply,omitempty" bson:"TotalSupply,omitempty"`
	CirculatingSupply float64        `json:"CirculatingSupply,omitempty" bson:"CirculatingSupply,omitempty"`
	ContractAddress   string         `json:"ContractAddress,omitempty" bson:"ContractAddress,omitempty"`

	// not useful for now
	Tags            []string            `json:"Tags,omitempty" bson:"Tags,omitempty"`
	ListedExchanges map[string][]string `json:"ListedExchanges,omitempty" bson:"ListedExchanges,omitempty"`

	// links
	Websites    []string `json:"Websites,omitempty" bson:"Websites,omitempty"`
	Explorers   []string `json:"Explorers,omitempty" bson:"Explorers,omitempty"`
	TechDocs    []string `json:"TechDocs,omitempty" bson:"TechDocs,omitempty"`
	SocialMedia []string `json:"SocialMedia,omitempty" bson:"SocialMedia,omitempty"`
	Exchanges   []string `json:"Exchanges,omitempty" bson:"Exchanges,omitempty"`
}

func (*AssetDetail) AppendSocialMedia

func (c *AssetDetail) AppendSocialMedia(newurls ...string)

func (*AssetDetail) GetSocialMediaContains

func (c *AssetDetail) GetSocialMediaContains(contain string) []string

func (*AssetDetail) Github

func (c *AssetDetail) Github() string

func (*AssetDetail) String

func (c *AssetDetail) String() string

func (*AssetDetail) TechDoc

func (c *AssetDetail) TechDoc() string

func (*AssetDetail) Update

func (c *AssetDetail) Update(newinfo AssetDetail)

func (*AssetDetail) Website

func (c *AssetDetail) Website() string

type CC

type CC struct {
	// contains filtered or unexported fields
}

func NewCryptoCompare

func NewCryptoCompare(proxy string) (*CC, error)

func (*CC) GetKlineEx

func (cc *CC) GetKlineEx(platform fintypes2.Platform, market fintypes2.Market, target fintypes2.Pair, period fintypes2.Period, since *time.Time) (*fintypes2.CandleSticks, error)

func (*CC) GetKlineProviderInfo

func (cc *CC) GetKlineProviderInfo() (*fintypes2.KlineProviderInfo, error)

type CgkClient

type CgkClient struct {
	// contains filtered or unexported fields
}

func (*CgkClient) GetAssets

func (c *CgkClient) GetAssets() ([]fintypes.Asset, error)

func (*CgkClient) GetDetail

func (c *CgkClient) GetDetail(coin fintypes.Asset) (*AssetDetail, error)

func (*CgkClient) SetProxy

func (c *CgkClient) SetProxy(proxy string)

type CmcClient

type CmcClient struct {
	// contains filtered or unexported fields
}

func (*CmcClient) GetDetails

func (c *CmcClient) GetDetails() ([]AssetDetail, error)

type Ecb

type Ecb struct{}

func NewEcb

func NewEcb() *Ecb

func (*Ecb) GetCandleSticks

func (ecb *Ecb) GetCandleSticks() (map[fintypes.Pair]fintypes.CandleSticks, error)

func (*Ecb) GetCurrentTicks

func (ecb *Ecb) GetCurrentTicks() (map[fintypes.Pair]gdecimal.Decimal, error)

type GoldMonthlyPrice

type GoldMonthlyPrice struct {
	YearMonth int              `bson:"_id"`
	Price     gdecimal.Decimal `bson:"Price"`
}

func GetGoldKline

func GetGoldKline() ([]GoldMonthlyPrice, *fintypes.CandleSticks, error)

type Ico

type Ico struct {
	AvgPrice float64          `json:"AvgPrice"` // ICO发行价,如果有多个价格则选择均价
	Amount   float64          `json:"Amount"`   // 募资总额
	Date     *gtime.DateRange `json:"Date"`
}

type StockDetail

type StockDetail struct {
	Name        string
	Symbol      string
	Exchange    fintypes.Platform
	TotalSupply int
}

type YFAPI

type YFAPI struct {
	// contains filtered or unexported fields
}

APIError represents an error response

func NewYahooFinance

func NewYahooFinance(proxy string) (*YFAPI, error)

func (*YFAPI) GetKlineEx

func (yf *YFAPI) GetKlineEx(platform fintypes2.Platform, market fintypes2.Market, target fintypes2.Pair, period fintypes2.Period, since *time.Time) (*fintypes2.CandleSticks, error)

index Pair samples: DJI/USD@open, SHH/CNY@open

func (*YFAPI) GetKlineProviderInfo

func (yf *YFAPI) GetKlineProviderInfo() (*fintypes2.KlineProviderInfo, error)

Jump to

Keyboard shortcuts

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