ex

package
v0.0.0-...-85ff41b Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ex

type Ex interface {
	// Exchange custom properties.
	Property() *ExProperty

	// Get all supported pairs, min trade amount...
	GetMarketInfo(ignorePairsNotFound bool) (*MarketInfo, error)

	// Get max open order books.
	GetDepth(market Market, target Pair) (*Depth, error)

	// Get kline.
	// If since is valid, since should appear in the results.
	GetCandleSticks(market Market, target Pair, period Period, since *time.Time) (*CandleSticks, error)

	// Get all ticks.
	GetTicks(ignorePairsNotFound bool) (map[PairM]Tick, error)

	// Get account info includes all currency balances.
	GetAccount() (*Account, error)

	// Margin account borrowable.
	GetBorrowable(margin Margin, asset string) (gdecimal.Decimal, error)

	// Margin account borrow.
	Borrow(margin Margin, asset string, amount gdecimal.Decimal) error

	// Margin account repay.
	Repay(margin Margin, asset string, amount gdecimal.Decimal) error

	// Transfer between different sub accounts.
	Transfer(asset string, amount gdecimal.Decimal, from, to SubAcc) error

	// amount: always unit amount, not quote amount, whether buy or sell.
	// price: when market-buy/market-sell, price will be ignored.
	Trade(market Market, margin Margin, leverage int, target Pair, side OrderSide, orderType OrderType, unitAmount, price, stopPrice gdecimal.Decimal) (*OrderId, error)

	// Get all my unfinished orders' info.
	GetOpenOrders(market *Market, margin *Margin, target *Pair) ([]Order, error)

	// Get all my non-open orders' info.
	GetClosedOrders(market Market, target Pair, beginTime time.Time, endTime time.Time) ([]Order, error)

	// Get order info by id.
	GetOrder(id OrderId) (*Order, error)

	// Cancel unfinished order by id.
	CancelOrder(id OrderId) error
}

Exchange interface

func NewEx

func NewEx(name Platform, apiKey, apiSecret, proxy string, c gtime.Clock, email string, cfgClient *gconfig.Client) (Ex, error)

email is required in living trading, but not required in kline spider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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