orderbook

package
v0.0.0-...-0959c99 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderBookGraph

type OrderBookGraph struct {
	// contains filtered or unexported fields
}

OrderBookGraph is an in memory graph representation of all the offers in the stellar ledger

func NewOrderBookGraph

func NewOrderBookGraph() *OrderBookGraph

NewOrderBookGraph constructs a new OrderBookGraph

func (*OrderBookGraph) AddOffer

func (graph *OrderBookGraph) AddOffer(offer xdr.OfferEntry) *OrderBookGraph

AddOffer will queue an operation to add the given offer to the order book in the internal batch. You need to run Apply() to apply all enqueued operations.

func (*OrderBookGraph) Apply

func (graph *OrderBookGraph) Apply() error

Apply will attempt to apply all the updates in the internal batch to the order book. When Apply is successful, a new empty, instance of internal batch will be created.

func (*OrderBookGraph) FindPaths

func (graph *OrderBookGraph) FindPaths(
	maxPathLength int,
	destinationAsset xdr.Asset,
	destinationAmount xdr.Int64,
	sourceAccountID xdr.AccountId,
	sourceAssets []xdr.Asset,
	sourceAssetBalances []xdr.Int64,
	maxAssetsPerPath int,
) ([]Path, error)

FindPaths returns a list of payment paths originating from a source account and ending with a given destinaton asset and amount.

func (*OrderBookGraph) RemoveOffer

func (graph *OrderBookGraph) RemoveOffer(offerID xdr.Int64) *OrderBookGraph

RemoveOffer will queue an operation to remove the given offer from the order book in the internal batch. You need to run Apply() to apply all enqueued operations.

type Path

type Path struct {
	SourceAmount xdr.Int64
	SourceAsset  xdr.Asset

	InteriorNodes     []xdr.Asset
	DestinationAsset  xdr.Asset
	DestinationAmount xdr.Int64
	// contains filtered or unexported fields
}

Path represents a payment path from a source asset to some destination asset

Jump to

Keyboard shortcuts

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