orderbook

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthMemory        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMemory          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMemory = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type BuyOrderBatchSelector

type BuyOrderBatchSelector struct {
	// buy_order_id is the buy order ID.
	BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"`
	// batch_id is the batch ID.
	BatchId uint64 `protobuf:"varint,2,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
}

BuyOrderBatchSelector indexes a buy order with batch selector.

func (*BuyOrderBatchSelector) Descriptor

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

func (*BuyOrderBatchSelector) GetBatchId

func (m *BuyOrderBatchSelector) GetBatchId() uint64

func (*BuyOrderBatchSelector) GetBuyOrderId

func (m *BuyOrderBatchSelector) GetBuyOrderId() uint64

func (*BuyOrderBatchSelector) Marshal

func (m *BuyOrderBatchSelector) Marshal() (dAtA []byte, err error)

func (*BuyOrderBatchSelector) MarshalTo

func (m *BuyOrderBatchSelector) MarshalTo(dAtA []byte) (int, error)

func (*BuyOrderBatchSelector) MarshalToSizedBuffer

func (m *BuyOrderBatchSelector) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BuyOrderBatchSelector) ProtoMessage

func (*BuyOrderBatchSelector) ProtoMessage()

func (*BuyOrderBatchSelector) Reset

func (m *BuyOrderBatchSelector) Reset()

func (*BuyOrderBatchSelector) Size

func (m *BuyOrderBatchSelector) Size() (n int)

func (*BuyOrderBatchSelector) String

func (m *BuyOrderBatchSelector) String() string

func (*BuyOrderBatchSelector) Unmarshal

func (m *BuyOrderBatchSelector) Unmarshal(dAtA []byte) error

func (*BuyOrderBatchSelector) XXX_DiscardUnknown

func (m *BuyOrderBatchSelector) XXX_DiscardUnknown()

func (*BuyOrderBatchSelector) XXX_Marshal

func (m *BuyOrderBatchSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BuyOrderBatchSelector) XXX_Merge

func (m *BuyOrderBatchSelector) XXX_Merge(src proto.Message)

func (*BuyOrderBatchSelector) XXX_Size

func (m *BuyOrderBatchSelector) XXX_Size() int

func (*BuyOrderBatchSelector) XXX_Unmarshal

func (m *BuyOrderBatchSelector) XXX_Unmarshal(b []byte) error

type BuyOrderClassSelector

type BuyOrderClassSelector struct {
	// buy_order_id is the buy order ID.
	BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"`
	// class_id is the class ID.
	ClassId uint64 `protobuf:"varint,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"`
	// project_location is the project location in the selector's criteria.
	ProjectLocation string `protobuf:"bytes,3,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"`
	// min_start_date is the minimum start date in the selector's criteria.
	MinStartDate *types.Timestamp `protobuf:"bytes,4,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"`
	// max_end_date is the maximum end date in the selector's criteria.
	MaxEndDate *types.Timestamp `protobuf:"bytes,5,opt,name=max_end_date,json=maxEndDate,proto3" json:"max_end_date,omitempty"`
}

BuyOrderClassSelector indexes a buy order with class selector.

func (*BuyOrderClassSelector) Descriptor

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

func (*BuyOrderClassSelector) GetBuyOrderId

func (m *BuyOrderClassSelector) GetBuyOrderId() uint64

func (*BuyOrderClassSelector) GetClassId

func (m *BuyOrderClassSelector) GetClassId() uint64

func (*BuyOrderClassSelector) GetMaxEndDate

func (m *BuyOrderClassSelector) GetMaxEndDate() *types.Timestamp

func (*BuyOrderClassSelector) GetMinStartDate

func (m *BuyOrderClassSelector) GetMinStartDate() *types.Timestamp

func (*BuyOrderClassSelector) GetProjectLocation

func (m *BuyOrderClassSelector) GetProjectLocation() string

func (*BuyOrderClassSelector) Marshal

func (m *BuyOrderClassSelector) Marshal() (dAtA []byte, err error)

func (*BuyOrderClassSelector) MarshalTo

func (m *BuyOrderClassSelector) MarshalTo(dAtA []byte) (int, error)

func (*BuyOrderClassSelector) MarshalToSizedBuffer

func (m *BuyOrderClassSelector) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BuyOrderClassSelector) ProtoMessage

