Documentation ¶
Index ¶
- func SubscribeOrderbook(exchange string, p currency.Pair, a asset.Item) (dispatch.Pipe, error)
- func SubscribeToExchangeOrderbooks(exchange string) (dispatch.Pipe, error)
- type Base
- func (b *Base) Process() error
- func (b *Base) SimulateOrder(amount float64, buy bool) *OrderSimulationResult
- func (b *Base) TotalAsksAmount() (amountCollated, total float64)
- func (b *Base) TotalBidsAmount() (amountCollated, total float64)
- func (b *Base) Update(bids, asks []Item)
- func (b *Base) Verify()
- func (b *Base) WhaleBomb(priceTarget float64, buy bool) (*WhaleBombResult, error)
- type Book
- type ByPrice
- type Item
- type OrderSimulationResult
- type Service
- type WhaleBombResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubscribeOrderbook ¶
SubscribeOrderbook subcribes to an orderbook and returns a communication channel to stream orderbook data updates
Types ¶
type Base ¶
type Base struct { Pair currency.Pair `json:"pair"` Bids []Item `json:"bids"` Asks []Item `json:"asks"` LastUpdated time.Time `json:"lastUpdated"` LastUpdateID int64 `json:"lastUpdateId"` AssetType asset.Item `json:"assetType"` ExchangeName string `json:"exchangeName"` }
Base holds the fields for the orderbook base
func Get ¶
Get checks and returns the orderbook given an exchange name and currency pair if it exists
func (*Base) Process ¶
Process processes incoming orderbooks, creating or updating the orderbook list
func (*Base) SimulateOrder ¶
func (b *Base) SimulateOrder(amount float64, buy bool) *OrderSimulationResult
SimulateOrder simulates an order
func (*Base) TotalAsksAmount ¶
TotalAsksAmount returns the total amount of asks and the total orderbook asks value
func (*Base) TotalBidsAmount ¶
TotalBidsAmount returns the total amount of bids and the total orderbook bids value
type Item ¶
type Item struct { Amount float64 Price float64 ID int64 // Contract variables LiquidationOrders int64 OrderCount int64 }
Item stores the amount and price values
type OrderSimulationResult ¶
type OrderSimulationResult WhaleBombResult
OrderSimulationResult returns the order simulation result
type Service ¶
type Service struct { Books map[string]map[*currency.Item]map[*currency.Item]map[asset.Item]*Book Exchange map[string]uuid.UUID sync.RWMutex // contains filtered or unexported fields }
Service holds orderbook information for each individual exchange
func (*Service) GetAssociations ¶
GetAssociations links a singular book with it's dispatch associations
func (*Service) SetNewData ¶
SetNewData sets new data