Documentation ¶
Index ¶
Constants ¶
const ( MapDefaultSize int = 100 DefaultFillExpire uint = 24 // hours DefaultClientExpire uint = 24 * 14 // hours DefaultClearerExpire uint = 24 * 14 // hours DefaultOrderExpire uint = 24 // hours DefaultFeedbackRating uint = 100 ExpireCheck uint = 1 // hours = Frequency to check expirations Precision uint = 1000 // Price precision multiplier )
Config Constants
const ( StatusNew string = "new" StatusActive string = "active" StatusFilled string = "filled" StatusPartial string = "partial" StatusCancelled string = "cancelled" StatusCancelledSelfTrade string = "cancelled remainder self trade" StatusCancelledPostOnly string = "cancelled post only" StatusCancelledFAK string = "cancelled remainder fill and kill" StatusCancelledFOK string = "cancelled fill or kill" )
Order Status Constants
const ( ModifierPostOnly string = "post only" ModifierFAK string = "fill and kill" ModifierFOK string = "fill or kill" )
Order Modifier Constants
const ( Buy bool = false Sell bool = true )
Direction Constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clearer ¶
type Clearer struct { Address string Expire uint Fills map[uint]*ClearerFill }
Clearer is a Server-created Clearer Instance
type ClearerFill ¶
type ClearerFill struct { ID uint `json:"id,omitempty"` ClearerAddress string `json:"clearer_address,omitempty"` MakerFill ClientFill `json:"maker_fill,omitempty"` TakerFill ClientFill `json:"taker_fill,omitempty"` Expire uint `json:"expire,omitempty"` }
ClearerFill is a Server-created Clearer Fill Instance
type Client ¶
type Client struct { Address string FeedbackRating uint TransactCount uint BadFeedback uint Expire uint Orders map[uint]*list.Element }
Client is a Server-created Client Instance
type ClientFill ¶
type ClientFill struct { ClientAddress string `json:"client_address,omitempty"` ClientOrderID uint `json:"client_order_id,omitempty"` BuyProduct string `json:"buy_product,omitempty"` BuyQuantity uint `json:"buy_quantity,omitempty"` SellProduct string `json:"sell_product,omitempty"` SellQuantity uint `json:"sell_quantity,omitempty"` }
ClientFill is a Server-created Client Fill Instance
type DB ¶
type DB struct { Orderbooks map[string]*list.List Clients map[string]*Client Clearers map[string]*Clearer }
DB is a Global Data Storage Instance
func (*DB) AddFeedback ¶
AddFeedback updates a Client's Feedback
func (*DB) CancelOrder ¶
CancelOrder finds a Resting Order from the Order Book using Client Orders, and Cancels it
func (*DB) CheckExpired ¶
func (db *DB) CheckExpired()
CheckExpired searches for Expiring Objects and delete thems. Updates expiration counters. To be called at ExpireCheck frequency
func (*DB) GetFills ¶
func (db *DB) GetFills(cf *ClearerFill) ([]*ClearerFill, error)
GetFills finds and Returns all resting Clearer Fills from the Clearer Fills array
type Feedback ¶
type Feedback struct { ClearerAddress string `json:"clearer_address,omitempty"` ClearerFillID uint `json:"clearer_fill_id,omitempty"` MakerAddress string `json:"maker_address,omitempty"` MakerFeedback bool `json:"maker_feedback,omitempty"` // 1 = Negative TakerAddress string `json:"taker_address,omitempty"` TakerFeedback bool `json:"taker_feedback,omitempty"` // 1 = Negative }
Feedback is a Clearer-created Feedback Instance
type Order ¶
type Order struct { ClientAddress string `json:"client_address,omitempty"` ClearerAddress string `json:"clearer_address,omitempty"` BuyProduct string `json:"buy_product,omitempty"` BuyQuantity uint `json:"buy_quantity,omitempty"` SellProduct string `json:"sell_product,omitempty"` SellQuantity uint `json:"sell_quantity,omitempty"` MinFeedback uint `json:"min_feedback,omitempty"` MinTransact uint `json:"min_transact,omitempty"` Status string `json:"status,omitempty"` Modifier string `json:"modifier,omitempty"` Expire uint `json:"expire,omitempty"` // hours ClientOrderID uint `json:"client_order_id,omitempty"` }
Order is a Client-created Order Instance