model

package
v0.0.0-...-3d48b77 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAccountId

func GenerateAccountId(userId string, currency string) string

func GenerateFillId

func GenerateFillId(venueOrderId string, fillId string) string

func GenerateTransactionId

func GenerateTransactionId(venueOrderId string) string

Types

type Account

type Account struct {
	Id       uuid.UUID `db:"id"`
	QldbId   string    `db:"qldb_id"`
	UserId   uuid.UUID `db:"user_id"`
	Currency string    `db:"currency"`
}

type AccountBalance

type AccountBalance struct {
	Id        uuid.UUID `db:"id"`
	AccountId uuid.UUID `db:"account_id"`
	Balance   string    `db:"balance"`
	Hold      string    `db:"hold"`
	Available string    `db:"available"`
	CreatedAt time.Time `db:"created_at"`
	RequestId uuid.UUID `db:"request_id"`
	Idem      string    `db:"idem"`
}

type Entry

type Entry struct {
	Id           uuid.UUID `db:"id"`
	AccountId    uuid.UUID `db:"account_id"`
	VenueOrderId uuid.UUID `db:"venue_order_id"`
	FillId       uuid.UUID `db:"fill_id"`
	Amount       string    `db:"amount"`
	Direction    string    `db:"direction"`
	CreatedAt    time.Time `db:"created_at"`
}

func (*Entry) ToRow

func (e *Entry) ToRow() []string

type Hold

type Hold struct {
	Id           uuid.UUID `db:"id"`
	AccountId    uuid.UUID `db:"account_id"`
	VenueOrderId uuid.UUID `db:"venue_order_id"`
	Amount       string    `db:"amount"`
	CreatedAt    time.Time `db:"created_at"`
	ReleasedAt   time.Time `db:"released_at"`
	Released     bool      `db:"released"`
	Idem         string    `db:"idem"`
}

type QldbAccount

type QldbAccount struct {
	Id          string       `ion:"id"`
	Currency    string       `ion:"currency"`
	UserId      string       `ion:"userId"`
	Balance     *ion.Decimal `ion:"balance"`
	Hold        *ion.Decimal `ion:"hold"`
	Available   *ion.Decimal `ion:"available"`
	UpdatedAt   time.Time    `ion:"updatedAt"`
	AccountUUID string       `ion:"accountUUID"`
}

func (*QldbAccount) ConvertToPostgresAccount

func (q *QldbAccount) ConvertToPostgresAccount() (*Account, error)

func (*QldbAccount) Equal

func (q *QldbAccount) Equal(i *api.AccountAndBalance) bool

func (*QldbAccount) GetCoreAccount

func (q *QldbAccount) GetCoreAccount() *QldbCoreAccount

type QldbCoreAccount

type QldbCoreAccount struct {
	Id          string `ion:"id"`
	Currency    string `ion:"currency"`
	UserId      string `ion:"userId"`
	AccountUUID string `ion:"accountUUID"`
}

func (*QldbCoreAccount) ConvertToPostgresAccount

func (q *QldbCoreAccount) ConvertToPostgresAccount() (*Account, error)

type QldbFill

type QldbFill struct {
	Id             string            `ion:"id"`
	ProductId      string            `ion:"productId"`
	Side           string            `ion:"side"`
	VenueOrderId   string            `ion:"venueOrderId"`
	FillId         string            `ion:"fillId"`
	Sender         *QldbCoreAccount  `ion:"sender"`
	Receiver       *QldbCoreAccount  `ion:"receiver"`
	FilledQuantity *ion.Decimal      `ion:"filledQuantity"`
	FilledValue    *ion.Decimal      `ion:"filledValue"`
	VenueFee       *ion.Decimal      `ion:"venueFee"`
	RetailFee      *ion.Decimal      `ion:"retailFee"`
	CreatedAt      time.Time         `ion:"createdAt"`
	Metadata       map[string]string `ion:"metadata"`
}

type QldbHold

type QldbHold struct {
	HoldUUID   string       `ion:"holdUUID"`
	AccountId  string       `ion:"accountIndex1"`
	Amount     *ion.Decimal `ion:"amount"`
	ReleasedAt time.Time    `ion:"ReleasedAt"`
	Released   bool         `ion:"Released"`
}

type QldbTransaction

type QldbTransaction struct {
	Id              string           `ion:"id"`
	VenueOrderId    string           `ion:"venueOrderId"`
	Sender          *QldbCoreAccount `ion:"sender"`
	Receiver        *QldbCoreAccount `ion:"receiver"`
	CreatedAt       time.Time        `ion:"createdAt"`
	UpdatedAt       time.Time        `ion:"updatedAt"`
	Status          string           `ion:"status"`
	TransactionType string           `ion:"transactionType"`
	Hold            *QldbHold        `ion:"hold"`
	ProductId       string           `ion:"productId"`
}

func (*QldbTransaction) ConvertToPostgresTransaction

func (q *QldbTransaction) ConvertToPostgresTransaction() (*Transaction, error)

type Transaction

type Transaction struct {
	Id                uuid.UUID `db:"id"`
	QldbId            string    `db:"qldb_id"`
	Sender            uuid.UUID `db:"sender_id"`
	Receiver          uuid.UUID `db:"receiver_id"`
	CreatedAt         time.Time `db:"created_at"`
	FinalizedAt       time.Time `db:"finalized_at"`
	TransactionStatus string    `db:"transaction_status"`
	TransactionType   string    `db:"transaction_type"`
	ProductId         string    `db:"product_id"`
}

Jump to

Keyboard shortcuts

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