Documentation ¶
Index ¶
- Constants
- Variables
- func GetAvroSchema() string
- func GetDereferencedJsonSchema() string
- func GetJsonSchema() string
- type Consumer
- type Currency
- type Data
- type Exchange
- type Metadata
- type Order
- type OrderDetails
- type OrderEvent
- type OrderSide
- type OrderType
- type Producer
- type Quantity
- type ReservedType
- type Subscriber
- type User
- type UserType
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"}
View Source
var ValuesToOrderSide = map[any]OrderSide{ OrderSideValues[OrderSideBid]: OrderSideBid, OrderSideValues[OrderSideAsk]: OrderSideAsk, }
View Source
var ValuesToOrderType = map[any]OrderType{ OrderTypeValues[OrderTypeInstant]: OrderTypeInstant, OrderTypeValues[OrderTypeMarket]: OrderTypeMarket, OrderTypeValues[OrderTypeLimit]: OrderTypeLimit, OrderTypeValues[OrderTypeStop]: OrderTypeStop, OrderTypeValues[OrderTypeTrailingStop]: OrderTypeTrailingStop, }
View Source
var ValuesToReservedType = map[any]ReservedType{ ReservedTypeValues[ReservedTypeOrderSubmitted]: ReservedTypeOrderSubmitted, ReservedTypeValues[ReservedTypeOrderCancel]: ReservedTypeOrderCancel, }
View Source
var ValuesToUserType = map[any]UserType{ UserTypeValues[UserTypeRetail]: UserTypeRetail, UserTypeValues[UserTypeInstitution]: UserTypeInstitution, }
Functions ¶
func GetAvroSchema ¶
func GetAvroSchema() string
func GetDereferencedJsonSchema ¶
func GetDereferencedJsonSchema() string
func GetJsonSchema ¶
func GetJsonSchema() string
Types ¶
type Consumer ¶
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 ¶
OrderEvent represents a OrderEvent model.
type OrderSide ¶
type OrderSide uint
OrderSide represents an enum of OrderSide.
func (OrderSide) MarshalJSON ¶
func (*OrderSide) UnmarshalJSON ¶
type OrderType ¶
type OrderType uint
OrderType represents an enum of OrderType.
func (OrderType) MarshalJSON ¶
func (*OrderType) UnmarshalJSON ¶
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 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
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.
func (UserType) MarshalJSON ¶
func (*UserType) UnmarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.