types

package
v1.68.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TyUnknowAction = iota + 200
	TyLimitOrderAction
	TyMarketOrderAction
	TyRevokeOrderAction
	TyExchangeBindAction
	TyEntrustOrderAction
	TyEntrustRevokeOrderAction

	NameLimitOrderAction         = "LimitOrder"
	NameMarketOrderAction        = "MarketOrder"
	NameRevokeOrderAction        = "RevokeOrder"
	NameExchangeBindAction       = "ExchangeBind"
	NameEntrustOrderAction       = "EntrustOrder"
	NameEntrustRevokeOrderAction = "EntrustRevokeOrder"

	FuncNameQueryMarketDepth      = "QueryMarketDepth"
	FuncNameQueryHistoryOrderList = "QueryHistoryOrderList"
	FuncNameQueryOrder            = "QueryOrder"
	FuncNameQueryOrderList        = "QueryOrderList"
)

action类型id和name,这些常量可以自定义修改

View Source
const (
	TyUnknownLog = iota + 200
	TyLimitOrderLog
	TyMarketOrderLog
	TyRevokeOrderLog

	TyExchangeBindLog
)

log类型id值

View Source
const (
	OpBuy = iota + 1
	OpSell
)

OP

View Source
const (
	Ordered = iota
	Completed
	Revoked
)

order status

View Source
const (
	ListDESC = int32(0)
	ListASC  = int32(1)
	ListSeek = int32(2)
)

const

View Source
const (
	//Count 单次list还回条数
	Count = int32(10)
	//MaxMatchCount 系统最大撮合深度
	MaxMatchCount = 100
)

Variables

View Source
var (
	ErrAssetAmount  = fmt.Errorf("%s", "The asset amount is not valid!")
	ErrAssetPrice   = fmt.Errorf("%s", "The asset price is not valid!")
	ErrAssetOp      = fmt.Errorf("%s", "The asset op is not define!")
	ErrAssetBalance = fmt.Errorf("%s", "Insufficient balance!")
	ErrOrderSatus   = fmt.Errorf("%s", "The order status is reovked or completed!")
	ErrAddr         = fmt.Errorf("%s", "Wrong Addr!")
	ErrAsset        = fmt.Errorf("%s", "The asset's execer or symbol can't be nil,The same assets cannot be exchanged!")
	ErrCount        = fmt.Errorf("%s", "The param count can't large  20")
	Err5Count       = fmt.Errorf("%s", "The param count can't large  50")
	ErrAssetDepth   = fmt.Errorf("%s", "The param only in  [1,priceDigits+3]")
	ErrDirection    = fmt.Errorf("%s", "The direction only 0 or 1!")
	ErrStatus       = fmt.Errorf("%s", "The status only in  0 , 1, 2!")
	ErrOrderID      = fmt.Errorf("%s", "Wrong OrderID!")

	ErrCfgFmt     = fmt.Errorf("%s", "ErrCfgFmt")
	ErrBindAddr   = fmt.Errorf("%s", "The address is not bound")
	ErrAddrIsBank = fmt.Errorf("%s", "The address cannot be banks")
)

some errors definition

View Source
var (
	//ExchangeX 执行器名称定义
	ExchangeX = "exchange"

	//ForkFix Forks
	ForkFix1 = "ForkFix1"

	ForkParamV1 = "ForkParamV1"
	ForkParamV2 = "ForkParamV2"
	ForkParamV3 = "ForkParamV3"
	ForkParamV4 = "ForkParamV4"
	ForkParamV5 = "ForkParamV5"
	ForkParamV6 = "ForkParamV6"
	ForkParamV7 = "ForkParamV7"
	ForkParamV8 = "ForkParamV8"
	ForkParamV9 = "ForkParamV9"

	ForkParamV10 = "ForkParamV10"
	ForkParamV11 = "ForkParamV11"
	ForkParamV12 = "ForkParamV12"
	ForkParamV13 = "ForkParamV13"
	ForkParamV14 = "ForkParamV14"
	ForkParamV15 = "ForkParamV15"
	ForkParamV16 = "ForkParamV16"
	ForkParamV17 = "ForkParamV17"
	ForkParamV18 = "ForkParamV18"
	ForkParamV19 = "ForkParamV19"
	ForkParamV20 = "ForkParamV20"
	ForkParamV21 = "ForkParamV21"
	ForkParamV22 = "ForkParamV22"
	ForkParamV23 = "ForkParamV23"
	ForkParamV24 = "ForkParamV24"
	ForkParamV25 = "ForkParamV25"
	ForkParamV26 = "ForkParamV26"
	ForkParamV27 = "ForkParamV27"
	ForkParamV28 = "ForkParamV28"
	ForkParamV29 = "ForkParamV29"
)
View Source
var File_exchange_proto protoreflect.FileDescriptor
View Source
var MverPrefix = "mver.exec.sub." + ExchangeX // [mver.exec.sub.exchange]

Functions

func GetDefaultCfgstring added in v1.66.0

func GetDefaultCfgstring() string

GetDefaultCfgstring ...

func InitExecutor

