models

package
v1.1.6-0...-625da48 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sec15    = 15
	Minute   = 60
	Minute5  = 300
	Minute15 = 900
	Hour     = 3600
	Hour4    = 14400
	Day      = 86400
)
View Source
const (
	OrderBookChannel = ChannelType("orderbook")
	TradesChannel    = ChannelType("trades")
	TickerChannel    = ChannelType("ticker")
	MarketsChannel   = ChannelType("markets")
	FillsChannel     = ChannelType("fills")
	OrdersChannel    = ChannelType("orders")
)
View Source
const (
	Subscribe   = Operation("subscribe")
	UnSubscribe = Operation("unsubscribe")
)
View Source
const (
	Error        = ResponseType("error")
	Subscribed   = ResponseType("subscribed")
	UnSubscribed = ResponseType("unsubscribed")
	Info         = ResponseType("info")
	Partial      = ResponseType("partial")
	Update       = ResponseType("update")
)
View Source
const (
	LimitOrder  = OrderType("limit")
	MarketOrder = OrderType("market")
)
View Source
const (
	Sell = OrderSide("sell")
	Buy  = OrderSide("buy")
)
View Source
const (
	New    = OrderStatus("new")
	Open   = OrderStatus("open")
	Closed = OrderStatus("closed")
)
View Source
const (
	Stop         = TriggerOrderType("stop")
	TrailingStop = TriggerOrderType("trailing_stop")
	TakeProfit   = TriggerOrderType("take_profit")
)
View Source
const (
	Erc20 = DepositMethod("erc20")
	Trc20 = DepositMethod("trc20")
	Spl   = DepositMethod("spl")
	Omni  = DepositMethod("omni")
	Bep2  = DepositMethod("bep2")
)
View Source
const (
	Call = OptionType("call")
	Put  = OptionType("put")
)
View Source
const (
	Maker = LiquidityType("maker")
	Taker = LiquidityType("taker")
)
View Source
const (
	Pending   = UnstakeRequestStatus("pending")
	Cancelled = UnstakeRequestStatus("cancelled")
	Processed = UnstakeRequestStatus("processed")
)
View Source
const Complete = TransferStatus("complete")

Variables

View Source
var ErrNilPtr = fmt.Errorf("nil pointer")

Functions

This section is empty.

Types

type AccountInformation

type AccountInformation struct {
	BackstopProvider             bool            `json:"backstopProvider"`
	Collateral                   decimal.Decimal `json:"collateral"`
	FreeCollateral               decimal.Decimal `json:"freeCollateral"`
	InitialMarginRequirement     decimal.Decimal `json:"initialMarginRequirement"`
	Liquidating                  bool            `json:"liquidating"`
	MaintenanceMarginRequirement decimal.Decimal `json:"maintenanceMarginRequirement"`
	MakerFee                     decimal.Decimal `json:"makerFee"`
	MarginFraction               decimal.Decimal `json:"marginFraction"`
	OpenMarginFraction           decimal.Decimal `json:"openMarginFraction"`
	TakerFee                     decimal.Decimal `json:"takerFee"`
	TotalAccountValue            decimal.Decimal `json:"totalAccountValue"`
	TotalPositionSize            decimal.Decimal `json:"totalPositionSize"`
	Username                     string          `json:"username"`
	Leverage                     decimal.Decimal `json:"leverage"`
	Positions                    []Position      `json:"positions"`
}

type AccountOptionsInfo

type AccountOptionsInfo struct {
	UsdBalance                   decimal.Decimal `json:"usdBalance"`
	LiquidationPrice             decimal.Decimal `json:"liquidationPrice"`
	Liquidated                   bool            `json:"liquidated"`
	MaintenanceMarginRequirement decimal.Decimal `json:"maintenanceMarginRequirement"`
	InitialMarginRequirement     decimal.Decimal `json:"initialMarginRequirement"`
}

type AirDrop

type AirDrop struct {
	Coin   string          `json:"coin"`
	ID     int64           `json:"id"`
	Size   decimal.Decimal `json:"size"`
	Status string          `json:"status"`
	Time   time.Time       `json:"time"`
}

type AirDropParams

type AirDropParams NumberTimeLimit

type Balance

type Balance struct {
	Coin  string          `json:"coin"`
	Free  decimal.Decimal `json:"free"`
	Total decimal.Decimal `json:"total"`
}

type BaseResponse

type BaseResponse struct {
	ResponseType ResponseType
	Symbol       string
}

type BorrowHistory

type BorrowHistory struct {
	Coin string          `json:"coin"`
	Cost decimal.Decimal `json:"cost"`
	Rate decimal.Decimal `json:"rate"`
	Size decimal.Decimal `json:"size"`
	Time time.Time       `json:"time"`
}

type BorrowRate

