Documentation ¶
Index ¶
- Constants
- Variables
- func CalCommission(ctx sdk.Context, keeper keepers.QueryMarketInfoAndParams, ...) (int64, sdk.Error)
- func EndBlocker(ctx sdk.Context, keeper keepers.Keeper)
- func InitGenesis(ctx sdk.Context, keeper keepers.Keeper, data GenesisState)
- func NewHandler(k keepers.Keeper) sdk.Handler
- func SendFillMsg(ctx sdk.Context, seller *Order, buyer *Order, stockAmount, moneyAmount int64, ...)
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)
- func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (am AppModule) QuerierRoute() string
- func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
- func (am AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (amb AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (amb AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (amb AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(data json.RawMessage) error
- type CancelOrderInfo
- type CreateOrderInfo
- type FillOrderInfo
- type GenesisState
- type InfoForDeal
- type Keeper
- type MarketInfo
- type MsgCancelOrder
- type MsgCancelTradingPair
- type MsgCreateOrder
- type MsgCreateTradingPair
- type MsgModifyPricePrecision
- type Order
- type ParamOfCommissionMsg
- type Params
- type WrappedOrder
- func (wo *WrappedOrder) Deal(otherSide match.OrderForTrade, amount int64, price sdk.Dec)
- func (wo *WrappedOrder) GetAmount() int64
- func (wo *WrappedOrder) GetHash() []byte
- func (wo *WrappedOrder) GetHeight() int64
- func (wo *WrappedOrder) GetOwner() match.Account
- func (wo *WrappedOrder) GetPrice() sdk.Dec
- func (wo *WrappedOrder) GetSide() int
- func (wo *WrappedOrder) String() string
Constants ¶
const ( StoreKey = types.StoreKey ModuleName = types.ModuleName )
const ( IntegrationNetSubString = types.IntegrationNetSubString OrderIDPartsNum = types.OrderIDPartsNum SymbolSeparator = types.SymbolSeparator LimitOrder = types.LimitOrder GTE = types.GTE BID = types.BID ASK = types.ASK BUY = types.BUY SELL = types.SELL )
Variables ¶
var ( NewBaseKeeper = keepers.NewKeeper DefaultParams = types.DefaultParams DecToBigEndianBytes = types.DecToBigEndianBytes ValidateOrderID = types.ValidateOrderID IsValidTradingPair = types.IsValidTradingPair ModuleCdc = types.ModuleCdc GetSymbol = dex.GetSymbol SplitSymbol = dex.SplitSymbol )
var ( AttributeValueCategory = ModuleName EventTypeKeyCreateTradingPair = "create_market" EventTypeKeyCreateOrder = "create_order" EventTypeKeyCancelOrder = "cancel_order" EventTypeKeyCancelTradingPair = "cancel_market" EventTypeKeyModifyPricePrecision = "modify_price_precision" AttributeKeyTradingPair = "trading_pair" AttributeKeyOrder = "order" AttributeKeyStock = "stock" AttributeKeyMoney = "money" AttributeKeyPricePrecision = "price_precision" AttributeKeyLastExecutePrice = "last_execute_price" AttributeKeySender = "sender" AttributeKeySequence = "sequence" AttributeKeyOrderType = "order_type" AttributeKeyPrice = "price" AttributeKeyQuantity = "quantity" AttributeKeySide = "side" AttributeKeyHeight = "height" AttributeKeyTimeInForce = "time_in_force" AttributeKeyDelOrderReason = "del_order_reason" AttributeKeyDelOrderHeight = "del_order_height" AttributeKeyUsedCommission = "used_commission" AttributeKeyLeftStock = "left_stock" AttributeKeyDealStock = "deal_stock" AttributeKeyRemainAmount = "remain_amount" AttributeKeyDealMoney = "deal_money" AttributeKeyEffectiveTime = "effective_time" AttributeKeyOldPricePrecision = "old_price_precision" AttributeKeyNewPricePrecision = "new_price_precision" )
Market module event types
Functions ¶
func CalCommission ¶
func CalCommission(ctx sdk.Context, keeper keepers.QueryMarketInfoAndParams, msg ParamOfCommissionMsg) (int64, sdk.Error)
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper keepers.Keeper, data GenesisState)
InitGenesis - Init store state from genesis data
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
___________________________ app module object
func NewAppModule ¶
NewAppModule creates a new AppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
func (AppModule) NewHandler ¶
func (AppModule) NewQuerierHandler ¶
func (AppModule) QuerierRoute ¶
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
registers
type AppModuleBasic ¶
type AppModuleBasic struct { }
app module basics object
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
genesis
func (AppModuleBasic) GetQueryCmd ¶
func (amb AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
func (AppModuleBasic) GetTxCmd ¶
func (amb AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
func (AppModuleBasic) RegisterRESTRoutes ¶
func (amb AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
client functionality
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(data json.RawMessage) error
type CancelOrderInfo ¶
type CancelOrderInfo = types.CancelOrderInfo
type CreateOrderInfo ¶
type CreateOrderInfo = types.CreateOrderInfo
type FillOrderInfo ¶
type FillOrderInfo = types.FillOrderInfo
type GenesisState ¶
type GenesisState struct { Params types.Params `json:"params"` Orders []*types.Order `json:"orders"` MarketInfos []types.MarketInfo `json:"market_infos"` OrderCleanTime int64 `json:"order_clean_time"` }
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - Return a default genesis state
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, k keepers.Keeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper
func NewGenesisState ¶
func NewGenesisState(params types.Params, orders []*types.Order, infos []types.MarketInfo, cleanTime int64) GenesisState
NewGenesisState - Create a new genesis state
func (GenesisState) Validate ¶
func (data GenesisState) Validate() error
ValidateGenesis performs basic validation of market genesis data returning an error for any failed validation criteria.
type InfoForDeal ¶
type InfoForDeal struct {
// contains filtered or unexported fields
}
Some handlers which are useful when orders are matched and traded.
type MarketInfo ¶
type MarketInfo = types.MarketInfo
type MsgCancelOrder ¶
type MsgCancelOrder = types.MsgCancelOrder
type MsgCancelTradingPair ¶
type MsgCancelTradingPair = types.MsgCancelTradingPair
type MsgCreateOrder ¶
type MsgCreateOrder = types.MsgCreateOrder
type MsgCreateTradingPair ¶
type MsgCreateTradingPair = types.MsgCreateTradingPair
type MsgModifyPricePrecision ¶
type MsgModifyPricePrecision = types.MsgModifyPricePrecision
type ParamOfCommissionMsg ¶
type ParamOfCommissionMsg struct {
// contains filtered or unexported fields
}
type WrappedOrder ¶
type WrappedOrder struct {
// contains filtered or unexported fields
}
Wrapper an order with InfoForDeal, which contains useful handlers
func (*WrappedOrder) Deal ¶
func (wo *WrappedOrder) Deal(otherSide match.OrderForTrade, amount int64, price sdk.Dec)
func (*WrappedOrder) GetAmount ¶
func (wo *WrappedOrder) GetAmount() int64
func (*WrappedOrder) GetHash ¶
func (wo *WrappedOrder) GetHash() []byte
func (*WrappedOrder) GetHeight ¶
func (wo *WrappedOrder) GetHeight() int64
func (*WrappedOrder) GetOwner ¶
func (wo *WrappedOrder) GetOwner() match.Account
func (*WrappedOrder) GetPrice ¶
func (wo *WrappedOrder) GetPrice() sdk.Dec
WrappedOrder implements OrderForTrade interface
func (*WrappedOrder) GetSide ¶
func (wo *WrappedOrder) GetSide() int
func (*WrappedOrder) String ¶
func (wo *WrappedOrder) String() string