market

package
v0.2.7-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2020 License: BSD-2-Clause Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	StoreKey   = types.StoreKey
	ModuleName = types.ModuleName
)
View Source
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

View Source
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
)
View Source
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 EndBlocker

func EndBlocker(ctx sdk.Context, keeper keepers.Keeper)

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper keepers.Keeper, data GenesisState)

InitGenesis - Init store state from genesis data

func NewHandler

func NewHandler(k keepers.Keeper) sdk.Handler

func SendFillMsg

func SendFillMsg(ctx sdk.Context, seller *Order, buyer *Order, stockAmount, moneyAmount int64, price sdk.Dec, currentHeight int64)

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

___________________________ app module object

func NewAppModule

func NewAppModule(marketKeeper keepers.Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)

func (AppModule) EndBlock

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 (am AppModule) NewHandler() sdk.Handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

registers

func (AppModule) Route

func (am AppModule) Route() string

routes

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 Keeper

type Keeper = keepers.Keeper

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 Order

type Order = types.Order

type ParamOfCommissionMsg

type ParamOfCommissionMsg struct {
	// contains filtered or unexported fields
}

type Params

type Params = types.Params

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

Directories

Path Synopsis
client
cli
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL