Documentation ¶
Index ¶
- Constants
- func DefaultTestAvailableBalance() int64
- func DefaultTestBalance() int64
- func DefaultTestInOrderBalance() int64
- type Account
- type AccountBSONUpdate
- type AccountRecord
- type AddressAssociation
- type AddressAssociationRecord
- type AddressAssociationWebsocketPayload
- type AssetCode
- type AssociationTransaction
- type AssociationTransactionResponse
- type Chain
- type ChartItem
- type CoinsIDMarketChart
- type DepositTransaction
- type EngineResponse
- type FavoriteTokenRequest
- type FiatPriceItem
- type FiatPriceItemBSONUpdate
- type GenerateAddressResponse
- type Image
- type KeyValue
- type LendingID
- type LendingMarketData
- type LendingMatches
- type LendingOrder
- func (o *LendingOrder) ComputeHash() common.Hash
- func (o *LendingOrder) GetBSON() (interface{}, error)
- func (o *LendingOrder) MarshalJSON() ([]byte, error)
- func (o *LendingOrder) PairCode() (string, error)
- func (o *LendingOrder) Process() error
- func (o *LendingOrder) SetBSON(raw bson.Raw) error
- func (o *LendingOrder) UnmarshalJSON(b []byte) error
- func (o *LendingOrder) Validate() error
- func (o *LendingOrder) VerifySignature() (bool, error)
- type LendingOrderBook
- type LendingOrderCancel
- type LendingOrderChangeEvent
- type LendingOrderMatchedPayload
- type LendingOrderPendingPayload
- type LendingOrderSuccessPayload
- type LendingPair
- type LendingPairRecord
- type LendingRecord
- type LendingRes
- type LendingSpec
- type LendingTick
- type LendingTicks
- type LendingTrade
- type LendingTradeBSON
- type LendingTradeChangeEvent
- type LendingTradeRes
- type LendingTradeSpec
- type M
- type MarketData
- 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() common.Address
- func (m *Matches) TakerOrderHash() common.Hash
- func (m *Matches) TradeAmounts() []*big.Int
- func (m *Matches) Validate() error
- type Message
- type NativeCurrency
- type NewOrderPayload
- func (p *NewOrderPayload) ComputeHash() common.Hash
- func (p *NewOrderPayload) EncodedSide() *big.Int
- func (p NewOrderPayload) MarshalJSON() ([]byte, error)
- func (p *NewOrderPayload) ToOrder() (o *Order, err error)
- func (p *NewOrderPayload) UnmarshalJSON(b []byte) error
- func (p NewOrderPayload) Validate() error
- func (p *NewOrderPayload) VerifySignature() (bool, error)
- type Notification
- type NotificationBSONUpdate
- type NotificationRecord
- type OHLCVParams
- type OperatorMessage
- type Order
- func (o *Order) BaseTokenSymbol() string
- func (o *Order) BuyAmount(pairMultiplier *big.Int) *big.Int
- func (o *Order) BuyToken() common.Address
- func (o *Order) BuyTokenSymbol() string
- func (o *Order) ComputeHash() common.Hash
- func (o *Order) EncodedSide() *big.Int
- func (o *Order) GetBSON() (interface{}, error)
- func (o *Order) MarshalJSON() ([]byte, error)
- 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) *big.Int
- func (o *Order) QuoteTokenSymbol() string
- func (o *Order) RemainingAmount() *big.Int
- func (o *Order) RemainingSellAmount(p *Pair) *big.Int
- func (o *Order) RequiredSellAmount(p *Pair) *big.Int
- func (o *Order) SellAmount(p *Pair) *big.Int
- func (o *Order) SellToken() common.Address
- func (o *Order) SellTokenSymbol() string
- func (o *Order) SetBSON(raw bson.Raw) error
- func (o *Order) Sign(w *Wallet) error
- func (o *Order) String() string
- func (o *Order) TotalRequiredSellAmount(p *Pair) *big.Int
- func (o *Order) UnmarshalJSON(b []byte) error
- func (o *Order) Validate() error
- func (o *Order) VerifySignature() (bool, error)
- type OrderBSONUpdate
- type OrderBook
- type OrderCancel
- func (oc *OrderCancel) ComputeHash() common.Hash
- func (oc *OrderCancel) GetSenderAddress() (common.Address, error)
- func (oc *OrderCancel) MarshalJSON() ([]byte, error)
- func (oc *OrderCancel) Sign(w *Wallet) error
- func (oc *OrderCancel) String() string
- func (oc *OrderCancel) UnmarshalJSON(b []byte) error
- func (oc *OrderCancel) VerifySignature(o *Order) (bool, error)
- type OrderChangeEvent
- type OrderData
- func (o *OrderData) AddressCode() 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 OrderRes
- type OrderSpec
- type OrderSuccessPayload
- type Pair
- func (p *Pair) AddressCode() string
- func (p *Pair) BaseTokenMultiplier() *big.Int
- func (p *Pair) Code() string
- func (p *Pair) DecimalsMultiplier() *big.Int
- func (p *Pair) EncodedTopic() 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() *big.Int
- func (p *Pair) Name() string
- func (p *Pair) PairMultiplier() *big.Int
- func (p *Pair) ParseAmount(a *big.Int) float64
- func (p *Pair) ParsePricePoint(pp *big.Int) float64
- func (p *Pair) PricepointMultiplier() *big.Int
- func (p *Pair) QuoteTokenMultiplier() *big.Int
- func (p *Pair) SetBSON(raw bson.Raw) error
- func (p *Pair) UnmarshalJSON(b []byte) error
- func (p Pair) Validate() error
- func (p Pair) ValidateAddresses() error
- type PairAPIData
- type PairAddresses
- type PairAddressesRecord
- type PairData
- type PairID
- type PairRecord
- type Params
- type PendingTradeBatch
- type PriceBoardData
- type PriceVolume
- type RawLendingOrderBook
- type RawOrderBook
- type RecallSpec
- type Relayer
- type RelayerBSONUpdate
- type RelayerLendingTick
- type RelayerLendingTicks
- type RelayerRecord
- type RelayerTick
- type RelayerTicks
- type RepaySpec
- type RestResponse
- type RestResponseMeta
- type Signature
- type SignatureRecord
- type SimplifiedPairAPIData
- type StopOrder
- func (so *StopOrder) ComputeHash() common.Hash
- func (so *StopOrder) EncodedSide() *big.Int
- func (so *StopOrder) GetBSON() (interface{}, error)
- func (so *StopOrder) MarshalJSON() ([]byte, error)
- func (so *StopOrder) PairCode() (string, error)
- func (so *StopOrder) Process(p *Pair) error
- func (so *StopOrder) QuoteAmount(p *Pair) *big.Int
- func (so *StopOrder) SetBSON(raw bson.Raw) error
- func (so *StopOrder) ToOrder() (*Order, error)
- func (so *StopOrder) UnmarshalJSON(b []byte) error
- func (so *StopOrder) Validate() error
- func (so *StopOrder) VerifySignature() (bool, error)
- type StopOrderBSONUpdate
- type StopOrderRecord
- type SubscriptionEvent
- type SubscriptionPayload
- type Tick
- type Ticks
- type Token
- type TokenBalance
- type TokenBalanceRecord
- type TokenRecord
- type TopupSpec
- type Trade
- func (t *Trade) ComputeHash() common.Hash
- func (t *Trade) GetBSON() (interface{}, error)
- func (t *Trade) MarshalJSON() ([]byte, error)
- func (t *Trade) Pair() (*Pair, error)
- func (t *Trade) QuoteAmount(p *Pair) *big.Int
- func (t *Trade) SetBSON(raw bson.Raw) error
- func (t *Trade) UnmarshalJSON(b []byte) error
- func (t *Trade) Validate() error
- type TradeBSONUpdate
- type TradeChangeEvent
- type TradeRecord
- type TradeRes
- type TradeSpec
- type Wallet
- func (w *Wallet) GetAddress() string
- func (w *Wallet) GetBSON() (interface{}, error)
- func (w *Wallet) GetPrivateKey() string
- func (w *Wallet) SetBSON(raw bson.Raw) error
- func (w *Wallet) SignHash(h common.Hash) (*Signature, error)
- func (w *Wallet) SignOrder(o *Order) error
- func (w *Wallet) Validate() error
- type WalletRecord
- type WebsocketEvent
- type WebsocketMessage
Constants ¶
const ( AssetCodeETH AssetCode = "ETH" AssetCodeBTC AssetCode = "BTC" CreateOffer = "CreateOffer" CreateAccount = "CreateAccount" RemoveSigner = "RemoveSigner" )
const ( LendingRate = 150 BORROW = "BORROW" LEND = "INVEST" TypeMarket = "MO" TypeLimit = "LO" LendingStatusOpen = "OPEN" LendingStatusPartialFilled = "PARTIAL_FILLED" LendingStatusFilled = "FILLED" LendingStatusRejected = "REJECTED" LendingStatusCancelled = "CANCELLED" LendingStatusRepay = "REPAY" LendingStatusTopup = "TOPUP" LendingStatusRecall = "RECALL" )
const ( TradeStatusOpen = "OPEN" TradeStatusClosed = "CLOSED" TradeStatusLiquidated = "LIQUIDATED" )
const ( PENDING = "PENDING" SUCCESS = "SUCCESS" FAILED = "FAILED" DefaultLimit = 50 )
const ( StatusUnread = "UNREAD" StatusRead = "READ" TypeAnnounce = "ANNOUNCE" TypeAlert = "ALERT" TypeLog = "LOG" )
const ( BUY = "BUY" SELL = "SELL" TypeMarketOrder = "MO" TypeLimitOrder = "LO" OrderStatusOpen = "OPEN" OrderStatusPartialFilled = "PARTIAL_FILLED" OrderStatusFilled = "FILLED" OrderStatusRejected = "REJECTED" OrderStatusCancelled = "CANCELLED" )
const ( OPERATION_TYPE_INSERT = "insert" OPERATION_TYPE_UPDATE = "update" OPERATION_TYPE_REPLACE = "replace" OPERATION_TYPE_DELETE = "delete" )
const ( TypeStopMarketOrder = "SMO" TypeStopLimitOrder = "SLO" StopOrderStatusOpen = "OPEN" StopOrderStatusDone = "DONE" StopOrderStatusCancelled = "CANCELLED" )
const ( TradeStatusPending = "PENDING" TradeStatusSuccess = "SUCCESS" TradeStatusError = "ERROR" )
const ( SUBSCRIBE SubscriptionEvent = "SUBSCRIBE" UNSUBSCRIBE SubscriptionEvent = "UNSUBSCRIBE" Fetch SubscriptionEvent = "fetch" UPDATE SubscriptionEvent = "UPDATE" ERROR SubscriptionEvent = "ERROR" SUCCESS_EVENT SubscriptionEvent = "SUCCESS" INIT SubscriptionEvent = "INIT" CANCEL SubscriptionEvent = "CANCEL" ORDER_ADDED = "ORDER_ADDED" ORDER_FILLED = "ORDER_FILLED" ORDER_PARTIALLY_FILLED = "ORDER_PARTIALLY_FILLED" ORDER_CANCELLED = "ORDER_CANCELLED" ORDER_REJECTED = "ORDER_REJECTED" ERROR_STATUS = "ERROR" TradeAdded = "TRADE_ADDED" TradeUpdated = "TRADE_UPDATED" // channel TradeChannel = "trades" OrderbookChannel = "orderbook" OrderChannel = "orders" OHLCVChannel = "ohlcv" // Lending LENDING_ORDER_ADDED = "LENDING_ORDER_ADDED" LENDING_ORDER_FILLED = "LENDING_ORDER_FILLED" LENDING_ORDER_PARTIALLY_FILLED = "LENDING_ORDER_PARTIALLY_FILLED" LENDING_ORDER_CANCELLED = "LENDING_ORDER_CANCELLED" LENDING_ORDER_REJECTED = "LENDING_ORDER_REJECTED" LENDING_ORDER_TOPUPED = "LENDING_ORDER_TOPUPED" LENDING_ORDER_REPAYED = "LENDING_ORDER_REPAYED" LENDING_ORDER_RECALLED = "LENDING_ORDER_RECALLED" LENDING_ORDER_TOPUP_REJECTED = "LENDING_ORDER_TOPUP_REJECTED" LENDING_ORDER_REPAY_REJECTED = "LENDING_ORDER_REPAY_REJECTED" LENDING_ORDER_RECALL_REJECTED = "LENDING_ORDER_RECALL_REJECTED" )
Enum members for SubscriptionEvent
Variables ¶
This section is empty.
Functions ¶
func DefaultTestAvailableBalance ¶
func DefaultTestAvailableBalance() int64
DefaultTestAvailableBalance returns the default available balance Only for testing/mock purpose
func DefaultTestBalance ¶
func DefaultTestBalance() int64
DefaultTestBalance returns the default balance Only for testing/mock purpose
func DefaultTestInOrderBalance ¶
func DefaultTestInOrderBalance() int64
DefaultTestBalance returns the default locked balance Only for testing/mock purpose
Types ¶
type Account ¶
type Account struct { ID bson.ObjectId `json:"-" bson:"_id"` Address common.Address `json:"address" bson:"address"` TokenBalances map[common.Address]*TokenBalance `json:"tokenBalances" bson:"tokenBalances"` FavoriteTokens map[common.Address]bool `json:"favoriteTokens" bson:"favoriteTokens"` 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 Ethereum 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"` FavoriteTokens map[string]bool `json:"favoriteTokens" bson:"favoriteTokens"` 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. big.Ints are encoded as strings
type AddressAssociation ¶
type AddressAssociation struct { // Chain is the name of the payment origin chain Chain Chain `json:"chain"` // BIP-44 AddressIndex uint64 `json:"addressIndex"` Address common.Address `json:"address"` AssociatedAddress common.Address `json:"associatedAddress"` TomochainPublicKey common.Address `json:"tomochainPublicKey"` CreatedAt time.Time `json:"createdAt"` }
type AddressAssociationRecord ¶
type AddressAssociationRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` AddressIndex uint64 `json:"addressIndex" bson:"addressIndex"` Chain Chain `json:"chain" bson:"chain"` Address string `json:"address" bson:"address"` Status string `json:"status" bson:"status"` AssociatedAddress string `json:"associatedAddress" bson:"associatedAddress"` // this is the last transaction envelopes, should move to seperated collection // We also have it from blockchain transactions TxEnvelopes []string `json:"txEnvelopes" bson:"txEnvelopes"` PairName string `json:"pairName" bson:"pairName"` BaseTokenAddress string `json:"baseTokenAddress" bson:"baseTokenAddress"` QuoteTokenAddress string `json:"quoteTokenAddress" bson:"quoteTokenAddress"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
AddressAssociationRecord is the object that will be saved in the database
func (*AddressAssociationRecord) GetJSON ¶
func (aar *AddressAssociationRecord) GetJSON() (*AddressAssociation, error)
type AddressAssociationWebsocketPayload ¶
type AddressAssociationWebsocketPayload struct { Chain Chain `json:"chain"` AssociatedAddress common.Address `json:"associatedAddress"` PairAddresses *PairAddresses `json:"pairAddresses"` }
type AssociationTransaction ¶
type AssociationTransaction struct { Source string `json:"source"` Signature []byte `json:"signature"` Hash []byte `json:"hash"` TransactionType string `json:"transactionType"` Params []string `json:"params"` }
func (*AssociationTransaction) ComputeHash ¶
func (o *AssociationTransaction) ComputeHash() []byte
ComputeHash calculates the orderRequest hash
func (*AssociationTransaction) GetJSON ¶
func (o *AssociationTransaction) GetJSON() *AssociationTransactionResponse
type CoinsIDMarketChart ¶
type DepositTransaction ¶
type DepositTransaction struct { Chain Chain TransactionID string AssetCode AssetCode PairName string // CRITICAL REQUIREMENT: Amount in the base unit of currency. // For 10 satoshi this should be equal 0.0000001 // For 1 BTC this should be equal 1.0000000 // For 1 Finney this should be equal 0.0010000 // For 1 ETH this should be equal 1.0000000 // Currently, the length of Amount string shouldn't be longer than 17 characters. Amount string AssociatedAddress string }
type EngineResponse ¶
type EngineResponse struct { Status string `json:"fillStatus,omitempty"` Order *Order `json:"order,omitempty"` Trade *Trade `json:"trade,omitenpty"` Matches *Matches `json:"matches,omitempty"` RecoveredOrders *[]*Order `json:"recoveredOrders,omitempty"` InvalidatedOrders *[]*Order `json:"invalidatedOrders,omitempty"` CancelledTrades *[]*Trade `json:"cancelledTrades,omitempty"` LendingOrder *LendingOrder `json:"lendingOrder,omitempty"` LendingTrade *LendingTrade `json:"lendingTrade,omitenpty"` LendingMatches *LendingMatches `json:"lendingMatches,omitempty"` }
EngineResponse engine message
func (*EngineResponse) AppendMatch ¶
func (r *EngineResponse) AppendMatch(mo *Order, t *Trade)
func (*EngineResponse) AppendMatches ¶
func (r *EngineResponse) AppendMatches(mo []*Order, t []*Trade)
type FavoriteTokenRequest ¶
type FiatPriceItem ¶
type FiatPriceItem struct { Symbol string `json:"-" bson:"symbol"` Price string `json:"price" bson:"price"` Timestamp int64 `json:"timestamp" bson:"timestamp"` FiatCurrency string `json:"fiatCurrency" bson:"fiatCurrency"` TotalVolume string `json:"totalVolume" bson:"totalVolume"` }
func (*FiatPriceItem) GetBSON ¶
func (i *FiatPriceItem) GetBSON() (interface{}, error)
type FiatPriceItemBSONUpdate ¶
type FiatPriceItemBSONUpdate struct {
*FiatPriceItem
}
type GenerateAddressResponse ¶
type Image ¶
type Image struct { URL string `json:"url" bson:"url"` Meta map[string]interface{} `json:"meta" bson:"meta"` }
Image is a sub document used to store data related to images
type KeyValue ¶
type KeyValue struct { Key string `json:"key" bson"key"` Value interface{} `json:"value" bson "value"` }
type LendingID ¶ added in v1.2.0
type LendingID struct { Name string `json:"name" bson:"name"` Term uint64 `json:"term" bson:"term"` LendingToken common.Address `json:"lendingToken" bson:"lendingToken"` }
LendingID is the subdocument for aggregate grouping for OHLCV data
type LendingMarketData ¶ added in v1.2.0
type LendingMarketData struct {
PairData []*LendingTick `json:"pairData" bson:"pairData"`
}
LendingMarketData lending pair tick data
type LendingMatches ¶ added in v1.2.0
type LendingMatches struct { Investing []*LendingOrder `json:"investing"` Borrowing *LendingOrder `json:"borrowing"` LendingTrades []*LendingTrade `json:"lendingTrades"` }
LendingMatches matching trade
type LendingOrder ¶ added in v1.2.0
type LendingOrder struct { ID bson.ObjectId `json:"id" bson:"_id"` Quantity *big.Int `bson:"quantity" json:"quantity"` Interest uint64 `bson:"interest" json:"interest"` Term uint64 `bson:"term" json:"term"` Side string `bson:"side" json:"side"` Type string `bson:"type" json:"type"` LendingToken common.Address `bson:"lendingToken" json:"lendingToken"` CollateralToken common.Address `bson:"collateralToken" json:"collateralToken"` FilledAmount *big.Int `bson:"filledAmount" json:"filledAmount"` Status string `bson:"status" json:"status"` UserAddress common.Address `bson:"userAddress" json:"userAddress"` RelayerAddress common.Address `bson:"relayer" json:"relayerAddress"` Signature *Signature `bson:"signature" json:"signature"` Hash common.Hash `bson:"hash" json:"hash"` TxHash common.Hash `bson:"txHash" json:"txHash"` Nonce *big.Int `bson:"nonce" json:"nonce"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` LendingID uint64 `bson:"lendingId" json:"lendingId"` ExtraData string `bson:"extraData" json:"extraData"` LendingTradeID uint64 `bson:"tradeId" json:"tradeId"` AutoTopUp uint64 `json:"autoTopUp" json:"autoTopUp"` Key string `json:"key" bson:"key"` }
LendingOrder contains the data related to an lending sent by the user
func (*LendingOrder) ComputeHash ¶ added in v1.2.0
func (o *LendingOrder) ComputeHash() common.Hash
ComputeHash calculates the orderRequest hash
func (*LendingOrder) GetBSON ¶ added in v1.2.0
func (o *LendingOrder) GetBSON() (interface{}, error)
GetBSON return bson
func (*LendingOrder) MarshalJSON ¶ added in v1.2.0
func (o *LendingOrder) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshal interface
func (*LendingOrder) PairCode ¶ added in v1.2.0
func (o *LendingOrder) PairCode() (string, error)
PairCode get orderbook code
func (*LendingOrder) Process ¶ added in v1.2.0
func (o *LendingOrder) Process() error
Process pre-process data
func (*LendingOrder) SetBSON ¶ added in v1.2.0
func (o *LendingOrder) SetBSON(raw bson.Raw) error
SetBSON for database
func (*LendingOrder) UnmarshalJSON ¶ added in v1.2.0
func (o *LendingOrder) UnmarshalJSON(b []byte) error
UnmarshalJSON : write custom logic to unmarshal bytes to LendingOrder
func (*LendingOrder) Validate ¶ added in v1.2.0
func (o *LendingOrder) Validate() error
Validate Verify userAddress, collateralToken, lendingToken, etc. conditions are working
func (*LendingOrder) VerifySignature ¶ added in v1.2.0
func (o *LendingOrder) VerifySignature() (bool, error)
VerifySignature checks that the orderRequest signature corresponds to the address in the userAddress field
type LendingOrderBook ¶ added in v1.2.0
type LendingOrderBook struct { Name string `json:"name"` Borrow []map[string]string `json:"borrow"` Lend []map[string]string `json:"lend"` }
LendingOrderBook for lending orderbook
type LendingOrderCancel ¶ added in v1.2.0
type LendingOrderCancel struct { LendingHash common.Hash `json:"lendingHash"` Nonce *big.Int `json:"nonce"` Hash common.Hash `json:"hash"` LendingID uint64 `json:"lendingId"` Status string `json:"status"` UserAddress common.Address `json:"userAddress"` RelayerAddress common.Address `json:"relayerAddress"` Term uint64 `json:"term"` Interest uint64 `json:"interest"` Signature *Signature `json:"signature"` }
LendingOrderCancel for cancelled lending order
func (*LendingOrderCancel) MarshalJSON ¶ added in v1.2.0
func (oc *LendingOrderCancel) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the LendingOrderCancel struct
func (*LendingOrderCancel) UnmarshalJSON ¶ added in v1.2.0
func (oc *LendingOrderCancel) UnmarshalJSON(b []byte) error
UnmarshalJSON creates an LendingOrderCancel object from a json byte string
type LendingOrderChangeEvent ¶ added in v1.2.0
type LendingOrderChangeEvent struct { ID interface{} `bson:"_id"` OperationType string `bson:"operationType"` FullDocument *LendingOrder `bson:"fullDocument,omitempty"` Ns evNamespace `bson:"ns"` DocumentKey M `bson:"documentKey"` UpdateDescription *updateDesc `bson:"updateDescription,omitempty"` }
LendingOrderChangeEvent data format for changing data records
type LendingOrderMatchedPayload ¶ added in v1.2.0
type LendingOrderMatchedPayload struct {
LendingMatches *LendingMatches `json:"matches"`
}
type LendingOrderPendingPayload ¶ added in v1.2.0
type LendingOrderPendingPayload struct {
LendingMatches *LendingMatches `json:"matches"`
}
type LendingOrderSuccessPayload ¶ added in v1.2.0
type LendingOrderSuccessPayload struct {
LendingMatches *LendingMatches `json:"matches"`
}
type LendingPair ¶ added in v1.2.0
type LendingPair struct { ID bson.ObjectId `json:"-" bson:"_id"` Term uint64 `json:"term,omitempty" bson:"term"` LendingTokenSymbol string `json:"lendingTokenSymbol,omitempty" bson:"lendingTokenSymbol"` LendingTokenAddress common.Address `json:"lendingTokenAddress,omitempty" bson:"lendingTokenAddress"` LendingTokenDecimals int `json:"lendingTokenDecimals,omitempty" bson:"lendingTokenDecimals"` RelayerAddress common.Address `json:"relayerAddress,omitempty" bson:"relayerAddress"` CreatedAt time.Time `json:"-" bson:"createdAt"` UpdatedAt time.Time `json:"-" bson:"updatedAt"` }
LendingPair struct is used to model the lendingPair data in the system and DB
func (*LendingPair) GetBSON ¶ added in v1.2.0
func (p *LendingPair) GetBSON() (interface{}, error)
GetBSON insert record to database
func (*LendingPair) MarshalJSON ¶ added in v1.2.0
func (p *LendingPair) MarshalJSON() ([]byte, error)
MarshalJSON marshal json byte
func (*LendingPair) Name ¶ added in v1.2.0
func (p *LendingPair) Name() string
Name name of lending pair
func (*LendingPair) SetBSON ¶ added in v1.2.0
func (p *LendingPair) SetBSON(raw bson.Raw) error
SetBSON get lending pair object from database
func (*LendingPair) UnmarshalJSON ¶ added in v1.2.0
func (p *LendingPair) UnmarshalJSON(b []byte) error
UnmarshalJSON umarshal JSON
type LendingPairRecord ¶ added in v1.2.0
type LendingPairRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` Term string `json:"term" bson:"term"` LendingTokenSymbol string `json:"lendingTokenSymbol" bson:"lendingTokenSymbol"` LendingTokenAddress string `json:"lendingTokenAddress" bson:"lendingTokenAddress"` LendingTokenDecimals int `json:"lendingTokenDecimals" bson:"lendingTokenDecimals"` RelayerAddress string `json:"relayerAddress" bson:"relayerAddress"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
LendingPairRecord struct for database
type LendingRecord ¶ added in v1.2.0
type LendingRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress string `json:"userAddress" bson:"userAddress"` RelayerAddress string `json:"relayerAddress" bson:"relayer"` CollateralToken string `json:"collateralToken" bson:"collateralToken"` LendingToken string `json:"lendingToken" bson:"lendingToken"` Term string `json:"term" bson:"term"` Interest string `json:"interest" bson:"interest"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Type string `json:"type" bson:"type"` Hash string `json:"hash" bson:"hash"` Quantity string `json:"quantity" bson:"quantity"` FilledAmount string `json:"filledAmount" bson:"filledAmount"` Nonce string `json:"nonce" bson:"nonce"` Signature *SignatureRecord `json:"signature,omitempty" bson:"signature"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` LendingID string `json:"lendingId,omitempty" bson:"lendingId"` NextOrder string `json:"nextOrder,omitempty" bson:"nextOrder"` PrevOrder string `json:"prevOrder,omitempty" bson:"prevOrder"` OrderList string `json:"orderList,omitempty" bson:"orderList"` Key string `json:"key" bson:"key"` }
LendingRecord is the object that will be saved in the database
type LendingRes ¶ added in v1.2.0
type LendingRes struct { Total int `json:"total" bson:"total"` LendingItems []*LendingOrder `json:"lendings" bson:"lendings"` }
LendingRes use for api
type LendingSpec ¶ added in v1.2.0
type LendingSpec struct { UserAddress string CollateralToken string RelayerAddress common.Address LendingToken string Term string Status string Side string Type string DateFrom int64 DateTo int64 Hash string }
LendingSpec contains field for filter
type LendingTick ¶ added in v1.2.0
type LendingTick struct { LendingID LendingID `json:"lendingID,omitempty" bson:"lendingID"` Open uint64 `json:"open,omitempty" bson:"open"` Close uint64 `json:"close,omitempty" bson:"close"` High uint64 `json:"high,omitempty" bson:"high"` Low uint64 `json:"low,omitempty" bson:"low"` Volume *big.Int `json:"volume,omitempty" bson:"volume"` Count *big.Int `json:"count,omitempty" bson:"count"` Timestamp int64 `json:"timestamp,omitempty" bson:"timestamp"` Duration int64 `json:"duration" bson:"duration"` Unit string `json:"unit" bson:"unit"` }
LendingTick is the format in which mongo aggregate pipeline returns data when queried for OHLCV data
func (*LendingTick) AddressCode ¶ added in v1.2.0
func (t *LendingTick) AddressCode() string
AddressCode generate code from pair
func (*LendingTick) MarshalJSON ¶ added in v1.2.0
func (t *LendingTick) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the trade struct
func (*LendingTick) UnmarshalJSON ¶ added in v1.2.0
func (t *LendingTick) UnmarshalJSON(b []byte) error
UnmarshalJSON creates a trade object from a json byte string
type LendingTicks ¶ added in v1.2.0
type LendingTicks []*LendingTick
LendingTicks array of lending ticks
type LendingTrade ¶ added in v1.2.0
type LendingTrade struct { ID bson.ObjectId `json:"id,omitempty" bson:"_id"` Borrower common.Address `bson:"borrower" json:"borrower"` Investor common.Address `bson:"investor" json:"investor"` LendingToken common.Address `bson:"lendingToken" json:"lendingToken"` CollateralToken common.Address `bson:"collateralToken" json:"collateralToken"` BorrowingOrderHash common.Hash `bson:"borrowingOrderHash" json:"borrowingOrderHash"` InvestingOrderHash common.Hash `bson:"investingOrderHash" json:"investingOrderHash"` BorrowingRelayer common.Address `bson:"borrowingRelayer" json:"borrowingRelayer"` InvestingRelayer common.Address `bson:"investingRelayer" json:"investingRelayer"` Term uint64 `bson:"term" json:"term"` Interest uint64 `bson:"interest" json:"interest"` CollateralPrice *big.Int `bson:"collateralPrice" json:"collateralPrice"` LiquidationPrice *big.Int `bson:"liquidationPrice" json:"liquidationPrice"` CollateralLockedAmount *big.Int `bson:"collateralLockedAmount" json:"collateralLockedAmount"` LiquidationTime uint64 `bson:"liquidationTime" json:"liquidationTime"` DepositRate *big.Int `bson:"depositRate" json:"depositRate"` Amount *big.Int `bson:"amount" json:"amount"` BorrowingFee *big.Int `bson:"borrowingFee" json:"borrowingFee"` InvestingFee *big.Int `bson:"investingFee" json:"investingFee"` Status string `bson:"status" json:"status"` TakerOrderSide string `bson:"takerOrderSide" json:"takerOrderSide"` TakerOrderType string `bson:"takerOrderType" json:"takerOrderType"` MakerOrderType string `bson:"makerOrderType" json:"makerOrderType"` TradeID string `bson:"tradeId" json:"tradeID"` Hash common.Hash `bson:"hash" json:"hash"` TxHash common.Hash `bson:"txHash" json:"txHash"` AutoTopUp uint64 `json:"autoTopUp" json:"autoTopUp"` ExtraData string `bson:"extraData" json:"extraData"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` }
LendingTrade lending trade struct
func (*LendingTrade) ComputeHash ¶ added in v1.2.0
func (t *LendingTrade) ComputeHash() common.Hash
ComputeHash returns hashes the trade The OrderHash, Amount, Taker and TradeNonce attributes must be set before attempting to compute the trade hash
func (*LendingTrade) GetBSON ¶ added in v1.2.0
func (t *LendingTrade) GetBSON() (interface{}, error)
GetBSON for monggo insert
func (*LendingTrade) MarshalJSON ¶ added in v1.2.0
func (t *LendingTrade) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the trade struct
func (*LendingTrade) SetBSON ¶ added in v1.2.0
func (t *LendingTrade) SetBSON(raw bson.Raw) error
SetBSON get monggo record
func (*LendingTrade) UnmarshalJSON ¶ added in v1.2.0
func (t *LendingTrade) UnmarshalJSON(b []byte) error
UnmarshalJSON creates a trade object from a json byte string
type LendingTradeBSON ¶ added in v1.2.0
type LendingTradeBSON struct { ID bson.ObjectId `json:"id,omitempty" bson:"_id"` Borrower string `bson:"borrower" json:"borrower"` Investor string `bson:"investor" json:"investor"` LendingToken string `bson:"lendingToken" json:"lendingToken"` CollateralToken string `bson:"collateralToken" json:"collateralToken"` BorrowingOrderHash string `bson:"borrowingOrderHash" json:"borrowingOrderHash"` InvestingOrderHash string `bson:"investingOrderHash" json:"investingOrderHash"` BorrowingRelayer string `bson:"borrowingRelayer" json:"borrowingRelayer"` InvestingRelayer string `bson:"investingRelayer" json:"investingRelayer"` Term string `bson:"term" json:"term"` Interest string `bson:"interest" json:"interest"` CollateralPrice string `bson:"collateralPrice" json:"collateralPrice"` LiquidationPrice string `bson:"liquidationPrice" json:"liquidationPrice"` LiquidationTime string `bson:"liquidationTime" json:"liquidationTime"` CollateralLockedAmount string `bson:"collateralLockedAmount" json:"collateralLockedAmount"` DepositRate string `bson:"depositRate" json:"depositRate"` Amount string `bson:"amount" json:"amount"` BorrowingFee string `bson:"borrowingFee" json:"borrowingFee"` InvestingFee string `bson:"investingFee" json:"investingFee"` Status string `bson:"status" json:"status"` TakerOrderSide string `bson:"takerOrderSide" json:"takerOrderSide"` TakerOrderType string `bson:"takerOrderType" json:"takerOrderType"` MakerOrderType string `bson:"makerOrderType" json:"makerOrderType"` TradeID string `bson:"tradeId" json:"tradeID"` Hash string `bson:"hash" json:"hash"` TxHash string `bson:"txHash" json:"txHash"` AutoTopUp uint64 `bson:"autoTopUp" json:"autoTopUp"` ExtraData string `bson:"extraData" json:"extraData"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` }
LendingTradeBSON lending trade mongo
type LendingTradeChangeEvent ¶ added in v1.2.0
type LendingTradeChangeEvent struct { ID interface{} `bson:"_id"` OperationType string `bson:"operationType"` FullDocument *LendingTrade `bson:"fullDocument,omitempty"` Ns evNamespace `bson:"ns"` DocumentKey M `bson:"documentKey"` UpdateDescription *updateDesc `bson:"updateDescription,omitempty"` }
LendingTradeChangeEvent event for changing mongo watch
type LendingTradeRes ¶ added in v1.2.0
type LendingTradeRes struct { Total int `json:"total" bson:"total"` LendingTrades []*LendingTrade `json:"trades" bson:"trades"` }
LendingTradeRes response api
type LendingTradeSpec ¶ added in v1.2.0
type LendingTradeSpec struct { CollateralToken string RelayerAddress common.Address LendingToken string Term string Status string DateFrom int64 DateTo int64 }
LendingTradeSpec for query
type MarketData ¶
type MarketData struct { PairData []*PairData `json:"pairData" bson:"pairData"` SmallChartsData map[string][]*FiatPriceItem `json:"smallChartsData" bson:"smallChartsData"` }
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 Message ¶
type Message struct { MessageType string `json:"type" bson:"type"` Description string `json:"description" bson:"description"` }
Message struct
type NativeCurrency ¶
type NativeCurrency struct { Address common.Address `json:"address" bson:"address"` Symbol string `json:"symbol" bson:"symbol"` Decimals int `json:"decimals" bson:"decimals"` }
func GetNativeCurrency ¶
func GetNativeCurrency() NativeCurrency
type NewOrderPayload ¶
type NewOrderPayload struct { PairName string `json:"pairName"` ExchangeAddress common.Address `json:"exchangeAddress"` UserAddress common.Address `json:"userAddress"` BaseToken common.Address `json:"baseToken"` QuoteToken common.Address `json:"quoteToken"` Side string `json:"side"` Amount *big.Int `json:"amount"` PricePoint *big.Int `json:"pricepoint"` Nonce *big.Int `json:"nonce" bson:"nonce"` Signature *Signature `json:"signature"` Hash common.Hash `json:"hash"` }
NewOrderPayload is the struct in which the order request sent by the user is populated
func (*NewOrderPayload) ComputeHash ¶
func (p *NewOrderPayload) ComputeHash() common.Hash
ComputeHash calculates the orderRequest hash
func (*NewOrderPayload) EncodedSide ¶
func (p *NewOrderPayload) EncodedSide() *big.Int
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.
func (*NewOrderPayload) VerifySignature ¶
func (p *NewOrderPayload) VerifySignature() (bool, error)
VerifySignature checks that the orderRequest signature corresponds to the address in the userAddress field
type Notification ¶
type Notification struct { ID bson.ObjectId `json:"_id" bson:"_id"` Recipient common.Address `json:"recipient" bson:"recipient"` Message Message `json:"message" bson:"message"` Type string `json:"type" bson:"type"` Status string `json:"status" bson:"status"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
Notification struct
func (*Notification) GetBSON ¶
func (n *Notification) GetBSON() (interface{}, error)
GetBSON get Notification struct
func (*Notification) MarshalJSON ¶
func (n *Notification) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the notification struct
func (*Notification) SetBSON ¶
func (n *Notification) SetBSON(raw bson.Raw) error
SetBSON json to Notification
func (*Notification) UnmarshalJSON ¶
func (n *Notification) UnmarshalJSON(b []byte) error
UnmarshalJSON creates a notification object from a json byte string
type NotificationBSONUpdate ¶
type NotificationBSONUpdate struct {
*Notification
}
NotificationBSONUpdate return BSON structure for NotificationSpec structure
type NotificationRecord ¶
type NotificationRecord struct { ID bson.ObjectId `json:"_id" bson:"_id"` Recipient string `json:"recipient" bson:"recipient"` Message Message `json:"message" bson:"message"` Type string `json:"type" bson:"type"` Status string `json:"status" bson:"status"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
NotificationRecord struct
type OHLCVParams ¶
type OHLCVParams struct { Pair []PairAddresses `json:"pair"` From int64 `json:"from"` To int64 `json:"to"` Duration int64 `json:"duration"` Units string `json:"units"` }
OHLCVParams struct
type OperatorMessage ¶
func (*OperatorMessage) String ¶
func (m *OperatorMessage) String() string
type Order ¶
type Order struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress common.Address `json:"userAddress" bson:"userAddress"` ExchangeAddress common.Address `json:"exchangeAddress" bson:"exchangeAddress"` BaseToken common.Address `json:"baseToken" bson:"baseToken"` QuoteToken common.Address `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Type string `json:"type" bson:"type"` Hash common.Hash `json:"hash" bson:"hash"` Signature *Signature `json:"signature,omitempty" bson:"signature"` PricePoint *big.Int `json:"pricepoint" bson:"price"` Amount *big.Int `json:"amount" bson:"quantity"` FilledAmount *big.Int `json:"filledAmount" bson:"filledAmount"` Nonce *big.Int `json:"nonce" bson:"nonce"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` OrderID uint64 `json:"orderID,omitempty" bson:"orderID"` NextOrder []byte `json:"-"` PrevOrder []byte `json:"-"` OrderList []byte `json:"-"` Key string `json:"key" bson:"key"` }
Order contains the data related to an order sent by the user
func (*Order) BaseTokenSymbol ¶
func (*Order) BuyTokenSymbol ¶
func (*Order) ComputeHash ¶
ComputeHash calculates the orderRequest hash
func (*Order) MarshalJSON ¶
MarshalJSON implements the json.Marshal interface
func (*Order) QuoteTokenSymbol ¶
func (*Order) RemainingAmount ¶
func (*Order) SellAmount ¶
SellAmount If order is a "BUY", then sellToken = quoteToken
func (*Order) SellTokenSymbol ¶
func (*Order) Sign ¶
Sign first calculates the order hash, then computes a signature of this hash with the given wallet
func (*Order) UnmarshalJSON ¶
UnmarshalJSON : write custom logic to unmarshal bytes to Order
func (*Order) Validate ¶
Validate Verify userAddress, baseToken, quoteToken, etc. conditions are working
func (*Order) VerifySignature ¶
VerifySignature checks that the orderRequest signature corresponds to the address in the userAddress field
type OrderBSONUpdate ¶
type OrderBSONUpdate struct {
*Order
}
func (OrderBSONUpdate) GetBSON ¶
func (o OrderBSONUpdate) GetBSON() (interface{}, error)
type OrderCancel ¶
type OrderCancel struct { OrderHash common.Hash `json:"orderHash"` Nonce *big.Int `json:"nonce"` Hash common.Hash `json:"hash"` OrderID uint64 `json:"orderID"` Status string `json:"status"` UserAddress common.Address `json:"userAddress"` ExchangeAddress common.Address `json:"exchangeAddress"` Signature *Signature `json:"signature"` }
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) ComputeHash ¶
func (oc *OrderCancel) ComputeHash() common.Hash
ComputeHash computes the hash of an order cancel message
func (*OrderCancel) GetSenderAddress ¶
func (oc *OrderCancel) GetSenderAddress() (common.Address, error)
func (*OrderCancel) MarshalJSON ¶
func (oc *OrderCancel) MarshalJSON() ([]byte, error)
MarshalJSON returns the json encoded byte array representing the OrderCancel struct
func (*OrderCancel) Sign ¶
func (oc *OrderCancel) Sign(w *Wallet) error
Sign first computes the order cancel hash, then signs and sets the signature
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
func (*OrderCancel) VerifySignature ¶
func (oc *OrderCancel) VerifySignature(o *Order) (bool, error)
VerifySignature returns a true value if the OrderCancel object signature corresponds to the Maker of the given order
type OrderChangeEvent ¶
type OrderData ¶
type OrderData struct { Pair PairID `json:"id,omitempty" bson:"_id"` OrderVolume *big.Int `json:"orderVolume,omitempty" bson:"orderVolume"` OrderCount *big.Int `json:"orderCount,omitempty" bson:"orderCount"` BestPrice *big.Int `json:"bestPrice,omitempty" bson:"bestPrice"` }
func (*OrderData) AddressCode ¶
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"` ExchangeAddress string `json:"exchangeAddress" bson:"exchangeAddress"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Type string `json:"type" bson:"type"` Hash string `json:"hash" bson:"hash"` Price string `json:"price" bson:"price"` Quantity string `json:"quantity" bson:"quantity"` FilledAmount string `json:"filledAmount" bson:"filledAmount"` Nonce string `json:"nonce" bson:"nonce"` Signature *SignatureRecord `json:"signature,omitempty" bson:"signature"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` OrderID string `json:"orderID,omitempty" bson:"orderID"` NextOrder string `json:"nextOrder,omitempty" bson:"nextOrder"` PrevOrder string `json:"prevOrder,omitempty" bson:"prevOrder"` OrderList string `json:"orderList,omitempty" bson:"orderList"` Key string `json:"key" bson:"key"` }
OrderRecord is the object that will be saved in the database
type OrderRes ¶
type OrderRes struct { Total int `json:"total" bson:"total"` Orders []*Order `json:"orders" bson:"orders"` }
OrderRes use for api
type OrderSpec ¶
type OrderSpec struct { UserAddress string RelayerAddress common.Address BaseToken string QuoteToken string Status string Side string OrderType string DateFrom int64 DateTo int64 OrderHash string }
OrderSpec contains field for filter
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"` BaseTokenAddress common.Address `json:"baseTokenAddress,omitempty" bson:"baseTokenAddress"` BaseTokenDecimals int `json:"baseTokenDecimals,omitempty" bson:"baseTokenDecimals"` QuoteTokenSymbol string `json:"quoteTokenSymbol,omitempty" bson:"quoteTokenSymbol"` QuoteTokenAddress common.Address `json:"quoteTokenAddress,omitempty" bson:"quoteTokenAddress"` 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"` MakeFee *big.Int `json:"makeFee,omitempty" bson:"makeFee"` TakeFee *big.Int `json:"takeFee,omitempty" bson:"takeFee"` RelayerAddress common.Address `json:"relayerAddress,omitempty" bson:"relayerAddress"` 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) AddressCode ¶
func (*Pair) BaseTokenMultiplier ¶
func (*Pair) DecimalsMultiplier ¶
func (*Pair) EncodedTopic ¶
func (*Pair) GetKVPrefix ¶
func (*Pair) GetOrderBookKeys ¶
GetOrderBookKeys returns the orderbook price point keys for corresponding pair It is used to fetch the orderbook of a pair
func (*Pair) MarshalJSON ¶
func (*Pair) MinQuoteAmount ¶
func (*Pair) PairMultiplier ¶
func (*Pair) PricepointMultiplier ¶
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) ValidateAddresses ¶
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"` 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 PairAddresses ¶
type PairAddressesRecord ¶
type PairData ¶
type PairData struct { Pair PairID `json:"pair,omitempty" bson:"_id"` Open *big.Int `json:"open,omitempty" bson:"open"` High *big.Int `json:"high,omitempty" bson:"high"` Low *big.Int `json:"low,omitempty" bson:"low"` Close *big.Int `json:"close,omitempty" bson:"close"` CloseBaseUsd *big.Float `json:"closeBaseUsd,omitempty" bson:"closeBaseUsd"` Volume *big.Int `json:"volume,omitempty" bson:"volume"` Count *big.Int `json:"count,omitempty" bson:"count"` Timestamp int64 `json:"timestamp,omitempty" bson:"timestamp"` OrderVolume *big.Int `json:"orderVolume,omitempty" bson:"orderVolume"` OrderCount *big.Int `json:"orderCount,omitempty" bson:"orderCount"` AverageOrderAmount *big.Int `json:"averageOrderAmount" bson:"averageOrderAmount"` AverageTradeAmount *big.Int `json:"averageTradeAmount" bson:"averageTradeAmount"` AskPrice *big.Int `json:"askPrice,omitempty" bson:"askPrice"` BidPrice *big.Int `json:"bidPrice,omitempty" bson:"bidPrice"` Price *big.Int `json:"price,omitempty" bson:"price"` Rank int `json:"rank,omitempty" bson:"rank"` }
func (*PairData) AddressCode ¶
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 common.Address `json:"baseToken" bson:"baseToken"` QuoteToken common.Address `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"` BaseTokenAddress string `json:"baseTokenAddress" bson:"baseTokenAddress"` BaseTokenDecimals int `json:"baseTokenDecimals" bson:"baseTokenDecimals"` QuoteTokenSymbol string `json:"quoteTokenSymbol" bson:"quoteTokenSymbol"` QuoteTokenAddress string `json:"quoteTokenAddress" bson:"quoteTokenAddress"` QuoteTokenDecimals int `json:"quoteTokenDecimals" bson:"quoteTokenDecimals"` RelayerAddress string `json:"relayerAddress" bson:"relayerAddress"` Active bool `json:"active" bson:"active"` Listed bool `json:"listed" bson:"listed"` MakeFee string `json:"makeFee" bson:"makeFee"` TakeFee string `json:"takeFee" bson:"takeFee"` Rank int `json:"rank" bson:"rank"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
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 PriceBoardData ¶
type PriceBoardData struct { Ticks []*Tick `json:"ticks" bson:"ticks"` PriceUSD string `json:"usd" bson:"usd"` LastTradePrice string `json:"last_trade_price" bson:"last_trade_price"` }
Pair struct is used to model the pair data in the system and DB
type PriceVolume ¶ added in v1.2.1
type PriceVolume struct { Price *big.Int `json:"price,omitempty"` Volume *big.Int `json:"volume,omitempty"` }
PriceVolume get best order price
type RawLendingOrderBook ¶ added in v1.2.0
type RawLendingOrderBook struct { PairName string `json:"pairName"` Orders []*Order `json:"orders"` }
RawLendingOrderBook for lending orderbook
type RawOrderBook ¶
type RecallSpec ¶ added in v1.2.0
type RecallSpec struct { UserAddress string CollateralToken string LendingToken string Term string Status string DateFrom int64 DateTo int64 Hash string }
RecallSpec filter recall
type Relayer ¶ added in v1.2.0
type Relayer struct { ID bson.ObjectId `json:"-" bson:"_id"` RID int `json:"rid" bson:"rid"` Owner common.Address `json:"owner" bson:"owner"` Deposit *big.Int `json:"deposit" bson:"deposit"` Address common.Address `json:"address" bson:"address"` Domain string `json:"domain" bson:"domain"` Name string `json:"name" bson:"name"` Resign bool `json:"resign" bson:"resign"` LockTime int `json:"lockTime" bson:"lockTime"` MakeFee *big.Int `json:"makeFee,omitempty" bson:"makeFee,omitempty"` TakeFee *big.Int `json:"takeFee,omitempty" bson:"makeFee,omitempty"` LendingFee *big.Int `json:"lendingFee,omitempty" bson:"lendingFee,omitempty"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
Relayer corresponds to a single Ethereum address. It contains a list of token balances for that address
func (*Relayer) MarshalJSON ¶ added in v1.2.0
MarshalJSON implements the json.Marshal interface
func (*Relayer) UnmarshalJSON ¶ added in v1.2.0
type RelayerBSONUpdate ¶ added in v1.2.0
type RelayerBSONUpdate struct {
*Relayer
}
func (*RelayerBSONUpdate) GetBSON ¶ added in v1.2.0
func (a *RelayerBSONUpdate) GetBSON() (interface{}, error)
type RelayerLendingTick ¶ added in v1.2.1
type RelayerLendingTick struct { RelayerAddress common.Address `json:"relayerAddress,omitempty" bson:"relayerAddress"` LendingTick *LendingTick `json:"lendingTick,omitempty" bson:"lendingTick"` }
RelayerLendingTick relayer tick
type RelayerLendingTicks ¶ added in v1.2.1
type RelayerLendingTicks []*RelayerLendingTick
RelayerLendingTicks array relayer tick
type RelayerRecord ¶ added in v1.2.0
type RelayerRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` RID int `json:"rid" bson:"rid"` Owner string `json:"owner" bson:"owner"` Deposit string `json:"deposit" bson:"deposit"` Address string `json:"address" bson:"address"` Domain string `json:"domain" bson:"domain"` Name string `json:"name" bson:"name"` Resign bool `json:"resign" bson:"resign"` LockTime int `json:"lockTime" bson:"lockTime"` MakeFee string `json:"makeFee,omitempty" bson:"makeFee,omitempty"` TakeFee string `json:"takeFee,omitempty" bson:"takeFee,omitempty"` LendingFee string `json:"lendingFee,omitempty" bson:"lendingFee,omitempty"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
RelayerRecord corresponds to what is stored in the DB. big.Ints are encoded as strings
type RelayerTick ¶ added in v1.2.0
type RelayerTick struct { RelayerAddress common.Address `json:"relayerAddress,omitempty" bson:"relayerAddress"` Tick *Tick `json:"tick,omitempty" bson:"tick"` }
RelayerTick relayer tick
type RelayerTicks ¶ added in v1.2.0
type RelayerTicks []*RelayerTick
RelayerTicks array relayer tick
type RepaySpec ¶ added in v1.2.0
type RepaySpec struct { UserAddress string LendingToken string Term string Status string DateFrom int64 DateTo int64 Hash string }
RepaySpec filter repay
type RestResponse ¶
type RestResponse struct { Status string `json:"status"` Data interface{} `json:"data"` Meta RestResponseMeta `json:"meta"` }
func (*RestResponse) String ¶
func (r *RestResponse) String() string
type RestResponseMeta ¶
type RestResponseMeta struct {
Total int `json:"total"`
}
func (*RestResponseMeta) String ¶
func (m *RestResponseMeta) String() string
type Signature ¶
Signature struct
func NewSignature ¶
NewSignature function decodes []byte to Signature type
func Sign ¶
Sign calculates the EDCSA signature corresponding of a hashed message from a given private key
func SignHash ¶
SignHash also calculates the EDCSA signature of a message but adds an "Ethereum Signed Message" prefix https://github.com/ethereum/EIPs/issues/191
func (*Signature) GetRecord ¶
func (s *Signature) GetRecord() *SignatureRecord
func (*Signature) MarshalSignature ¶
MarshalSignature marshals the signature struct to []byte
type SignatureRecord ¶
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"` 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 StopOrder ¶
type StopOrder struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress common.Address `json:"userAddress" bson:"userAddress"` ExchangeAddress common.Address `json:"exchangeAddress" bson:"exchangeAddress"` BaseToken common.Address `json:"baseToken" bson:"baseToken"` QuoteToken common.Address `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Type string `json:"type" bson:"type"` Hash common.Hash `json:"hash" bson:"hash"` Signature *Signature `json:"signature,omitempty" bson:"signature"` StopPrice *big.Int `json:"stopPrice" bson:"stopPrice"` LimitPrice *big.Int `json:"limitPrice" bson:"limitPrice"` Direction int `json:"direction" bson:"direction"` Amount *big.Int `json:"amount" bson:"amount"` FilledAmount *big.Int `json:"filledAmount" bson:"filledAmount"` Nonce *big.Int `json:"nonce" bson:"nonce"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
func (*StopOrder) ComputeHash ¶
ComputeHash calculates the orderRequest hash
func (*StopOrder) EncodedSide ¶
TODO handle error case ?
func (*StopOrder) MarshalJSON ¶
MarshalJSON implements the json.Marshal interface
func (*StopOrder) ToOrder ¶
ToOrder converts a stop order to a real order that will be pushed to TomoX
func (*StopOrder) UnmarshalJSON ¶
UnmarshalJSON : write custom logic to unmarshal bytes to StopOrder
func (*StopOrder) Validate ¶
TODO: Verify userAddress, baseToken, quoteToken, etc. conditions are working
func (*StopOrder) VerifySignature ¶
VerifySignature checks that the orderRequest signature corresponds to the address in the userAddress field
type StopOrderBSONUpdate ¶
type StopOrderBSONUpdate struct {
*StopOrder
}
func (StopOrderBSONUpdate) GetBSON ¶
func (o StopOrderBSONUpdate) GetBSON() (interface{}, error)
type StopOrderRecord ¶
type StopOrderRecord struct { ID bson.ObjectId `json:"id" bson:"_id"` UserAddress string `json:"userAddress" bson:"userAddress"` ExchangeAddress string `json:"exchangeAddress" bson:"exchangeAddress"` BaseToken string `json:"baseToken" bson:"baseToken"` QuoteToken string `json:"quoteToken" bson:"quoteToken"` Status string `json:"status" bson:"status"` Side string `json:"side" bson:"side"` Type string `json:"type" bson:"type"` Hash string `json:"hash" bson:"hash"` StopPrice string `json:"stopPrice" bson:"stopPrice"` LimitPrice string `json:"limitPrice" bson:"limitPrice"` Direction int `json:"direction" bson:"direction"` Amount string `json:"amount" bson:"amount"` FilledAmount string `json:"filledAmount" bson:"filledAmount"` Nonce string `json:"nonce" bson:"nonce"` Signature *SignatureRecord `json:"signature,omitempty" bson:"signature"` PairName string `json:"pairName" bson:"pairName"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` }
StopOrderRecord is the object that will be saved in the database
type SubscriptionEvent ¶
type SubscriptionEvent string
SubscriptionEvent is an enum signifies whether the incoming message is of type Subscribe or unsubscribe
type SubscriptionPayload ¶
type SubscriptionPayload struct { PairName string `json:"pairName,omitempty"` QuoteToken common.Address `json:"quoteToken,omitempty"` BaseToken common.Address `json:"baseToken,omitempty"` From int64 `json"from"` To int64 `json:"to"` Duration int64 `json:"duration"` Units string `json:"units"` Term uint64 `json:"term"` LendingToken common.Address `json:"lendingToken,omitempty"` }
type Tick ¶
type Tick struct { Pair PairID `json:"id,omitempty" bson:"_id"` Open *big.Int `json:"open,omitempty" bson:"open"` Close *big.Int `json:"close,omitempty" bson:"close"` High *big.Int `json:"high,omitempty" bson:"high"` Low *big.Int `json:"low,omitempty" bson:"low"` Volume *big.Int `json:"volume,omitempty" bson:"volume"` VolumeByQuote *big.Int `json:"volumebyquote,omitempty" bson:"volumebyquote"` VolumeUsdt *big.Int `json:"volumeusdt,omitempty" bson:"volumeusdt"` Count *big.Int `json:"count,omitempty" bson:"count"` Timestamp int64 `json:"timestamp,omitempty" bson:"timestamp"` OpenTime time.Time `json:"openTime" bson:"openTime"` CloseTime time.Time `json:"closeTime" bson:"closeTime"` Duration int64 `json:"duration" bson:"duration"` Unit string `json:"unit" bson:"unit"` }
Tick is the format in which mongo aggregate pipeline returns data when queried for OHLCV data
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"` Name string `json:"name" bson:"name"` Symbol string `json:"symbol" bson:"symbol"` Address common.Address `json:"address" bson:"address"` Image Image `json:"image" bson:"image"` ContractAddress common.Address `json:"contractAddress" bson:"contractAddress"` RelayerAddress common.Address `json:"relayerAddress" bson:"relayerAddress"` Decimals int `json:"decimals" bson:"decimals"` Active bool `json:"active" bson:"active"` Listed bool `json:"listed" bson:"listed"` Quote bool `json:"quote" bson:"quote"` MakeFee *big.Int `json:"makeFee,omitempty" bson:"makeFee,omitempty"` TakeFee *big.Int `json:"takeFee,omitempty" bson:"makeFee,omitempty"` USD string `json:"usd,omitempty" bson:"usd,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 { Address common.Address `json:"address" bson:"address"` Symbol string `json:"symbol" bson:"symbol"` Decimals int `json:"decimals" bson:"decimals"` Balance *big.Int `json:"balance" bson:"balance"` AvailableBalance *big.Int `json:"availableBalance" bson:"availableBalance"` InOrderBalance *big.Int `json:"inOrderBalance" bson:"inOrderBalance"` InUsdBalance *big.Float `json:"inUsdBalance" bson:"inUsdBalance"` }
TokenBalance holds the Balance and the Locked balance values for a single Ethereum token Balance and Locked Balance are stored as big.Int as they represent uint256 values
func (*TokenBalance) MarshalJSON ¶
func (t *TokenBalance) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshal interface
func (*TokenBalance) UnmarshalJSON ¶
func (t *TokenBalance) UnmarshalJSON(b []byte) error
type TokenBalanceRecord ¶
type TokenBalanceRecord struct { Address string `json:"address" bson:"address"` Symbol string `json:"symbol" bson:"symbol"` Decimals int `json:"decimals" bson:"decimals"` Balance string `json:"balance" bson:"balance"` AvailableBalance string `json:"availableBalance" base:"availableBalance"` InOrderBalance string `json:"inOrderBalance" bson:"inOrderBalance"` }
TokenBalanceRecord corresponds to a TokenBalance struct that is stored in the DB. big.Ints are encoded as strings
type TokenRecord ¶
type TokenRecord struct { ID bson.ObjectId `json:"-" bson:"_id"` Name string `json:"name" bson:"name"` Symbol string `json:"symbol" bson:"symbol"` Image Image `json:"image" bson:"image"` ContractAddress string `json:"contractAddress" bson:"contractAddress"` RelayerAddress string `json:"relayerAddress" bson:"relayerAddress"` Decimals int `json:"decimals" bson:"decimals"` Active bool `json:"active" bson:"active"` Quote bool `json:"quote" bson:"quote"` MakeFee string `json:"makeFee,omitempty" bson:"makeFee,omitempty"` TakeFee string `json:"takeFee,omitempty" bson:"takeFee,omitempty"` USD string `json:"usd,omitempty" bson:"usd,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 TopupSpec ¶ added in v1.2.0
type TopupSpec struct { UserAddress string CollateralToken string LendingToken string Term string Status string DateFrom int64 DateTo int64 Hash string }
TopupSpec filter topup
type Trade ¶
type Trade struct { ID bson.ObjectId `json:"id,omitempty" bson:"_id"` Taker common.Address `json:"taker" bson:"taker"` Maker common.Address `json:"maker" bson:"maker"` BaseToken common.Address `json:"baseToken" bson:"baseToken"` QuoteToken common.Address `json:"quoteToken" bson:"quoteToken"` MakerOrderHash common.Hash `json:"makerOrderHash" bson:"makerOrderHash"` TakerOrderHash common.Hash `json:"takerOrderHash" bson:"takerOrderHash"` Hash common.Hash `json:"hash" bson:"hash"` TxHash common.Hash `json:"txHash" bson:"txHash"` PairName string `json:"pairName" bson:"pairName"` PricePoint *big.Int `json:"pricepoint" bson:"pricepoint"` Amount *big.Int `json:"amount" bson:"amount"` MakeFee *big.Int `json:"makeFee" bson:"makeFee"` TakeFee *big.Int `json:"takeFee" bson:"takeFee"` Status string `json:"status" bson:"status"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` TakerOrderSide string `json:"takerOrderSide" bson:"takerOrderSide"` TakerOrderType string `json:"takerOrderType" bson:"takerOrderType"` MakerOrderType string `json:"makerOrderType" bson:"makerOrderType"` MakerExchange common.Address `json:"makerExchange" bson:"makerExchange"` TakerExchange common.Address `json:"takerExchange" bson:"takerExchange"` }
Trade struct holds arguments corresponding to a "Taker Order" To be valid an accept by the matching engine (and ultimately the exchange smart-contract), the trade signature must be made from the trader Maker account
func NewTrade ¶
NewTrade returns a new unsigned trade corresponding to an Order, amount and taker address
func (*Trade) ComputeHash ¶
ComputeHash returns hashes the trade The OrderHash, Amount, Taker and TradeNonce 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 TradeChangeEvent ¶
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"` Amount string `json:"amount" bson:"amount"` MakeFee string `json:"makeFee" bson:"makeFee"` TakeFee string `json:"takeFee" bson:"takeFee"` PricePoint string `json:"pricepoint" bson:"pricepoint"` Status string `json:"status" bson:"status"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` TakerOrderSide string `json:"takerOrderSide" bson:"takerOrderSide"` TakerOrderType string `json:"takerOrderType" bson:"takerOrderType"` MakerOrderType string `json:"makerOrderType" bson:"makerOrderType"` MakerExchange string `json:"makerExchange" bson:"makerExchange"` TakerExchange string `json:"takerExchange" bson:"takerExchange"` }
type TradeRes ¶
type TradeRes struct { Total int `json:"total" bson:"total"` Trades []*Trade `json:"trades" bson:"orders"` }
TradeRes response api
type TradeSpec ¶
type TradeSpec struct { BaseToken string QuoteToken string RelayerAddress common.Address DateFrom int64 DateTo int64 }
TradeSpec for query
type Wallet ¶
type Wallet struct { ID bson.ObjectId Address common.Address PrivateKey *ecdsa.PrivateKey Admin bool Operator bool }
Wallet holds both the address and the private key of an ethereum account
func NewWallet ¶
func NewWallet() *Wallet
NewWallet returns a new wallet object corresponding to a random private key
func NewWalletFromPrivateKey ¶
NewWalletFromPrivateKey returns a new wallet object corresponding to a given private key
func (*Wallet) GetAddress ¶
GetAddress returns the wallet address
func (*Wallet) GetPrivateKey ¶
GetPrivateKey returns the wallet private key
type WalletRecord ¶
type WebsocketEvent ¶
type WebsocketEvent struct { Type SubscriptionEvent `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
Source Files ¶
- account.go
- config.go
- deposit.go
- engine.go
- lending.go
- lending_markets.go
- lending_ohlcv.go
- lending_orderbook.go
- lending_pair.go
- lending_trade.go
- main.go
- market.go
- notification.go
- ohlcv.go
- operator.go
- order.go
- order_cancel.go
- orderbook.go
- pair.go
- payloads.go
- price_board.go
- relayer.go
- restmsg.go
- signature.go
- stop_order.go
- token.go
- trade.go
- wallet.go
- wsmsg.go