func InitExecutor(cfg *types.Chain33Config)

InitExecutor defines register executor

func InitFork

func InitFork(cfg *types.Chain33Config)

InitFork defines register fork

func RegisterExchangeServer

func RegisterExchangeServer(s *grpc.Server, srv ExchangeServer)

Types

type Asset

type Asset struct {
	Execer string `protobuf:"bytes,1,opt,name=execer,proto3" json:"execer,omitempty"`
	Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"`
	// contains filtered or unexported fields
}

资产类型

func (*Asset) Descriptor deprecated

func (*Asset) Descriptor() ([]byte, []int)

Deprecated: Use Asset.ProtoReflect.Descriptor instead.

func (*Asset) GetExecer

func (x *Asset) GetExecer() string

func (*Asset) GetSymbol

func (x *Asset) GetSymbol() string

func (*Asset) ProtoMessage

func (*Asset) ProtoMessage()

func (*Asset) ProtoReflect added in v1.65.3

func (x *Asset) ProtoReflect() protoreflect.Message

func (*Asset) Reset

func (x *Asset) Reset()

func (*Asset) String

func (x *Asset) String() string

type CoinCfg added in v1.67.0

type CoinCfg struct {
	Coin   string
	Execer string
	Name   string
}

type Econfig added in v1.67.0

type Econfig struct {
	Banks     []string
	RobotMap  map[string]bool
	Coins     []CoinCfg
	Exchanges map[string]*Trade // 现货交易、杠杠交易
}

func (*Econfig) GetCoinName added in v1.67.0

func (f *Econfig) GetCoinName(asset *Asset) string

func (*Econfig) GetFeeAddr added in v1.67.0

func (f *Econfig) GetFeeAddr() string

func (*Econfig) GetSymbol added in v1.67.0

func (f *Econfig) GetSymbol(left, right *Asset) string

func (*Econfig) GetTrade added in v1.67.0

func (f *Econfig) GetTrade(left, right *Asset) *Trade

func (*Econfig) IsBankAddr added in v1.67.3

func (f *Econfig) IsBankAddr(addr string) bool

func (*Econfig) IsFeeFreeAddr added in v1.67.3

func (f *Econfig) IsFeeFreeAddr(addr string) bool

type EntrustOrder added in v1.66.3

