Documentation ¶
Index ¶
- Constants
- type Acknowledgement
- type Asset
- type Audit
- type BookOrderNote
- type Bytes
- type CancelOrder
- type Candle
- type CandlesRequest
- type Coin
- type ConfigResult
- type Connect
- type ConnectResult
- type EpochOrderNote
- type EpochReportNote
- type Error
- type FeeAsset
- type Init
- type LimitOrder
- type Market
- type MarketOrder
- type MarketStatus
- type Match
- type MatchProofNote
- type MatchRequest
- type MatchStatusResult
- type Message
- type MessageType
- type NoMatch
- type NotifyFee
- type NotifyFeeResult
- type OrderBook
- type OrderBookSubscription
- type OrderNote
- type OrderResult
- type OrderStatus
- type OrderStatusRequest
- type Penalty
- type PenaltyNote
- type Prefix
- type PreimageRequest
- type PreimageResponse
- type Redeem
- type Redemption
- type Register
- type RegisterResult
- type ResponsePayload
- type RevokeMatch
- type RevokeOrder
- type Signable
- type Signature
- type Spot
- type Stampable
- type Trade
- type TradeNote
- type TradeResumption
- type TradeSuspension
- type UnbookOrderNote
- type UnsubOrderBook
- type UpdateRemainingNote
- type WireCandles
Constants ¶
const ( RPCErrorUnspecified = iota // 0 RPCParseError // 1 RPCUnknownRoute // 2 RPCInternal // 3 RPCQuarantineClient // 4 RPCVersionUnsupported // 5 RPCUnknownMatch // 6 RPCInternalError // 7 RPCInitError // 8 RPCLoginError // 9 RPCLogoutError // 10 RPCCreateWalletError // 11 RPCOpenWalletError // 12 RPCWalletExistsError // 13 RPCCloseWalletError // 14 RPCGetFeeError // 15 RPCRegisterError // 16 RPCArgumentsError // 17 RPCTradeError // 18 RPCCancelError // 19 RPCWithdrawError // 20 RPCOrderBookError // 21 SignatureError // 22 SerializationError // 23 TransactionUndiscovered // 24 ContractError // 25 SettlementSequenceError // 26 ResultLengthError // 27 IDMismatchError // 28 RedemptionError // 29 IDTypeError // 30 AckCountError // 31 UnknownResponseID // 32 OrderParameterError // 33 UnknownMarketError // 34 ClockRangeError // 35 FundingError // 36 CoinAuthError // 37 UnknownMarket // 38 NotSubscribedError // 39 AuthenticationError // 41 PubKeyParseError // 42 FeeError // 43 InvalidPreimage // 44 PreimageCommitmentMismatch // 45 UnknownMessageType // 46 AccountClosedError // 47 MarketNotRunningError // 48 TryAgainLaterError // 49 AccountNotFoundError // 50 UnpaidAccountError // 51 InvalidRequestError // 52 OrderQuantityTooHigh // 53 HTTPRouteError // 54 AccountExistsError // 56 AccountSuspendedError // 57 RPCExportSeedError // 58 TooManyRequestsError // 59 RPCGetDEXConfigError // 60 RPCDiscoverAcctError // 61 RPCWalletRescanError // 62 )
Error codes
const ( // MatchRoute is the route of a DEX-originating request-type message notifying // the client of a match and initiating swap negotiation. MatchRoute = "match" // NoMatchRoute is the route of a DEX-originating notification-type message // notifying the client that an order did not match during its match cycle. NoMatchRoute = "nomatch" // MatchStatusRoute is the route of a client-originating request-type // message to retrieve match data from the DEX. MatchStatusRoute = "match_status" // OrderStatusRoute is the route of a client-originating request-type // message to retrieve order data from the DEX. OrderStatusRoute = "order_status" // InitRoute is the route of a client-originating request-type message // notifying the DEX, and subsequently the match counter-party, of the details // of a swap contract. InitRoute = "init" // AuditRoute is the route of a DEX-originating request-type message relaying // swap contract details (from InitRoute) from one client to the other. AuditRoute = "audit" // RedeemRoute is the route of a client-originating request-type message // notifying the DEX, and subsequently the match counter-party, of the details // of a redemption transaction. RedeemRoute = "redeem" // RedemptionRoute is the route of a DEX-originating request-type message // relaying redemption transaction (from RedeemRoute) details from one client // to the other. RedemptionRoute = "redemption" // RevokeMatchRoute is a DEX-originating notification-type message informing // a client that a match has been revoked. RevokeMatchRoute = "revoke_match" // RevokeOrderRoute is a DEX-originating notification-type message informing // a client that an order has been revoked. RevokeOrderRoute = "revoke_order" // LimitRoute is the client-originating request-type message placing a limit // order. LimitRoute = "limit" // MarketRoute is the client-originating request-type message placing a market // order. MarketRoute = "market" // CancelRoute is the client-originating request-type message placing a cancel // order. CancelRoute = "cancel" // OrderBookRoute is the client-originating request-type message subscribing // to an order book update notification feed. OrderBookRoute = "orderbook" // UnsubOrderBookRoute is client-originating request-type message cancelling // an order book subscription. UnsubOrderBookRoute = "unsub_orderbook" // BookOrderRoute is the DEX-originating notification-type message informing // the client to add the order to the order book. BookOrderRoute = "book_order" // UnbookOrderRoute is the DEX-originating notification-type message informing // the client to remove an order from the order book. UnbookOrderRoute = "unbook_order" // EpochOrderRoute is the DEX-originating notification-type message informing // the client about an order added to the epoch queue. EpochOrderRoute = "epoch_order" // UpdateRemainingRoute is the DEX-originating notification-type message that // updates the remaining amount of unfilled quantity on a standing limit order. UpdateRemainingRoute = "update_remaining" // EpochReportRoute is the DEX-originating notification-type message that // indicates the end of an epoch's book updates and provides stats for // maintaining a candlestick cache. EpochReportRoute = "epoch_report" // ConnectRoute is a client-originating request-type message seeking // authentication so that the connection can be used for trading. ConnectRoute = "connect" // RegisterRoute is the client-originating request-type message initiating a // new client registration. RegisterRoute = "register" // NotifyFeeRoute is the client-originating request-type message informing the // DEX that the fee has been paid and has the requisite number of // confirmations. NotifyFeeRoute = "notifyfee" // ConfigRoute is the client-originating request-type message requesting the // DEX configuration information. ConfigRoute = "config" // MatchProofRoute is the DEX-originating notification-type message // delivering match cycle results to the client. MatchProofRoute = "match_proof" // PreimageRoute is the DEX-originating request-type message requesting the // preimages for the client's epoch orders. PreimageRoute = "preimage" // SuspensionRoute is the DEX-originating request-type message informing the // client of an upcoming trade suspension. This is part of the // subscription-based orderbook notification feed. SuspensionRoute = "suspension" // ResumptionRoute is the DEX-originating request-type message informing the // client of an upcoming trade resumption. This is part of the // subscription-based orderbook notification feed. ResumptionRoute = "resumption" // NotifyRoute is the DEX-originating notification-type message // delivering text messages from the operator. NotifyRoute = "notify" // PenaltyRoute is the DEX-originating notification-type message // informing of a broken rule and the resulting penalty. PenaltyRoute = "penalty" // SpotsRoute is the client-originating HTTP or WebSocket request to get the // spot price and volume for the DEX's markets. SpotsRoute = "spots" // FeeRateRoute is the client-originating request asking for the most // recently recorded transaction fee estimate for an asset. FeeRateRoute = "fee_rate" // PriceFeedRoute is the client-originating request subscribing to the // market overview feed. PriceFeedRoute = "price_feed" // PriceUpdateRoute is a dex-originating notification updating the current // spot price for a market. PriceUpdateRoute = "price_update" // CandlesRoute is the HTTP request to get the set of candlesticks // representing market activity history. CandlesRoute = "candles" )
Routes are destinations for a "payload" of data. The type of data being delivered, and what kind of action is expected from the receiving party, is completely dependent on the route. The route designation is a string sent as the "route" parameter of a JSON-encoded Message.
const ( BuyOrderNum = 1 SellOrderNum = 2 StandingOrderNum = 1 ImmediateOrderNum = 2 LimitOrderNum = 1 MarketOrderNum = 2 CancelOrderNum = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acknowledgement ¶
Acknowledgement is the 'result' field in a response to a request that requires an acknowledgement. It is typically a signature of some serialized data associated with the request.
type Asset ¶
type Asset struct { Symbol string `json:"symbol"` ID uint32 `json:"id"` Version uint32 `json:"version"` LotSize uint64 `json:"lotsize,omitempty"` RateStep uint64 `json:"ratestep,omitempty"` MaxFeeRate uint64 `json:"maxfeerate"` SwapSize uint64 `json:"swapsize"` SwapSizeBase uint64 `json:"swapsizebase"` SwapConf uint16 `json:"swapconf"` UnitInfo dex.UnitInfo `json:"unitinfo"` }
Asset describes an asset and its variables, and is returned as part of a ConfigResult.
type Audit ¶
type Audit struct { Signature OrderID Bytes `json:"orderid"` MatchID Bytes `json:"matchid"` Time uint64 `json:"timestamp"` CoinID Bytes `json:"coinid"` Contract Bytes `json:"contract"` TxData Bytes `json:"txdata"` }
Audit is the payload for a DEX-originating AuditRoute request.
type BookOrderNote ¶
BookOrderNote is the payload for a DEX-originating notification-type message informing the client to add the order to the order book.
type CancelOrder ¶
CancelOrder is the payload for the CancelRoute, which places a cancel order.
func (*CancelOrder) Serialize ¶
func (c *CancelOrder) Serialize() []byte
Serialize serializes the CancelOrder data.
type Candle ¶ added in v0.2.0
type Candle struct { StartStamp uint64 `json:"startStamp"` EndStamp uint64 `json:"endStamp"` MatchVolume uint64 `json:"matchVolume"` QuoteVolume uint64 `json:"quoteVolume"` HighRate uint64 `json:"highRate"` LowRate uint64 `json:"lowRate"` StartRate uint64 `json:"startRate"` EndRate uint64 `json:"endRate"` }
Candle is a statistical history of a specified period of market activity.
type CandlesRequest ¶ added in v0.2.0
type CandlesRequest struct { BaseID uint32 `json:"baseID"` QuoteID uint32 `json:"quoteID"` BinSize string `json:"binSize"` NumCandles int `json:"numCandles,omitempty"` // default and max defined in apidata. }
CandlesRequest is a data API request for market history.
type Coin ¶
type Coin struct { ID Bytes `json:"coinid"` PubKeys []Bytes `json:"pubkeys"` Sigs []Bytes `json:"sigs"` Redeem Bytes `json:"redeem"` }
Coin is information for validating funding coins. Some number of Coins must be included with both Limit and Market payloads.
type ConfigResult ¶
type ConfigResult struct { CancelMax float64 `json:"cancelmax"` BroadcastTimeout uint64 `json:"btimeout"` RegFeeConfirms uint16 `json:"regfeeconfirms"` // DEPRECATED Assets []*Asset `json:"assets"` Markets []*Market `json:"markets"` Fee uint64 `json:"fee"` // DEPRECATED APIVersion uint16 `json:"apiver"` BinSizes []string `json:"binSizes"` // Just apidata.BinSizes for now. DEXPubKey Bytes `json:"pubkey"` RegFees map[string]*FeeAsset `json:"regFees"` }
ConfigResult is the successful result for the ConfigRoute.
type Connect ¶
type Connect struct { Signature AccountID Bytes `json:"accountid"` APIVersion uint16 `json:"apiver"` Time uint64 `json:"timestamp"` }
Connect is the payload for a client-originating ConnectRoute request.
type ConnectResult ¶
type ConnectResult struct { Sig Bytes `json:"sig"` ActiveOrderStatuses []*OrderStatus `json:"activeorderstatuses"` ActiveMatches []*Match `json:"activematches"` Score int32 `json:"score"` Suspended *bool `json:"suspended,omitempty"` // will be implied (obsolete) with tiers and bonds }
ConnectResult is the result for the ConnectRoute request.
TODO: Include penalty data as specified in the spec.
type EpochOrderNote ¶
type EpochOrderNote struct { BookOrderNote Commit Bytes `json:"com"` OrderType uint8 `json:"otype"` Epoch uint64 `json:"epoch"` TargetID Bytes `json:"target,omitempty"` // omit for cancel orders }
EpochOrderRoute is the DEX-originating notification-type message informing the client about an order added to the epoch queue.
type EpochReportNote ¶ added in v0.2.0
type EpochReportNote struct { MarketID string `json:"marketid"` Epoch uint64 `json:"epoch"` BaseFeeRate uint64 `json:"baseFeeRate"` QuoteFeeRate uint64 `json:"quoteFeeRate"` Candle }
EpochReportNote is a report about an epoch sent after all of the epoch's book updates. Like TradeResumption, and TradeSuspension when Persist is true, Seq is omitted since it doesn't modify the book.
type Error ¶
Error is returned as part of the Response to indicate that an error occurred during method execution.
type FeeAsset ¶ added in v0.4.0
type FeeAsset struct { ID uint32 `json:"id"` Confs uint32 `json:"confs"` Amt uint64 `json:"amount"` }
FeeAsset describes an asset for which registration fees are supported.
type Init ¶
type Init struct { Signature OrderID Bytes `json:"orderid"` MatchID Bytes `json:"matchid"` CoinID Bytes `json:"coinid"` Contract Bytes `json:"contract"` }
Init is the payload for a client-originating InitRoute request.
type LimitOrder ¶
LimitOrder is the payload for the LimitRoute, which places a limit order.
func (*LimitOrder) Serialize ¶
func (l *LimitOrder) Serialize() []byte
Serialize serializes the Limit data.
type Market ¶
type Market struct { Name string `json:"name"` Base uint32 `json:"base"` Quote uint32 `json:"quote"` EpochLen uint64 `json:"epochlen"` LotSize uint64 `json:"lotsize"` RateStep uint64 `json:"ratestep"` MarketBuyBuffer float64 `json:"buybuffer"` MarketStatus `json:"status"` }
Market describes a market and its variables, and is returned as part of a ConfigResult. The market's status (running, start epoch, and any planned final epoch before suspend) are also provided.
type MarketOrder ¶
MarketOrder is the payload for the MarketRoute, which places a market order.
func (*MarketOrder) Serialize ¶
func (m *MarketOrder) Serialize() []byte
Serialize serializes the MarketOrder data.
type MarketStatus ¶
type MarketStatus struct { StartEpoch uint64 `json:"startepoch"` FinalEpoch uint64 `json:"finalepoch,omitempty"` Persist *bool `json:"persistbook,omitempty"` // nil and omitted when finalepoch is omitted }
MarketStatus describes the status of the market, where StartEpoch is when the market started or will start. FinalEpoch is a when the market will suspend if it is running, or when the market suspended if it is presently stopped.
type Match ¶
type Match struct { Signature OrderID Bytes `json:"orderid"` MatchID Bytes `json:"matchid"` Quantity uint64 `json:"qty"` Rate uint64 `json:"rate"` ServerTime uint64 `json:"tserver"` Address string `json:"address"` FeeRateBase uint64 `json:"feeratebase"` FeeRateQuote uint64 `json:"feeratequote"` // Status and Side are provided for convenience and are not part of the // match serialization. Status uint8 `json:"status"` Side uint8 `json:"side"` }
Match is the params for a DEX-originating MatchRoute request.
type MatchProofNote ¶
type MatchProofNote struct { MarketID string `json:"marketid"` Epoch uint64 `json:"epoch"` Preimages []Bytes `json:"preimages"` Misses []Bytes `json:"misses"` CSum Bytes `json:"csum"` Seed Bytes `json:"seed"` }
MatchProofNote is the match_proof notification payload.
type MatchRequest ¶
type MatchRequest struct { Base uint32 `json:"base"` Quote uint32 `json:"quote"` MatchID Bytes `json:"matchid"` }
MatchRequest details a match for the MatchStatusRoute request. The actual payload is a []MatchRequest.
type MatchStatusResult ¶
type MatchStatusResult struct { MatchID Bytes `json:"matchid"` Status uint8 `json:"status"` MakerContract Bytes `json:"makercontract,omitempty"` TakerContract Bytes `json:"takercontract,omitempty"` MakerSwap Bytes `json:"makerswap,omitempty"` TakerSwap Bytes `json:"takerswap,omitempty"` MakerRedeem Bytes `json:"makerredeem,omitempty"` TakerRedeem Bytes `json:"takerredeem,omitempty"` Secret Bytes `json:"secret,omitempty"` Active bool `json:"active"` // MakerTxData and TakerTxData will only be populated by the server when the // match status is MakerSwapCast and TakerSwapCast, respectively. MakerTxData Bytes `json:"makertx,omitempty"` TakerTxData Bytes `json:"takertx,omitempty"` }
MatchStatus is the successful result for the MatchStatusRoute request.
type Message ¶
type Message struct { // Type is the message type. Type MessageType `json:"type"` // Route is used for requests and notifications, and specifies a handler for // the message. Route string `json:"route,omitempty"` // ID is a unique number that is used to link a response to a request. ID uint64 `json:"id,omitempty"` // Payload is any data attached to the message. How Payload is decoded // depends on the Route. Payload json.RawMessage `json:"payload,omitempty"` }
Message is the primary messaging type for websocket communications.
func DecodeMessage ¶
DecodeMessage decodes a *Message from JSON-formatted bytes. Note that *Message may be nil even if error is nil, when the message is JSON null, []byte("null").
func NewNotification ¶
NewNotification encodes the payload and creates a Notification-type *Message.
func NewRequest ¶
NewRequest is the constructor for a Request-type *Message.
func NewResponse ¶
NewResponse encodes the result and creates a Response-type *Message.
func (*Message) Response ¶
func (msg *Message) Response() (*ResponsePayload, error)
Response attempts to decode the payload to a *ResponsePayload. Response will return an error if the Type is not Response. It is an error if the Message's Payload is []byte("null").
func (*Message) Unmarshal ¶
Unmarshal unmarshals the Payload field into the provided interface. Note that the payload interface must contain a pointer. If it is a pointer to a pointer, it may become nil for a Message.Payload of []byte("null").
func (*Message) UnmarshalResult ¶
UnmarshalResult is a convenience method for decoding the Result field of a ResponsePayload.
type MessageType ¶
type MessageType uint8
MessageType indicates the type of message. MessageType is typically the first switch checked when examining a message, and how the rest of the message is decoded depends on its MessageType.
const ( InvalidMessageType MessageType = iota // 0 Request // 1 Response // 2 Notification // 3 )
func (MessageType) String ¶
func (mt MessageType) String() string
String satisfies the Stringer interface for translating the MessageType code into a description, primarily for logging.
type NoMatch ¶
type NoMatch struct {
OrderID Bytes `json:"orderid"`
}
Nomatch is the payload for a server-originating NoMatchRoute notification.
type NotifyFee ¶
type NotifyFee struct { Signature AccountID Bytes `json:"accountid"` CoinID Bytes `json:"coinid"` Time uint64 `json:"timestamp"` }
NotifyFee is the payload for a client-originating NotifyFeeRoute request.
type NotifyFeeResult ¶
type NotifyFeeResult struct {
Signature
}
NotifyFeeResult is the result for the response to NotifyFee. Though it embeds Signature, it does not satisfy the Signable interface, as it has no need for serialization.
type OrderBook ¶
type OrderBook struct { MarketID string `json:"marketid"` Seq uint64 `json:"seq"` Epoch uint64 `json:"epoch"` // MarketStatus `json:"status"`// maybe // DRAFT NOTE: We might want to use a different structure for bulk updates. // Sending a struct of arrays rather than an array of structs could // potentially cut the encoding effort and encoded size substantially. Orders []*BookOrderNote `json:"orders"` BaseFeeRate uint64 `json:"baseFeeRate"` QuoteFeeRate uint64 `json:"quoteFeeRate"` }
OrderBook is the response to a successful OrderBookSubscription.
type OrderBookSubscription ¶
OrderBookSubscription is the payload for a client-originating request to the OrderBookRoute, intializing an order book feed.
type OrderNote ¶
type OrderNote struct { Seq uint64 `json:"seq,omitempty"` // May be empty when part of an OrderBook. MarketID string `json:"marketid,omitempty"` // May be empty when part of an OrderBook. OrderID Bytes `json:"oid"` }
OrderNote is part of a notification about any type of order.
type OrderResult ¶
type OrderResult struct { Sig Bytes `json:"sig"` OrderID Bytes `json:"orderid"` ServerTime uint64 `json:"tserver"` }
OrderResult is returned from the order-placing routes.
type OrderStatus ¶
OrderStatus is the current status of an order.
type OrderStatusRequest ¶
type OrderStatusRequest struct { Base uint32 `json:"base"` Quote uint32 `json:"quote"` OrderID Bytes `json:"orderid"` }
OrderStatusRequest details an order for the OrderStatusRoute request. The actual payload is a []OrderStatusRequest.
type Penalty ¶
type Penalty struct { Rule account.Rule `json:"rule"` Time uint64 `json:"timestamp"` Duration uint64 `json:"duration"` Details string `json:"details"` }
Penalty is part of the payload for a dex-originating Penalty notification and part of the connect response.
type PenaltyNote ¶
PenaltyNote is the payload of a Penalty notification.
func (*PenaltyNote) Serialize ¶
func (n *PenaltyNote) Serialize() []byte
Serialize serializes the PenaltyNote data.
type Prefix ¶
type Prefix struct { Signature AccountID Bytes `json:"accountid"` Base uint32 `json:"base"` Quote uint32 `json:"quote"` OrderType uint8 `json:"ordertype"` ClientTime uint64 `json:"tclient"` ServerTime uint64 `json:"tserver"` Commit Bytes `json:"com"` }
Prefix is a common structure shared among order type payloads.
type PreimageRequest ¶
type PreimageRequest struct { OrderID Bytes `json:"orderid"` Commitment Bytes `json:"commit"` CommitChecksum Bytes `json:"csum"` }
PreimageRequest is the server-originating preimage request payload.
type PreimageResponse ¶
type PreimageResponse struct {
Preimage Bytes `json:"pimg"`
}
PreimageResponse is the client-originating preimage response payload.
type Redeem ¶
type Redeem struct { Signature OrderID Bytes `json:"orderid"` MatchID Bytes `json:"matchid"` CoinID Bytes `json:"coinid"` Secret Bytes `json:"secret"` }
Redeem are the params for a client-originating RedeemRoute request.
type Redemption ¶
Redemption is the payload for a DEX-originating RedemptionRoute request.
func (*Redemption) Serialize ¶
func (r *Redemption) Serialize() []byte
Serialize serializes the Redemption data.
type Register ¶
type Register struct { Signature PubKey Bytes `json:"pubkey"` Time uint64 `json:"timestamp"` Asset *uint32 `json:"feeAsset,omitempty"` // default to 42 if not set by client }
Register is the payload for the RegisterRoute request.
type RegisterResult ¶
type RegisterResult struct { Signature DEXPubKey Bytes `json:"pubkey"` // ClientPubKey is excluded from the JSON payload to save bandwidth. The // client must add it back to verify the server's signature. ClientPubKey Bytes `json:"-"` AssetID *uint32 `json:"feeAsset,omitempty"` // default to 42 if not set by server Address string `json:"address"` Fee uint64 `json:"fee"` Time uint64 `json:"timestamp"` }
RegisterResult is the result for the response to Register.
func (*RegisterResult) Serialize ¶
func (r *RegisterResult) Serialize() []byte
Serialize serializes the RegisterResult data.
type ResponsePayload ¶
type ResponsePayload struct { // Result is the payload, if successful, else nil. Result json.RawMessage `json:"result,omitempty"` // Error is the error, or nil if none was encountered. Error *Error `json:"error,omitempty"` }
ResponsePayload is the payload for a Response-type Message.
type RevokeMatch ¶
RevokeMatch are the params for a DEX-originating RevokeMatchRoute request.
func (*RevokeMatch) Serialize ¶
func (rev *RevokeMatch) Serialize() []byte
Serialize serializes the RevokeMatch data.
type RevokeOrder ¶
RevokeOrder are the params for a DEX-originating RevokeOrderRoute notification.
func (*RevokeOrder) Serialize ¶
func (rev *RevokeOrder) Serialize() []byte
Serialize serializes the RevokeOrder data.
type Signature ¶
type Signature struct {
Sig Bytes `json:"sig"`
}
Signature partially implements Signable, and can be embedded by types intended to satisfy Signable, which must themselves implement the Serialize method.
type Spot ¶ added in v0.2.0
type Spot struct { Stamp uint64 `json:"stamp"` BaseID uint32 `json:"baseID"` QuoteID uint32 `json:"quoteID"` Rate uint64 `json:"rate"` BookVolume uint64 `json:"bookVolume"` Change24 float64 `json:"change24"` Vol24 uint64 `json:"vol24"` }
Spot is a snapshot of a market at the end of a match cycle. A slice of Spot are sent as the response to the SpotsRoute request.
type Trade ¶
type Trade struct { Side uint8 `json:"side"` Quantity uint64 `json:"ordersize"` Coins []*Coin `json:"coins"` Address string `json:"address"` }
Trade is common to Limit and Market Payloads.
type TradeNote ¶
type TradeNote struct { Side uint8 `json:"side,omitempty"` Quantity uint64 `json:"qty,omitempty"` Rate uint64 `json:"rate,omitempty"` TiF uint8 `json:"tif,omitempty"` Time uint64 `json:"time,omitempty"` }
TradeNote is part of a notification that includes information about a limit or market order.
type TradeResumption ¶
type TradeResumption struct { MarketID string `json:"marketid"` ResumeTime uint64 `json:"resumetime,omitempty"` // only set in advance of resume StartEpoch uint64 `json:"startepoch"` }
TradeResumption is the ResumptionRoute notification payload. It is part of the orderbook subscription.
type TradeSuspension ¶
type TradeSuspension struct { MarketID string `json:"marketid"` Seq uint64 `json:"seq,omitempty"` // only set at suspend time and if Persist==false SuspendTime uint64 `json:"suspendtime,omitempty"` // only set in advance of suspend FinalEpoch uint64 `json:"finalepoch"` Persist bool `json:"persistbook"` }
TradeSuspension is the SuspensionRoute notification payload. It is part of the orderbook subscription.
type UnbookOrderNote ¶
type UnbookOrderNote OrderNote
UnbookOrderRoute is the DEX-originating notification-type message informing the client to remove an order from the order book.
type UnsubOrderBook ¶
type UnsubOrderBook struct {
MarketID string `json:"marketid"`
}
UnsubOrderBook is the payload for a client-originating request to the UnsubOrderBookRoute, terminating an order book subscription.
type UpdateRemainingNote ¶
UpdateRemainingNote is the DEX-originating notification-type message informing the client about an update to a booked order's remaining quantity.
type WireCandles ¶ added in v0.2.0
type WireCandles struct { StartStamps []uint64 `json:"startStamps"` EndStamps []uint64 `json:"endStamps"` MatchVolumes []uint64 `json:"matchVolumes"` QuoteVolumes []uint64 `json:"quoteVolumes"` HighRates []uint64 `json:"highRates"` LowRates []uint64 `json:"lowRates"` StartRates []uint64 `json:"startRates"` EndRates []uint64 `json:"endRates"` }
WireCandles are Candles encoded as a series of integer arrays, as opposed to an array of candles. WireCandles encode smaller than []Candle, since the property names are not repeated for each candle.
func NewWireCandles ¶ added in v0.2.0
func NewWireCandles(n int) *WireCandles
NewWireCandles prepares a *WireCandles with slices of capacity n.
func (*WireCandles) Candles ¶ added in v0.2.0
func (wc *WireCandles) Candles() []*Candle
Candles converts the WireCandles to []*Candle.