orderv1

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 = "order.v1.event"

Variables

View Source
var OrderSideValues = []any{"BID", "ASK"}
View Source
var OrderTypeValues = []any{"INSTANT", "MARKET", "LIMIT", "STOP", "TRAILING_STOP"}
View Source
var ReservedTypeValues = []any{"orderSubmitted", "orderCancel"}
View Source
var UserTypeValues = []any{"RETAIL", "INSTITUTION"}

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 Data

type Data struct {
	BeforeState *Order `json:"beforeState,omitempty"`
	AfterState  Order  `json:"afterState"`
}

Data represents a Data model.

type Exchange

type Exchange struct {
	Id string `json:"id"` // The unique ID of the supported exchange
}

Exchange represents a Exchange 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 Order

type Order struct {
	Id                   int                     `json:"id"` // The unique order ID
	OrderDetails         OrderDetails            `json:"orderDetails"`
	User                 *User                   `json:"user,omitempty"`
	PreferredExchanges   []Exchange              `json:"preferredExchanges"` // the preferred list of the supportef exchanged by the user
	AdditionalProperties *map[string]interface{} `json:"additionalProperties,omitempty"`
}

Order represents a Order model.

type OrderDetails

type OrderDetails struct {
	BaseCurrency         Currency                `json:"baseCurrency"`
	CounterCurrency      Currency                `json:"counterCurrency"`
	ReservedType         OrderType               `json:"type"`
	Side                 OrderSide               `json:"side"`
	Quantity             Quantity                `json:"quantity"`
	Price                Quantity                `json:"price"`
	AdditionalProperties *map[string]interface{} `json:"additionalProperties,omitempty"`
}

OrderDetails represents a OrderDetails model.

type OrderEvent

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

OrderEvent represents a OrderEvent model.

type OrderSide

type OrderSide uint

OrderSide represents an enum of OrderSide.

const (
	OrderSideBid OrderSide = iota
	OrderSideAsk
)

func (OrderSide) MarshalJSON

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

func (OrderSide) String

func (enumVal OrderSide) String() string

func (*OrderSide) UnmarshalJSON

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

func (OrderSide) Value

func (op OrderSide) Value() any

Value returns the value of the enum.

type OrderType

type OrderType uint

OrderType represents an enum of OrderType.

const (
	OrderTypeInstant OrderType = iota
	OrderTypeMarket
	OrderTypeLimit
	OrderTypeStop
	OrderTypeTrailingStop
)

func (OrderType) MarshalJSON

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

func (OrderType) String

func (enumVal OrderType) String() string

func (*OrderType) UnmarshalJSON

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

func (OrderType) Value

func (op OrderType) Value() any

Value returns the value of the enum.

type Producer

type Producer interface {
	Produce(ctx context.Context, key string, event OrderEvent) 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 (
	ReservedTypeOrderSubmitted ReservedType = iota
	ReservedTypeOrderCancel
)

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 OrderEvent) error
}

type User

type User struct {
	Id                   uuid.UUID               `json:"id"`
	Created              *time.Time              `json:"created,omitempty"`
	Updated              *time.Time              `json:"updated,omitempty"`
	ReservedType         *UserType               `json:"type,omitempty"`
	AdditionalProperties *map[string]interface{} `json:"additionalProperties,omitempty"`
}

User represents a User model.

type UserType

type UserType uint

UserType represents an enum of UserType.

const (
	UserTypeRetail UserType = iota
	UserTypeInstitution
)

func (UserType) MarshalJSON

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

func (UserType) String

func (enumVal UserType) String() string

func (*UserType) UnmarshalJSON

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

func (UserType) Value

func (op UserType) Value() any

Value returns the value of the enum.

Directories

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

Jump to

Keyboard shortcuts

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