Documentation
¶
Index ¶
- Variables
- type AllOKExOptionsScrapers
- type DeribitETHOptionScraper
- func (scraper *DeribitETHOptionScraper) Channel() chan *dia.OptionOrderbookDatum
- func (scraper *DeribitETHOptionScraper) FetchInstruments()
- func (scraper *DeribitETHOptionScraper) GetAndStoreOptionsMeta() (err error)
- func (scraper *DeribitETHOptionScraper) MetaOnOptionIsAvailable(option DeribitInstrument) (available bool, err error)
- func (scraper *DeribitETHOptionScraper) Scrape()
- type DeribitInstrument
- type DeribitInstrumentsResponse
- type DeribitOptionResponse
- type DeribitOptionsResponse
- type DeribitParam
- type DeribitRequest
- type OKExInstrument
- type OKExInstrumentDetail
- type OKExInstrumentDetails
- type OKExInstruments
- type OKExOptionState
- type OKExOptionsScraper
- func (s *OKExOptionsScraper) Channel() chan *dia.OptionOrderbookDatum
- func (s *OKExOptionsScraper) FetchInstruments()
- func (s *OKExOptionsScraper) GetAndStoreOptionsMeta() (err error)
- func (s *OKExOptionsScraper) MetaOnOptionIsAvailable(option OKExInstrument) (available bool, err error)
- func (s *OKExOptionsScraper) Scrape()
- func (s *OKExOptionsScraper) ScrapeInstrument(market string)
- type OptionAttrs
- type OptionsScraper
- type OpynInstrumentsResponse
- type OpynOptionScraper
- func (scraper *OpynOptionScraper) Channel() chan *dia.OptionOrderbookDatum
- func (scraper *OpynOptionScraper) FetchInstruments()
- func (scraper *OpynOptionScraper) FetchMarkets()
- func (scraper *OpynOptionScraper) GetAndStoreOptionsMeta() (err error)
- func (scraper *OpynOptionScraper) MetaOnOptionIsAvailable(option OptionAttrs) (available bool, err error)
- func (scraper *OpynOptionScraper) Scrape()
- type PremiaScraper
Constants ¶
This section is empty.
Variables ¶
View Source
var Exchanges map[string]dia.Exchange
View Source
var OtokenControllerAddress = common.HexToAddress("0x4ccc2339F87F6c59c6893E1A678c2266cA58dC72")
View Source
var OtokenFactoryAddress = common.HexToAddress("0x7C06792Af1632E77cb27a558Dc0885338F4Bdf8E")
View Source
var PremiaMarketAddress = common.HexToAddress("0x45eBD0FC72E2056adb5c864Ea6F151ad943d94af")
View Source
var PremiaOptionAddress = common.HexToAddress("0x5920cb60B1c62dC69467bf7c6EDFcFb3f98548c0")
Functions ¶
This section is empty.
Types ¶
type AllOKExOptionsScrapers ¶
type AllOKExOptionsScrapers struct {
Scrapers []*OKExOptionsScraper
Markets []string
// contains filtered or unexported fields
}
type DeribitETHOptionScraper ¶
type DeribitETHOptionScraper struct {
PollFrequency int8
ScraperIsRunning bool
ScraperIsRunningMu sync.Mutex
DataStore *models.DB
Ratelimiter *rate.Limiter
// contains filtered or unexported fields
}
func NewDeribitETHOptionScraper ¶
func NewDeribitETHOptionScraper() *DeribitETHOptionScraper
func (*DeribitETHOptionScraper) Channel ¶
func (scraper *DeribitETHOptionScraper) Channel() chan *dia.OptionOrderbookDatum
func (*DeribitETHOptionScraper) FetchInstruments ¶
func (scraper *DeribitETHOptionScraper) FetchInstruments()
func (*DeribitETHOptionScraper) GetAndStoreOptionsMeta ¶
func (scraper *DeribitETHOptionScraper) GetAndStoreOptionsMeta() (err error)
func (*DeribitETHOptionScraper) MetaOnOptionIsAvailable ¶
func (scraper *DeribitETHOptionScraper) MetaOnOptionIsAvailable(option DeribitInstrument) (available bool, err error)
func (*DeribitETHOptionScraper) Scrape ¶
func (scraper *DeribitETHOptionScraper) Scrape()
type DeribitInstrument ¶
type DeribitInstrument struct {
TickSize float64 `json:"tick_size"`
TakerCommission float64 `json:"taker_commission"`
Strike float64 `json:"strike,omitempty"`
SettlementPeriod string `json:"settlement_period"`
QuoteCurrency string `json:"quote_currency"`
OptionType string `json:"option_type,omitempty"`
MinTradeAmount int `json:"min_trade_amount"`
MakerCommission float64 `json:"maker_commission"`
Kind string `json:"kind"`
IsActive bool `json:"is_active"`
InstrumentName string `json:"instrument_name"`
ExpirationTimestamp int64 `json:"expiration_timestamp"`
CreationTimestamp int64 `json:"creation_timestamp"`
ContractSize float64 `json:"contract_size"`
BlockTradeCommission float64 `json:"block_trade_commission"`
BaseCurrency string `json:"base_currency"`
MaxLiquidationCommission float64 `json:"max_liquidation_commission,omitempty"`
MaxLeverage int `json:"max_leverage,omitempty"`
}
type DeribitOptionResponse ¶
type DeribitOptionResponse struct {
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params struct {
Channel string `json:"channel"`
Data struct {
Asks [][]interface{} `json:"asks,omitempty"`
Bids [][]interface{} `json:"bids,omitempty"`
ChangeID int64 `json:"change_id"`
InstrumentName string `json:"instrument_name"`
PrevChangeID int64 `json:"prev_change_id"`
Timestamp int64 `json:"timestamp"`
Type string `json:"type"`
} `json:"data"`
} `json:"params"`
}
type DeribitOptionsResponse ¶
type DeribitParam ¶
type DeribitParam struct {
Channels []string `json:"channels"`
}
type DeribitRequest ¶
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) GetAndStoreOptionsMeta ¶
func (s *OKExOptionsScraper) GetAndStoreOptionsMeta() (err error)
func (*OKExOptionsScraper) MetaOnOptionIsAvailable ¶
func (s *OKExOptionsScraper) MetaOnOptionIsAvailable(option OKExInstrument) (available bool, err error)
func (*OKExOptionsScraper) Scrape ¶
func (s *OKExOptionsScraper) Scrape()
func (*OKExOptionsScraper) ScrapeInstrument ¶
func (s *OKExOptionsScraper) ScrapeInstrument(market string)
type OptionAttrs ¶
type OptionAttrs struct {
// contains filtered or unexported fields
}
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.
type OpynInstrumentsResponse ¶
type OpynInstrumentsResponse struct {
Bids struct {
Total int `json:"total"`
Page int `json:"page"`
PerPage int `json:"perPage"`
Records []struct {
Order struct {
Signature struct {
SignatureType int `json:"signatureType"`
R string `json:"r"`
S string `json:"s"`
V int `json:"v"`
} `json:"signature"`
Sender string `json:"sender"`
Maker string `json:"maker"`
Taker string `json:"taker"`
TakerTokenFeeAmount string `json:"takerTokenFeeAmount"`
MakerAmount string `json:"makerAmount"`
TakerAmount string `json:"takerAmount"`
MakerToken string `json:"makerToken"`
TakerToken string `json:"takerToken"`
Salt string `json:"salt"`
VerifyingContract string `json:"verifyingContract"`
FeeRecipient string `json:"feeRecipient"`
Expiry string `json:"expiry"`
ChainID int `json:"chainId"`
Pool string `json:"pool"`
} `json:"order"`
MetaData struct {
OrderHash string `json:"orderHash"`
RemainingFillableTakerAmount string `json:"remainingFillableTakerAmount"`
CreatedAt time.Time `json:"createdAt"`
} `json:"metaData"`
} `json:"records"`
} `json:"bids"`
Asks struct {
Total int `json:"total"`
Page int `json:"page"`
PerPage int `json:"perPage"`
Records []struct {
Order struct {
Signature struct {
SignatureType int `json:"signatureType"`
R string `json:"r"`
S string `json:"s"`
V int `json:"v"`
} `json:"signature"`
Sender string `json:"sender"`
Maker string `json:"maker"`
Taker string `json:"taker"`
TakerTokenFeeAmount string `json:"takerTokenFeeAmount"`
MakerAmount string `json:"makerAmount"`
TakerAmount string `json:"takerAmount"`
MakerToken string `json:"makerToken"`
TakerToken string `json:"takerToken"`
Salt string `json:"salt"`
VerifyingContract string `json:"verifyingContract"`
FeeRecipient string `json:"feeRecipient"`
Expiry string `json:"expiry"`
ChainID int `json:"chainId"`
Pool string `json:"pool"`
} `json:"order"`
MetaData struct {
OrderHash string `json:"orderHash"`
RemainingFillableTakerAmount string `json:"remainingFillableTakerAmount"`
CreatedAt time.Time `json:"createdAt"`
} `json:"metaData"`
} `json:"records"`
} `json:"asks"`
}
type OpynOptionScraper ¶
type OpynOptionScraper struct {
WsClient *ethclient.Client
RestClient *ethclient.Client
PollFrequency int8
ScraperIsRunning bool
ScraperIsRunningMu sync.Mutex
DataStore *models.DB
Ratelimiter *rate.Limiter
// contains filtered or unexported fields
}
func NewOpynETHOptionScraper ¶
func NewOpynETHOptionScraper() *OpynOptionScraper
func (*OpynOptionScraper) Channel ¶
func (scraper *OpynOptionScraper) Channel() chan *dia.OptionOrderbookDatum
func (*OpynOptionScraper) FetchInstruments ¶
func (scraper *OpynOptionScraper) FetchInstruments()
func (*OpynOptionScraper) FetchMarkets ¶
func (scraper *OpynOptionScraper) FetchMarkets()
func (*OpynOptionScraper) GetAndStoreOptionsMeta ¶
func (scraper *OpynOptionScraper) GetAndStoreOptionsMeta() (err error)
func (*OpynOptionScraper) MetaOnOptionIsAvailable ¶
func (scraper *OpynOptionScraper) MetaOnOptionIsAvailable(option OptionAttrs) (available bool, err error)
func (*OpynOptionScraper) Scrape ¶
func (scraper *OpynOptionScraper) Scrape()
type PremiaScraper ¶
type PremiaScraper struct {
WsClient *ethclient.Client
RestClient *ethclient.Client
PollFrequency int8
ScraperIsRunning bool
ScraperIsRunningMu sync.Mutex
DataStore *models.DB
Ratelimiter *rate.Limiter
// contains filtered or unexported fields
}
func NewPremiaETHOptionScraper ¶
func NewPremiaETHOptionScraper() *PremiaScraper
func (*PremiaScraper) Channel ¶
func (scrapper *PremiaScraper) Channel() chan *dia.OptionOrderbookDatum
func (*PremiaScraper) FetchInstruments ¶
func (scrapper *PremiaScraper) FetchInstruments()
func (*PremiaScraper) FetchMarkets ¶
func (scrapper *PremiaScraper) FetchMarkets()
func (*PremiaScraper) Scrape ¶
func (scrapper *PremiaScraper) Scrape()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.