Documentation ¶
Index ¶
- type Account
- type DepositAPI
- type ErrDepositAmountAboveLimit
- type ErrTooManyDepositAddresses
- type ErrWithdrawAmountAboveLimit
- type ErrWithdrawAmountInvalid
- type Exchange
- type FeedPair
- type Level
- type LevelProvider
- type PrepareDepositResult
- type PriceFeed
- type SideStrategy
- type Strategy
- type Ticker
- type TickerAPI
- type TradeAPI
- type TradeHistoryResult
- type TradesResult
- type WithdrawAPI
- type WithdrawFunds
- type WithdrawInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account interface {
GetAccountBalances(assetList []model.Asset) (map[model.Asset]model.Number, error)
}
Account allows you to access key account functions
type DepositAPI ¶
type DepositAPI interface { /* Input: asset - asset you want to deposit amount - amount you want to deposit Output: PrepareDepositResult - contains the deposit instructions error - ErrDepositAmountAboveLimit, ErrTooManyDepositAddresses, or any other error */ PrepareDeposit(asset model.Asset, amount *model.Number) (*PrepareDepositResult, error) }
DepositAPI is defined by anything where you can deposit funds.
type ErrDepositAmountAboveLimit ¶
type ErrDepositAmountAboveLimit error
ErrDepositAmountAboveLimit error type
func MakeErrDepositAmountAboveLimit ¶
func MakeErrDepositAmountAboveLimit(amount *model.Number, limit *model.Number) ErrDepositAmountAboveLimit
MakeErrDepositAmountAboveLimit is a factory method
type ErrTooManyDepositAddresses ¶
type ErrTooManyDepositAddresses error
ErrTooManyDepositAddresses error type
func MakeErrTooManyDepositAddresses ¶
func MakeErrTooManyDepositAddresses() ErrTooManyDepositAddresses
MakeErrTooManyDepositAddresses is a factory method
type ErrWithdrawAmountAboveLimit ¶
type ErrWithdrawAmountAboveLimit error
ErrWithdrawAmountAboveLimit error type
func MakeErrWithdrawAmountAboveLimit ¶
func MakeErrWithdrawAmountAboveLimit(amount *model.Number, limit *model.Number) ErrWithdrawAmountAboveLimit
MakeErrWithdrawAmountAboveLimit is a factory method
type ErrWithdrawAmountInvalid ¶
type ErrWithdrawAmountInvalid error
ErrWithdrawAmountInvalid error type
func MakeErrWithdrawAmountInvalid ¶
func MakeErrWithdrawAmountInvalid(amountToWithdraw *model.Number, fee *model.Number) ErrWithdrawAmountInvalid
MakeErrWithdrawAmountInvalid is a factory method
type Exchange ¶
type Exchange interface { Account TickerAPI TradeAPI DepositAPI WithdrawAPI }
Exchange is the interface we use as a generic API for all crypto exchanges
type FeedPair ¶
FeedPair is the struct representing a price feed for a trading pair
func (*FeedPair) GetCenterPrice ¶
GetCenterPrice fetches the center price from this feed
type LevelProvider ¶
type LevelProvider interface {
GetLevels(maxAssetBase float64, maxAssetQuote float64) ([]Level, error)
}
LevelProvider returns the levels for the given center price, which controls the spread and number of levels
type PrepareDepositResult ¶
type PrepareDepositResult struct { Fee *model.Number // fee that will be deducted from your deposit, i.e. amount available is depositAmount - fee Address string // address you should send the funds to ExpireTs int64 // expire time as a unix timestamp, 0 if it does not expire }
PrepareDepositResult is the result of a PrepareDeposit call
type SideStrategy ¶
type SideStrategy interface { PruneExistingOffers(offers []horizon.Offer) ([]build.TransactionMutator, []horizon.Offer) PreUpdate(maxAssetA float64, maxAssetB float64, trustA float64, trustB float64) error UpdateWithOps(offers []horizon.Offer) (ops []build.TransactionMutator, newTopOffer *model.Number, e error) PostUpdate() error }
SideStrategy represents a strategy on a single side of the orderbook
type Strategy ¶
type Strategy interface { PruneExistingOffers(buyingAOffers []horizon.Offer, sellingAOffers []horizon.Offer) ([]build.TransactionMutator, []horizon.Offer, []horizon.Offer) PreUpdate(maxAssetA float64, maxAssetB float64, trustA float64, trustB float64) error UpdateWithOps(buyingAOffers []horizon.Offer, sellingAOffers []horizon.Offer) ([]build.TransactionMutator, error) PostUpdate() error }
Strategy represents some logic for a bot to follow while doing market making
type TickerAPI ¶ added in v1.1.0
type TickerAPI interface {
GetTickerPrice(pairs []model.TradingPair) (map[model.TradingPair]Ticker, error)
}
TickerAPI is the interface we use as a generic API for getting ticker data from any crypto exchange
type TradeAPI ¶
type TradeAPI interface { GetAssetConverter() *model.AssetConverter GetOrderBook(pair *model.TradingPair, maxCount int32) (*model.OrderBook, error) GetTrades(pair *model.TradingPair, maybeCursor interface{}) (*TradesResult, error) GetTradeHistory(maybeCursorStart interface{}, maybeCursorEnd interface{}) (*TradeHistoryResult, error) GetOpenOrders() (map[model.TradingPair][]model.OpenOrder, error) AddOrder(order *model.Order) (*model.TransactionID, error) CancelOrder(txID *model.TransactionID) (model.CancelOrderResult, error) }
TradeAPI is the interface we use as a generic API for trading on any crypto exchange
type TradeHistoryResult ¶
TradeHistoryResult is the result of a GetTradeHistory call
type TradesResult ¶
TradesResult is the result of a GetTrades call
type WithdrawAPI ¶
type WithdrawAPI interface { /* Input: asset - asset you want to withdraw amountToWithdraw - amount you want deducted from your account address - address you want to withdraw to Output: WithdrawInfo - details on how to perform the withdrawal error - ErrWithdrawAmountAboveLimit, ErrWithdrawAmountInvalid, or any other error */ GetWithdrawInfo(asset model.Asset, amountToWithdraw *model.Number, address string) (*WithdrawInfo, error) /* Input: asset - asset you want to withdraw amountToWithdraw - amount you want deducted from your account (fees will be deducted from here, use GetWithdrawInfo for fee estimate) address - address you want to withdraw to Output: WithdrawFunds - result of the withdrawal error - any error */ WithdrawFunds( asset model.Asset, amountToWithdraw *model.Number, address string, ) (*WithdrawFunds, error) }
WithdrawAPI is defined by anything where you can withdraw funds.
type WithdrawFunds ¶
type WithdrawFunds struct {
WithdrawalID string
}
WithdrawFunds is the result of a WithdrawFunds call
type WithdrawInfo ¶
type WithdrawInfo struct {
AmountToReceive *model.Number // amount that you will receive after any fees is taken (excludes fees charged on the deposit side)
}
WithdrawInfo is the result of a GetWithdrawInfo call