modules

package
v0.0.0-...-c49ec99 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BINANCE_FAPI_ENDPOINT     string = "https://fapi.binance.com/fapi/v1"
	BINANCE_FAPI_LEVERAGE     string = "/leverage"
	BINANCE_FAPI_BATCH_ORDERS string = "/batchOrders"
	BINANCE_FAPI_DEPTH        string = "/depth"
	BINANCE_FAPI_OPEN_ORDERS  string = "/positionRisk"

	FUNDING_RATE_ENDPOINT string = "https://wiwisorich.capslock.tw"

	DEFAULT_LEVERAGE   int     = 10
	DEFAULT_DIFFERENCE float64 = 0.05
	DEFAULT_MINUTES    float64 = 480
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

type Core struct {
	Setting        *models.ConfigSetting
	EventReceiver  chan string
	ID             *string
	RateLimiter    ratelimit.Limiter
	EventPublisher chan models.EventMessage
}

func NewCore

func NewCore(
	setting *models.ConfigSetting,
	eventReceiver chan string,
	ID *string,
	ratelimiter ratelimit.Limiter,
) *Core

func (*Core) GetDepth

func (c *Core) GetDepth(
	currency string,
) (
	bid,
	bidSize,
	ask,
	askSize float64,
)

func (*Core) GetPublisher

func (c *Core) GetPublisher() <-chan models.EventMessage

func (*Core) MakeRequest

func (c *Core) MakeRequest(
	path,
	method string,
	body map[string]string,
) *gorequest.SuperAgent

func (*Core) Run

func (c *Core) Run()

type Crypto

type Crypto struct {
	Block cipher.Block
}

func NewCrypto

func NewCrypto(key []byte) *Crypto

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(value string) (result *string, err error)

func (*Crypto) Encrypt

func (c *Crypto) Encrypt(value string) (result *string, err error)

type DB

type DB struct {
	DB     *sql.DB
	Crypto *Crypto
	Secret string
}

func NewDB

func NewDB(path string, secret string) *DB

func (*DB) Close

func (d *DB) Close()

func (*DB) CreateUserState

func (d *DB) CreateUserState(userID string, value any) string

func (*DB) DropState

func (d *DB) DropState(ID string) error

func (*DB) DropUserState

func (d *DB) DropUserState(userID string, ID string) error

func (*DB) DropUserStates

func (d *DB) DropUserStates(userID string) error

func (*DB) GetSates

func (d *DB) GetSates() (result []State)

func (*DB) GetUserSates

func (d *DB) GetUserSates(userID string) (result []State)

type Http

type Http struct {
	Store       string
	DB          *DB
	Channel     chan string
	RateLimiter ratelimit.Limiter
}

func NewHttp

func NewHttp(db *DB, ratelimiter ratelimit.Limiter) *Http

func (*Http) Bot

func (h *Http) Bot(setting models.ConfigSetting, ID string)

func (*Http) Serve

func (h *Http) Serve()

type State

type State struct {
	ID     string
	UserID string
	Value  string
}

type Yaml

type Yaml struct {
	Path        string
	RateLimiter ratelimit.Limiter
}

func NewYaml

func NewYaml(path string, ratelimiter ratelimit.Limiter) *Yaml

func (*Yaml) Run

func (y *Yaml) Run()

Jump to

Keyboard shortcuts

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