type BorrowRate struct {
	Coin     string  `json:"coin"`
	Estimate float64 `json:"estimate"`
	Previous float64 `json:"previous"`
}

type BorrowedAmount

type BorrowedAmount struct {
	Coin string          `json:"coin"`
	Size decimal.Decimal `json:"size"`
}

type CancelAllParams

type CancelAllParams struct {
	Market                *string `json:"market,omitempty"`
	ConditionalOrdersOnly *bool   `json:"conditionalOrdersOnly,omitempty"`
	LimitOrdersOnly       *bool   `json:"limitOrdersOnly"`
}

type CancelOrderParams

type CancelOrderParams struct {
	OrderID *int64 `json:"orderId"`
}

type CancelQuoteRequest

type CancelQuoteRequest OptionQuoteRequest

type ChannelType

type ChannelType string

type Coin

type Coin struct {
	Bep2Asset     string          `json:"bep2Asset"`
	CanConvert    bool            `json:"canConvert"`
	CanDeposit    bool            `json:"canDeposit"`
	CanWithdraw   bool            `json:"canWithdraw"`
	Collateral    bool            `json:"collateral"`
	CreditTo      string          `json:"creditTo"`
	Erc20Contract string          `json:"erc20Contract"`
	Fiat          bool            `json:"fiat"`
	HasTag        bool            `json:"hasTag"`
	ID            string          `json:"id"`
	IsToken       bool            `json:"isToken"`
	Methods       []DepositMethod `json:"methods"`
	Name          string          `json:"name"`
	SplMint       string          `json:"splMint"`
	Trc20Contract string          `json:"trc20Contract"`
	UsdFungible   bool            `json:"usdFungible"`
}

type ConvertQuoteStatus

type ConvertQuoteStatus struct {
	BaseCoin  string          `json:"baseCoin"`
	Cost      decimal.Decimal `json:"cost"`
	Expired   bool            `json:"expired"`
	Filled    bool            `json:"filled"`
	FromCoin  string          `json:"fromCoin"`
	ID        int64           `json:"id"`
	Price     decimal.Decimal `json:"price"`
	Proceeds  decimal.Decimal `json:"proceeds"`
	QuoteCoin string          `json:"quoteCoin"`
	Side      OrderSide       `json:"side"`
	ToCoin    string          `json:"toCoin"`
}

type CreateQuoteRequest

type CreateQuoteRequest struct {
	OptionInput
	Side OrderSide       `json:"side"`
	Size decimal.Decimal `json:"size"`
}

type Deposit

type Deposit struct {
	Coin          string          `json:"coin"`
	ID            int64           `json:"id"`
	Size          decimal.Decimal `json:"size"`
	Status        string          `json:"status"`
	Time          time.Time       `json:"time"`
	Fee           decimal.Decimal `json:"fee"`
	Notes         string          `json:"notes"`
	Txid          string          `json:"txid"`
	Confirmations int             `json:"confirmations"`
	ConfirmedTime time.Time       `json:"confirmedTime"`
	SentTime      time.Time       `json:"sentTime"`
}

type DepositAddress

type DepositAddress struct {
	Address string `json:"address"`
	Tag     string `json:"tag"`
}

type DepositHistoryParams

type DepositHistoryParams NumberTimeLimit

type DepositMethod

type DepositMethod string

type FTXTime

type FTXTime struct {
	Time time.Time
}

func (FTXTime) MarshalJSON

func (f FTXTime) MarshalJSON() ([]byte, error)

func (*FTXTime) UnmarshalJSON

func (f *FTXTime) UnmarshalJSON(data []byte) error

type Fill

type Fill struct {
	Fee           float64         `json:"fee"`
	FeeCurrency   string          `json:"feeCurrency"`
	FeeRate       float64         `json:"feeRate"`
	Future        string          `json:"future"`
	ID            int64           `json:"id"`
	Liquidity     string          `json:"liquidity"`
	Market        string          `json:"market"`
	BaseCurrency  string          `json:"baseCurrency"`
	QuoteCurrency string          `json:"quoteCurrency"`
	OrderID       int64           `json:"orderId"`
	TradeID       int64           `json:"tradeId"`
	Price         decimal.Decimal `json:"price"`
	Side          string          `json:"side"`
	Size          decimal.Decimal `json:"size"`
	Time          time.Time       `json:"time"`
	Type          string          `json:"type"`
}

type FillParams

type FillParams struct {
	Market    *string `json:"market,omitempty"`
	Limit     *int    `json:"limit,omitempty"`
	StartTime *int64  `json:"start_time,omitempty"`
	EndTime   *int64  `json:"end_time,omitempty"`
	Order     *string `json:"order,omitempty"`
	OrderID   *int64  `json:"orderId,omitempty"`
}

type FillResponse

type FillResponse struct {
	Fill
	BaseResponse
}

type FundingPayment

type FundingPayment struct {
	Future  string          `json:"future"`
	ID      int64           `json:"id"`
	Payment decimal.Decimal `json:"payment"`
	Time    time.Time       `json:"time"`
	Rate    decimal.Decimal `json:"rate"`
}

type FundingPaymentParams

type FundingPaymentParams struct {
	StartTime *int64  `json:"start_time,omitempty"`
	EndTime   *int64  `json:"end_time,omitempty"`
	Future    *string `json:"future,omitempty"`
}

type FundingRates

type FundingRates struct {
	Future string    `json:"future"`
	Rate   float64   `json:"rate"`
	Time   time.Time `json:"time"`
}

type FundingRatesParams

type FundingRatesParams struct {
	StartTime *int64 `json:"start_time,omitempty"`
	EndTime   *int64 `json:"end_time,omitempty"`
}

type Future

type Future struct {
	Ask                 decimal.Decimal `json:"ask"`
	Bid                 decimal.Decimal `json:"bid"`
	Change1h            decimal.Decimal `json:"change1h"`
	Change24h           decimal.Decimal `json:"change24h"`
	ChangeBod           decimal.Decimal `json:"changeBod"`
	VolumeUsd24h        float64         `json:"volumeUsd24h"`
	Volume              float64         `json:"volume"`
	Description         string          `json:"description"`
	Enabled             bool            `json:"enabled"`
	Expired             bool            `json:"expired"`
	Expiry              time.Time       `json:"expiry"`
	Index               float64         `json:"index"`
	ImfFactor           float64         `json:"imfFactor"`
	Last                decimal.Decimal `json:"last"`
	LowerBound          decimal.Decimal `json:"lowerBound"`
	Mark                decimal.Decimal `json:"mark"`
	Name                string          `json:"name"`
	Perpetual           bool            `json:"perpetual"`
	PositionLimitWeight float64         `json:"positionLimitWeight"`
	PostOnly            bool            `json:"postOnly"`
	PriceIncrement      decimal.Decimal `json:"priceIncrement"`
	SizeIncrement       decimal.Decimal `json:"sizeIncrement"`
	Underlying          string          `json:"underlying"`
	UpperBound          decimal.Decimal `json:"upperBound"`
	Type                string          `json:"type"`
}

type FutureExpired

type FutureExpired struct {
	Ask                   decimal.Decimal `json:"ask"`
	Bid                   decimal.Decimal `json:"bid"`
	Description           string          `json:"description"`
	Enabled               bool            `json:"enabled"`
	Expired               bool            `json:"expired"`
	Expiry                time.Time       `json:"expiry"`
	ExpiryDescription     string          `json:"expiryDescription"`
	Group                 string          `json:"group"`
	ImfFactor             float64         `json:"imfFactor"`
	Index                 float64         `json:"index"`
	Last                  decimal.Decimal `json:"last"`
	LowerBound            decimal.Decimal `json:"lowerBound"`
	MarginPrice           float64         `json:"marginPrice"`
	Mark                  decimal.Decimal `json:"mark"`
	MoveStart             string          `json:"moveStart"`
	Name                  string          `json:"name"`
	Perpetual             bool            `json:"perpetual"`
	PositionLimitWeight   float64         `json:"positionLimitWeight"`
	PostOnly              bool            `json:"postOnly"`
	PriceIncrement        decimal.Decimal `json:"priceIncrement"`
	SizeIncrement         decimal.Decimal `json:"sizeIncrement"`
	Type                  string          `json:"type"`
	Underlying            string          `json:"underlying"`
	UnderlyingDescription string          `json:"underlyingDescription"`
	UpperBound            decimal.Decimal `json:"upperBound"`
}

type FutureStats

type FutureStats struct {
	Volume                   decimal.Decimal `json:"volume"`
	NextFundingRate          float64         `json:"nextFundingRate"`
	NextFundingTime          time.Time       `json:"nextFundingTime"`
	ExpirationPrice          decimal.Decimal `json:"expirationPrice"`
	PredictedExpirationPrice decimal.Decimal `json:"predictedExpirationPrice"`
	StrikePrice              decimal.Decimal `json:"strikePrice"`
	OpenInterest             float64         `json:"openInterest"`
}

type GetHistoricalPricesParams

type GetHistoricalPricesParams struct {
	Resolution Resolution `json:"resolution"`
	Limit      *int       `json:"limit"`
	StartTime  *int64     `json:"start_time"`
	EndTime    *int64     `json:"end_time"`
}

type GetTradesParams

type GetTradesParams NumberTimeLimit

type HistoricalIndex

