order

package
v0.0.0-...-9e0b26f Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 4 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cancel

type Cancel Order

Cancel gets sent out after an Order was cancelled successfully.

func CancelFromRaw

func CancelFromRaw(raw []interface{}) (Cancel, error)

CancelFromRaw reds "oc" type message from data stream and maps it to order.Cancel data structure

type CancelRequest

type CancelRequest struct {
	ID      int64  `json:"id,omitempty"`
	CID     int64  `json:"cid,omitempty"`
	CIDDate string `json:"cid_date,omitempty"`
}

CancelRequest represents an order cancel request. An order can be cancelled using the internal ID or a combination of Client ID (CID) and the daten for the given CID.

func (*CancelRequest) MarshalJSON

func (cr *CancelRequest) MarshalJSON() ([]byte, error)

MarshalJSON converts the order cancel object into the format required by the bitfinex websocket service.

func (*CancelRequest) ToJSON

func (cr *CancelRequest) ToJSON() ([]byte, error)

type New

type New Order

New gets sent out after an Order was created successfully.

func NewFromRaw

func NewFromRaw(raw []interface{}) (New, error)

NewFromRaw reds "on" type message from data stream and maps it to order.New data structure

type NewRequest

type NewRequest struct {
	GID           int64                  `json:"gid"`
	CID           int64                  `json:"cid"`
	Type          string                 `json:"type"`
	Symbol        string                 `json:"symbol"`
	Amount        float64                `json:"amount,string"`
	Price         float64                `json:"price,string"`
	Leverage      int64                  `json:"lev,omitempty"`
	PriceTrailing float64                `json:"price_trailing,string,omitempty"`
	PriceAuxLimit float64                `json:"price_aux_limit,string,omitempty"`
	PriceOcoStop  float64                `json:"price_oco_stop,string,omitempty"`
	Hidden        bool                   `json:"hidden,omitempty"`
	PostOnly      bool                   `json:"postonly,omitempty"`
	Close         bool                   `json:"close,omitempty"`
	OcoOrder      bool                   `json:"oco_order,omitempty"`
	TimeInForce   string                 `json:"tif,omitempty"`
	AffiliateCode string                 `json:"-"`
	Meta          map[string]interface{} `json:"meta,omitempty"`
}

NewRequest represents an order to be posted to the bitfinex websocket service.

func (*NewRequest) EnrichedPayload

func (nr *NewRequest) EnrichedPayload() interface{}

EnrichedPayload returns enriched representation of order struct for submission

func (*NewRequest) MarshalJSON

func (nr *NewRequest) MarshalJSON() ([]byte, error)

MarshalJSON converts the order object into the format required by the bitfinex websocket service.

func (*NewRequest) ToJSON

func (nr *NewRequest) ToJSON() ([]byte, error)

type Order

type Order struct {
	ID            int64
	GID           int64
	CID           int64
	Symbol        string
	MTSCreated    int64
	MTSUpdated    int64
	Amount        float64
	AmountOrig    float64
	Type          string
	TypePrev      string
	MTSTif        int64
	Flags         int64
	Status        string
	Price         float64
	PriceAvg      float64
	PriceTrailing float64
	PriceAuxLimit float64
	Notify        bool
	Hidden        bool
	PlacedID      int64
	Routing       string
	Meta          map[string]interface{}
}

func FromRaw

func FromRaw(raw []interface{}) (o *Order, err error)

FromRaw takes the raw list of values as returned from the websocket service and tries to convert it into an Order.

type Snapshot

type Snapshot struct {
	Snapshot []*Order
}

Snapshot is a collection of Orders that would usually be sent on inital connection.

func SnapshotFromRaw

func SnapshotFromRaw(raw []interface{}) (s *Snapshot, err error)

SnapshotFromRaw takes a raw list of values as returned from the websocket service and tries to convert it into an Snapshot.

type Update

type Update Order

Update is an Order that gets sent out after every change to an order.

func UpdateFromRaw

func UpdateFromRaw(raw []interface{}) (Update, error)

UpdateFromRaw reds "ou" type message from data stream and maps it to order.Update data structure

type UpdateRequest

type UpdateRequest struct {
	ID            int64                  `json:"id"`
	GID           int64                  `json:"gid,omitempty"`
	Price         float64                `json:"price,string,omitempty"`
	Amount        float64                `json:"amount,string,omitempty"`
	Leverage      int64                  `json:"lev,omitempty"`
	Delta         float64                `json:"delta,string,omitempty"`
	PriceTrailing float64                `json:"price_trailing,string,omitempty"`
	PriceAuxLimit float64                `json:"price_aux_limit,string,omitempty"`
	Hidden        bool                   `json:"hidden,omitempty"`
	PostOnly      bool                   `json:"postonly,omitempty"`
	TimeInForce   string                 `json:"tif,omitempty"`
	Meta          map[string]interface{} `json:"meta,omitempty"`
}

func (*UpdateRequest) EnrichedPayload

func (ur *UpdateRequest) EnrichedPayload() interface{}

func (*UpdateRequest) MarshalJSON

func (ur *UpdateRequest) MarshalJSON() ([]byte, error)

MarshalJSON converts the order object into the format required by the bitfinex websocket service.

func (*UpdateRequest) ToJSON

func (ur *UpdateRequest) ToJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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