Documentation
¶
Index ¶
- Constants
- type Candle
- type Config
- type CsvExchange
- func (c *CsvExchange) AmountPrecision() int32
- func (c *CsvExchange) Balance() (cash, currency, fee decimal.Decimal)
- func (c *CsvExchange) BaseCurrency() string
- func (c *CsvExchange) Buy(price, amount decimal.Decimal, clientId string) (hs.Order, error)
- func (c *CsvExchange) FeeCurrency() string
- func (c *CsvExchange) FeePrice() (decimal.Decimal, error)
- func (c *CsvExchange) LastPrice() decimal.Decimal
- func (c *CsvExchange) MinAmount() decimal.Decimal
- func (c *CsvExchange) MinTotal() decimal.Decimal
- func (c *CsvExchange) Price() (decimal.Decimal, error)
- func (c *CsvExchange) PricePrecision() int32
- func (c *CsvExchange) QuoteCurrency() string
- func (c *CsvExchange) Sell(price, amount decimal.Decimal, clientId string) (hs.Order, error)
- func (c *CsvExchange) SetCandleChannel(candleCh chan Candle)
- func (c *CsvExchange) SetTickerChannel(tickerCh chan Ticker)
- func (c *CsvExchange) Start(ctx context.Context)
- func (c *CsvExchange) Symbol() string
- type CsvExchangeConfig
- type Exchange
- type Ticker
- type TurtleExchange
- func (t *TurtleExchange) AmountPrecision() int32
- func (t *TurtleExchange) Balance() (cash, currency, fee decimal.Decimal)
- func (t *TurtleExchange) BaseCurrency() string
- func (t *TurtleExchange) Buy(price, amount decimal.Decimal, clientId string) (hs.Order, error)
- func (t *TurtleExchange) FeeCurrency() string
- func (t *TurtleExchange) FeePrice() (decimal.Decimal, error)
- func (t *TurtleExchange) MinAmount() decimal.Decimal
- func (t *TurtleExchange) MinTotal() decimal.Decimal
- func (t *TurtleExchange) Price() (decimal.Decimal, error)
- func (t *TurtleExchange) PricePrecision() int32
- func (t *TurtleExchange) QuoteCurrency() string
- func (t *TurtleExchange) Sell(price, amount decimal.Decimal, clientId string) (hs.Order, error)
- func (t *TurtleExchange) SetCandleChannel(candleCh chan Candle)
- func (t *TurtleExchange) SetTickerChannel(tickerCh chan Ticker)
- func (t *TurtleExchange) Start(ctx context.Context)
- func (t *TurtleExchange) Symbol() string
Constants ¶
View Source
const DefaultFeePrice = 0.5
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { hs.ExchangeConf FeeCurrency string `json:"feeCurrency"` // eg. HT ClientId string `json:"clientId"` Period string // candle type, 1m, 15m, 1h Csv *CsvExchangeConfig `json:"csv,omitempty"` }
type CsvExchange ¶
func NewCsvExchange ¶
func NewCsvExchange(config CsvExchangeConfig, symbols []string) *CsvExchange
func (*CsvExchange) AmountPrecision ¶
func (c *CsvExchange) AmountPrecision() int32
func (*CsvExchange) Balance ¶
func (c *CsvExchange) Balance() (cash, currency, fee decimal.Decimal)
func (*CsvExchange) BaseCurrency ¶
func (c *CsvExchange) BaseCurrency() string
func (*CsvExchange) FeeCurrency ¶
func (c *CsvExchange) FeeCurrency() string
func (*CsvExchange) LastPrice ¶
func (c *CsvExchange) LastPrice() decimal.Decimal
func (*CsvExchange) MinAmount ¶
func (c *CsvExchange) MinAmount() decimal.Decimal
func (*CsvExchange) MinTotal ¶
func (c *CsvExchange) MinTotal() decimal.Decimal
func (*CsvExchange) PricePrecision ¶
func (c *CsvExchange) PricePrecision() int32
func (*CsvExchange) QuoteCurrency ¶
func (c *CsvExchange) QuoteCurrency() string
func (*CsvExchange) SetCandleChannel ¶
func (c *CsvExchange) SetCandleChannel(candleCh chan Candle)
func (*CsvExchange) SetTickerChannel ¶
func (c *CsvExchange) SetTickerChannel(tickerCh chan Ticker)
func (*CsvExchange) Start ¶
func (c *CsvExchange) Start(ctx context.Context)
func (*CsvExchange) Symbol ¶
func (c *CsvExchange) Symbol() string
type CsvExchangeConfig ¶
type Exchange ¶
type Exchange interface { Symbol() string QuoteCurrency() string // BTC/USDT -> USDT BaseCurrency() string // BTC/USDT -> BTC FeeCurrency() string MinAmount() decimal.Decimal MinTotal() decimal.Decimal PricePrecision() int32 AmountPrecision() int32 Balance() (cash, currency, fee decimal.Decimal) Price() (decimal.Decimal, error) FeePrice() (decimal.Decimal, error) Buy(price, amount decimal.Decimal, clientId string) (hs.Order, error) Sell(price, amount decimal.Decimal, clientId string) (hs.Order, error) SetTickerChannel(tickerCh chan Ticker) SetCandleChannel(candleCh chan Candle) Start(ctx context.Context) }
exchange interface for turtle trade only. with only one symbol, only one fee currency, and almost no error
type TurtleExchange ¶
type TurtleExchange struct {
// contains filtered or unexported fields
}
func NewTurtle ¶
func NewTurtle(config Config) *TurtleExchange
func (*TurtleExchange) AmountPrecision ¶
func (t *TurtleExchange) AmountPrecision() int32
func (*TurtleExchange) Balance ¶
func (t *TurtleExchange) Balance() (cash, currency, fee decimal.Decimal)
func (*TurtleExchange) BaseCurrency ¶
func (t *TurtleExchange) BaseCurrency() string
func (*TurtleExchange) FeeCurrency ¶
func (t *TurtleExchange) FeeCurrency() string
func (*TurtleExchange) MinAmount ¶
func (t *TurtleExchange) MinAmount() decimal.Decimal
func (*TurtleExchange) MinTotal ¶
func (t *TurtleExchange) MinTotal() decimal.Decimal
func (*TurtleExchange) PricePrecision ¶
func (t *TurtleExchange) PricePrecision() int32
func (*TurtleExchange) QuoteCurrency ¶
func (t *TurtleExchange) QuoteCurrency() string
func (*TurtleExchange) SetCandleChannel ¶
func (t *TurtleExchange) SetCandleChannel(candleCh chan Candle)
func (*TurtleExchange) SetTickerChannel ¶
func (t *TurtleExchange) SetTickerChannel(tickerCh chan Ticker)
func (*TurtleExchange) Start ¶
func (t *TurtleExchange) Start(ctx context.Context)
func (*TurtleExchange) Symbol ¶
func (t *TurtleExchange) Symbol() string
Click to show internal directories.
Click to hide internal directories.