Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dauction

DOI GoDoc Build Status

dauction facilitates the calculation of double auction clearing prices.

Installation

$ go get github.com/kchristidis/dauction

Usage

// group buyer bids into a bid collection object
bb1 := dauction.Bid{PricePerUnit: 6.5, Units: 2}
bb2 := dauction.Bid{PricePerUnit: 10, Units: 2}
buyerBids := dauction.BidCollection{bb1, bb2}

// same for seller bids
sb1 := dauction.Bid{PricePerUnit: 6.5, Units: 2}
sb2 := dauction.Bid{PricePerUnit: 11, Units: 2}
sellerBids := dauction.BidCollection{sb1, sb2}

// settle the market
res, err := dauction.Settle(buyerBids, sellerBids)
if err != nil { // When no clearing price can be found
    fmt.Println(err)
}
// - res.PricePerUnit = 8.25 (clearing price)
// - res.Units = 2 (number of units that can be cleared)
fmt.Println(res)

You may also wish to consult the package documentation in GoDoc.

Contributing

Contributions are welcome. Fork this library and submit a pull request.

About

Determine the clearing price for a double auction, using the average mechanism

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages