optionscrapers

package
v1.0.1-tekton-ci-beta-4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exchanges map[string]dia.Exchange

Functions

This section is empty.

Types

type AllOKExOptionsScrapers

type AllOKExOptionsScrapers struct {
	Scrapers []*OKExOptionsScraper
	Markets  []string
	// contains filtered or unexported fields
}

func (*AllOKExOptionsScrapers) GetAndStoreOptionsMeta

func (s *AllOKExOptionsScrapers) GetAndStoreOptionsMeta() (err error)

func (*AllOKExOptionsScrapers) MetaOnOptionIsAvailable

func (s *AllOKExOptionsScrapers) MetaOnOptionIsAvailable(option OKExInstrument) (available bool, err error)

type OKExInstrument

type OKExInstrument struct {
	InstrumentName        string `json:"instrument_id"`
	Underlying            string `json:"underlying"`
	SettlementCurrency    string `json:"settlement_currency"`
	MinTradeAmount        string `json:"contract_val"`
	OptionType            string `json:"option_type"`
	Strike                string `json:"strike"`
	TickSize              string `json:"tick_size"`
	LotSize               string `json:"lot_size"`
	Listing               string `json:"listing"`
	Expiration            string `json:"delivery"`
	State                 string `json:"state"`
	TradingStartTimestamp string `json:"trading_start_time"`
}

type OKExInstrumentDetail

type OKExInstrumentDetail struct {
	Category           string    `json:"category"`
	ContractVal        string    `json:"contract_val"`
	Delivery           time.Time `json:"delivery"`
	InstrumentID       string    `json:"instrument_id"`
	Listing            time.Time `json:"listing"`
	LotSize            string    `json:"lot_size"`
	OptionType         string    `json:"option_type"`
	SettlementCurrency string    `json:"settlement_currency"`
	State              string    `json:"state"`
	Strike             string    `json:"strike"`
	TickSize           string    `json:"tick_size"`
	Timestamp          time.Time `json:"timestamp"`
	TradingStartTime   time.Time `json:"trading_start_time"`
	Underlying         string    `json:"underlying"`
}

type OKExInstrumentDetails

type OKExInstrumentDetails []OKExInstrumentDetail

type OKExInstruments

type OKExInstruments struct {
	Result []OKExInstrument `json:"result"`
}

type OKExOptionState

type OKExOptionState int
const (
	PreOpen OKExOptionState = iota + 1
	Live
	Suspended
	Settlement
)

type OKExOptionsScraper

type OKExOptionsScraper struct {
	Markets []string

	// OKEx Options endpoint is a REST one and you are limited to 20 requests per 2 seconds. So you have
	// to throttle your polling frequency. This is in seconds. So you can have at most 10
	// markets running at the same time on the same ip address
	PollFrequency      int8
	ScraperIsRunning   bool
	ScraperIsRunningMu sync.Mutex
	// optionsWaitGroup   *sync.WaitGroup
	DataStore *models.DB

	Ratelimiter *rate.Limiter
	// contains filtered or unexported fields
}

func NewOKExOptionsScraper

func NewOKExOptionsScraper(pollFreq int8) *OKExOptionsScraper

func (*OKExOptionsScraper) Channel

func (s *OKExOptionsScraper) Channel() chan *dia.OptionOrderbookDatum

func (*OKExOptionsScraper) FetchInstruments

func (s *OKExOptionsScraper) FetchInstruments()

func (*OKExOptionsScraper) Scrape

func (s *OKExOptionsScraper) Scrape()

func (*OKExOptionsScraper) ScrapeInstrument

func (s *OKExOptionsScraper) ScrapeInstrument(market string)

type OptionsScraper

type OptionsScraper interface {
	//io.Closer
	FetchInstruments()
	Scrape()
	// Channel returns a channel that can be used to receive trades
	Channel() chan *dia.OptionOrderbookDatum
}
OptionsScraper provides common methods needed to get Option orderBook information from

exchange APIs.

func New

func New(exchange string, key string, secret string) OptionsScraper

Jump to

Keyboard shortcuts

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