type HistoricalIndex struct {
	StartTime time.Time       `json:"startTime"`
	Open      decimal.Decimal `json:"open"`
	High      decimal.Decimal `json:"high"`
	Low       decimal.Decimal `json:"low"`
	Close     decimal.Decimal `json:"close"`
	Volume    float64         `json:"volume"`
}

type HistoricalIndexParams

type HistoricalIndexParams struct {
	Resolution *int   `json:"resolution"`
	Limit      *int   `json:"limit,omitempty"`
	StartTime  *int64 `json:"start_time,omitempty"`
	EndTime    *int64 `json:"end_time,omitempty"`
}

type HistoricalPrice

type HistoricalPrice struct {
	StartTime time.Time       `json:"startTime"`
	Open      decimal.Decimal `json:"open"`
	Close     decimal.Decimal `json:"close"`
	High      decimal.Decimal `json:"high"`
	Low       decimal.Decimal `json:"low"`
	Volume    decimal.Decimal `json:"volume"`
}

type LendingHistory

type LendingHistory BorrowHistory

type LendingInfo

type LendingInfo struct {
	Coin     string          `json:"coin"`
	Lendable decimal.Decimal `json:"lendable"`
	Locked   decimal.Decimal `json:"locked"`
	MinRate  float64         `json:"minRate"`
	Offered  decimal.Decimal `json:"offered"`
}

type LendingOffer

type LendingOffer struct {
	Coin string          `json:"coin"`
	Rate float64         `json:"rate"`
	Size decimal.Decimal `json:"size"`
}

type LendingOfferParams

type LendingOfferParams struct {
	Coin *string          `json:"coin"`
	Size *decimal.Decimal `json:"size"`
	Rate *float64         `json:"rate"`
}

type LendingRate

type LendingRate BorrowRate

type LeveragedToken

type LeveragedToken struct {
	Name             string          `json:"name"`
	Description      string          `json:"description"`
	Underlying       string          `json:"underlying"`
	Leverage         float64         `json:"leverage"`
	Outstanding      decimal.Decimal `json:"outstanding"`
	PricePerShare    decimal.Decimal `json:"pricePerShare"`
	PositionPerShare decimal.Decimal `json:"positionPerShare"`
	UnderlyingMark   decimal.Decimal `json:"underlyingMark"`
	ContractAddress  string          `json:"contractAddress"`
	Change1h         decimal.Decimal `json:"change1h"`
	Change24h        decimal.Decimal `json:"change24h"`
}

type LeveragedTokenBalance

type LeveragedTokenBalance struct {
	Token   string          `json:"token"`
	Balance decimal.Decimal `json:"balance"`
}

type LeveragedTokenCreation

type LeveragedTokenCreation struct {
	ID            int64           `json:"id"`
	Token         string          `json:"token"`
	RequestedSize decimal.Decimal `json:"requestedSize"`
	Cost          decimal.Decimal `json:"cost"`
	Pending       bool            `json:"pending"`
	RequestedAt   time.Time       `json:"requestedAt"`
}

type LeveragedTokenCreationRequest

type LeveragedTokenCreationRequest struct {
	ID            int64           `json:"id"`
	Token         string          `json:"token"`
	RequestedSize decimal.Decimal `json:"requestedSize"`
	Pending       bool            `json:"pending"`
	CreatedSize   decimal.Decimal `json:"createdSize"`
	Price         decimal.Decimal `json:"price"`
	Cost          decimal.Decimal `json:"cost"`
	Fee           decimal.Decimal `json:"fee"`
	RequestedAt   time.Time       `json:"requestedAt"`
	FulfilledAt   time.Time       `json:"fulfilledAt"`
}

type LeveragedTokenRedemption

type LeveragedTokenRedemption struct {
	ID                int64           `json:"id"`
	Token             string          `json:"token"`
	Size              decimal.Decimal `json:"size"`
	ProjectedProceeds decimal.Decimal `json:"projectedProceeds"`
	Pending           bool            `json:"pending"`
	RequestedAt       time.Time       `json:"requestedAt"`
}

type LeveragedTokenRedemptionRequest

type LeveragedTokenRedemptionRequest struct {
	ID          int64           `json:"id"`
	Token       string          `json:"token"`
	Size        decimal.Decimal `json:"size"`
	Pending     bool            `json:"pending"`
	Price       decimal.Decimal `json:"price"`
	Proceeds    decimal.Decimal `json:"proceeds"`
	Fee         decimal.Decimal `json:"fee"`
	RequestedAt time.Time       `json:"requestedAt"`
	FulfilledAt time.Time       `json:"fulfilledAt"`
}

type LiquidityType

type LiquidityType string

type Market