type EntrustOrder struct {

	//交易对
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//交易对
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	//价格
	Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	//总量
	Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
	//操作, 1为买,2为卖
	Op int32 `protobuf:"varint,5,opt,name=op,proto3" json:"op,omitempty"`
	//交易地址
	Addr string `protobuf:"bytes,6,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

委托限价订单

func (*EntrustOrder) Descriptor deprecated added in v1.66.3

func (*EntrustOrder) Descriptor() ([]byte, []int)

Deprecated: Use EntrustOrder.ProtoReflect.Descriptor instead.

func (*EntrustOrder) GetAddr added in v1.66.3

func (x *EntrustOrder) GetAddr() string

func (*EntrustOrder) GetAmount added in v1.66.3

func (x *EntrustOrder) GetAmount() int64

func (*EntrustOrder) GetLeftAsset added in v1.66.3

func (x *EntrustOrder) GetLeftAsset() *Asset

func (*EntrustOrder) GetOp added in v1.66.3

func (x *EntrustOrder) GetOp() int32

func (*EntrustOrder) GetPrice added in v1.66.3

func (x *EntrustOrder) GetPrice() int64

func (*EntrustOrder) GetRightAsset added in v1.66.3

func (x *EntrustOrder) GetRightAsset() *Asset

func (*EntrustOrder) ProtoMessage added in v1.66.3

func (*EntrustOrder) ProtoMessage()

func (*EntrustOrder) ProtoReflect added in v1.66.3

func (x *EntrustOrder) ProtoReflect() protoreflect.Message

func (*EntrustOrder) Reset added in v1.66.3

func (x *EntrustOrder) Reset()

func (*EntrustOrder) String added in v1.66.3

func (x *EntrustOrder) String() string

type EntrustRevokeOrder added in v1.66.3

type EntrustRevokeOrder struct {

	//订单号
	OrderID int64 `protobuf:"varint,1,opt,name=orderID,proto3" json:"orderID,omitempty"`
	//交易地址
	Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

委托撤回订单

func (*EntrustRevokeOrder) Descriptor deprecated added in v1.66.3

func (*EntrustRevokeOrder) Descriptor() ([]byte, []int)

Deprecated: Use EntrustRevokeOrder.ProtoReflect.Descriptor instead.

func (*EntrustRevokeOrder) GetAddr added in v1.66.3

func (x *EntrustRevokeOrder) GetAddr() string

func (*EntrustRevokeOrder) GetOrderID added in v1.66.3

func (x *EntrustRevokeOrder) GetOrderID() int64

func (*EntrustRevokeOrder) ProtoMessage added in v1.66.3

func (*EntrustRevokeOrder) ProtoMessage()

func (*EntrustRevokeOrder) ProtoReflect added in v1.66.3

func (x *EntrustRevokeOrder) ProtoReflect() protoreflect.Message

func (*EntrustRevokeOrder) Reset added in v1.66.3

func (x *EntrustRevokeOrder) Reset()

func (*EntrustRevokeOrder) String added in v1.66.3

func (x *EntrustRevokeOrder) String() string

type Exchange

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

func (*Exchange) Descriptor deprecated

func (*Exchange) Descriptor() ([]byte, []int)

Deprecated: Use Exchange.ProtoReflect.Descriptor instead.

func (*Exchange) ProtoMessage

func (*Exchange) ProtoMessage()

func (*Exchange) ProtoReflect added in v1.65.3

func (x *Exchange) ProtoReflect() protoreflect.Message

func (*Exchange) Reset

func (x *Exchange) Reset()

func (*Exchange) String

func (x *Exchange) String() string

type ExchangeAction

type ExchangeAction struct {

	// Types that are assignable to Value:
	//	*ExchangeAction_LimitOrder
	//	*ExchangeAction_MarketOrder
	//	*ExchangeAction_RevokeOrder
	//	*ExchangeAction_ExchangeBind
	//	*ExchangeAction_EntrustOrder
	//	*ExchangeAction_EntrustRevokeOrder
	Value isExchangeAction_Value `protobuf_oneof:"value"`
	Ty    int32                  `protobuf:"varint,6,opt,name=ty,proto3" json:"ty,omitempty"`
	// contains filtered or unexported fields
}

func (*ExchangeAction) Descriptor deprecated

func (*ExchangeAction) Descriptor() ([]byte, []int)

Deprecated: Use ExchangeAction.ProtoReflect.Descriptor instead.

func (*ExchangeAction) GetEntrustOrder added in v1.66.3

func (x *ExchangeAction) GetEntrustOrder() *EntrustOrder

func (*ExchangeAction) GetEntrustRevokeOrder added in v1.66.3

func (x *ExchangeAction) GetEntrustRevokeOrder() *EntrustRevokeOrder

func (*ExchangeAction) GetExchangeBind added in v1.66.3

func (x *ExchangeAction) GetExchangeBind() *ExchangeBind

func (*ExchangeAction) GetLimitOrder

func (x *ExchangeAction) GetLimitOrder() *LimitOrder

func (*ExchangeAction) GetMarketOrder

func (x *ExchangeAction) GetMarketOrder() *MarketOrder

func (*ExchangeAction) GetRevokeOrder

func (x *ExchangeAction) GetRevokeOrder() *RevokeOrder

func (*ExchangeAction) GetTy

func (x *ExchangeAction) GetTy() int32

func (*ExchangeAction) GetValue

func (m *ExchangeAction) GetValue() isExchangeAction_Value

func (*ExchangeAction) ProtoMessage

func (*ExchangeAction) ProtoMessage()

func (*ExchangeAction) ProtoReflect added in v1.65.3

func (x *ExchangeAction) ProtoReflect() protoreflect.Message

func (*ExchangeAction) Reset

func (x *ExchangeAction) Reset()

func (*ExchangeAction) String

func (x *ExchangeAction) String() string

type ExchangeAction_EntrustOrder added in v1.66.3

type ExchangeAction_EntrustOrder struct {
	EntrustOrder *EntrustOrder `protobuf:"bytes,5,opt,name=entrustOrder,proto3,oneof"`
}

type ExchangeAction_EntrustRevokeOrder added in v1.66.3

type ExchangeAction_EntrustRevokeOrder struct {
	EntrustRevokeOrder *EntrustRevokeOrder `protobuf:"bytes,7,opt,name=entrustRevokeOrder,proto3,oneof"`
}

type ExchangeAction_ExchangeBind added in v1.66.3

type ExchangeAction_ExchangeBind struct {
	ExchangeBind *ExchangeBind `protobuf:"bytes,4,opt,name=exchangeBind,proto3,oneof"`
}

type ExchangeAction_LimitOrder

type ExchangeAction_LimitOrder struct {
	LimitOrder *LimitOrder `protobuf:"bytes,1,opt,name=limitOrder,proto3,oneof"`
}

type ExchangeAction_MarketOrder

type ExchangeAction_MarketOrder struct {
	MarketOrder *MarketOrder `protobuf:"bytes,2,opt,name=marketOrder,proto3,oneof"`
}

type ExchangeAction_RevokeOrder

type ExchangeAction_RevokeOrder struct {
	RevokeOrder *RevokeOrder `protobuf:"bytes,3,opt,name=revokeOrder,proto3,oneof"`
}

type ExchangeBind added in v1.66.3

type ExchangeBind struct {

	//交易地址
	ExchangeAddress string `protobuf:"bytes,1,opt,name=exchangeAddress,proto3" json:"exchangeAddress,omitempty"`
	//委托地址
	EntrustAddress string `protobuf:"bytes,2,opt,name=entrustAddress,proto3" json:"entrustAddress,omitempty"`
	// contains filtered or unexported fields
}

func (*ExchangeBind) Descriptor deprecated added in v1.66.3

func (*ExchangeBind) Descriptor() ([]byte, []int)

Deprecated: Use ExchangeBind.ProtoReflect.Descriptor instead.

func (*ExchangeBind) GetEntrustAddress added in v1.66.3

func (x *ExchangeBind) GetEntrustAddress() string

func (*ExchangeBind) GetExchangeAddress added in v1.66.3

func (x *ExchangeBind) GetExchangeAddress() string

func (*ExchangeBind) ProtoMessage added in v1.66.3

func (*ExchangeBind) ProtoMessage()

func (*ExchangeBind) ProtoReflect added in v1.66.3

func (x *ExchangeBind) ProtoReflect() protoreflect.Message

func (*ExchangeBind) Reset added in v1.66.3

func (x *ExchangeBind) Reset()

func (*ExchangeBind) String added in v1.66.3

func (x *ExchangeBind) String() string

type ExchangeClient

type ExchangeClient interface {
}

ExchangeClient is the client API for Exchange service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewExchangeClient

func NewExchangeClient(cc grpc.ClientConnInterface) ExchangeClient

type ExchangeServer

type ExchangeServer interface {
}

ExchangeServer is the server API for Exchange service.

type ExchangeType

type ExchangeType struct {
	types.ExecTypeBase
}

ExchangeType ...

func NewType

func NewType(cfg *types.Chain33Config) *ExchangeType

NewType ...

func (*ExchangeType) GetLogMap

func (e *ExchangeType) GetLogMap() map[int64]*types.LogInfo

GetLogMap 获取合约log相关信息

func (*ExchangeType) GetPayload

func (e *ExchangeType) GetPayload() types.Message

GetPayload 获取合约action结构

func (*ExchangeType) GetTypeMap

func (e *ExchangeType) GetTypeMap() map[string]int32

GetTypeMap 获取合约action的id和name信息

type LimitOrder

type LimitOrder struct {

	//交易对
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//交易对
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	//价格
	Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	//总量
	Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
	//操作, 1为买,2为卖
	Op int32 `protobuf:"varint,5,opt,name=op,proto3" json:"op,omitempty"`
	// contains filtered or unexported fields
}

限价订单

func (*LimitOrder) Descriptor deprecated

func (*LimitOrder) Descriptor() ([]byte, []int)

Deprecated: Use LimitOrder.ProtoReflect.Descriptor instead.

func (*LimitOrder) GetAmount

func (x *LimitOrder) GetAmount() int64

func (*LimitOrder) GetLeftAsset

func (x *LimitOrder) GetLeftAsset() *Asset

func (*LimitOrder) GetOp

func (x *LimitOrder) GetOp() int32

func (*LimitOrder) GetPrice

func (x *LimitOrder) GetPrice() int64

func (*LimitOrder) GetRightAsset

func (x *LimitOrder) GetRightAsset() *Asset

func (*LimitOrder) ProtoMessage

func (*LimitOrder) ProtoMessage()

func (*LimitOrder) ProtoReflect added in v1.65.3

func (x *LimitOrder) ProtoReflect() protoreflect.Message

func (*LimitOrder) Reset

func (x *LimitOrder) Reset()

func (*LimitOrder) String

func (x *LimitOrder) String() string

type MarketAllDepth added in v1.67.3

type MarketAllDepth struct {

	//买
	Bids []*MarketDepth `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids,omitempty"`
	//卖
	Asks []*MarketDepth `protobuf:"bytes,2,rep,name=asks,proto3" json:"asks,omitempty"`
	// contains filtered or unexported fields
}

