models

package
v0.0.0-...-51e8eb1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelOrderResponse

type CancelOrderResponse struct {
	Triggered           *bool    `json:"triggered"`
	Trigger             *string  `json:"trigger"`
	TimeInForce         string   `json:"time_in_force"`
	TriggerPrice        *float64 `json:"trigger_price"`
	ReduceOnly          bool     `json:"reduce_only"`
	Price               float64  `json:"price"`
	PostOnly            bool     `json:"post_only"`
	OrderType           string   `json:"order_type"`
	OrderState          string   `json:"order_state"`
	OrderID             string   `json:"order_id"`
	MaxShow             float64  `json:"max_show"`
	LastUpdateTimestamp int64    `json:"last_update_timestamp"`
	Label               string   `json:"label"`
	IsRebalance         *bool    `json:"is_rebalance"`
	IsLiquidation       bool     `json:"is_liquidation"`
	InstrumentName      string   `json:"instrument_name"`
	Direction           string   `json:"direction"`
	CreationTimestamp   int64    `json:"creation_timestamp"`
	API                 bool     `json:"api"`
	Amount              float64  `json:"amount"`
}

type Decimal

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

Decimal package in Go to match rust_decimal usage

func NewDecimalFromFloat

func NewDecimalFromFloat(f float64) (Decimal, error)

func (Decimal) Cmp

func (d Decimal) Cmp(other Decimal) int

type Depth

type Depth int
const (
	One         Depth = 1
	Five        Depth = 5
	Ten         Depth = 10
	TwentyFive  Depth = 25
	OneHundred  Depth = 100
	OneThousand Depth = 1000
	TenThousand Depth = 10000
)

type DeribitResponse

type DeribitResponse[T any] struct {
	Jsonrpc string `json:"jsonrpc"`
	Id      *int64 `json:"id,omitempty"`
	Result  T      `json:"result"`
}

type Direction

type Direction string
const (
	Buy  Direction = "buy"
	Sell Direction = "sell"
)

type Order

type Order struct {
	Web            bool        `json:"web"`
	TimeInForce    string      `json:"time_in_force"`
	Replaced       bool        `json:"replaced"`
	ReduceOnly     bool        `json:"reduce_only"`
	Price          float64     `json:"price"                    decimal_format:"deserialize"`
	PostOnly       bool        `json:"post_only"`
	OrderType      OrderType   `json:"order_type"`
	Status         OrderStatus `json:"order_state"`
	OrderID        string      `json:"order_id"`
	MaxShow        float64     `json:"max_show"                 decimal_format:"deserialize"`
	LastUpdate     int64       `json:"last_update_timestamp"`
	Label          string      `json:"label"`
	IsRebalance    *bool       `json:"is_rebalance"`
	IsLiquidation  bool        `json:"is_liquidation"`
	InstrumentName string      `json:"instrument_name"`
	FilledAmount   float64     `json:"filled_amount"            decimal_format:"deserialize"`
	Direction      Direction   `json:"direction"`
	Timestamp      int64       `json:"creation_timestamp"`
	AveragePrice   float64     `json:"average_price"            decimal_format:"deserialize"`
	API            bool        `json:"api"`
	Amount         float64     `json:"amount"                   decimal_format:"deserialize"`
}

type OrderBook

type OrderBook struct {
	Asks      PriceLevels
	Bids      PriceLevels
	Timestamp time.Time
}

func (*OrderBook) UnmarshalJSON

func (o *OrderBook) UnmarshalJSON(data []byte) error

type OrderResult

type OrderResult struct {
	Trades []models.Trade `json:"trades"`
	Order  Order          `json:"order"`
}

type OrderStatus

type OrderStatus string
const (
	Open      OrderStatus = "open"
	Filled    OrderStatus = "filled"
	Cancelled OrderStatus = "cancelled"
	Rejected  OrderStatus = "rejected"
)

type OrderType

type OrderType string
const (
	Market OrderType = "market"
	Limit  OrderType = "limit"
)

type Orders

type Orders []Order

func (Orders) IsEmpty

func (orders Orders) IsEmpty() bool

func (Orders) Iter

func (orders Orders) Iter() []Order

func (Orders) Len

func (orders Orders) Len() int

type PriceLevel

type PriceLevel struct {
	Price  decimal.Decimal
	Amount decimal.Decimal
}

type PriceLevels

type PriceLevels []PriceLevel

func (PriceLevels) Len

func (p PriceLevels) Len() int

func (PriceLevels) Less

func (p PriceLevels) Less(i, j int) bool

func (PriceLevels) Swap

func (p PriceLevels) Swap(i, j int)

Jump to

Keyboard shortcuts

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