Documentation ¶
Index ¶
- Constants
- func CalcActualCost(op int32, amount int64, price int64) int64
- func CheckAmount(amount int64) bool
- func CheckCount(count int32) bool
- func CheckDirection(direction int32) bool
- func CheckExchangeAsset(left, right *et.Asset) bool
- func CheckOp(op int32) bool
- func CheckPrice(price int64) bool
- func CheckStatus(status int32) bool
- func Direction(op int32) int32
- func GetName() string
- func Init(name string, cfg *types.Chain33Config, sub []byte)
- func InitExecType()
- func NewExchange() drivers.Driver
- func NewHistoryOrderTable(kvdb db.KV) *table.Table
- func NewMarketDepthTable(kvdb db.KV) *table.Table
- func NewMarketOrderTable(kvdb db.KV) *table.Table
- func OpSwap(op int32) int32
- func QueryHistoryOrderList(localdb dbm.KV, left, right *et.Asset, primaryKey string, ...) (types.Message, error)
- func QueryMarketDepth(localdb dbm.KV, left, right *et.Asset, op int32, primaryKey string, ...) (*et.MarketDepthList, error)
- func QueryOrderList(localdb dbm.KV, addr string, status, count, direction int32, primaryKey string) (types.Message, error)
- func SafeMul(x, y int64) int64
- type Action
- type HistoryOrderRow
- type MarketDepthRow
- type OrderRow
Constants ¶
View Source
const ( //KeyPrefixStateDB state db key必须前缀 KeyPrefixStateDB = "mavl-exchange-" //KeyPrefixLocalDB local db的key必须前缀 KeyPrefixLocalDB = "LODB-exchange" )
Variables ¶
This section is empty.
Functions ¶
func CheckCount ¶
func CheckDirection ¶
func CheckStatus ¶
func NewExchange ¶
func QueryHistoryOrderList ¶
func QueryHistoryOrderList(localdb dbm.KV, left, right *et.Asset, primaryKey string, count, direction int32) (types.Message, error)
QueryHistoryOrderList 只返回成交的订单信息
func QueryMarketDepth ¶
func QueryMarketDepth(localdb dbm.KV, left, right *et.Asset, op int32, primaryKey string, count int32) (*et.MarketDepthList, error)
这里primaryKey当作主键索引来用,首次查询不需要填值,买单按价格由高往低,卖单按价格由低往高查询
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action action struct
func (*Action) LimitOrder ¶
func (*Action) RevokeOrder ¶
type HistoryOrderRow ¶
HistoryOrderRow table meta 结构
func NewHistoryOrderRow ¶
func NewHistoryOrderRow() *HistoryOrderRow
func (*HistoryOrderRow) CreateRow ¶
func (m *HistoryOrderRow) CreateRow() *table.Row
func (*HistoryOrderRow) Get ¶
func (m *HistoryOrderRow) Get(key string) ([]byte, error)
Get 按照indexName 查询 indexValue
func (*HistoryOrderRow) SetPayload ¶
func (m *HistoryOrderRow) SetPayload(data types.Message) error
SetPayload 设置数据
type MarketDepthRow ¶
type MarketDepthRow struct {
*ety.MarketDepth
}
marketDepthRow table meta 结构
func (*MarketDepthRow) CreateRow ¶
func (m *MarketDepthRow) CreateRow() *table.Row
CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存eventid)
func (*MarketDepthRow) Get ¶
func (m *MarketDepthRow) Get(key string) ([]byte, error)
Get 按照indexName 查询 indexValue
func (*MarketDepthRow) SetPayload ¶
func (m *MarketDepthRow) SetPayload(data types.Message) error
SetPayload 设置数据
Click to show internal directories.
Click to hide internal directories.