type Market struct {
	Name           string          `json:"name"`
	Underlying     string          `json:"underlying"`
	BaseCurrency   string          `json:"baseCurrency"`
	QuoteCurrency  string          `json:"quoteCurrency"`
	Type           string          `json:"type"`
	Enabled        bool            `json:"enabled"`
	Ask            decimal.Decimal `json:"ask"`
	Bid            decimal.Decimal `json:"bid"`
	Last           decimal.Decimal `json:"last"`
	PostOnly       bool            `json:"postOnly"`
	PriceIncrement decimal.Decimal `json:"priceIncrement"`
	SizeIncrement  decimal.Decimal `json:"sizeIncrement"`
	Restricted     bool            `json:"restricted"`
}

type ModifyOrderParams

type ModifyOrderParams struct {
	Price    *decimal.Decimal `json:"price,omitempty"`
	Size     *decimal.Decimal `json:"size,omitempty"`
	ClientID *string          `json:"clientId,omitempty"`
}

type ModifyTriggerOrderParams

type ModifyTriggerOrderParams struct {
	TriggerPrice *decimal.Decimal `json:"triggerPrice,omitempty"`
	Size         *decimal.Decimal `json:"size,omitempty"`
	OrderPrice   *decimal.Decimal `json:"orderPrice,omitempty"`
	TrailValue   *decimal.Decimal `json:"trailValue,omitempty"`
}

type NumberTimeLimit

type NumberTimeLimit struct {
	Limit     *int   `json:"limit,omitempty"`
	StartTime *int64 `json:"start_time,omitempty"`
	EndTime   *int64 `json:"end_time,omitempty"`
}

type OpenTriggerOrdersParams

type OpenTriggerOrdersParams struct {
	Market *string           `json:"market"`
	Type   *TriggerOrderType `json:"type"`
}

type Operation

type Operation string

type Option

type Option struct {
	Underlying string          `json:"underlying"`
	Type       OptionType      `json:"type"`
	Strike     decimal.Decimal `json:"strike"`
	Expiry     time.Time       `json:"expiry"`
}

type OptionFill

type OptionFill struct {
	Fee       decimal.Decimal `json:"fee"`
	FeeRate   decimal.Decimal `json:"feeRate"`
	ID        int64           `json:"id"`
	Liquidity LiquidityType   `json:"liquidity"`
	Option    Option          `json:"option"`
	Price     decimal.Decimal `json:"price"`
	QuoteID   int             `json:"quoteId"`
	Side      OrderSide       `json:"side"`
	Size      decimal.Decimal `json:"size"`
	Time      time.Time       `json:"time"`
}

type OptionInput

type OptionInput struct {
	Underlying *string          `json:"underlying"`
	Type       *OptionType      `json:"type"`
	Strike     *decimal.Decimal `json:"strike"`
	Expiry     *int64           `json:"expiry"`
}

type OptionOutput

type OptionOutput Option

type OptionPosition

type OptionPosition struct {
	EntryPrice            decimal.Decimal `json:"entryPrice"`
	NetSize               decimal.Decimal `json:"netSize"`
	Option                Option          `json:"option"`
	Side                  OrderSide       `json:"side"`
	Size                  decimal.Decimal `json:"size"`
	PessimisticValuation  decimal.Decimal `json:"pessimisticValuation"`
	PessimisticIndexPrice decimal.Decimal `json:"pessimisticIndexPrice"`
	PessimisticVol        decimal.Decimal `json:"pessimisticVol"`
}

type OptionQuote

type OptionQuote struct {
	Collateral  decimal.Decimal `json:"collateral"`
	ID          int64           `json:"id"`
	Price       decimal.Decimal `json:"price"`
	QuoteExpiry time.Time       `json:"quoteExpiry"`
	Status      OrderStatus     `json:"status"`
	Time        time.Time       `json:"time"`
}

type OptionQuoteRequest

type OptionQuoteRequest struct {
	ID             int64           `json:"id"`
	Option         Option          `json:"option"`
	Side           OrderSide       `json:"side"`
	Size           decimal.Decimal `json:"size"`
	Time           time.Time       `json:"time"`
	RequestExpiry  time.Time       `json:"requestExpiry"`
	Status         OrderStatus     `json:"status"`
	HideLimitPrice bool            `json:"hideLimitPrice"`
	LimitPrice     decimal.Decimal `json:"limitPrice"`
	Quotes         []OptionQuote   `json:"quotes"`
}

type OptionQuoteRequestParams

type OptionQuoteRequestParams struct {
	*OptionInput
	Side           *OrderSide       `json:"side"`
	Size           *decimal.Decimal `json:"size"`
	LimitPrice     *decimal.Decimal `json:"limitPrice,omitempty"`
	HideLimitPrice *bool            `json:"hideLimitPrice,omitempty"`
	RequestExpiry  *int64           `json:"requestExpiry,omitempty"`
	CounterpartyID *int64           `json:"counterpartyId,omitempty"`
}

