Documentation ¶
Index ¶
- func Exchanges() map[string]ExchangeContainer
- func MakeExchange(exchangeType string, simMode bool) (api.Exchange, error)
- func MakeFeedPair(dataTypeA, dataFeedAUrl, dataTypeB, dataFeedBUrl string) (*api.FeedPair, error)
- func MakeFillLogger() api.FillHandler
- func MakeFillTracker(pair *model.TradingPair, threadTracker *multithreading.ThreadTracker, ...) api.FillTracker
- func MakeIntervalTimeController(tickInterval time.Duration, maxTickDelayMillis int64) api.TimeController
- func MakePriceFeed(feedType string, url string) (api.PriceFeed, error)
- func MakeStrategy(sdex *SDEX, tradingPair *model.TradingPair, assetBase *horizon.Asset, ...) (api.Strategy, error)
- func MakeTradingExchange(exchangeType string, apiKeys []api.ExchangeAPIKey, simMode bool) (api.Exchange, error)
- func Strategies() map[string]StrategyContainer
- type Balance
- type ExchangeContainer
- type FillLogger
- type FillTracker
- type IntervalTimeController
- type Liabilities
- type SDEX
- func (sdex *SDEX) AddLiabilities(selling horizon.Asset, buying horizon.Asset, incrementalSell float64, ...)
- func (sdex *SDEX) AvailableCapacity(asset horizon.Asset, incrementalNativeAmountRaw float64) (*Liabilities, error)
- func (sdex *SDEX) ComputeIncrementalNativeAmountRaw(isNewOffer bool) float64
- func (sdex *SDEX) CreateBuyOffer(base horizon.Asset, counter horizon.Asset, price float64, amount float64, ...) (*build.ManageOfferBuilder, error)
- func (sdex *SDEX) CreateSellOffer(base horizon.Asset, counter horizon.Asset, price float64, amount float64, ...) (*build.ManageOfferBuilder, error)
- func (sdex *SDEX) DeleteAllOffers(offers []horizon.Offer) []build.TransactionMutator
- func (sdex *SDEX) DeleteOffer(offer horizon.Offer) build.ManageOfferBuilder
- func (sdex *SDEX) GetLatestTradeCursor() (interface{}, error)
- func (sdex *SDEX) GetOrderConstraints(pair *model.TradingPair) *model.OrderConstraints
- func (sdex *SDEX) GetTradeHistory(pair model.TradingPair, maybeCursorStart interface{}, ...) (*api.TradeHistoryResult, error)
- func (sdex *SDEX) LogAllLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset)
- func (sdex *SDEX) ModifyBuyOffer(offer horizon.Offer, price float64, amount float64, ...) (*build.ManageOfferBuilder, error)
- func (sdex *SDEX) ModifySellOffer(offer horizon.Offer, price float64, amount float64, ...) (*build.ManageOfferBuilder, error)
- func (sdex *SDEX) ParseOfferAmount(amt string) (float64, error)
- func (sdex *SDEX) RecomputeAndLogCachedLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset)
- func (sdex *SDEX) ResetCachedBalances()
- func (sdex *SDEX) ResetCachedLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset) error
- func (sdex *SDEX) SubmitOps(ops []build.TransactionMutator, asyncCallback func(hash string, e error)) error
- type StrategyContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exchanges ¶
func Exchanges() map[string]ExchangeContainer
Exchanges returns the list of exchanges
func MakeExchange ¶
MakeExchange is a factory method to make an exchange based on a given type
func MakeFeedPair ¶
MakeFeedPair is the factory method that we expose
func MakeFillLogger ¶ added in v1.3.0
func MakeFillLogger() api.FillHandler
MakeFillLogger is a factory method
func MakeFillTracker ¶ added in v1.3.0
func MakeFillTracker( pair *model.TradingPair, threadTracker *multithreading.ThreadTracker, fillTrackable api.FillTrackable, fillTrackerSleepMillis uint32, ) api.FillTracker
MakeFillTracker impl.
func MakeIntervalTimeController ¶ added in v1.2.0
func MakeIntervalTimeController(tickInterval time.Duration, maxTickDelayMillis int64) api.TimeController
MakeIntervalTimeController is a factory method
func MakePriceFeed ¶
MakePriceFeed makes a PriceFeed
func MakeStrategy ¶
func MakeStrategy( sdex *SDEX, tradingPair *model.TradingPair, assetBase *horizon.Asset, assetQuote *horizon.Asset, strategy string, stratConfigPath string, simMode bool, ) (api.Strategy, error)
MakeStrategy makes a strategy
func MakeTradingExchange ¶ added in v1.3.0
func MakeTradingExchange(exchangeType string, apiKeys []api.ExchangeAPIKey, simMode bool) (api.Exchange, error)
MakeTradingExchange is a factory method to make an exchange based on a given type
func Strategies ¶
func Strategies() map[string]StrategyContainer
Strategies returns the list of strategies along with metadata
Types ¶
type ExchangeContainer ¶ added in v1.3.0
type ExchangeContainer struct { SortOrder uint8 Description string TradeEnabled bool // contains filtered or unexported fields }
ExchangeContainer contains the exchange factory method along with some metadata
type FillLogger ¶ added in v1.3.0
type FillLogger struct{}
FillLogger is a FillHandler that logs fills
func (*FillLogger) HandleFill ¶ added in v1.3.0
func (f *FillLogger) HandleFill(trade model.Trade) error
HandleFill impl.
type FillTracker ¶ added in v1.3.0
type FillTracker struct {
// contains filtered or unexported fields
}
FillTracker tracks fills
func (*FillTracker) GetPair ¶ added in v1.3.0
func (f *FillTracker) GetPair() (pair *model.TradingPair)
GetPair impl
func (*FillTracker) NumHandlers ¶ added in v1.3.0
func (f *FillTracker) NumHandlers() uint8
NumHandlers impl
func (*FillTracker) RegisterHandler ¶ added in v1.3.0
func (f *FillTracker) RegisterHandler(handler api.FillHandler)
RegisterHandler impl
func (*FillTracker) TrackFills ¶ added in v1.3.0
func (f *FillTracker) TrackFills() error
TrackFills impl
type IntervalTimeController ¶ added in v1.2.0
type IntervalTimeController struct {
// contains filtered or unexported fields
}
IntervalTimeController provides a standard time interval
func (*IntervalTimeController) ShouldUpdate ¶ added in v1.2.0
func (t *IntervalTimeController) ShouldUpdate(lastUpdateTime time.Time, currentUpdateTime time.Time) bool
ShouldUpdate impl
type Liabilities ¶
type Liabilities struct { Buying float64 // affects how much more can be bought Selling float64 // affects how much more can be sold }
Liabilities represents the "committed" units of an asset on both the buy and sell sides
type SDEX ¶
type SDEX struct { API *horizon.Client SourceAccount string TradingAccount string SourceSeed string TradingSeed string Network build.Network // contains filtered or unexported fields }
SDEX helps with building and submitting transactions to the Stellar network
func MakeSDEX ¶
func MakeSDEX( api *horizon.Client, sourceSeed string, tradingSeed string, sourceAccount string, tradingAccount string, network build.Network, threadTracker *multithreading.ThreadTracker, operationalBuffer float64, operationalBufferNonNativePct float64, simMode bool, pair *model.TradingPair, assetMap map[model.Asset]horizon.Asset, ) *SDEX
MakeSDEX is a factory method for SDEX
func (*SDEX) AddLiabilities ¶
func (sdex *SDEX) AddLiabilities(selling horizon.Asset, buying horizon.Asset, incrementalSell float64, incrementalBuy float64, incrementalNativeAmountRaw float64)
AddLiabilities updates the cached liabilities, units are in their respective assets
func (*SDEX) AvailableCapacity ¶
func (sdex *SDEX) AvailableCapacity(asset horizon.Asset, incrementalNativeAmountRaw float64) (*Liabilities, error)
AvailableCapacity returns the buying and selling amounts available for a given asset
func (*SDEX) ComputeIncrementalNativeAmountRaw ¶
ComputeIncrementalNativeAmountRaw returns the native amount that will be added to liabilities because of fee and min-reserve additions
func (*SDEX) CreateBuyOffer ¶
func (sdex *SDEX) CreateBuyOffer(base horizon.Asset, counter horizon.Asset, price float64, amount float64, incrementalNativeAmountRaw float64) (*build.ManageOfferBuilder, error)
CreateBuyOffer creates a buy offer
func (*SDEX) CreateSellOffer ¶
func (sdex *SDEX) CreateSellOffer(base horizon.Asset, counter horizon.Asset, price float64, amount float64, incrementalNativeAmountRaw float64) (*build.ManageOfferBuilder, error)
CreateSellOffer creates a sell offer
func (*SDEX) DeleteAllOffers ¶
func (sdex *SDEX) DeleteAllOffers(offers []horizon.Offer) []build.TransactionMutator
DeleteAllOffers is a helper that accumulates delete operations for the passed in offers
func (*SDEX) DeleteOffer ¶
func (sdex *SDEX) DeleteOffer(offer horizon.Offer) build.ManageOfferBuilder
DeleteOffer returns the op that needs to be submitted to the network in order to delete the passed in offer
func (*SDEX) GetLatestTradeCursor ¶ added in v1.3.0
GetLatestTradeCursor impl.
func (*SDEX) GetOrderConstraints ¶ added in v1.3.0
func (sdex *SDEX) GetOrderConstraints(pair *model.TradingPair) *model.OrderConstraints
GetOrderConstraints impl
func (*SDEX) GetTradeHistory ¶ added in v1.3.0
func (sdex *SDEX) GetTradeHistory(pair model.TradingPair, maybeCursorStart interface{}, maybeCursorEnd interface{}) (*api.TradeHistoryResult, error)
GetTradeHistory fetches trades for the trading account bound to this instance of SDEX
func (*SDEX) LogAllLiabilities ¶
LogAllLiabilities logs the liabilities for the two assets along with the native asset
func (*SDEX) ModifyBuyOffer ¶
func (sdex *SDEX) ModifyBuyOffer(offer horizon.Offer, price float64, amount float64, incrementalNativeAmountRaw float64) (*build.ManageOfferBuilder, error)
ModifyBuyOffer modifies a buy offer
func (*SDEX) ModifySellOffer ¶
func (sdex *SDEX) ModifySellOffer(offer horizon.Offer, price float64, amount float64, incrementalNativeAmountRaw float64) (*build.ManageOfferBuilder, error)
ModifySellOffer modifies a sell offer
func (*SDEX) ParseOfferAmount ¶
ParseOfferAmount is a convenience method to parse an offer amount
func (*SDEX) RecomputeAndLogCachedLiabilities ¶
func (sdex *SDEX) RecomputeAndLogCachedLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset)
RecomputeAndLogCachedLiabilities clears the cached liabilities and recomputes from the network before logging
func (*SDEX) ResetCachedBalances ¶
func (sdex *SDEX) ResetCachedBalances()
ResetCachedBalances resets the cached balances map
func (*SDEX) ResetCachedLiabilities ¶
ResetCachedLiabilities resets the cache to include only the two assets passed in
Source Files ¶
- balancedLevelProvider.go
- balancedStrategy.go
- buysellStrategy.go
- ccxtExchange.go
- cmcFeed.go
- composeStrategy.go
- deleteSideStrategy.go
- deleteStrategy.go
- exchangeFeed.go
- factory.go
- fiatFeed.go
- fillLogger.go
- fillTracker.go
- fixedFeed.go
- intervalTimeController.go
- krakenExchange.go
- mirrorStrategy.go
- priceFeed.go
- sdex.go
- sellSideStrategy.go
- sellStrategy.go
- staticSpreadLevelProvider.go