Documentation ¶
Index ¶
- Constants
- type Account
- type AccountBSONUpdate
- type AccountRecord
- type EngineResponse
- type ExchangeData
- type ExchangeLogError
- type ExchangeStats
- type Matches
- func (m *Matches) AppendMatch(mo *Order, t *Trade)
- func (m *Matches) Length() int
- func (m *Matches) NthMatch(i int) *Matches
- func (m *Matches) PairCode() (string, error)
- func (m *Matches) String() string
- func (m *Matches) Taker() string
- func (m *Matches) TakerOrderHash() string
- func (m *Matches) TradeAmounts() []int64
- func (m *Matches) Validate() error
- type NewOrderPayload
- type OHLCVParams
- type OperatorMessage
- type Order
- func (o *Order) BaseTokenSymbol() string
- func (o *Order) BuyAmount(pairMultiplier int64) int64
- func (o *Order) BuyToken() string
- func (o *Order) BuyTokenSymbol() string
- func (o *Order) EncodedSide() int64
- func (o *Order) GetBSON() (interface{}, error)
- func (o *Order) MarshalJSON() ([]byte, error)
- func (o *Order) MatcherFeeRate() float64
- func (o *Order) OriginalPrice() float64
- func (o *Order) Pair() (*Pair, error)
- func (o *Order) PairCode() (string, error)
- func (o *Order) Process(p *Pair) error
- func (o *Order) QuoteAmount(p *Pair) int64
- func (o *Order) QuoteTokenSymbol() string
- func (o *Order) RemainingAmount() int64
- func (o *Order) RemainingQuoteAmount() int64
- func (o *Order) RequiredSellAmount(p *Pair) int64
- func (o *Order) SellAmount(p *Pair) int64
- func (o *Order) SellToken() string
- func (o *Order) SellTokenSymbol() string
- func (o *Order) SetBSON(raw bson.Raw) error
- func (o *Order) String() string
- func (o *Order) TotalRequiredSellAmount(p *Pair) int64
- func (o *Order) UnmarshalJSON(b []byte) error
- func (o *Order) Validate() error
- type OrderBSONUpdate
- type OrderCancel
- type OrderData
- func (o *OrderData) AssetCode() string
- func (o *OrderData) ConvertedVolume(p *Pair, exchangeRate float64) float64
- func (o *OrderData) GetBSON() (interface{}, error)
- func (o *OrderData) MarshalJSON() ([]byte, error)
- func (o *OrderData) SetBSON(raw bson.Raw) error
- func (o *OrderData) UnmarshalJSON(b []byte) error
- type OrderMatchedPayload
- type OrderPendingPayload
- type OrderRecord
- type OrderSuccessPayload
- type Pair
- func (p *Pair) AssetCode() string
- func (p *Pair) BaseTokenMultiplier() int64
- func (p *Pair) Code() string
- func (p *Pair) GetBSON() (interface{}, error)
- func (p *Pair) GetKVPrefix() string
- func (p *Pair) GetOrderBookKeys() (sell, buy string)
- func (p *Pair) MarshalJSON() ([]byte, error)
- func (p *Pair) MinQuoteAmount() int64
- func (p *Pair) Name() string
- func (p *Pair) PairMultiplier() int64
- func (p *Pair) ParseAmount(a int64) float64
- func (p *Pair) ParsePrice(pp float64) float64
- func (p *Pair) QuoteTokenMultiplier() int64
- func (p *Pair) SetBSON(raw bson.Raw) error
- func (p *Pair) UnmarshalJSON(b []byte) error
- func (p Pair) Validate() error
- func (p Pair) ValidateAssets() error
- type PairAPIData
- type PairAssets
- type PairAssetsRecord
- type PairData
- type PairID
- type PairRecord
- type PairStats
- type Params
- type PendingTradeBatch
- type RawOrderBook
- type SimplifiedPairAPIData
- type SubscriptionEvent
- type SubscriptionPayload
- type Tick
- func (t *Tick) AssetCode() string
- func (t *Tick) AveragePrice() float64
- func (t *Tick) ConvertedVolume(p *Pair, exchangeRate float64) float64
- func (t *Tick) GetBSON() (interface{}, error)
- func (t *Tick) MarshalJSON() ([]byte, error)
- func (t *Tick) SetBSON(raw bson.Raw) error
- func (t *Tick) UnmarshalJSON(b []byte) error
- type Token
- type TokenBalance
- type TokenBalanceRecord
- type TokenRecord
- type Trade
- func (t *Trade) CalcQuoteAmount() int64
- func (t *Trade) ComputeHash() string
- func (t *Trade) GetBSON() (interface{}, error)
- func (t *Trade) MarshalJSON() ([]byte, error)
- func (t *Trade) Pair() (*Pair, error)
- func (t *Trade) SetBSON(raw bson.Raw) error
- func (t *Trade) UnmarshalJSON(b []byte) error
- func (t *Trade) Validate() error
- type TradeBSONUpdate
- type TradeRecord
- type WebsocketEvent
- type WebsocketMessage
Constants ¶
const OHLCVChannel = "ohlcv"
const OrderChannel = "orders"
const OrderbookChannel = "order_book"
const TradeChannel = "trades"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID bson.ObjectId `json:"-" bson:"_id"` Address string `json:"address" bson:"address"` TokenBalances map[string]*TokenBalance `json:"tokenBalances" bson:"tokenBalances"` IsBlocked bool `json:"isBlocked" bson:"isBlocked"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
Account corresponds to a single Obyte address. It contains a list of token balances for that address
func (*Account) MarshalJSON ¶
MarshalJSON implements the json.Marshal interface
func (*Account) UnmarshalJSON ¶
type AccountBSONUpdate ¶
type AccountBSONUpdate struct {
*Account
}
func (*AccountBSONUpdate) GetBSON ¶
func (a *AccountBSONUpdate) GetBSON() (interface{}, error)
type AccountRecord ¶
type AccountRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` Address string `json:"address" bson:"address"` TokenBalances map[string]TokenBalanceRecord `json:"tokenBalances" bson:"tokenBalances"` IsBlocked bool `json:"isBlocked" bson:"isBlocked"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
AccountRecord corresponds to what is stored in the DB.
type EngineResponse ¶
type EngineResponse struct { Status string `json:"fillStatus,omitempty"` Order *Order `json:"order,omitempty"` Matches *Matches `json:"matches,omitempty"` RecoveredOrders *[]*Order `json:"recoveredOrders,omitempty"` InvalidatedOrders *[]*Order `json:"invalidatedOrders,omitempty"` CancelledTrades *[]*Trade `json:"cancelledTrades,omitempty"` }
func (*EngineResponse) AppendMatch ¶
func (r *EngineResponse) AppendMatch(mo *Order, t *Trade)
func (*EngineResponse) AppendMatches ¶
func (r *EngineResponse) AppendMatches(mo []*Order, t []*Trade)
type ExchangeData ¶
type ExchangeData struct { PairData []*PairAPIData `json:"pairData"` TotalOrders int `json:"totalOrders"` TotalTrades int `json:"totalTrades"` TotalSellOrders int `json:"totalSellOrders"` TotalBuyOrders int `json:"totalBuyOrders"` TotalBuyOrderAmount float64 `json:"totalBuyAmount"` TotalSellOrderAmount float64 `json:"totalSellAmount"` TotalVolume float64 `json:"totalVolume"` TotalOrderAmount float64 `json:"totalOrderAmount"` MostTradedToken string `json:"mostTradedToken"` MostTradedPair string `json:"mostTradedPair"` TradeSuccessRatio float64 `json:"tradeSuccessRatio"` }
type ExchangeLogError ¶
type ExchangeStats ¶
type ExchangeStats struct { TotalOrders int `json:"totalOrders"` TotalTrades int `json:"totalTrades"` TotalSellOrders int `json:"totalSellOrders"` TotalBuyOrders int `json:"totalBuyOrders"` TotalBuyOrderAmount float64 `json:"totalBuyAmount"` TotalSellOrderAmount float64 `json:"totalSellAmount"` TotalVolume float64 `json:"totalVolume"` TotalOrderAmount float64 `json:"totalOrderAmount"` MostTradedToken string `json:"mostTradedToken"` MostTradedPair string `json:"mostTradedPair"` TradeSuccessRatio float64 `json:"tradeSuccessRatio"` }
type Matches ¶
type Matches struct { MakerOrders []*Order `json:"makerOrders"` TakerOrder *Order `json:"takerOrder"` Trades []*Trade `json:"trades"` }
func NewMatches ¶
func (*Matches) AppendMatch ¶
func (*Matches) TakerOrderHash ¶
func (*Matches) TradeAmounts ¶
type NewOrderPayload ¶
type NewOrderPayload struct { PairName string `json:"pairName"` MatcherAddress string `json:"matcherAddress"` AffiliateAddress string `json:"affiliateAddress"` UserAddress string `json:"userAddress"` BaseToken string `json:"baseToken"` QuoteToken string `json:"quoteToken"` Side string `json:"side"` Amount int64 `json:"amount"` Price float64 `json:"price"` Hash string `json:"hash"` }
NewOrderPayload is the struct in which the order request sent by the user is populated
func (*NewOrderPayload) EncodedSide ¶
func (p *NewOrderPayload) EncodedSide() int64
func (NewOrderPayload) MarshalJSON ¶
func (p NewOrderPayload) MarshalJSON() ([]byte, error)
func (*NewOrderPayload) ToOrder ¶
func (p *NewOrderPayload) ToOrder() (o *Order, err error)
ToOrder converts the NewOrderPayload to Order
func (*NewOrderPayload) UnmarshalJSON ¶
func (p *NewOrderPayload) UnmarshalJSON(b []byte) error
func (NewOrderPayload) Validate ¶
func (p NewOrderPayload) Validate() error
Validate validates the NewOrderPayload fields.
type OHLCVParams ¶
type OHLCVParams struct { Pair []PairAssets `json:"pair"` From int64 `json:"from"` To int64 `json:"to"` Duration int64 `json:"duration"` Units string `json:"units"` }
type OperatorMessage ¶
func (*OperatorMessage) String ¶
func (m *OperatorMessage) String() string
type Order ¶
type Order struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress string `json:"userAddress" bson:"userAddress"` MatcherAddress string `json:"matcherAddress" bson:"matcherAddress"` AffiliateAddress string `json:"affiliateAddress" bson:"affiliateAddress"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Hash string `json:"hash" bson:"hash"` Price float64 `json:"price" bson:"price"` Amount int64 `json:"amount" bson:"amount"` FilledAmount int64 `json:"filledAmount" bson:"filledAmount"` RemainingSellAmount int64 `json:"remainingSellAmount" bson:"remainingSellAmount"` PairName string `json:"pairName" bson:"pairName"` OriginalOrder map[string]interface{} `json:"originalOrder" bson:"originalOrder"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
Order contains the data related to an order sent by the user
func (*Order) BaseTokenSymbol ¶
func (*Order) BuyTokenSymbol ¶
func (*Order) MarshalJSON ¶
MarshalJSON implements the json.Marshal interface
func (*Order) MatcherFeeRate ¶
func (*Order) OriginalPrice ¶
func (*Order) QuoteAmount ¶
func (*Order) QuoteTokenSymbol ¶
func (*Order) RemainingAmount ¶
func (*Order) RemainingQuoteAmount ¶
func (*Order) RequiredSellAmount ¶
func (*Order) SellAmount ¶
SellAmount If order is a "BUY", then sellToken = quoteToken
func (*Order) SellTokenSymbol ¶
func (*Order) TotalRequiredSellAmount ¶
func (*Order) UnmarshalJSON ¶
type OrderBSONUpdate ¶
type OrderBSONUpdate struct {
*Order
}
func (OrderBSONUpdate) GetBSON ¶
func (o OrderBSONUpdate) GetBSON() (interface{}, error)
type OrderCancel ¶
type OrderCancel struct { OrderHash string `json:"orderHash"` UserAddress string `json:"userAddress"` }
OrderCancel is a group of params used for canceling an order previously sent to the matching engine. The OrderId and OrderHash must correspond to the same order. To be valid and be able to be processed by the matching engine, the OrderCancel must include a signature by the Maker of the order corresponding to the OrderHash.
func NewOrderCancel ¶
func NewOrderCancel() *OrderCancel
NewOrderCancel returns a new empty OrderCancel object
func (*OrderCancel) MarshalJSON ¶
func (oc *OrderCancel) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the OrderCancel struct
func (*OrderCancel) String ¶
func (oc *OrderCancel) String() string
func (*OrderCancel) UnmarshalJSON ¶
func (oc *OrderCancel) UnmarshalJSON(b []byte) error
UnmarshalJSON creates an OrderCancel object from a json byte string
type OrderData ¶
type OrderData struct { Pair PairID `json:"id,omitempty" bson:"_id"` OrderVolume int64 `json:"orderVolume,omitempty" bson:"orderVolume"` OrderCount int64 `json:"orderCount,omitempty" bson:"orderCount"` BestPrice float64 `json:"bestPrice,omitempty" bson:"bestPrice"` }
func (*OrderData) ConvertedVolume ¶
func (*OrderData) MarshalJSON ¶
func (*OrderData) UnmarshalJSON ¶
UnmarshalJSON creates a trade object from a json byte string
type OrderMatchedPayload ¶
type OrderMatchedPayload struct {
Matches *Matches `json:"matches"`
}
type OrderPendingPayload ¶
type OrderPendingPayload struct {
Matches *Matches `json:"matches"`
}
type OrderRecord ¶
type OrderRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress string `json:"userAddress" bson:"userAddress"` MatcherAddress string `json:"matcherAddress" bson:"matcherAddress"` AffiliateAddress string `json:"affiliateAddress" bson:"affiliateAddress"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Hash string `json:"hash" bson:"hash"` Price float64 `json:"price" bson:"price"` Amount int64 `json:"amount" bson:"amount"` FilledAmount int64 `json:"filledAmount" bson:"filledAmount"` RemainingSellAmount int64 `json:"remainingSellAmount" bson:"remainingSellAmount"` OriginalOrder map[string]interface{} `json:"originalOrder" bson:"originalOrder"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
OrderRecord is the object that will be saved in the database
type OrderSuccessPayload ¶
type OrderSuccessPayload struct {
Matches *Matches `json:"matches"`
}
type Pair ¶
type Pair struct { ID bson.ObjectId `json:"-" bson:"_id"` BaseTokenSymbol string `json:"baseTokenSymbol,omitempty" bson:"baseTokenSymbol"` BaseAsset string `json:"baseAsset,omitempty" bson:"baseAsset"` BaseTokenDecimals int `json:"baseTokenDecimals,omitempty" bson:"baseTokenDecimals"` QuoteTokenSymbol string `json:"quoteTokenSymbol,omitempty" bson:"quoteTokenSymbol"` QuoteAsset string `json:"quoteAsset,omitempty" bson:"quoteAsset"` QuoteTokenDecimals int `json:"quoteTokenDecimals,omitempty" bson:"quoteTokenDecimals"` Listed bool `json:"listed,omitempty" bson:"listed"` Active bool `json:"active,omitempty" bson:"active"` Rank int `json:"rank,omitempty" bson:"rank"` CreatedAt time.Time `json:"-" bson:"createdAt"` UpdatedAt time.Time `json:"-" bson:"updatedAt"` }
Pair struct is used to model the pair data in the system and DB
func (*Pair) BaseTokenMultiplier ¶
func (*Pair) GetKVPrefix ¶
func (*Pair) GetOrderBookKeys ¶
GetOrderBookKeys
func (*Pair) MarshalJSON ¶
func (*Pair) MinQuoteAmount ¶
func (*Pair) PairMultiplier ¶
func (*Pair) ParseAmount ¶
func (*Pair) ParsePrice ¶
func (*Pair) QuoteTokenMultiplier ¶
func (*Pair) UnmarshalJSON ¶
func (Pair) Validate ¶
Validate function is used to verify if an instance of struct satisfies all the conditions for a valid instance
func (Pair) ValidateAssets ¶
type PairAPIData ¶
type PairAPIData struct { Pair PairID `json:"pair" bson:"_id"` Open float64 `json:"open" bson:"open"` High float64 `json:"high" bson:"high"` Low float64 `json:"low" bson:"low"` Close float64 `json:"close" bson:"close"` Volume float64 `json:"volume" bson:"volume"` QuoteVolume float64 `json:"quoteVolume" bson:"quoteVolume"` Timestamp int `json:"timestamp" bson:"timestamp"` OrderVolume float64 `json:"orderVolume" bson:"orderVolume"` OrderCount int `json:"orderCount" bson:"orderCount"` TradeCount int `json:"tradeCount" bson:"tradeCount"` AverageOrderAmount float64 `json:"averageOrderAmount" bson:"averageOrderAmount"` AverageTradeAmount float64 `json:"averageTradeAmount" bson:"averageTradeAmount"` AskPrice float64 `json:"askPrice" bson:"askPrice"` BidPrice float64 `json:"bidPrice" bson:"bidPrice"` Price float64 `json:"price" bson:"price"` Rank int `json:"rank" bson:"rank"` }
type PairAssets ¶
type PairAssetsRecord ¶
type PairData ¶
type PairData struct { Pair PairID `json:"pair,omitempty" bson:"_id"` Close float64 `json:"close,omitempty" bson:"close"` Count int64 `json:"count,omitempty" bson:"count"` High float64 `json:"high,omitempty" bson:"high"` Low float64 `json:"low,omitempty" bson:"low"` Open float64 `json:"open,omitempty" bson:"open"` Volume int64 `json:"volume,omitempty" bson:"volume"` QuoteVolume int64 `json:"quoteVolume,omitempty" bson:"quoteVolume"` Timestamp int64 `json:"timestamp,omitempty" bson:"timestamp"` OrderVolume int64 `json:"orderVolume,omitempty" bson:"orderVolume"` OrderCount int64 `json:"orderCount,omitempty" bson:"orderCount"` AverageOrderAmount int64 `json:"averageOrderAmount" bson:"averageOrderAmount"` AverageTradeAmount int64 `json:"averageTradeAmount" bson:"averageTradeAmount"` AskPrice float64 `json:"askPrice,omitempty" bson:"askPrice"` BidPrice float64 `json:"bidPrice,omitempty" bson:"bidPrice"` Price float64 `json:"price,omitempty" bson:"price"` Rank int `json:"rank,omitempty" bson:"rank"` }
func (*PairData) MarshalJSON ¶
func (*PairData) ToAPIData ¶
func (p *PairData) ToAPIData(pair *Pair) *PairAPIData
func (*PairData) ToSimplifiedAPIData ¶
func (p *PairData) ToSimplifiedAPIData(pair *Pair) *SimplifiedPairAPIData
ToAPIData converts detailed data into public PairAPIData that contains
type PairID ¶
type PairID struct { PairName string `json:"pairName" bson:"pairName"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` }
PairID is the subdocument for aggregate grouping for OHLCV data
type PairRecord ¶
type PairRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` BaseTokenSymbol string `json:"baseTokenSymbol" bson:"baseTokenSymbol"` BaseAsset string `json:"baseAsset" bson:"baseAsset"` BaseTokenDecimals int `json:"baseTokenDecimals" bson:"baseTokenDecimals"` QuoteTokenSymbol string `json:"quoteTokenSymbol" bson:"quoteTokenSymbol"` QuoteAsset string `json:"quoteAsset" bson:"quoteAsset"` QuoteTokenDecimals int `json:"quoteTokenDecimals" bson:"quoteTokenDecimals"` Active bool `json:"active" bson:"active"` Listed bool `json:"listed" bson:"listed"` Rank int `json:"rank" bson:"rank"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
type PairStats ¶
type PairStats []*PairAPIData
type Params ¶
type Params struct { From int64 `json:"from"` To int64 `json:"to"` Duration int64 `json:"duration"` Units string `json:"units"` PairID string `json:"pair"` }
Params is a sub document used to pass parameters in Subscription messages
type PendingTradeBatch ¶
type PendingTradeBatch struct {
Matches *Matches
}
type RawOrderBook ¶
type SimplifiedPairAPIData ¶
type SimplifiedPairAPIData struct { PairName string `json:"pairName"` LastPrice float64 `json:"lastPrice"` TradeCount int `json:"tradeCount"` OrderCount int `json:"orderCount"` Volume float64 `json:"volume"` QuoteVolume float64 `json:"quoteVolume"` OrderVolume float64 `json:"orderVolume"` AverageOrderAmount float64 `json:"averageOrderAmount"` AverageTradeAmount float64 `json:"averageTradeAmount"` }
PairAPIData is a similar structure to PairData that contains human-readable data for a certain pair
type SubscriptionEvent ¶
type SubscriptionEvent string
SubscriptionEvent is an enum signifies whether the incoming message is of type Subscribe or unsubscribe
const ( SUBSCRIBE SubscriptionEvent = "SUBSCRIBE" UNSUBSCRIBE SubscriptionEvent = "UNSUBSCRIBE" Fetch SubscriptionEvent = "fetch" )
Enum members for SubscriptionEvent
type SubscriptionPayload ¶
type Tick ¶
type Tick struct { Pair PairID `json:"id,omitempty" bson:"_id"` Close float64 `json:"close,omitempty" bson:"close"` Count int64 `json:"count,omitempty" bson:"count"` High float64 `json:"high,omitempty" bson:"high"` Low float64 `json:"low,omitempty" bson:"low"` Open float64 `json:"open,omitempty" bson:"open"` Volume int64 `json:"volume,omitempty" bson:"volume"` QuoteVolume int64 `json:"quoteVolume,omitempty" bson:"quoteVolume"` Timestamp int64 `json:"timestamp,omitempty" bson:"timestamp"` }
Tick is the format in which mongo aggregate pipeline returns data when queried for OHLCV data
func (*Tick) AveragePrice ¶
func (*Tick) ConvertedVolume ¶
RoundedVolume returns the value exchanged during this tick in the currency for which the 'exchangeRate' param was provided.
func (*Tick) MarshalJSON ¶
MarshalJSON returns the json encoded byte array representing the trade struct
func (*Tick) UnmarshalJSON ¶
UnmarshalJSON creates a trade object from a json byte string
type Token ¶
type Token struct { ID bson.ObjectId `json:"-" bson:"_id"` Symbol string `json:"symbol" bson:"symbol"` Asset string `json:"asset" bson:"asset"` Decimals int `json:"decimals" bson:"decimals"` Active bool `json:"active" bson:"active"` Listed bool `json:"listed" bson:"listed"` Quote bool `json:"quote" bson:"quote"` Rank int `json:"rank,omitempty" bson:"rank,omitempty"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
Token struct is used to model the token data in the system and DB
func (*Token) MarshalJSON ¶
func (*Token) UnmarshalJSON ¶
type TokenBalance ¶
type TokenBalance struct { Asset string `json:"asset" bson:"asset"` Symbol string `json:"symbol" bson:"symbol"` Balance int64 `json:"balance" bson:"balance"` PendingBalance int64 `json:"pendingBalance" bson:"pendingBalance"` LockedBalance int64 `json:"lockedBalance" bson:"lockedBalance"` }
TokenBalance holds the Balance and the Locked balance values for a single asset
type TokenBalanceRecord ¶
type TokenBalanceRecord struct { Asset string `json:"asset" bson:"asset"` Symbol string `json:"symbol" bson:"symbol"` Balance int64 `json:"balance" bson:"balance"` PendingBalance int64 `json:"pendingBalance" base:"pendingBalance"` LockedBalance int64 `json:"lockedBalance" bson:"lockedBalance"` }
TokenBalanceRecord corresponds to a TokenBalance struct that is stored in the DB.
type TokenRecord ¶
type TokenRecord struct { ID bson.ObjectId `json:"-" bson:"_id"` Symbol string `json:"symbol" bson:"symbol"` Asset string `json:"asset" bson:"asset"` Decimals int `json:"decimals" bson:"decimals"` Active bool `json:"active" bson:"active"` Listed bool `json:"listed" bson:"listed"` Quote bool `json:"quote" bson:"quote"` Rank int `json:"rank,omitempty" bson:"rank,omitempty"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
TokenRecord is the struct which is stored in db
type Trade ¶
type Trade struct { ID bson.ObjectId `json:"id,omitempty" bson:"_id"` Taker string `json:"taker" bson:"taker"` Maker string `json:"maker" bson:"maker"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` MakerOrderHash string `json:"makerOrderHash" bson:"makerOrderHash"` TakerOrderHash string `json:"takerOrderHash" bson:"takerOrderHash"` Hash string `json:"hash" bson:"hash"` TxHash string `json:"txHash" bson:"txHash"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` Price float64 `json:"price" bson:"price"` Status string `json:"status" bson:"status"` Amount int64 `json:"amount" bson:"amount"` QuoteAmount int64 `json:"quoteAmount" bson:"quoteAmount"` RemainingTakerSellAmount int64 `json:"remainingTakerSellAmount" bson:"remainingTakerSellAmount"` RemainingMakerSellAmount int64 `json:"remainingMakerSellAmount" bson:"remainingMakerSellAmount"` MakerSide string `json:"makerSide" bson:"makerSide"` }
Trade struct holds arguments corresponding to a "Taker Order"
func NewTrade ¶
NewTrade returns a new unsigned trade corresponding to an Order, amount and taker address
func (*Trade) CalcQuoteAmount ¶
func (*Trade) ComputeHash ¶
ComputeHash returns hashes the trade The OrderHash, Amount, and Taker attributes must be set before attempting to compute the trade hash
func (*Trade) MarshalJSON ¶
MarshalJSON returns the json encoded byte array representing the trade struct
func (*Trade) UnmarshalJSON ¶
UnmarshalJSON creates a trade object from a json byte string
type TradeBSONUpdate ¶
type TradeBSONUpdate struct {
*Trade
}
func (TradeBSONUpdate) GetBSON ¶
func (t TradeBSONUpdate) GetBSON() (interface{}, error)
type TradeRecord ¶
type TradeRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` Taker string `json:"taker" bson:"taker"` Maker string `json:"maker" bson:"maker"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` MakerOrderHash string `json:"makerOrderHash" bson:"makerOrderHash"` TakerOrderHash string `json:"takerOrderHash" bson:"takerOrderHash"` Hash string `json:"hash" bson:"hash"` TxHash string `json:"txHash" bson:"txHash"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` Price float64 `json:"price" bson:"price"` Amount int64 `json:"amount" bson:"amount"` QuoteAmount int64 `json:"quoteAmount" bson:"quoteAmount"` RemainingTakerSellAmount int64 `json:"remainingTakerSellAmount" bson:"remainingTakerSellAmount"` RemainingMakerSellAmount int64 `json:"remainingMakerSellAmount" bson:"remainingMakerSellAmount"` Status string `json:"status" bson:"status"` MakerSide string `json:"makerSide" bson:"makerSide"` }
type WebsocketEvent ¶
type WebsocketEvent struct { Type string `json:"type"` Hash string `json:"hash,omitempty"` Payload interface{} `json:"payload"` }
func (*WebsocketEvent) String ¶
func (ev *WebsocketEvent) String() string
type WebsocketMessage ¶
type WebsocketMessage struct { Channel string `json:"channel"` Event WebsocketEvent `json:"event"` }
func NewOrderAddedWebsocketMessage ¶
func NewOrderAddedWebsocketMessage(o *Order, p *Pair, filled int64) *WebsocketMessage
func NewOrderCancelWebsocketMessage ¶
func NewOrderCancelWebsocketMessage(oc *OrderCancel) *WebsocketMessage
func NewOrderWebsocketMessage ¶
func NewOrderWebsocketMessage(o *Order) *WebsocketMessage
func (*WebsocketMessage) String ¶
func (ev *WebsocketMessage) String() string