ticker

package
v0.0.0-...-e43266c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackfillTrades

func BackfillTrades(
	s *tickerdb.TickerSession,
	c *horizonclient.Client,
	l *hlog.Entry,
	numHours int,
	limit int,
) error

BackfillTrades ingest the most recent trades (limited to numDays) directly from Horizon into the database.

func GenerateAssetsFile

func GenerateAssetsFile(s *tickerdb.TickerSession, l *hlog.Entry, filename string) error

GenerateAssetsFile generates a file with the info about all valid scraped Assets

func GenerateMarketSummaryFile

func GenerateMarketSummaryFile(s *tickerdb.TickerSession, l *hlog.Entry, filename string, forCMC bool) error

GenerateMarketSummaryFile generates a MarketSummary with the statistics for all valid markets within the database and outputs it to <filename>.

func RefreshAssets

func RefreshAssets(s *tickerdb.TickerSession, c *horizonclient.Client, l *hlog.Entry) (err error)

RefreshAssets scrapes the most recent asset list and ingests then into the db.

func RefreshOrderbookEntries

func RefreshOrderbookEntries(s *tickerdb.TickerSession, c *horizonclient.Client, l *hlog.Entry) error

RefreshOrderbookEntries updates the orderbook entries for the relevant markets that were active in the past 7-day interval

func StartGraphQLServer

func StartGraphQLServer(s *tickerdb.TickerSession, l *hlog.Entry, port string)

func StreamTrades

func StreamTrades(
	ctx context.Context,
	s *tickerdb.TickerSession,
	c *horizonclient.Client,
	l *hlog.Entry,
) error

StreamTrades constantly streams and ingests new trades directly from horizon.

Types

type Asset

type Asset struct {
	scraper.FinalAsset

	LastValidTimestamp string `json:"last_valid"`
}

Asset represent the aggregated data for a given asset.

type AssetSummary

type AssetSummary struct {
	GeneratedAt        int64   `json:"generated_at"`
	GeneratedAtRFC3339 string  `json:"generated_at_rfc3339"`
	Assets             []Asset `json:"assets"`
}

Asset Sumary represents the collection of valid assets.

type MarketStats

type MarketStats struct {
	TradePairName    string  `json:"name"`
	BaseVolume24h    float64 `json:"base_volume"`
	CounterVolume24h float64 `json:"counter_volume"`
	TradeCount24h    int64   `json:"trade_count"`
	Open24h          float64 `json:"open"`
	Low24h           float64 `json:"low"`
	High24h          float64 `json:"high"`
	Change24h        float64 `json:"change"`
	BaseVolume7d     float64 `json:"base_volume_7d"`
	CounterVolume7d  float64 `json:"counter_volume_7d"`
	TradeCount7d     int64   `json:"trade_count_7d"`
	Open7d           float64 `json:"open_7d"`
	Low7d            float64 `json:"low_7d"`
	High7d           float64 `json:"high_7d"`
	Change7d         float64 `json:"change_7d"`
	Price            float64 `json:"price"`
	Close            float64 `json:"close"`
	CloseTime        string  `json:"close_time"`
	BidCount         int     `json:"bid_count"`
	BidVolume        float64 `json:"bid_volume"`
	BidMax           float64 `json:"bid_max"`
	AskCount         int     `json:"ask_count"`
	AskVolume        float64 `json:"ask_volume"`
	AskMin           float64 `json:"ask_min"`
	Spread           float64 `json:"spread"`
	SpreadMidPoint   float64 `json:"spread_mid_point"`
}

Market stats represents the statistics of a specific market (identified by a trade pair).

type MarketSummary

type MarketSummary struct {
	GeneratedAt        int64         `json:"generated_at"`
	GeneratedAtRFC3339 string        `json:"generated_at_rfc3339"`
	Pairs              []MarketStats `json:"pairs"`
}

MarketSummary represents a summary of statistics of all valid markets within a given period of time.

func GenerateMarketSummary

func GenerateMarketSummary(s *tickerdb.TickerSession) (ms MarketSummary, err error)

GenerateMarketSummary outputs a MarketSummary with the statistics for all valid markets within the database.

Directories

Path Synopsis
gql

Jump to

Keyboard shortcuts

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