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: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OptionsBaseURL = "https://eapi.binance.com"
)

Functions

This section is empty.

Types

type ContractType

type ContractType = string
var (
	CALL ContractType = "CALL"
	PUT  ContractType = "PUT"
)

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"
	Hour12   KlineInterval = "12h"
	Day1     KlineInterval = "1d"
	Day3     KlineInterval = "3d"
	Week1    KlineInterval = "1w"
)

type NewOrderRespType

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

type OptionsClient

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

func NewOptionsClient

func NewOptionsClient(cfg *OptionsClientCfg) (*OptionsClient, error)

func (*OptionsClient) GenHeaders

func (o *OptionsClient) GenHeaders(t usdmutils.SecurityType) (map[string]string, error)

func (*OptionsClient) GetBaseURL

func (o *OptionsClient) GetBaseURL() string

func (*OptionsClient) GetDebug

func (o *OptionsClient) GetDebug() bool

func (*OptionsClient) GetKey

func (o *OptionsClient) GetKey() string

func (*OptionsClient) GetRecvWindow

func (o *OptionsClient) GetRecvWindow() int

func (*OptionsClient) GetSecret

func (o *OptionsClient) GetSecret() string

func (*OptionsClient) NeedSignature

func (o *OptionsClient) NeedSignature(t usdmutils.SecurityType) bool

func (*OptionsClient) SendHTTPRequest

func (o *OptionsClient) SendHTTPRequest(ctx context.Context, req utils.HTTPRequest) (*utils.ApiResponse, error)

type OptionsClientCfg

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

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

type OrderSide

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

type OrderStatus

type OrderStatus = string
var (
	Accepted        OrderStatus = "ACCEPTED"
	Rejected        OrderStatus = "REJECTED"
	PartiallyFilled OrderStatus = "PARTIALLY_FILLED"
	Filled          OrderStatus = "FILLED"
	Canceled        OrderStatus = "CANCELED"
)

type OrderType

type OrderType = string
var (
	Limit OrderType = "LIMIT"
)

type PositionSide

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

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"
)

Jump to

Keyboard shortcuts

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