executor

package
v0.0.0-...-0d73d77 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
}

type Executor

type Executor interface {
	QuoteCurrency() string // BTC/USDT -> USDT
	BaseCurrency() string  // BTC/USDT -> BTC
	FeeCurrency() string

	Balance() (cash, currency, fee decimal.Decimal)
	Price() (decimal.Decimal, error)
	FeePrice() (decimal.Decimal, error)

	MinAmount() decimal.Decimal
	MinTotal() decimal.Decimal
	PricePrecision() int32
	AmountPrecision() int32
	Buy(price, amount decimal.Decimal, clientId string) (hs.Order, error)
	Sell(price, amount decimal.Decimal, clientId string) (hs.Order, error)
	PlaceOrder(signal *types.Signal, clientId string) (hs.Order, error)
}

A exchange agent for turtle use. It saves some useful variables, eg. the only symbol, base-currency, quote-currency, precisions.

func New

func New(config Config, ex exchange.Exchange) Executor

type TurtleExecutor

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

for test

func NewTurtleExecutor

func NewTurtleExecutor(config Config, ex exchange.Exchange) *TurtleExecutor

func (*TurtleExecutor) AmountPrecision

func (t *TurtleExecutor) AmountPrecision() int32

func (*TurtleExecutor) Balance

func (t *TurtleExecutor) Balance() (cash, currency, fee decimal.Decimal)

func (*TurtleExecutor) BaseCurrency

func (t *TurtleExecutor) BaseCurrency() string

BTC/USDT -> BTC

func (*TurtleExecutor) Buy

func (t *TurtleExecutor) Buy(price, amount decimal.Decimal, clientId string) (hs.Order, error)

func (*TurtleExecutor) FeeCurrency

func (t *TurtleExecutor) FeeCurrency() string

func (*TurtleExecutor) FeePrice

func (t *TurtleExecutor) FeePrice() (decimal.Decimal, error)

func (*TurtleExecutor) MinAmount

func (t *TurtleExecutor) MinAmount() decimal.Decimal

func (*TurtleExecutor) MinTotal

func (t *TurtleExecutor) MinTotal() decimal.Decimal

func (*TurtleExecutor) PlaceOrder

func (t *TurtleExecutor) PlaceOrder(signal *types.Signal, clientId string) (hs.Order, error)

func (*TurtleExecutor) Price

func (t *TurtleExecutor) Price() (decimal.Decimal, error)

price of the base currency

func (*TurtleExecutor) PricePrecision

func (t *TurtleExecutor) PricePrecision() int32

func (*TurtleExecutor) QuoteCurrency

func (t *TurtleExecutor) QuoteCurrency() string

BTC/USDT -> USDT

func (*TurtleExecutor) Sell

func (t *TurtleExecutor) Sell(price, amount decimal.Decimal, clientId string) (hs.Order, error)

Jump to

Keyboard shortcuts

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