Documentation ¶
Index ¶
Constants ¶
const ( MapDefaultSize int = 100 DefaultClientExpire uint = 24 * 14 // hours DefaultOrderExpire uint = 24 // hours DefaultDealExpire uint = 24 // hours 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 Client ¶
type Client struct { Address string `json:"client_address,omitempty"` ClearerAddress string `json:"clearer_address,omitempty"` Approved bool `json:"approved,omitempty"` Expire uint Orders map[uint]*list.Element Balances map[string]uint `json:"balances"` }
Client is a Server-created Client Instance
type DB ¶
type DB struct { Orderbooks map[string]*list.List Clients map[string]*Client Deals map[uint]*Deal ClearerAddress string }
DB is a Global Data Storage Instance
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 deletes them. Updates expiration counters. To be called at ExpireCheck frequency
func (*DB) GetOrders ¶
GetOrders finds and Returns all resting Client Orders from the Order Book using the Client Orders array If an Order ID is provided, one Client Order will be returned if it exists
func (*DB) UpdateClient ¶
UpdateClient updates a Client in the Client DB
type Deal ¶
type Deal struct { ID uint `json:"id,omitempty"` ClearerAddress string `json:"clearer_address,omitempty"` MakerFill Fill `json:"maker_fill,omitempty"` TakerFill Fill `json:"taker_fill,omitempty"` Expire uint `json:"expire,omitempty"` }
Deal is a Server-created Deal Instance
type Fill ¶
type Fill 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"` }
Fill is a Server-created Fill 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"` 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