Documentation ¶
Index ¶
- func CheckProfitable(edges []Offer) bool
- func CurrencyAmountAndIssuer(takerPays interface{}) (string, float64, string)
- func DropToPriceInUSD(drop int) (usd float64)
- func DropToXrp(drop float64) (xrp float64)
- func GetCycle(asset string, predecessors map[string]string) []string
- type Graph
- func (graph *Graph) CreateSimpleGraph() SimplerGraph
- func (graph *Graph) GetProfitableOffers() ([]Offer, []string)
- func (graph *Graph) ParseTransaction(tx data.Transaction) (newOffers []Offer)
- func (graph *Graph) PaymentTransactionParse(tx data.Transaction) (newOffers []Offer)
- func (graph *Graph) SortGraphWithTxs()
- type Offer
- type OrderBook
- type SimplerGraph
- type TxList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckProfitable ¶
func CurrencyAmountAndIssuer ¶
func DropToPriceInUSD ¶
Types ¶
type Graph ¶
type Graph struct { Graph map[string]map[string]*OrderBook AccountRoots map[string]map[int]*Offer Issuers map[string]bool Clients map[string]bool AccountLedger map[string][]string Lock sync.RWMutex }
Graph : Data structure for graph of offers
func (*Graph) CreateSimpleGraph ¶
func (graph *Graph) CreateSimpleGraph() SimplerGraph
CreateSimpleGraph : function for creating a SimpleGraph
func (*Graph) GetProfitableOffers ¶
func (*Graph) ParseTransaction ¶
func (graph *Graph) ParseTransaction(tx data.Transaction) (newOffers []Offer)
func (*Graph) PaymentTransactionParse ¶
func (graph *Graph) PaymentTransactionParse(tx data.Transaction) (newOffers []Offer)
func (*Graph) SortGraphWithTxs ¶
func (graph *Graph) SortGraphWithTxs()
SortGraphWithTxs : function for creating a new graph with offers sorted by rates
type Offer ¶
type Offer struct { //Indexing XrpTx data.Transaction TxHash string Account string SequenceNumber int //Actual transaction data Rate float64 Quantity float64 CreatorWillPay string CreatorWillGet string Issuer string }
Offer : Data structure for an offer
type SimplerGraph ¶
type SimplerGraph struct { Graph map[string]map[string]float64 Currencies []string Lock sync.Mutex }
SimplerGraph : Data structure for graph of best offers (nxn grid, -log(edge))
func (SimplerGraph) BellmanFord ¶
func (graph SimplerGraph) BellmanFord() (string, map[string]string)
BellmanFord : Run Bellman-Ford Algorithm on the Simpler Graph with the best rates
Click to show internal directories.
Click to hide internal directories.