utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 12 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	USDMarginedBaseURL = "https://fapi.binance.com"
)

Functions

This section is empty.

Types

type ContractType

type ContractType = string
var (
	Perpetual           ContractType = "PERPETUAL"
	CurrentMonth        ContractType = "CURRENT_MONTH"
	NextMonth           ContractType = "NEXT_MONTH"
	CurrentQuarter      ContractType = "CURRENT_QUARTER"
	NextQuarter         ContractType = "NEXT_QUARTER"
	PerpetualDelivering ContractType = "PERPETUAL_DELIVERING"
)

type KlineInterval

type KlineInterval = string
var (
	Minute1  KlineInterval = "1m"
	Minute3  KlineInterval = "3m"
	Minute5  KlineInterval = "5m"
	Minute15 KlineInterval = "15m"
	Minute30 KlineInterval = "30m"
	Hour1    KlineInterval = "1h"
	Hour2    KlineInterval = "2h"
	Hour4    KlineInterval = "4h"
	Hour6    KlineInterval = "6h"
	Hour8    KlineInterval = "8h"
	Hour12   KlineInterval = "12h"
	Day1     KlineInterval = "1d"
	Day3     KlineInterval = "3d"
	Week1    KlineInterval = "1w"
	Month1   KlineInterval = "1M"
)

type MarginType

type MarginType = string
var (
	ISOLATED MarginType = "ISOLATED"
	CROSSED  MarginType = "CROSSED"
)

type NewOrderRespType

type NewOrderRespType = string
var (
	ACK    NewOrderRespType = "ACK"
	RESULT NewOrderRespType = "RESULT"
)

type OrderSide

type OrderSide = string
var (
	BuySide  OrderSide = "BUY"
	SellSide OrderSide = "SELL"
)

type OrderStatus

type OrderStatus = string
var (
	New             OrderStatus = "NEW"
	PartiallyFilled OrderStatus = "PARTIALLY_FILLED"
	Filled          OrderStatus = "FILLED"
	Canceled        OrderStatus = "CANCELED"
	Rejected        OrderStatus = "REJECTED"
	Expired         OrderStatus = "EXPIRED"
)

type OrderType

type OrderType = string
var (
	LimitOrder              OrderType = "LIMIT"
	MarketOrder             OrderType = "MARKET"
	StopOrder               OrderType = "STOP"
	StopMarketOrder         OrderType = "STOP_MARKET"
	TakeProfitOrder         OrderType = "TAKE_PROFIT"
	TakeProfitMarketOrder   OrderType = "TAKE_PROFIT_MARKET"
	TrailingStopMarketOrder OrderType = "TRAILING_STOP_MARKET"
)

type PositionSide

type PositionSide = string
var (
	Both  PositionSide = "BOTH"
	Long  PositionSide = "LONG"
	Short PositionSide = "SHORT"
)

type SecurityType

type SecurityType = string
var (
	NONE        SecurityType = "NONE"
	TRADE       SecurityType = "TRADE"
	USER_DATA   SecurityType = "USER_DATA"
	USER_STREAM SecurityType = "USER_STREAM"
	MARKET_DATA SecurityType = "MARKET_DATA"
)

type TimeInForce

type TimeInForce = string
var (
	// GTC - Good Till Cancel
	GTC TimeInForce = "GTC"
	// IOC - Immediate or Cancel
	IOC TimeInForce = "IOC"
	// FOK - Fill or Kill
	FOK TimeInForce = "FOK"
	// GTX - Good Till Crossing (Post Only)
	GTX TimeInForce = "GTX"
)

type USDMarginedClient

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

func NewUSDMarginedClient

func NewUSDMarginedClient(cfg *USDMarginedClientCfg) (*USDMarginedClient, error)

func (*USDMarginedClient) GenHeaders

func (u *USDMarginedClient) GenHeaders(t SecurityType) (map[string]string, error)

func (*USDMarginedClient) GetBaseURL

func (u *USDMarginedClient) GetBaseURL() string

func (*USDMarginedClient) GetDebug

func (u *USDMarginedClient) GetDebug() bool

func (*USDMarginedClient) GetKey

func (u *USDMarginedClient) GetKey() string

func (*USDMarginedClient) GetRecvWindow

func (u *USDMarginedClient) GetRecvWindow() int

func (*USDMarginedClient) GetSecret

func (u *USDMarginedClient) GetSecret() string

func (*USDMarginedClient) NeedSignature

func (u *USDMarginedClient) NeedSignature(t SecurityType) bool

func (*USDMarginedClient) SendHTTPRequest

func (u *USDMarginedClient) SendHTTPRequest(ctx context.Context, req utils.HTTPRequest) (*utils.ApiResponse, error)

type USDMarginedClientCfg

type USDMarginedClientCfg struct {
	Debug bool
	// Logger
	Logger *slog.Logger

	BaseURL    string `validate:"required"`
	Key        string
	Secret     string
	RecvWindow int
}

Jump to

Keyboard shortcuts

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