Documentation
¶
Index ¶
- Constants
- func CalcActualCost(op int32, amount int64, price, coinPrecision int64) int64
- func CheckAmount(amount, coinPrecision int64) bool
- func CheckCount(count int32) bool
- func CheckDirection(direction int32) bool
- func CheckExchangeAsset(coinExec string, 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 ParseCoins(cfg *types.Chain33Config, tradeKey string, height int64) (coins []et.CoinCfg, err error)
- func ParseConfig(cfg *types.Chain33Config, height int64) (*et.Econfig, error)
- func ParseStrings(cfg *types.Chain33Config, tradeKey string, height int64) (ret []string, err error)
- func ParseSymbols(cfg *types.Chain33Config, tradeKey string, height int64) (symbols map[string]*et.Trade, err error)
- 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, coinPrecision int64) int64
- type Action
- func (a *Action) EntrustOrder(payload *et.EntrustOrder) (*types.Receipt, error)
- func (a *Action) EntrustRevokeOrder(payload *et.EntrustRevokeOrder) (*types.Receipt, error)
- func (a *Action) ExchangeBind(payload *et.ExchangeBind) (*types.Receipt, error)
- func (a *Action) GetIndex() int64
- func (a *Action) GetKVSet(order *et.Order) (kvset []*types.KeyValue)
- func (a *Action) LimitOrder(payload *et.LimitOrder, entrustAddr string) (*types.Receipt, error)
- func (a *Action) OpSwap(op int32) int32
- func (a *Action) RevokeOrder(payload *et.RevokeOrder) (*types.Receipt, error)
- 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 CalcActualCost ¶
CalcActualCost Calculate actual cost
func CheckExchangeAsset ¶
CheckExchangeAsset
func NewHistoryOrderTable ¶
NewHistoryOrderTable ...
func NewMarketDepthTable ¶
NewMarketDepthTable 新建表
func NewMarketOrderTable ¶
NewMarketOrderTable ...
func ParseCoins ¶ added in v1.66.0
func ParseConfig ¶ added in v1.66.0
func ParseStrings ¶ added in v1.66.0
func ParseSymbols ¶ added in v1.67.0
func QueryHistoryOrderList ¶
func QueryHistoryOrderList(localdb dbm.KV, left, right *et.Asset, primaryKey string, count, direction int32) (types.Message, error)
QueryHistoryOrderList Only the order information is returned
func QueryMarketDepth ¶
func QueryMarketDepth(localdb dbm.KV, left, right *et.Asset, op int32, primaryKey string, count int32) (*et.MarketDepthList, error)
QueryMarketDepth 这里primaryKey当作主键索引来用, The first query does not need to fill in the value, pay according to the price from high to low, selling orders according to the price from low to high query
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action action struct
func NewAction ¶
func NewAction(e *exchange, tx *types.Transaction, index int) *Action
NewAction ...
func (*Action) EntrustOrder ¶ added in v1.66.3
func (*Action) EntrustRevokeOrder ¶ added in v1.66.3
func (*Action) ExchangeBind ¶ added in v1.66.3
func (*Action) LimitOrder ¶
LimitOrder ...
func (*Action) RevokeOrder ¶
RevokeOrder ...
type HistoryOrderRow ¶
HistoryOrderRow table meta 结构
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.