查询接口返回的市场买卖深度

func (*MarketAllDepth) Descriptor deprecated added in v1.67.3

func (*MarketAllDepth) Descriptor() ([]byte, []int)

Deprecated: Use MarketAllDepth.ProtoReflect.Descriptor instead.

func (*MarketAllDepth) GetAsks added in v1.67.3

func (x *MarketAllDepth) GetAsks() []*MarketDepth

func (*MarketAllDepth) GetBids added in v1.67.3

func (x *MarketAllDepth) GetBids() []*MarketDepth

func (*MarketAllDepth) ProtoMessage added in v1.67.3

func (*MarketAllDepth) ProtoMessage()

func (*MarketAllDepth) ProtoReflect added in v1.67.3

func (x *MarketAllDepth) ProtoReflect() protoreflect.Message

func (*MarketAllDepth) Reset added in v1.67.3

func (x *MarketAllDepth) Reset()

func (*MarketAllDepth) String added in v1.67.3

func (x *MarketAllDepth) String() string

type MarketDepth

type MarketDepth struct {

	//资产1
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//资产2
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	//价格
	Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	//总量
	Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
	//操作, 1为买,2为卖
	Op int32 `protobuf:"varint,5,opt,name=op,proto3" json:"op,omitempty"`
	// contains filtered or unexported fields
}

市场深度

func (*MarketDepth) Descriptor deprecated

func (*MarketDepth) Descriptor() ([]byte, []int)

Deprecated: Use MarketDepth.ProtoReflect.Descriptor instead.

func (*MarketDepth) GetAmount

func (x *MarketDepth) GetAmount() int64

func (*MarketDepth) GetLeftAsset

func (x *MarketDepth) GetLeftAsset() *Asset