type OptionType

type OptionType string

type OptionsHistoricalOpenInterest

type OptionsHistoricalOpenInterest struct {
	NumContracts decimal.Decimal `json:"numContracts"`
	Time         time.Time       `json:"time"`
}

type OptionsHistoricalVolumes

type OptionsHistoricalVolumes struct {
	NumContracts decimal.Decimal `json:"numContracts"`
	EndTime      time.Time       `json:"endTime"`
	StartTime    time.Time       `json:"startTime"`
}

type OptionsVolume

type OptionsVolume struct {
	Contracts       decimal.Decimal `json:"contracts"`
	UnderlyingTotal decimal.Decimal `json:"underlying_total"`
}

type Order

type Order struct {
	ID            int64           `json:"id"`
	Market        string          `json:"market"`
	Type          OrderType       `json:"type"`
	Side          OrderSide       `json:"side"`
	Price         decimal.Decimal `json:"price"`
	Size          decimal.Decimal `json:"size"`
	FilledSize    decimal.Decimal `json:"filledSize"`
	RemainingSize decimal.Decimal `json:"remainingSize"`
	AvgFillPrice  decimal.Decimal `json:"avgFillPrice"`
	Status        OrderStatus     `json:"status"`
	CreatedAt     time.Time       `json:"createdAt"`
	ReduceOnly    bool            `json:"reduceOnly"`
	IOC           bool            `json:"ioc"`
	PostOnly      bool            `json:"postOnly"`
	Future        string          `json:"future"`
	ClientID      string          `json:"clientId"`
}

type OrderBook

type OrderBook struct {
	Asks     [][]decimal.Decimal `json:"asks"`
	Bids     [][]decimal.Decimal `json:"bids"`
	Checksum int64               `json:"checksum,omitempty"`
	Time     FTXTime             `json:"time"`
}

type OrderBookResponse

type OrderBookResponse struct {
	OrderBook
	BaseResponse
}

type OrderParams

type OrderParams struct {
	Market     *string          `json:"market"`
	Side       *string          `json:"side"`
	Price      *decimal.Decimal `json:"price"`
	Type       *string          `json:"type"`
	Size       *decimal.Decimal `json:"size"`
	ReduceOnly *bool            `json:"reduceOnly,omitempty"`
	IOC        *bool            `json:"ioc,omitempty"`
	PostOnly   *bool            `json:"postOnly,omitempty"`
	ClientID   *string          `json:"clienId,omitempty"`
}

type OrderSide

type OrderSide string

type OrderStatus

type OrderStatus string

type OrderType

type OrderType string

type OrdersHistoryParams

type OrdersHistoryParams struct {
	Market    *string `json:"market"`
	Limit     *int    `json:"limit"`
	StartTime *int64  `json:"start_time"`
	EndTime   *int64  `json:"end_time"`
}

type OrdersResponse

type OrdersResponse struct {
	Order
	BaseResponse
}

type Position

type Position struct {
	Cost                         decimal.Decimal `json:"cost"`
	EntryPrice                   decimal.Decimal `json:"entryPrice"`
	EstimatedLiquidationPrice    decimal.Decimal `json:"estimatedLiquidationPrice"`
	Future                       string          `json:"future"`
	InitialMarginRequirement     decimal.Decimal `json:"initialMarginRequirement"`
	LongOrderSize                decimal.Decimal `json:"longOrderSize"`
	MaintenanceMarginRequirement decimal.Decimal `json:"maintenanceMarginRequirement"`
	NetSize                      decimal.Decimal `json:"netSize"`
	OpenSize                     decimal.Decimal `json:"openSize"`
	RealizedPnl                  decimal.Decimal `json:"realizedPnl"`
	ShortOrderSize               decimal.Decimal `json:"shortOrderSize"`
	Side                         string          `json:"side"`
	Size                         decimal.Decimal `json:"size"`
	UnrealizedPnl                decimal.Decimal `json:"unrealizedPnl"`
	CollateralUsed               decimal.Decimal `json:"collateralUsed"`
}

type PublicOptionTrade

type PublicOptionTrade struct {
	ID     int64           `json:"id"`
	Size   decimal.Decimal `json:"size"`
	Price  decimal.Decimal `json:"price"`
	Option Option          `json:"option"`
	Time   time.Time       `json:"time"`
}

type QuotesForOptionQuoteRequest

type QuotesForOptionQuoteRequest struct {
	Collateral  decimal.Decimal `json:"collateral"`
	ID          int64           `json:"id"`
	Option      Option          `json:"option"`
	Price       decimal.Decimal `json:"price"`
	QuoteExpiry time.Time       `json:"quoteExpiry"`
	QuoterSide  OrderSide       `json:"quoterSide"`
	RequestSide OrderSide       `json:"requestSide"`
	Size        decimal.Decimal `json:"size"`
}

