plugins

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exchanges

func Exchanges() map[string]string

Exchanges returns the list of exchanges along with the description

func MakeExchange

func MakeExchange(exchangeType string) (api.Exchange, error)

MakeExchange is a factory method to make an exchange based on a given type

func MakeFeedPair

func MakeFeedPair(dataTypeA, dataFeedAUrl, dataTypeB, dataFeedBUrl string) (*api.FeedPair, error)

MakeFeedPair is the factory method that we expose

func MakePriceFeed

func MakePriceFeed(feedType string, url string) (api.PriceFeed, error)

MakePriceFeed makes a PriceFeed

func MakeStrategy

func MakeStrategy(
	sdex *SDEX,
	assetBase *horizon.Asset,
	assetQuote *horizon.Asset,
	strategy string,
	stratConfigPath string,
) (api.Strategy, error)

MakeStrategy makes a strategy

func Strategies

func Strategies() map[string]StrategyContainer

Strategies returns the list of strategies along with metadata

Types

type Balance

type Balance struct {
	Balance float64
	Trust   float64
	Reserve float64
}

Balance repesents an asset's balance response from the assetBalance method below

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,
	operationalBuffer float64,
	simMode bool,
) *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

func (sdex *SDEX) ComputeIncrementalNativeAmountRaw(isNewOffer bool) float64

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) LogAllLiabilities

func (sdex *SDEX) LogAllLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset)

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

func (sdex *SDEX) ParseOfferAmount(amt string) (float64, error)

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

func (sdex *SDEX) ResetCachedLiabilities(assetBase horizon.Asset, assetQuote horizon.Asset) error

ResetCachedLiabilities resets the cache to include only the two assets passed in

func (*SDEX) SubmitOps

func (sdex *SDEX) SubmitOps(ops []build.TransactionMutator, asyncCallback func(hash string, e error)) error

SubmitOps submits the passed in operations to the network asynchronously in a single transaction

type StrategyContainer

type StrategyContainer struct {
	SortOrder   uint8
	Description string
	NeedsConfig bool
	Complexity  string
	// contains filtered or unexported fields
}

StrategyContainer contains the strategy factory method along with some metadata

Jump to

Keyboard shortcuts

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