trade

package
v0.0.0-...-52e1e13 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type GetServerOpenTradesWithStatusParams

type GetServerOpenTradesWithStatusParams struct {
	InitiatingServer pgtype.UUID
	Status           pgtype.Text
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) GetServerOpenTradesWithStatus

func (q *Queries) GetServerOpenTradesWithStatus(ctx context.Context, arg GetServerOpenTradesWithStatusParams) ([]Trade, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Server

type Server struct {
	Q *Queries
}

func NewServer

func NewServer(db *pgx.Conn) *Server

func (*Server) CancelTrade

Cancel an open trade

func (Server) CreateTrade

Create a new trade (either buy, or sell), registered to the server that requested it

func (*Server) FulfillTrade

Fulfill an open trade. This will trigger both servers to At the moment, this is only buying with coins, or selling for coins

func (*Server) WatchTrade

Stream events for an open trade

type Trade

type Trade struct {
	ID                pgtype.UUID
	Status            pgtype.Text
	Type              pgtype.Text
	InitiatingServer  pgtype.UUID
	Item              pgtype.Text
	TradeQuantity     pgtype.Int4
	Price             pgtype.Int4
	FulfilledQuantity pgtype.Int4
	CreatedAt         pgtype.Timestamp
	FulfilledAt       pgtype.Timestamp
	CancelledAt       pgtype.Timestamp
	UpdatedAt         pgtype.Timestamp
}

type TradeFulfillment

type TradeFulfillment struct {
	ID                pgtype.UUID
	TradeID           pgtype.UUID
	FulfillingServer  pgtype.UUID
	FulfilledQuantity pgtype.Int4
	CreatedAt         pgtype.Timestamp
}

Jump to

Keyboard shortcuts

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