Documentation ¶
Index ¶
- Constants
- Variables
- func CreateMatchEng(pairSymbol string, basePrice, lotSize int64) *me.MatchEng
- func GenerateOrderID(sequence int64, addr sdk.AccAddress) string
- func IsValidOrderType(ot int8) bool
- func IsValidSide(side int8) bool
- func IsValidTimeInForce(tif int8) bool
- func NewHandler(dexKeeper *DexKeeper) sdk.Handler
- func NewWAL(walPath string) (*orderbookWAL, error)
- func RegisterWALMessages(cdc *amino.Codec)
- func SideStringToSideCode(side string) (int8, error)
- func TifStringToTifCode(tif string) (int8, error)
- func TransferFromTrade(trade *me.Trade, symbol string, orderMap map[string]*OrderInfo) (Transfer, Transfer)
- type ActiveOrders
- type BEP2OrderKeeper
- type BEP2SymbolSelector
- type BaseOrderKeeper
- type CancelOrderMsg
- func (msg CancelOrderMsg) GetInvolvedAddresses() []sdk.AccAddress
- func (msg CancelOrderMsg) GetSignBytes() []byte
- func (msg CancelOrderMsg) GetSigners() []sdk.AccAddress
- func (msg CancelOrderMsg) Route() string
- func (msg CancelOrderMsg) String() string
- func (msg CancelOrderMsg) Type() string
- func (msg CancelOrderMsg) ValidateBasic() sdk.Error
- type ChangeType
- type ChangedPriceLevelsMap
- type ChangedPriceLevelsPerSymbol
- type DexKeeper
- func (kp *DexKeeper) AddEngine(pair dexTypes.TradingPair) *me.MatchEng
- func (kp *DexKeeper) AddOrder(info OrderInfo, isRecovery bool) (err error)
- func (kp *DexKeeper) CanDelistTradingPair(ctx sdk.Context, baseAsset, quoteAsset string) error
- func (kp *DexKeeper) CanListTradingPair(ctx sdk.Context, baseAsset, quoteAsset string) error
- func (kp *DexKeeper) ClearAfterMatch()
- func (kp *DexKeeper) ClearOrderBook(pair string)
- func (kp *DexKeeper) ClearOrderChanges()
- func (kp *DexKeeper) ClearRoundFee()
- func (kp *DexKeeper) DelistTradingPair(ctx sdk.Context, symbol string, postAllocTransHandler TransferHandler)
- func (kp *DexKeeper) DetermineLotSize(baseAssetSymbol, quoteAssetSymbol string, price int64) (lotSize int64)
- func (kp *DexKeeper) EnablePublish()
- func (kp *DexKeeper) ExpireOrders(ctx sdk.Context, blockTime time.Time, postAlloTransHandler TransferHandler)
- func (kp *DexKeeper) GetAllOrderChanges() OrderChanges
- func (kp *DexKeeper) GetAllOrderInfosForPub() OrderInfoForPublish
- func (kp *DexKeeper) GetAllOrders() map[string]map[string]*OrderInfo
- func (kp *DexKeeper) GetAllOrdersForPair(symbol string) map[string]*OrderInfo
- func (kp *DexKeeper) GetBreatheBlockHeight(ctx sdk.Context, timeNow time.Time, daysBack int) (int64, error)
- func (kp *DexKeeper) GetEngines() map[string]*me.MatchEng
- func (kp *DexKeeper) GetLastBreatheBlockHeight(ctx sdk.Context, latestBlockHeight int64, timeNow time.Time, ...) int64
- func (kp *DexKeeper) GetLastTrades(height int64, pair string) ([]me.Trade, int64)
- func (kp *DexKeeper) GetLastTradesForPair(pair string) ([]me.Trade, int64)
- func (kp *DexKeeper) GetOpenOrders(pair string, addr sdk.AccAddress) []store.OpenOrder
- func (kp *DexKeeper) GetOrder(id string, symbol string, side int8, price int64) (ord me.OrderPart, err error)
- func (kp *DexKeeper) GetOrderBookLevels(pair string, maxLevels int) (orderbook []store.OrderBookLevel, pendingMatch bool)
- func (kp *DexKeeper) GetOrderBooks(maxLevels int) ChangedPriceLevelsMap
- func (kp *DexKeeper) GetOrderChanges(pairType SymbolPairType) OrderChanges
- func (kp *DexKeeper) GetOrderInfosForPub(pairType SymbolPairType) OrderInfoForPublish
- func (kp *DexKeeper) GetPairType(symbol string) SymbolPairType
- func (kp *DexKeeper) GetPriceLevel(pair string, side int8, price int64) *me.PriceLevel
- func (kp *DexKeeper) Init(ctx sdk.Context, blockInterval, daysBack int, blockStore *tmstore.BlockStore, ...)
- func (kp *DexKeeper) InitRecentPrices(ctx sdk.Context)
- func (kp *DexKeeper) LoadOrderBookSnapshot(ctx sdk.Context, latestBlockHeight int64, timeOfLatestBlock time.Time, ...) (int64, error)
- func (kp *DexKeeper) MarkBreatheBlock(ctx sdk.Context, height int64, blockTime time.Time)
- func (kp *DexKeeper) MatchAndAllocateSymbols(ctx sdk.Context, postAlloTransHandler TransferHandler, matchAllSymbols bool)
- func (kp *DexKeeper) MatchSymbols(height, timestamp int64, matchAllSymbols bool)
- func (kp *DexKeeper) OrderExists(symbol, id string) (OrderInfo, bool)
- func (kp *DexKeeper) ReloadOrder(symbol string, orderInfo *OrderInfo, height int64)
- func (kp *DexKeeper) RemoveOrder(id string, symbol string, postCancelHandler func(ord me.OrderPart)) error
- func (kp *DexKeeper) RemoveOrderInfosForPub(pair string, orderId string)
- func (kp *DexKeeper) ReplayOrdersFromBlock(ctx sdk.Context, bc *tmstore.BlockStore, stateDb dbm.DB, ...) error
- func (kp *DexKeeper) SelectSymbolsToMatch(height int64, matchAllSymbols bool) []string
- func (kp *DexKeeper) SetBUSDSymbol(symbol string)
- func (kp *DexKeeper) ShouldPublishOrder() bool
- func (kp *DexKeeper) SnapShotOrderBook(ctx sdk.Context, height int64) (effectedStoreKeys []string, err error)
- func (kp *DexKeeper) StoreTradePrices(ctx sdk.Context)
- func (kp *DexKeeper) SubscribeParamChange(hub *paramhub.Keeper)
- func (kp *DexKeeper) UpdateLotSize(symbol string, lotSize int64)
- func (kp *DexKeeper) UpdateOrderChangeSync(change OrderChange, symbol string)
- func (kp *DexKeeper) UpdateTickSizeAndLotSize(ctx sdk.Context)
- type DexOrderKeeper
- type ExecutionType
- type ExpireHolder
- type ExpireTransfers
- type FeeConfig
- type FeeHandler
- type FeeHolder
- type FeeManager
- func (m *FeeManager) CalcExpiresFee(balances sdk.Coins, expireType transferEventType, ...) sdk.Fee
- func (m *FeeManager) CalcFixedFee(balances sdk.Coins, eventType transferEventType, inAsset string, ...) sdk.Fee
- func (m *FeeManager) CalcTradeFee(balances sdk.Coins, tradeIn sdk.Coin, engines map[string]*matcheng.MatchEng) sdk.Fee
- func (m *FeeManager) CalcTradesFee(balances sdk.Coins, tradeTransfers TradeTransfers, ...) sdk.Fee
- func (m *FeeManager) CancelFee(feeType FeeType) int64
- func (m *FeeManager) CancelFees() (int64, int64)
- func (m *FeeManager) ExpireFee(feeType FeeType) int64
- func (m *FeeManager) ExpireFees() (int64, int64)
- func (m *FeeManager) GetConfig() FeeConfig
- func (m *FeeManager) IOCExpireFee(feeType FeeType) int64
- func (m *FeeManager) IOCExpireFees() (int64, int64)
- func (m *FeeManager) TradeFee(amount *big.Int, feeType FeeType) *big.Int
- func (m *FeeManager) UpdateConfig(feeConfig FeeConfig) error
- type FeeType
- type MiniOrderKeeper
- type MiniSymbolSelector
- type NewOrderMsg
- func (msg NewOrderMsg) GetInvolvedAddresses() []sdk.AccAddress
- func (msg NewOrderMsg) GetSignBytes() []byte
- func (msg NewOrderMsg) GetSigners() []sdk.AccAddress
- func (msg NewOrderMsg) Route() string
- func (msg NewOrderMsg) String() string
- func (msg NewOrderMsg) Type() string
- func (msg NewOrderMsg) ValidateBasic() sdk.Error
- type NewOrderResponse
- type OrderBookSnapshot
- type OrderChange
- type OrderChanges
- type OrderInfo
- type OrderInfoForPublish
- type SymbolPairType
- type SymbolSelector
- type SymbolWithOrderNumber
- type TimedWALMessage
- type TradeTransfers
- type Transfer
- type TransferHandler
- type WAL
- type WALDecoder
- type WALEncoder
- type WALMessage
- type WALSearchOptions
Constants ¶
const ( FeeByNativeToken = FeeType(0x01) FeeByTradeToken = FeeType(0x02) ExpireFeeField = "ExpireFee" ExpireFeeNativeField = "ExpireFeeNative" CancelFeeField = "CancelFee" CancelFeeNativeField = "CancelFeeNative" FeeRateField = "FeeRate" FeeRateNativeField = "FeeRateNative" IOCExpireFee = "IOCExpireFee" IOCExpireFeeNative = "IOCExpireFeeNative" )
const ( BEP2TypeValue = 1 MiniTypeValue = 2 )
const ( RouteNewOrder = "orderNew" RouteCancelOrder = "orderCancel" )
Variables ¶
var BUSDSymbol string
var NewWALDeccoder = cs.NewWALDecoder
var NewWALEncoder = cs.NewWALEncoder
var OrderType = struct { LIMIT int8 MARKET int8 }{orderLimit, orderMarket}
OrderType is an enum of order type options supported by the matching engine
var PairType = struct { BEP2 SymbolPairType MINI SymbolPairType }{BEP2TypeValue, MiniTypeValue}
Side/TimeInForce/OrderType are const, following FIX protocol convention Used as Enum
var TimeInForce = struct { GTE int8 IOC int8 }{tifGTE, tifIOC}
TimeInForce is an enum of TIF (Time in Force) options supported by the matching engine
Functions ¶
func GenerateOrderID ¶
func GenerateOrderID(sequence int64, addr sdk.AccAddress) string
GenerateOrderID generates an order ID
func IsValidOrderType ¶
IsValidOrderType validates that an order type is valid and supported by the matching engine
func IsValidSide ¶
IsValidSide validates that a side is valid and supported by the matching engine
func IsValidTimeInForce ¶
IsValidTimeInForce validates that a tif code is correct
func NewHandler ¶
NewHandler - returns a handler for dex type messages.
func RegisterWALMessages ¶
func SideStringToSideCode ¶
SideStringToSideCode converts a string like "BUY" to its internal side code
func TifStringToTifCode ¶
TifStringToTifCode converts a string like "GTE" to its internal tif code
Types ¶
type ActiveOrders ¶
type ActiveOrders struct {
Orders []OrderInfo `json:"orders"`
}
type BEP2OrderKeeper ¶
type BEP2OrderKeeper struct { BaseOrderKeeper // contains filtered or unexported fields }
type BEP2SymbolSelector ¶
type BEP2SymbolSelector struct{}
func (*BEP2SymbolSelector) SelectSymbolsToMatch ¶
type BaseOrderKeeper ¶
type BaseOrderKeeper struct {
// contains filtered or unexported fields
}
in the future, this may be distributed via Sharding
func NewBaseOrderKeeper ¶
func NewBaseOrderKeeper(moduleName string) BaseOrderKeeper
type CancelOrderMsg ¶
type CancelOrderMsg struct { Sender sdk.AccAddress `json:"sender"` Symbol string `json:"symbol"` RefId string `json:"refid"` }
CancelOrderMsg represents a message to cancel an open order
func NewCancelOrderMsg ¶
func NewCancelOrderMsg(sender sdk.AccAddress, symbol, refId string) CancelOrderMsg
NewCancelOrderMsg constructs a new CancelOrderMsg
func (CancelOrderMsg) GetInvolvedAddresses ¶
func (msg CancelOrderMsg) GetInvolvedAddresses() []sdk.AccAddress
func (CancelOrderMsg) GetSignBytes ¶
func (msg CancelOrderMsg) GetSignBytes() []byte
GetSignBytes - Get the bytes for the message signer to sign on
func (CancelOrderMsg) GetSigners ¶
func (msg CancelOrderMsg) GetSigners() []sdk.AccAddress
func (CancelOrderMsg) String ¶
func (msg CancelOrderMsg) String() string
func (CancelOrderMsg) Type ¶
func (msg CancelOrderMsg) Type() string
func (CancelOrderMsg) ValidateBasic ¶
func (msg CancelOrderMsg) ValidateBasic() sdk.Error
ValidateBasic is used to quickly disqualify obviously invalid messages quickly
type ChangeType ¶
type ChangeType uint8
const ( Ack ChangeType = iota // new order tx Canceled // cancel order tx Expired // expired for gte order IocNoFill // ioc order is not filled expire IocExpire // ioc order is partial filled expire PartialFill // order is partial filled, derived from trade FullyFill // order is fully filled, derived from trade FailedBlocking // order tx is failed blocking, we only publish essential message FailedMatching // order failed matching )
func (ChangeType) IsOpen ¶
func (tpe ChangeType) IsOpen() bool
True for should not remove order in these status from OrderInfoForPub False for remove
func (ChangeType) String ¶
func (tpe ChangeType) String() string
type ChangedPriceLevelsMap ¶
type ChangedPriceLevelsMap map[string]ChangedPriceLevelsPerSymbol
type DexKeeper ¶
type DexKeeper struct { PairMapper store.TradingPairMapper FeeManager *FeeManager RoundOrderFees FeeHolder // order (and trade) related fee of this round, str of addr bytes -> fee CollectOrderInfoForPublish bool //TODO separate for each order keeper OrderKeepers []DexOrderKeeper // contains filtered or unexported fields }
func NewDexKeeper ¶
func NewDexKeeper(key sdk.StoreKey, am auth.AccountKeeper, tradingPairMapper store.TradingPairMapper, codespace sdk.CodespaceType, concurrency uint, cdc *wire.Codec, collectOrderInfoForPublish bool) *DexKeeper
func (*DexKeeper) AddEngine ¶
func (kp *DexKeeper) AddEngine(pair dexTypes.TradingPair) *me.MatchEng
func (*DexKeeper) CanDelistTradingPair ¶
func (*DexKeeper) CanListTradingPair ¶
func (*DexKeeper) ClearAfterMatch ¶
func (kp *DexKeeper) ClearAfterMatch()
func (*DexKeeper) ClearOrderBook ¶
func (*DexKeeper) ClearOrderChanges ¶
func (kp *DexKeeper) ClearOrderChanges()
func (*DexKeeper) ClearRoundFee ¶
func (kp *DexKeeper) ClearRoundFee()
func (*DexKeeper) DelistTradingPair ¶
func (kp *DexKeeper) DelistTradingPair(ctx sdk.Context, symbol string, postAllocTransHandler TransferHandler)
func (*DexKeeper) DetermineLotSize ¶
func (*DexKeeper) EnablePublish ¶
func (kp *DexKeeper) EnablePublish()
func (*DexKeeper) ExpireOrders ¶
func (*DexKeeper) GetAllOrderChanges ¶
func (kp *DexKeeper) GetAllOrderChanges() OrderChanges
func (*DexKeeper) GetAllOrderInfosForPub ¶
func (kp *DexKeeper) GetAllOrderInfosForPub() OrderInfoForPublish
func (*DexKeeper) GetAllOrders ¶
func (*DexKeeper) GetAllOrdersForPair ¶
ONLY FOR TEST USE
func (*DexKeeper) GetBreatheBlockHeight ¶
func (*DexKeeper) GetLastBreatheBlockHeight ¶
func (*DexKeeper) GetLastTrades ¶
func (*DexKeeper) GetLastTradesForPair ¶
!!! FOR TEST USE ONLY
func (*DexKeeper) GetOpenOrders ¶
func (*DexKeeper) GetOrderBookLevels ¶
func (*DexKeeper) GetOrderBooks ¶
func (kp *DexKeeper) GetOrderBooks(maxLevels int) ChangedPriceLevelsMap
func (*DexKeeper) GetOrderChanges ¶
func (kp *DexKeeper) GetOrderChanges(pairType SymbolPairType) OrderChanges
func (*DexKeeper) GetOrderInfosForPub ¶
func (kp *DexKeeper) GetOrderInfosForPub(pairType SymbolPairType) OrderInfoForPublish
func (*DexKeeper) GetPairType ¶
func (kp *DexKeeper) GetPairType(symbol string) SymbolPairType
func (*DexKeeper) GetPriceLevel ¶
func (*DexKeeper) InitRecentPrices ¶
func (*DexKeeper) LoadOrderBookSnapshot ¶
func (*DexKeeper) MarkBreatheBlock ¶
func (*DexKeeper) MatchAndAllocateSymbols ¶
func (kp *DexKeeper) MatchAndAllocateSymbols(ctx sdk.Context, postAlloTransHandler TransferHandler, matchAllSymbols bool)
func (*DexKeeper) MatchSymbols ¶
func (*DexKeeper) OrderExists ¶
func (*DexKeeper) ReloadOrder ¶
func (*DexKeeper) RemoveOrder ¶
func (*DexKeeper) RemoveOrderInfosForPub ¶
func (*DexKeeper) ReplayOrdersFromBlock ¶
func (*DexKeeper) SelectSymbolsToMatch ¶
func (*DexKeeper) SetBUSDSymbol ¶
func (*DexKeeper) ShouldPublishOrder ¶
func (*DexKeeper) SnapShotOrderBook ¶
func (*DexKeeper) StoreTradePrices ¶
func (*DexKeeper) SubscribeParamChange ¶
func (*DexKeeper) UpdateLotSize ¶
func (*DexKeeper) UpdateOrderChangeSync ¶
func (kp *DexKeeper) UpdateOrderChangeSync(change OrderChange, symbol string)
func (*DexKeeper) UpdateTickSizeAndLotSize ¶
type DexOrderKeeper ¶
type DexOrderKeeper interface {
// contains filtered or unexported methods
}
func NewBEP2OrderKeeper ¶
func NewBEP2OrderKeeper() DexOrderKeeper
NewBEP2OrderKeeper - Returns the BEP2OrderKeeper
func NewMiniOrderKeeper ¶
func NewMiniOrderKeeper() DexOrderKeeper
NewBEP2OrderKeeper - Returns the MiniToken orderKeeper
type ExecutionType ¶
type ExecutionType uint8
const (
NEW ExecutionType = iota
)
func (ExecutionType) String ¶
func (this ExecutionType) String() string
type ExpireHolder ¶
type ExpireHolder struct { OrderId string Reason ChangeType Fee string Symbol string }
type ExpireTransfers ¶
type ExpireTransfers []*Transfer
func (ExpireTransfers) Len ¶
func (trans ExpireTransfers) Len() int
func (ExpireTransfers) Less ¶
func (trans ExpireTransfers) Less(i, j int) bool
func (*ExpireTransfers) Sort ¶
func (trans *ExpireTransfers) Sort()
func (ExpireTransfers) Swap ¶
func (trans ExpireTransfers) Swap(i, j int)
type FeeConfig ¶
type FeeConfig struct { ExpireFee int64 `json:"expire_fee"` ExpireFeeNative int64 `json:"expire_fee_native"` IOCExpireFee int64 `json:"ioc_expire_fee"` IOCExpireFeeNative int64 `json:"ioc_expire_fee_native"` CancelFee int64 `json:"cancel_fee"` CancelFeeNative int64 `json:"cancel_fee_native"` FeeRate int64 `json:"fee_rate"` FeeRateNative int64 `json:"fee_rate_native"` }
func NewFeeConfig ¶
func NewFeeConfig() FeeConfig
func ParamToFeeConfig ¶
type FeeHandler ¶
type FeeManager ¶
type FeeManager struct { FeeConfig FeeConfig // contains filtered or unexported fields }
func NewFeeManager ¶
func NewFeeManager(cdc *wire.Codec, logger tmlog.Logger) *FeeManager
func (*FeeManager) CalcExpiresFee ¶
func (m *FeeManager) CalcExpiresFee(balances sdk.Coins, expireType transferEventType, expireTransfers ExpireTransfers, engines map[string]*matcheng.MatchEng, expireTransferHandler func(tran Transfer)) sdk.Fee
func (*FeeManager) CalcFixedFee ¶
func (m *FeeManager) CalcFixedFee(balances sdk.Coins, eventType transferEventType, inAsset string, engines map[string]*matcheng.MatchEng) sdk.Fee
Note: the result of `CalcFixedFee` depends on the balances of the acc, so the right way of allocation is: 1. transfer the "inAsset" to the balance, i.e. call doTransfer() 2. call this method 3. deduct the fee right away
func (*FeeManager) CalcTradeFee ¶
func (m *FeeManager) CalcTradeFee(balances sdk.Coins, tradeIn sdk.Coin, engines map[string]*matcheng.MatchEng) sdk.Fee
DEPRECATED Note1: the result of `CalcTradeFeeDeprecated` depends on the balances of the acc, so the right way of allocation is: 1. transfer the "inAsset" to the balance, i.e. call doTransfer() 2. call this method 3. deduct the fee right away
Note2: even though the function is called in multiple threads, `engines` map would stay the same as no other function may change it in fee calculation stage, so no race condition concern
func (*FeeManager) CalcTradesFee ¶
func (m *FeeManager) CalcTradesFee(balances sdk.Coins, tradeTransfers TradeTransfers, engines map[string]*matcheng.MatchEng) sdk.Fee
func (*FeeManager) CancelFee ¶
func (m *FeeManager) CancelFee(feeType FeeType) int64
func (*FeeManager) CancelFees ¶
func (m *FeeManager) CancelFees() (int64, int64)
func (*FeeManager) ExpireFee ¶
func (m *FeeManager) ExpireFee(feeType FeeType) int64
func (*FeeManager) ExpireFees ¶
func (m *FeeManager) ExpireFees() (int64, int64)
func (*FeeManager) GetConfig ¶
func (m *FeeManager) GetConfig() FeeConfig
func (*FeeManager) IOCExpireFee ¶
func (m *FeeManager) IOCExpireFee(feeType FeeType) int64
func (*FeeManager) IOCExpireFees ¶
func (m *FeeManager) IOCExpireFees() (int64, int64)
func (*FeeManager) UpdateConfig ¶
func (m *FeeManager) UpdateConfig(feeConfig FeeConfig) error
UpdateConfig should only happen when Init or in BreatheBlock
type MiniOrderKeeper ¶
type MiniOrderKeeper struct { BaseOrderKeeper // contains filtered or unexported fields }
order keeper for mini-token
type MiniSymbolSelector ¶
type MiniSymbolSelector struct {
// contains filtered or unexported fields
}
func (*MiniSymbolSelector) SelectSymbolsToMatch ¶
type NewOrderMsg ¶
type NewOrderMsg struct { Sender sdk.AccAddress `json:"sender"` Id string `json:"id"` Symbol string `json:"symbol"` OrderType int8 `json:"ordertype"` Side int8 `json:"side"` Price int64 `json:"price"` Quantity int64 `json:"quantity"` TimeInForce int8 `json:"timeinforce"` }
func NewNewOrderMsg ¶
func NewNewOrderMsg(sender sdk.AccAddress, id string, side int8, symbol string, price int64, qty int64) NewOrderMsg
NewNewOrderMsg constructs a new NewOrderMsg
func NewNewOrderMsgAuto ¶
func NewNewOrderMsgAuto(txBuilder txbuilder.TxBuilder, sender sdk.AccAddress, side int8, symbol string, price int64, qty int64) (NewOrderMsg, error)
NewNewOrderMsgAuto constructs a new NewOrderMsg and auto-assigns its order ID
func (NewOrderMsg) GetInvolvedAddresses ¶
func (msg NewOrderMsg) GetInvolvedAddresses() []sdk.AccAddress
func (NewOrderMsg) GetSignBytes ¶
func (msg NewOrderMsg) GetSignBytes() []byte
GetSignBytes - Get the bytes for the message signer to sign on
func (NewOrderMsg) GetSigners ¶
func (msg NewOrderMsg) GetSigners() []sdk.AccAddress
func (NewOrderMsg) String ¶
func (msg NewOrderMsg) String() string
func (NewOrderMsg) Type ¶
func (msg NewOrderMsg) Type() string
func (NewOrderMsg) ValidateBasic ¶
func (msg NewOrderMsg) ValidateBasic() sdk.Error
ValidateBasic is used to quickly disqualify obviously invalid messages quickly
type NewOrderResponse ¶
type NewOrderResponse struct {
OrderID string `json:"order_id"`
}
type OrderBookSnapshot ¶
type OrderBookSnapshot struct { Buys []me.PriceLevel `json:"buys"` Sells []me.PriceLevel `json:"sells"` LastTradePrice int64 `json:"lasttradeprice"` LastMatchHeight int64 `json:"lastmatchheight"` }
type OrderChange ¶
type OrderChange struct { Id string Tpe ChangeType SingleFee string MsgForFailedTx interface{} // pointer to NewOrderMsg or CancelOrderMsg }
func (OrderChange) ResolveOrderInfo ¶
func (oc OrderChange) ResolveOrderInfo(orderInfos OrderInfoForPublish) *OrderInfo
func (OrderChange) String ¶
func (oc OrderChange) String() string
type OrderChanges ¶
type OrderChanges []OrderChange // clean after publish each block's EndBlock and before next block's BeginBlock
type OrderInfoForPublish ¶
provide an easy way to retrieve order related static fields during generate executed order status
type SymbolPairType ¶
type SymbolPairType int8
type SymbolSelector ¶
type SymbolWithOrderNumber ¶
type SymbolWithOrderNumber struct {
// contains filtered or unexported fields
}
type TimedWALMessage ¶
type TimedWALMessage = cs.TimedWALMessage
type TradeTransfers ¶
type TradeTransfers []*Transfer
func (TradeTransfers) Len ¶
func (trans TradeTransfers) Len() int
func (TradeTransfers) Less ¶
func (trans TradeTransfers) Less(i, j int) bool
func (*TradeTransfers) Sort ¶
func (trans *TradeTransfers) Sort()
func (TradeTransfers) Swap ¶
func (trans TradeTransfers) Swap(i, j int)
type Transfer ¶
type Transfer struct { Oid string Fee sdk.Fee Trade *me.Trade Symbol string // contains filtered or unexported fields }
Transfer represents a transfer between trade currencies
func TransferFromCanceled ¶
func (Transfer) IsExpiredWithFee ¶
func (Transfer) IsNativeIn ¶
func (Transfer) IsNativeOut ¶
type TransferHandler ¶
type TransferHandler func(Transfer)
type WAL ¶
type WAL interface { Write(WALMessage) WriteSync(WALMessage) File() *os.File Start() error Stop() error Wait() }
WAL is an interface for any write-ahead logger.
type WALDecoder ¶
type WALDecoder = cs.WALDecoder
type WALEncoder ¶
type WALEncoder = cs.WALEncoder
type WALMessage ¶
type WALMessage interface{}
type WALSearchOptions ¶
type WALSearchOptions struct { // IgnoreDataCorruptionErrors set to true will result in skipping data corruption errors. IgnoreDataCorruptionErrors bool }
WALSearchOptions are optional arguments to SearchForEndHeight.