trade

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderService

type OrderService struct {
	Client *binance.Client
	// contains filtered or unexported fields
}

OrderService represents the service for Order API.

https://github.com/adshao/go-binance https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md

func NewOrderService

func NewOrderService() *OrderService

NewCreateOrderService returns the Analytical Indicator Strategy (AIS).

func (*OrderService) Buy

func (s *OrderService) Buy() *OrderService

Symbol set symbol.

func (*OrderService) Do

func (s *OrderService) Do(cluster *service.ClusterService) (order *OrderService)

Do returns the trade.

func (*OrderService) Fee

func (s *OrderService) Fee(fee float64) *OrderService

Fee sets the exchange fee ratio for the order.

func (*OrderService) Limit

func (s *OrderService) Limit(limit float64) *OrderService

Limit sets the tax-free limit for profit within an order.

func (*OrderService) Liquidity

func (s *OrderService) Liquidity(liquidity float64) *OrderService

Liquidity sets the liquidity to invest.

func (*OrderService) NewClient

func (s *OrderService) NewClient() *OrderService

NewClient initialize an API client with API key and secret key.

func (*OrderService) Price

func (s *OrderService) Price(price string) *OrderService

Price set price.

func (*OrderService) Quantity

func (s *OrderService) Quantity(quantity float64) *OrderService

Quantity set quantity.

func (*OrderService) ROI

func (s *OrderService) ROI(roi map[int]float64) *OrderService

ROI defines the minimal Return On Investment (ROI) a trade should reach before selling, independent from the sell signal.

roi := map[int]float64{
  40:  0.0,
  30:  0.01,
  20:  0.02,
  0:   0.04,
}

The above configuration would therefore mean:

  • Sell whenever 4% profit was reached.
  • Sell when 2% profit was reached (in effect after 20 minutes).
  • Sell when 1% profit was reached (in effect after 30 minutes).
  • Sell when trade is non-loosing (in effect after 40 minutes).

func (*OrderService) Sell

func (s *OrderService) Sell() *OrderService

Symbol set symbol.

func (*OrderService) ServerTime

func (s *OrderService) ServerTime() *OrderService

ServerTime init set server time.

func (*OrderService) Stoploss

func (s *OrderService) Stoploss(stoploss float64) *OrderService

Stoploss sets the threshold ratio for the sell order.

func (*OrderService) Symbol

func (s *OrderService) Symbol(symbol string) *OrderService

Symbol set symbol.

func (*OrderService) Test

func (s *OrderService) Test(cluster *service.ClusterService) (profit types.Profits)

Test returns the test trade.

Jump to

Keyboard shortcuts

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