func (*MarketDepth) GetOp

func (x *MarketDepth) GetOp() int32

func (*MarketDepth) GetPrice

func (x *MarketDepth) GetPrice() int64

func (*MarketDepth) GetRightAsset

func (x *MarketDepth) GetRightAsset() *Asset

func (*MarketDepth) ProtoMessage

func (*MarketDepth) ProtoMessage()

func (*MarketDepth) ProtoReflect added in v1.65.3

func (x *MarketDepth) ProtoReflect() protoreflect.Message

func (*MarketDepth) Reset

func (x *MarketDepth) Reset()

func (*MarketDepth) String

func (x *MarketDepth) String() string

type MarketDepthList

type MarketDepthList struct {
	List       []*MarketDepth `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	PrimaryKey string         `protobuf:"bytes,2,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	// contains filtered or unexported fields
}

查询接口返回的市场深度列表

func (*MarketDepthList) Descriptor deprecated

func (*MarketDepthList) Descriptor() ([]byte, []int)

Deprecated: Use MarketDepthList.ProtoReflect.Descriptor instead.

func (*MarketDepthList) GetList

func (x *MarketDepthList) GetList() []*MarketDepth

func (*MarketDepthList) GetPrimaryKey

func (x *MarketDepthList) GetPrimaryKey() string

func (*MarketDepthList) ProtoMessage

func (*MarketDepthList) ProtoMessage()

func (*MarketDepthList) ProtoReflect added in v1.65.3

func (x *MarketDepthList) ProtoReflect() protoreflect.Message

func (*MarketDepthList) Reset

func (x *MarketDepthList) Reset()

func (*MarketDepthList) String

func (x *MarketDepthList) String() string

type MarketOrder

type MarketOrder struct {

	//资产1
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//资产2
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	//总量
	Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	//操作, 1为买,2为卖
	Op int32 `protobuf:"varint,4,opt,name=op,proto3" json:"op,omitempty"`
	// contains filtered or unexported fields
}

市价委托

func (*MarketOrder) Descriptor deprecated

func (*MarketOrder) Descriptor() ([]byte, []int)

Deprecated: Use MarketOrder.ProtoReflect.Descriptor instead.

func (*MarketOrder) GetAmount

func (x *MarketOrder) GetAmount() int64

func (*MarketOrder) GetLeftAsset

func (x *MarketOrder) GetLeftAsset() *Asset

func (*MarketOrder) GetOp

func (x *MarketOrder) GetOp() int32

func (*MarketOrder) GetRightAsset

func (x *MarketOrder) GetRightAsset() *Asset

func (*MarketOrder) ProtoMessage

func (*MarketOrder) ProtoMessage()

func (*MarketOrder) ProtoReflect added in v1.65.3

func (x *MarketOrder) ProtoReflect() protoreflect.Message

func (*MarketOrder) Reset

func (x *MarketOrder) Reset()

func (*MarketOrder) String

func (x *MarketOrder) String() string

type Order

type Order struct {
	OrderID int64 `protobuf:"varint,1,opt,name=orderID,proto3" json:"orderID,omitempty"`
	// Types that are assignable to Value:
	//	*Order_LimitOrder
	//	*Order_MarketOrder
	Value isOrder_Value `protobuf_oneof:"value"`
	//挂单类型
	Ty int32 `protobuf:"varint,4,opt,name=ty,proto3" json:"ty,omitempty"`
	//已经成交的数量
	Executed int64 `protobuf:"varint,5,opt,name=executed,proto3" json:"executed,omitempty"`
	//成交均价
	AVGPrice int64 `protobuf:"varint,6,opt,name=AVG_price,json=AVGPrice,proto3" json:"AVG_price,omitempty"`
	//余额
	Balance int64 `protobuf:"varint,7,opt,name=balance,proto3" json:"balance,omitempty"`
	//状态,0 挂单中ordered, 1 完成completed, 2撤回 revoked
	Status int32 `protobuf:"varint,8,opt,name=status,proto3" json:"status,omitempty"`
	//用户地址
	Addr string `protobuf:"bytes,9,opt,name=addr,proto3" json:"addr,omitempty"`
	//更新时间
	UpdateTime int64 `protobuf:"varint,10,opt,name=updateTime,proto3" json:"updateTime,omitempty"`
	//索引
	Index int64 `protobuf:"varint,11,opt,name=index,proto3" json:"index,omitempty"`
	//手续费率 (挂单)
	Rate int32 `protobuf:"varint,12,opt,name=rate,proto3" json:"rate,omitempty"`
	//手续费
	DigestedFee int64 `protobuf:"varint,13,opt,name=digestedFee,proto3" json:"digestedFee,omitempty"`
	//最小手续费
	MinFee int64 `protobuf:"varint,14,opt,name=minFee,proto3" json:"minFee,omitempty"`
	//挂单hash
	Hash string `protobuf:"bytes,15,opt,name=hash,proto3" json:"hash,omitempty"`
	//撤单hash
	RevokeHash string `protobuf:"bytes,16,opt,name=revokeHash,proto3" json:"revokeHash,omitempty"`
	//创建时间
	CreateTime int64 `protobuf:"varint,17,opt,name=createTime,proto3" json:"createTime,omitempty"`
	//委托地址
	EntrustAddr string `protobuf:"bytes,18,opt,name=entrustAddr,proto3" json:"entrustAddr,omitempty"`
	// contains filtered or unexported fields
}

