orderbookv1

package
v0.0.0-...-fe50809 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TopicName = "orderbook.v1.event"

Variables

View Source
var ReservedTypeValues = []any{"orderBookUpdated"}

Functions

func GetAvroSchema

func GetAvroSchema() string

func GetDereferencedJsonSchema

func GetDereferencedJsonSchema() string

func GetJsonSchema

func GetJsonSchema() string

Types

type Consumer

type Consumer interface {
	StartAsync(ctx context.Context) error
	Close()
}

func NewConsumer

func NewConsumer(
	logger *zap.SugaredLogger,
	subscriber Subscriber,
	messageConsumer messaging.MessageConsumer,
	timeHelper enterpriseTime.TimeHelper) Consumer

type Currency

type Currency struct {
	Code         string `json:"code"`
	Name         string `json:"name"`
	MaxPrecision int32  `json:"maxPrecision"`
	Digital      bool   `json:"digital"`
}

Currency represents a Currency model.

type Metadata

type Metadata struct {
	Id            uuid.UUID    `json:"id"` // The unique message ID
	Source        string       `json:"source"`
	ReservedType  ReservedType `json:"type"`
	Subject       string       `json:"subject"`
	Time          time.Time    `json:"time"`
	CorrelationId uuid.UUID    `json:"correlationId"`
	Actor         string       `json:"actor"`
}

Metadata represents a Metadata model.

type OrderBook

type OrderBook struct {
	ExchangeId           string                  `json:"exchangeId"` // The unique ID of the exchange
	BaseCurrency         Currency                `json:"baseCurrency"`
	CounterCurrency      Currency                `json:"counterCurrency"`
	Bids                 []OrderBookEntry        `json:"bids"`
	Asks                 []OrderBookEntry        `json:"asks"`
	AdditionalProperties *map[string]interface{} `json:"additionalProperties,omitempty"`
}

OrderBook represents a OrderBook model.

type OrderBookEntry

type OrderBookEntry struct {
	Time     time.Time `json:"time"` // The order book entry timestamp
	Quantity Quantity  `json:"quantity"`
	Price    Quantity  `json:"price"`
}

OrderBookEntry represents a OrderBookEntry model.

type OrderBookEvent

type OrderBookEvent struct {
	Metadata Metadata  `json:"metadata"`
	Data     OrderBook `json:"data"`
}

OrderBookEvent represents a OrderBookEvent model.

type Producer

type Producer interface {
	Produce(ctx context.Context, key string, event OrderBookEvent) error
	Close()
}

func NewProducer

func NewProducer(
	logger *zap.SugaredLogger,
	messageProducer messaging.MessageProducer) Producer

type Quantity

type Quantity struct {
	Amount int64 `json:"amount"`
	Scale  int32 `json:"scale"`
}

Quantity represents a Quantity model.

type ReservedType

type ReservedType uint

ReservedType represents an enum of ReservedType.

const (
	ReservedTypeOrderBookUpdated ReservedType = iota
)

func (ReservedType) MarshalJSON

func (enumVal ReservedType) MarshalJSON() ([]byte, error)

func (ReservedType) String

func (enumVal ReservedType) String() string

func (*ReservedType) UnmarshalJSON

func (enumVal *ReservedType) UnmarshalJSON(buffer []byte) error

func (ReservedType) Value

func (op ReservedType) Value() any

Value returns the value of the enum.

type Subscriber

type Subscriber interface {
	Handle(ctx context.Context, event OrderBookEvent) error
}

Directories

Path Synopsis
Package mock_orderbookv1 is a generated GoMock package.
Package mock_orderbookv1 is a generated GoMock package.

Jump to

Keyboard shortcuts

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