func (*BuyOrderClassSelector) ProtoMessage()

func (*BuyOrderClassSelector) Reset

func (m *BuyOrderClassSelector) Reset()

func (*BuyOrderClassSelector) Size

func (m *BuyOrderClassSelector) Size() (n int)

func (*BuyOrderClassSelector) String

func (m *BuyOrderClassSelector) String() string

func (*BuyOrderClassSelector) Unmarshal

func (m *BuyOrderClassSelector) Unmarshal(dAtA []byte) error

func (*BuyOrderClassSelector) XXX_DiscardUnknown

func (m *BuyOrderClassSelector) XXX_DiscardUnknown()

func (*BuyOrderClassSelector) XXX_Marshal

func (m *BuyOrderClassSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BuyOrderClassSelector) XXX_Merge

func (m *BuyOrderClassSelector) XXX_Merge(src proto.Message)

func (*BuyOrderClassSelector) XXX_Size

func (m *BuyOrderClassSelector) XXX_Size() int

func (*BuyOrderClassSelector) XXX_Unmarshal

func (m *BuyOrderClassSelector) XXX_Unmarshal(b []byte) error

type BuyOrderProjectSelector

type BuyOrderProjectSelector struct {
	// buy_order_id is the buy order ID.
	BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"`
	// project_id is the project ID.
	ProjectId uint64 `protobuf:"varint,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// min_start_date is the minimum start date in the selector's criteria.
	MinStartDate *types.Timestamp `protobuf:"bytes,3,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"`
	// max_end_date is the maximum end date in the selector's criteria.
	MaxEndDate *types.Timestamp `protobuf:"bytes,4,opt,name=max_end_date,json=maxEndDate,proto3" json:"max_end_date,omitempty"`
}

BuyOrderProjectSelector indexes a buy order with project selector.

func (*BuyOrderProjectSelector) Descriptor

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

func (*BuyOrderProjectSelector) GetBuyOrderId

func (m *BuyOrderProjectSelector) GetBuyOrderId() uint64

func (*BuyOrderProjectSelector) GetMaxEndDate

func (m *BuyOrderProjectSelector) GetMaxEndDate() *types.Timestamp

func (*BuyOrderProjectSelector) GetMinStartDate

func (m *BuyOrderProjectSelector) GetMinStartDate() *types.Timestamp

func (*BuyOrderProjectSelector) GetProjectId

func (m *BuyOrderProjectSelector) GetProjectId() uint64

func (*BuyOrderProjectSelector) Marshal

func (m *BuyOrderProjectSelector) Marshal() (dAtA []byte, err error)

func (*BuyOrderProjectSelector) MarshalTo

func (m *BuyOrderProjectSelector) MarshalTo(dAtA []byte) (int, error)

func (*BuyOrderProjectSelector) MarshalToSizedBuffer

func (m *BuyOrderProjectSelector) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BuyOrderProjectSelector) ProtoMessage

func (*BuyOrderProjectSelector) ProtoMessage()

func (*BuyOrderProjectSelector) Reset

func (m *BuyOrderProjectSelector) Reset()

func (*BuyOrderProjectSelector) Size

func (m *BuyOrderProjectSelector) Size() (n int)

func (*BuyOrderProjectSelector) String

func (m *BuyOrderProjectSelector) String() string

func (*BuyOrderProjectSelector) Unmarshal

func (m *BuyOrderProjectSelector) Unmarshal(dAtA []byte) error

func (*BuyOrderProjectSelector) XXX_DiscardUnknown

func (m *BuyOrderProjectSelector) XXX_DiscardUnknown()

func (*BuyOrderProjectSelector) XXX_Marshal

func (m *BuyOrderProjectSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BuyOrderProjectSelector) XXX_Merge

func (m *BuyOrderProjectSelector) XXX_Merge(src proto.Message)

func (*BuyOrderProjectSelector) XXX_Size

func (m *BuyOrderProjectSelector) XXX_Size() int

func (*BuyOrderProjectSelector) XXX_Unmarshal

func (m *BuyOrderProjectSelector) XXX_Unmarshal(b []byte) error

type BuyOrderSellOrderMatch

type BuyOrderSellOrderMatch struct {
	// market_id defines the market within which this match exists.
	MarketId uint64 `protobuf:"varint,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"`
	// buy_order_id is the buy order ID.
	BuyOrderId uint64 `protobuf:"varint,2,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"`
	// sell_order_id is the sell order ID.
	SellOrderId uint64 `protobuf:"varint,3,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"`
	// bid_price_complement is the the complement (^ operator) of the bid price
	// encoded as a uint32 (which should have sufficient precision) - effectively
	// ~price * 10^exponent (usually 10^6). The complement is used so that bids
	// can be sorted high to low.
	BidPriceComplement uint32 `protobuf:"fixed32,4,opt,name=bid_price_complement,json=bidPriceComplement,proto3" json:"bid_price_complement,omitempty"`
	// ask_price is the ask price encoded to a uint32. Ask prices are sorted low
	// to high.
	AskPrice uint32 `protobuf:"fixed32,5,opt,name=ask_price,json=askPrice,proto3" json:"ask_price,omitempty"`
}

BuyOrderSellOrderMatch defines the data the FIFO/price-time-priority matching algorithm used to actually match buy and sell orders.

func (*BuyOrderSellOrderMatch) Descriptor

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

func (*BuyOrderSellOrderMatch) GetAskPrice

func (m *BuyOrderSellOrderMatch) GetAskPrice() uint32

func (*BuyOrderSellOrderMatch) GetBidPriceComplement

func (m *BuyOrderSellOrderMatch) GetBidPriceComplement() uint32

func (*BuyOrderSellOrderMatch) GetBuyOrderId

func (m *BuyOrderSellOrderMatch) GetBuyOrderId() uint64

func (*BuyOrderSellOrderMatch) GetMarketId

func (m *BuyOrderSellOrderMatch) GetMarketId() uint64

func (*BuyOrderSellOrderMatch) GetSellOrderId

func (m *BuyOrderSellOrderMatch) GetSellOrderId() uint64

func (*BuyOrderSellOrderMatch) Marshal

func (m *BuyOrderSellOrderMatch) Marshal() (dAtA []byte, err error)

func (*BuyOrderSellOrderMatch) MarshalTo

func (m *BuyOrderSellOrderMatch) MarshalTo(dAtA []byte) (int, error)

func (*BuyOrderSellOrderMatch) MarshalToSizedBuffer

func (m *BuyOrderSellOrderMatch) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BuyOrderSellOrderMatch) ProtoMessage

func (*BuyOrderSellOrderMatch) ProtoMessage()

func (*BuyOrderSellOrderMatch) Reset

func (m *BuyOrderSellOrderMatch) Reset()

func (*BuyOrderSellOrderMatch) Size

func (m *BuyOrderSellOrderMatch) Size() (n int)

func (*BuyOrderSellOrderMatch) String

func (m *BuyOrderSellOrderMatch) String() string

func (*BuyOrderSellOrderMatch) Unmarshal

func (m *BuyOrderSellOrderMatch) Unmarshal(dAtA []byte) error

func (*BuyOrderSellOrderMatch) XXX_DiscardUnknown

func (m *BuyOrderSellOrderMatch) XXX_DiscardUnknown()

func (*BuyOrderSellOrderMatch) XXX_Marshal

func (m *BuyOrderSellOrderMatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BuyOrderSellOrderMatch) XXX_Merge

func (m *BuyOrderSellOrderMatch) XXX_Merge(src proto.Message)

func (*BuyOrderSellOrderMatch) XXX_Size

func (m *BuyOrderSellOrderMatch) XXX_Size() int

func (*BuyOrderSellOrderMatch) XXX_Unmarshal

func (m *BuyOrderSellOrderMatch) XXX_Unmarshal(b []byte) error

type OrderBook

type OrderBook interface {

	// OnInsertSellOrder gets called whenever a sell order is inserted into the marketplace state.
	OnInsertSellOrder(ctx context.Context, sellOrder *marketplacev1.SellOrder, batch *ecocreditv1.Batch) error

	// ProcessBatch called in end blocker, can happen every block or at some epoch.
	ProcessBatch(ctx context.Context) error

	// Reload gets call on end blocker only when a node starts up.
	Reload(ctx context.Context) error
}

func NewOrderBook

func NewOrderBook(db ormdb.ModuleDB) (OrderBook, error)

NewOrderBook creates a new OrderBook instance.

Jump to

Keyboard shortcuts

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