订单信息

func (*Order) Descriptor deprecated

func (*Order) Descriptor() ([]byte, []int)

Deprecated: Use Order.ProtoReflect.Descriptor instead.

func (*Order) GetAVGPrice

func (x *Order) GetAVGPrice() int64

func (*Order) GetAddr

func (x *Order) GetAddr() string

func (*Order) GetBalance

func (x *Order) GetBalance() int64

func (*Order) GetCreateTime added in v1.66.0

func (x *Order) GetCreateTime() int64

func (*Order) GetDigestedFee added in v1.66.0

func (x *Order) GetDigestedFee() int64

func (*Order) GetEntrustAddr added in v1.66.3

func (x *Order) GetEntrustAddr() string

func (*Order) GetExecuted

func (x *Order) GetExecuted() int64

func (*Order) GetHash added in v1.66.0

func (x *Order) GetHash() string

func (*Order) GetIndex

func (x *Order) GetIndex() int64

func (*Order) GetLimitOrder

func (x *Order) GetLimitOrder() *LimitOrder

func (*Order) GetMarketOrder

func (x *Order) GetMarketOrder() *MarketOrder

func (*Order) GetMinFee added in v1.66.0

func (x *Order) GetMinFee() int64

func (*Order) GetOrderID

func (x *Order) GetOrderID() int64

func (*Order) GetRate added in v1.66.0

func (x *Order) GetRate() int32

func (*Order) GetRevokeHash added in v1.66.0

func (x *Order) GetRevokeHash() string

func (*Order) GetStatus

func (x *Order) GetStatus() int32

func (*Order) GetTy

func (x *Order) GetTy() int32

func (*Order) GetUpdateTime

func (x *Order) GetUpdateTime() int64

func (*Order) GetValue

func (m *Order) GetValue() isOrder_Value

func (*Order) ProtoMessage

func (*Order) ProtoMessage()

func (*Order) ProtoReflect added in v1.65.3

func (x *Order) ProtoReflect() protoreflect.Message

func (*Order) Reset

func (x *Order) Reset()

func (*Order) String

func (x *Order) String() string

type OrderList

type OrderList struct {
	List       []*Order `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	PrimaryKey string   `protobuf:"bytes,2,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	// contains filtered or unexported fields
}

订单列表

func (*OrderList) Descriptor deprecated

func (*OrderList) Descriptor() ([]byte, []int)

Deprecated: Use OrderList.ProtoReflect.Descriptor instead.

func (*OrderList) GetList

func (x *OrderList) GetList() []*Order

func (*OrderList) GetPrimaryKey

func (x *OrderList) GetPrimaryKey() string

func (*OrderList) ProtoMessage

func (*OrderList) ProtoMessage()

func (*OrderList) ProtoReflect added in v1.65.3

func (x *OrderList) ProtoReflect() protoreflect.Message

func (*OrderList) Reset

func (x *OrderList) Reset()

func (*OrderList) String

func (x *OrderList) String() string

type Order_LimitOrder

type Order_LimitOrder struct {
	LimitOrder *LimitOrder `protobuf:"bytes,2,opt,name=limitOrder,proto3,oneof"`
}

type Order_MarketOrder

type Order_MarketOrder struct {
	MarketOrder *MarketOrder `protobuf:"bytes,3,opt,name=marketOrder,proto3,oneof"`
}

type QueryHistoryOrderList

type QueryHistoryOrderList struct {

	//资产1
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//资产2
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	// 索引值
	PrimaryKey string `protobuf:"bytes,3,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	//单页返回多少条记录,默认返回10条,为了系统安全最多单次只能返回20条
	Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	// 0降序,1升序,默认降序
	Direction int32 `protobuf:"varint,5,opt,name=direction,proto3" json:"direction,omitempty"`
	// contains filtered or unexported fields
}

查询最新得成交信息,外部接口

func (*QueryHistoryOrderList) Descriptor deprecated

func (*QueryHistoryOrderList) Descriptor() ([]byte, []int)

Deprecated: Use QueryHistoryOrderList.ProtoReflect.Descriptor instead.

func (*QueryHistoryOrderList) GetCount

func (x *QueryHistoryOrderList) GetCount() int32

func (*QueryHistoryOrderList) GetDirection

func (x *QueryHistoryOrderList) GetDirection() int32

func (*QueryHistoryOrderList) GetLeftAsset

func (x *QueryHistoryOrderList) GetLeftAsset() *Asset

func (*QueryHistoryOrderList) GetPrimaryKey

func (x *QueryHistoryOrderList) GetPrimaryKey() string

func (*QueryHistoryOrderList) GetRightAsset

func (x *QueryHistoryOrderList) GetRightAsset() *Asset

func (*QueryHistoryOrderList) ProtoMessage

func (*QueryHistoryOrderList) ProtoMessage()

func (*QueryHistoryOrderList) ProtoReflect added in v1.65.3

func (x *QueryHistoryOrderList) ProtoReflect() protoreflect.Message

func (*QueryHistoryOrderList) Reset

func (x *QueryHistoryOrderList) Reset()

func (*QueryHistoryOrderList) String

func (x *QueryHistoryOrderList) String() string

type QueryMarketDepth

type QueryMarketDepth struct {

	//资产1
	LeftAsset *Asset `protobuf:"bytes,1,opt,name=leftAsset,proto3" json:"leftAsset,omitempty"`
	//资产2
	RightAsset *Asset `protobuf:"bytes,2,opt,name=rightAsset,proto3" json:"rightAsset,omitempty"`
	//操作, 1为买,2为卖
	Op int32 `protobuf:"varint,3,opt,name=op,proto3" json:"op,omitempty"`
	// 这里用价格作为索引值
	PrimaryKey string `protobuf:"bytes,4,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	//单页返回多少条记录,默认返回10条,为了系统安全最多单次只能返回20条
	Count int32 `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`
	//档位、精度
	Depth int32 `protobuf:"varint,6,opt,name=depth,proto3" json:"depth,omitempty"`
	// contains filtered or unexported fields
}

