trades

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromWSRaw

func FromWSRaw(pair string, raw, data []interface{}) (interface{}, error)

FromWSRaw acts as a relay for public trades channel to abstract complexity from msg. Data arrives under "trades" channel and then splits into sub types: ["tu", "te", "ftu", "fte"] and can also be a snapshot.

Types

type AuthFundingTrade

type AuthFundingTrade struct {
	ID         int64
	Symbol     string
	MTSCreated int64
	OfferID    int64
	Amount     float64
	Rate       float64
	Period     int64
	Maker      int64
}

AuthFundingTrade data structure

func AFTFromRaw

func AFTFromRaw(raw []interface{}) (aft AuthFundingTrade, err error)

AFTFromRaw maps raw data slice to instance of AuthFundingTrade

type AuthFundingTradeExecuted

type AuthFundingTradeExecuted AuthFundingTrade

func AFTEFromRaw

func AFTEFromRaw(raw []interface{}) (AuthFundingTradeExecuted, error)

AFTEFromRaw maps raw data slice to instance of AuthFundingTradeExecuted

type AuthFundingTradeSnapshot

type AuthFundingTradeSnapshot struct {
	Snapshot []AuthFundingTrade
}

func AFTSnapshotFromRaw

func AFTSnapshotFromRaw(raw [][]interface{}) (AuthFundingTradeSnapshot, error)

AFTSnapshotFromRaw maps raw data slice to authenticated funding trade data structures

type AuthFundingTradeUpdate

type AuthFundingTradeUpdate AuthFundingTrade

func AFTUFromRaw

func AFTUFromRaw(raw []interface{}) (AuthFundingTradeUpdate, error)

AFTUFromRaw maps raw data slice to instance of AuthFundingTradeUpdate

type AuthTradeExecution

type AuthTradeExecution struct {
	ID            int64
	Pair          string
	MTS           int64
	OrderID       int64
	ExecAmount    float64
	ExecPrice     float64
	OrderType     string
	OrderPrice    float64
	Maker         int
	ClientOrderID int64
}

AuthTradeExecution used for mapping authenticated trade execution raw messages

func ATEFromRaw

func ATEFromRaw(raw []interface{}) (e AuthTradeExecution, err error)

ATEFromRaw - authenticated trade execution mapping to data type

type AuthTradeExecutionUpdate

type AuthTradeExecutionUpdate struct {
	ID          int64
	Pair        string
	MTS         int64
	OrderID     int64
	ExecAmount  float64
	ExecPrice   float64
	OrderType   string
	OrderPrice  float64
	Maker       int
	Fee         float64
	FeeCurrency string
}

AuthTradeExecutionUpdate used for mapping authenticated trade execution update raw messages

func ATEUFromRaw

func ATEUFromRaw(raw []interface{}) (eu AuthTradeExecutionUpdate, err error)

ATEUFromRaw authenticated trade execution update mapping to data type

type FundingTrade

type FundingTrade struct {
	Symbol string
	ID     int64
	MTS    int64
	Amount float64
	Rate   float64
	Period int
}

FundingTrade data structure for mapping funding/margin currency raw data with "f" prefix in SYMBOL from public feed

func FTFromRaw

func FTFromRaw(pair string, raw []interface{}) (t FundingTrade, err error)

FTFromRaw maps raw data slice to instance of FundingTrade

type FundingTradeExecuted

type FundingTradeExecuted FundingTrade

func FTEFromRaw

func FTEFromRaw(pair string, raw []interface{}) (FundingTradeExecuted, error)

FTEFromRaw maps raw data slice to instance of FundingTradeExecuted

type FundingTradeExecutionUpdate

type FundingTradeExecutionUpdate FundingTrade

func FTEUFromRaw

func FTEUFromRaw(pair string, raw []interface{}) (FundingTradeExecutionUpdate, error)

FTEUFromRaw maps raw data slice to instance of FundingTradeExecutionUpdate

type FundingTradeSnapshot

type FundingTradeSnapshot struct {
	Snapshot []FundingTrade
}

func FTSnapshotFromRaw

func FTSnapshotFromRaw(pair string, raw [][]interface{}) (FundingTradeSnapshot, error)

FTSnapshotFromRaw maps raw data slice to funding trade data structures

type Trade

type Trade struct {
	Pair   string
	ID     int64
	MTS    int64
	Amount float64
	Price  float64
}

Trade data structure for mapping trading pair currency raw data with "t" prefix in SYMBOL from public feed

func TFromRaw

func TFromRaw(pair string, raw []interface{}) (t Trade, err error)

TFromRaw maps raw data slice to instance of Trade

type TradeExecuted

type TradeExecuted Trade

func TEFromRaw

func TEFromRaw(pair string, raw []interface{}) (TradeExecuted, error)

TEFromRaw maps raw data slice to instance of TradeExecuted

type TradeExecutionUpdate

type TradeExecutionUpdate Trade

func TEUFromRaw

func TEUFromRaw(pair string, raw []interface{}) (TradeExecutionUpdate, error)

TEUFromRaw maps raw data slice to instance of TradeExecutionUpdate

type TradeSnapshot

type TradeSnapshot struct {
	Snapshot []Trade
}

func TSnapshotFromRaw

func TSnapshotFromRaw(pair string, raw [][]interface{}) (TradeSnapshot, error)

TSnapshotFromRaw maps raw data slice to trading data structures

Jump to

Keyboard shortcuts

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