type RequestWithdrawalParams

type RequestWithdrawalParams struct {
	Address  *string          `json:"address"`
	Code     *string          `json:"code,omitempty"`
	Coin     *string          `json:"coin"`
	Password *string          `json:"password,omitempty"`
	Size     *decimal.Decimal `json:"size"`
	Tag      *string          `json:"tag,omitempty"`
}

type Resolution

type Resolution int

type ResponseType

type ResponseType string

type Result

type Result struct {
	Result string `json:"result"`
}

type SavedAddress

type SavedAddress struct {
	Address          string    `json:"address"`
	Coin             string    `json:"coin"`
	Fiat             bool      `json:"fiat"`
	ID               int64     `json:"id"`
	IsPrimetrust     bool      `json:"isPrimetrust"`
	LastUsedAt       time.Time `json:"lastUsedAt"`
	Name             string    `json:"name"`
	Tag              string    `json:"tag"`
	Whitelisted      bool      `json:"whitelisted"`
	WhitelistedAfter string    `json:"whitelistedAfter"`
}

type SavedAddressParams

type SavedAddressParams struct {
	Address      *string `json:"address"`
	AddressName  *string `json:"addressName"`
	Coin         *string `json:"coin"`
	IsPrimetrust *bool   `json:"isPrimetrust"`
	Tag          *string `json:"tag,omitempty"`
}

type SpotMarginMarketInfo

type SpotMarginMarketInfo struct {
	Coin         string          `json:"coin"`
	Borrowed     decimal.Decimal `json:"borrowed"`
	Free         decimal.Decimal `json:"free"`
	EsimatedRate float64         `json:"estimatedRate"`
	PreviousRate float64         `json:"previousRate"`
}

type Stake

type Stake struct {
	Coin      string          `json:"coin"`
	CreatedAt time.Time       `json:"createdAt"`
	ID        int64           `json:"id"`
	Size      decimal.Decimal `json:"size"`
}

type StakeBalance

type StakeBalance struct {
	Coin               string          `json:"coin"`
	LifetimeRewards    float64         `json:"lifetimeRewards"`
	ScheduledToUnstake decimal.Decimal `json:"scheduledToUnstake"`
	Staked             decimal.Decimal `json:"staked"`
}

type StakeRequest

type StakeRequest Stake

type StakeRequestParams

type StakeRequestParams struct {
	Coin *string          `json:"coin"`
	Size *decimal.Decimal `json:"size"`
}

type StakingReward

type StakingReward struct {
	Coin   string          `json:"coid"`
	ID     int64           `json:"id"`
	Size   decimal.Decimal `json:"size"`
	Status string          `json:"status"`
	Time   time.Time       `json:"time"`
}

type SubAccount

type SubAccount struct {
	Nickname    string `json:"nickname"`
	Deletable   bool   `json:"deletable"`
	Editable    bool   `json:"editable"`
	Competition bool   `json:"competition,omitempty"`
}

type Ticker

type Ticker struct {
	Bid     decimal.Decimal `json:"bid"`
	Ask     decimal.Decimal `json:"ask"`
	BidSize decimal.Decimal `json:"bidSize"`
	AskSize decimal.Decimal `json:"askSize"`
	Last    decimal.Decimal `json:"last"`
	Time    FTXTime         `json:"time"`
}

type TickerResponse

type TickerResponse struct {
	Ticker
	BaseResponse
}

type TokenInfo

type TokenInfo LeveragedToken

type Trade

type Trade struct {
	ID          int64           `json:"id"`
	Liquidation bool            `json:"liquidation"`
	Price       decimal.Decimal `json:"price"`
	Side        string          `json:"side"`
	Size        decimal.Decimal `json:"size"`
	Time        time.Time       `json:"time"`
}

type TradeResponse

type TradeResponse struct {
	Trade
	BaseResponse
}

type TradesResponse

type TradesResponse struct {
	Trades []Trade
	BaseResponse
}

type TransferPayload

type TransferPayload struct {
	Coin        string          `json:"coin"`
	Size        decimal.Decimal `json:"size"`
	Source      *string         `json:"source"`
	Destination *string         `json:"destination"`
}

type TransferResponse

type TransferResponse struct {
	ID     int64           `json:"id"`
	Coin   string          `json:"coin"`
	Size   decimal.Decimal `json:"size"`
	Time   time.Time       `json:"time"`
	Notes  string          `json:"notes"`
	Status TransferStatus  `json:"status"`
}

type TransferStatus

type TransferStatus string

type Trigger

type Trigger struct {
	Error      string    `json:"error"`
	FilledSize float64   `json:"filledSize"`
	OrderSize  float64   `json:"orderSize"`
	OrderID    int64     `json:"orderId"`
	Time       time.Time `json:"time"`
}