查询接口

func (*QueryMarketDepth) Descriptor deprecated

func (*QueryMarketDepth) Descriptor() ([]byte, []int)

Deprecated: Use QueryMarketDepth.ProtoReflect.Descriptor instead.

func (*QueryMarketDepth) GetCount

func (x *QueryMarketDepth) GetCount() int32

func (*QueryMarketDepth) GetDepth added in v1.67.3

func (x *QueryMarketDepth) GetDepth() int32

func (*QueryMarketDepth) GetLeftAsset

func (x *QueryMarketDepth) GetLeftAsset() *Asset

func (*QueryMarketDepth) GetOp

func (x *QueryMarketDepth) GetOp() int32

func (*QueryMarketDepth) GetPrimaryKey

func (x *QueryMarketDepth) GetPrimaryKey() string

func (*QueryMarketDepth) GetRightAsset

func (x *QueryMarketDepth) GetRightAsset() *Asset

func (*QueryMarketDepth) ProtoMessage

func (*QueryMarketDepth) ProtoMessage()

func (*QueryMarketDepth) ProtoReflect added in v1.65.3

func (x *QueryMarketDepth) ProtoReflect() protoreflect.Message

func (*QueryMarketDepth) Reset

func (x *QueryMarketDepth) Reset()

func (*QueryMarketDepth) String

func (x *QueryMarketDepth) String() string

type QueryOrder

type QueryOrder struct {
	OrderID int64 `protobuf:"varint,1,opt,name=orderID,proto3" json:"orderID,omitempty"`
	// contains filtered or unexported fields
}

根据orderID去查询订单信息

func (*QueryOrder) Descriptor deprecated

func (*QueryOrder) Descriptor() ([]byte, []int)

Deprecated: Use QueryOrder.ProtoReflect.Descriptor instead.

func (*QueryOrder) GetOrderID

func (x *QueryOrder) GetOrderID() int64

func (*QueryOrder) ProtoMessage

func (*QueryOrder) ProtoMessage()

func (*QueryOrder) ProtoReflect added in v1.65.3

func (x *QueryOrder) ProtoReflect() protoreflect.Message

func (*QueryOrder) Reset

func (x *QueryOrder) Reset()

func (*QueryOrder) String

func (x *QueryOrder) String() string

type QueryOrderList

type QueryOrderList struct {

	//挂单状态必填(默认是0,只查询ordered挂单中的)
	Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
	//用户地址信息,必填
	Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// 主键索引
	PrimaryKey string `protobuf:"bytes,3,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	//单页返回多少条记录,默认返回10条,为了系统安全最多单次只能返回20条
	Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	// 0降序,1升序,默认降序
	Direction int32 `protobuf:"varint,5,opt,name=direction,proto3" json:"direction,omitempty"`
	// contains filtered or unexported fields
}

根据地址,状态查询用户自己的挂单信息

func (*QueryOrderList) Descriptor deprecated

func (*QueryOrderList) Descriptor() ([]byte, []int)

Deprecated: Use QueryOrderList.ProtoReflect.Descriptor instead.

func (*QueryOrderList) GetAddress

func (x *QueryOrderList) GetAddress() string

func (*QueryOrderList) GetCount

func (x *QueryOrderList) GetCount() int32

func (*QueryOrderList) GetDirection

func (x *QueryOrderList) GetDirection() int32

func (*QueryOrderList) GetPrimaryKey

func (x *QueryOrderList) GetPrimaryKey() string

func (*QueryOrderList) GetStatus

func (x *QueryOrderList) GetStatus() int32

func (*QueryOrderList) ProtoMessage

func (*QueryOrderList) ProtoMessage()

func (*QueryOrderList) ProtoReflect added in v1.65.3

func (x *QueryOrderList) ProtoReflect() protoreflect.Message

func (*QueryOrderList) Reset

func (x *QueryOrderList) Reset()

func (*QueryOrderList) String

func (x *QueryOrderList) String() string

type ReceiptExchange

type ReceiptExchange struct {
	Order       *Order   `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
	MatchOrders []*Order `protobuf:"bytes,2,rep,name=matchOrders,proto3" json:"matchOrders,omitempty"`
	Index       int64    `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
	// contains filtered or unexported fields
}

exchange执行票据日志

func (*ReceiptExchange) Descriptor deprecated

func (*ReceiptExchange) Descriptor() ([]byte, []int)

Deprecated: Use ReceiptExchange.ProtoReflect.Descriptor instead.

func (*ReceiptExchange) GetIndex

func (x *ReceiptExchange) GetIndex() int64

func (*ReceiptExchange) GetMatchOrders

func (x *ReceiptExchange) GetMatchOrders() []*Order

func (*ReceiptExchange) GetOrder

func (x *ReceiptExchange) GetOrder() *Order

func (*ReceiptExchange) ProtoMessage

func (*ReceiptExchange) ProtoMessage()

func (*ReceiptExchange) ProtoReflect added in v1.65.3

func (x *ReceiptExchange) ProtoReflect() protoreflect.Message

func (*ReceiptExchange) Reset

func (x *ReceiptExchange) Reset()

func (*ReceiptExchange) String

func (x *ReceiptExchange) String() string

type ReceiptExchangeBind added in v1.66.3

type ReceiptExchangeBind struct {

	//交易地址
	ExchangeAddress string `protobuf:"bytes,1,opt,name=exchangeAddress,proto3" json:"exchangeAddress,omitempty"`
	//委托地址
	NewEntrustAddress string `protobuf:"bytes,2,opt,name=newEntrustAddress,proto3" json:"newEntrustAddress,omitempty"`
	//委托地址
	OldEntrustAddress string `protobuf:"bytes,3,opt,name=oldEntrustAddress,proto3" json:"oldEntrustAddress,omitempty"`
	// contains filtered or unexported fields
}

func (*ReceiptExchangeBind) Descriptor deprecated added in v1.66.3

func (*ReceiptExchangeBind) Descriptor() ([]byte, []int)

Deprecated: Use ReceiptExchangeBind.ProtoReflect.Descriptor instead.

func (*ReceiptExchangeBind) GetExchangeAddress added in v1.66.3

func (x *ReceiptExchangeBind) GetExchangeAddress() string

func (*ReceiptExchangeBind) GetNewEntrustAddress added in v1.66.3

func (x *ReceiptExchangeBind) GetNewEntrustAddress() string

func (*ReceiptExchangeBind) GetOldEntrustAddress added in v1.66.3

func (x *ReceiptExchangeBind) GetOldEntrustAddress() string

func (*ReceiptExchangeBind) ProtoMessage added in v1.66.3

func (*ReceiptExchangeBind) ProtoMessage()

func (*ReceiptExchangeBind) ProtoReflect added in v1.66.3

func (x *ReceiptExchangeBind) ProtoReflect() protoreflect.Message

func (*ReceiptExchangeBind) Reset added in v1.66.3

func (x *ReceiptExchangeBind) Reset()

func (*ReceiptExchangeBind) String added in v1.66.3

func (x *ReceiptExchangeBind) String() string

type RevokeOrder

type RevokeOrder struct {

	//订单号
	OrderID int64 `protobuf:"varint,1,opt,name=orderID,proto3" json:"orderID,omitempty"`
	// contains filtered or unexported fields
}

撤回订单

func (*RevokeOrder) Descriptor deprecated

func (*RevokeOrder) Descriptor() ([]byte, []int)

Deprecated: Use RevokeOrder.ProtoReflect.Descriptor instead.

func (*RevokeOrder) GetOrderID

func (x *RevokeOrder) GetOrderID() int64

func (*RevokeOrder) ProtoMessage

func (*RevokeOrder) ProtoMessage()

func (*RevokeOrder) ProtoReflect added in v1.65.3

func (x *RevokeOrder) ProtoReflect() protoreflect.Message

func (*RevokeOrder) Reset

func (x *RevokeOrder) Reset()

func (*RevokeOrder) String

func (x *RevokeOrder) String() string

type Trade added in v1.67.0

type Trade struct {
	Symbol       string
	PriceDigits  int32
	AmountDigits int32
	Taker        int32
	Maker        int32
	MinFee       int64
}

交易对配置

func (*Trade) GetAmountDigits added in v1.67.0

func (t *Trade) GetAmountDigits() int32

func (*Trade) GetMaker added in v1.67.0

func (t *Trade) GetMaker() int32

func (*Trade) GetMinFee added in v1.67.0

func (t *Trade) GetMinFee() int64

func (*Trade) GetPriceDigits added in v1.67.0

func (t *Trade) GetPriceDigits() int32

func (*Trade) GetTaker added in v1.67.0

func (t *Trade) GetTaker() int32

type UnimplementedExchangeServer

type UnimplementedExchangeServer struct {
}

UnimplementedExchangeServer can be embedded to have forward compatible implementations.

Jump to

Keyboard shortcuts

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