type TriggerOrder

type TriggerOrder struct {
	ID               int64            `json:"id"`
	OrderID          int64            `json:"orderId"`
	Market           string           `json:"market"`
	CreatedAt        time.Time        `json:"createdAt"`
	Error            string           `json:"error"`
	Future           string           `json:"future"`
	OrderPrice       decimal.Decimal  `json:"orderPrice"`
	ReduceOnly       bool             `json:"reduceOnly"`
	Side             OrderSide        `json:"side"`
	Size             decimal.Decimal  `json:"size"`
	Status           OrderStatus      `json:"status"`
	TrailStart       decimal.Decimal  `json:"trailStart"`
	TrailValue       decimal.Decimal  `json:"trailValue"`
	TriggerPrice     decimal.Decimal  `json:"triggerPrice"`
	TriggeredAt      time.Time        `json:"triggeredAt"`
	Type             TriggerOrderType `json:"type"`
	OrderType        OrderType        `json:"orderType"`
	FilledSize       decimal.Decimal  `json:"filledSize"`
	AvgFillPrice     decimal.Decimal  `json:"avgFillPrice"`
	OrderStatus      string           `json:"orderStatus"`
	RetryUntilFilled bool             `json:"retryUntilFilled"`
}

type TriggerOrderParams

type TriggerOrderParams struct {
	Market       *string          `json:"market"`
	Side         *string          `json:"side"`
	Size         *decimal.Decimal `json:"size"`
	Type         *string          `json:"type"`
	TriggerPrice *decimal.Decimal `json:"triggerPrice"`
	OrderPrice   *decimal.Decimal `json:"orderPrice"`
	ReduceOnly   *bool            `json:"reduceOnly,omitempty"`
	TrailValue   *decimal.Decimal `json:"trailValue,omitempty"`
}

type TriggerOrderType

type TriggerOrderType string

type TriggerOrdersHistoryParams

type TriggerOrdersHistoryParams struct {
	Market    *string `json:"market"`
	Limit     *int    `json:"limit"`
	StartTime *int    `json:"start_time"`
	EndTime   *int    `json:"end_time"`
	Side      *string `json:"side"`
	Type      *string `json:"type"`
	OrderType *string `json:"orderType"`
}

type UnstakeRequest

type UnstakeRequest struct {
	Stake
	Status   UnstakeRequestStatus `json:"status"`
	UnlockAt time.Time            `json:"unlockAt"`
}

type UnstakeRequestParams

type UnstakeRequestParams StakeRequestParams

type UnstakeRequestStatus

type UnstakeRequestStatus string

type UserOptionQuote

type UserOptionQuote struct {
	QuotesForOptionQuoteRequest
	Status OrderStatus `json:"status"`
	Time   time.Time   `json:"time"`
}

type WSRequest

type WSRequest struct {
	ChannelType ChannelType `json:"channel"`
	Market      string      `json:"market"`
	Op          Operation   `json:"op"`
}

type WSRequestAuthorize

type WSRequestAuthorize struct {
	Args map[string]interface{} `json:"args"`
	Op   Operation              `json:"op"`
}

type Withdrawal

type Withdrawal struct {
	Coin    string          `json:"coin"`
	ID      int64           `json:"id"`
	Size    decimal.Decimal `json:"size"`
	Status  string          `json:"status"`
	Time    time.Time       `json:"time"`
	Fee     decimal.Decimal `json:"fee"`
	Notes   string          `json:"notes"`
	Txid    string          `json:"txid"`
	Address string          `json:"address"`
	Tag     string          `json:"tag"`
}

type WithdrawalHistoryParams

type WithdrawalHistoryParams DepositHistoryParams

type WsResponse

type WsResponse struct {
	ChannelType  ChannelType     `json:"channel"`
	Market       string          `json:"market"`
	ResponseType ResponseType    `json:"type"`
	Code         int             `json:"code"`
	Message      string          `json:"msg"`
	Data         json.RawMessage `json:"data"`
}

func (*WsResponse) MapToFillResponse

func (wr *WsResponse) MapToFillResponse() (*FillResponse, error)

func (*WsResponse) MapToOrderBookResponse

func (wr *WsResponse) MapToOrderBookResponse() (*OrderBookResponse, error)

func (*WsResponse) MapToOrdersResponse

func (wr *WsResponse) MapToOrdersResponse() (*OrdersResponse, error)

func (*WsResponse) MapToTickerResponse

func (wr *WsResponse) MapToTickerResponse() (*TickerResponse, error)

func (*WsResponse) MapToTradesResponse

func (wr *WsResponse) MapToTradesResponse() (*TradesResponse, error)

Jump to

Keyboard shortcuts

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