service

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 7 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BacktestService

type BacktestService struct {
	DB *sqlx.DB
}

func (*BacktestService) Insert

func (s *BacktestService) Insert(kline types.KLine) error

func (*BacktestService) QueryKLinesBackward

func (s *BacktestService) QueryKLinesBackward(exchange types.ExchangeName, symbol string, interval types.Interval, endTime time.Time) ([]types.KLine, error)

func (*BacktestService) QueryKLinesCh

func (s *BacktestService) QueryKLinesCh(since, until time.Time, exchange types.Exchange, symbols []string, intervals []types.Interval) (chan types.KLine, chan error)

func (*BacktestService) QueryKLinesForward

func (s *BacktestService) QueryKLinesForward(exchange types.ExchangeName, symbol string, interval types.Interval, startTime time.Time) ([]types.KLine, error)

func (*BacktestService) QueryLast

func (s *BacktestService) QueryLast(ex types.ExchangeName, symbol string, interval types.Interval) (*types.KLine, error)

QueryLast queries the last order from the database

func (*BacktestService) Sync

func (s *BacktestService) Sync(ctx context.Context, exchange types.Exchange, symbol string, startTime time.Time) error

type OrderService

type OrderService struct {
	DB *sqlx.DB
}

func (*OrderService) Insert

func (s *OrderService) Insert(order types.Order) error

func (*OrderService) Query

func (s *OrderService) Query(ex types.ExchangeName, symbol string) ([]types.Order, error)

func (*OrderService) QueryLast

func (s *OrderService) QueryLast(ex types.ExchangeName, symbol string) (*types.Order, error)

QueryLast queries the last order from the database

type SyncService

type SyncService struct {
	TradeService *TradeService
	OrderService *OrderService
}

func (*SyncService) SyncOrders

func (s *SyncService) SyncOrders(ctx context.Context, exchange types.Exchange, symbol string, startTime time.Time) error

func (*SyncService) SyncTrades

func (s *SyncService) SyncTrades(ctx context.Context, exchange types.Exchange, symbol string, startTime time.Time) error

type TradeService

type TradeService struct {
	DB *sqlx.DB
}

func NewTradeService

func NewTradeService(db *sqlx.DB) *TradeService

func (*TradeService) Insert

func (s *TradeService) Insert(trade types.Trade) error

func (*TradeService) Query

func (s *TradeService) Query(ex types.ExchangeName, symbol string) ([]types.Trade, error)

func (*TradeService) QueryForTradingFeeCurrency

func (s *TradeService) QueryForTradingFeeCurrency(ex types.ExchangeName, symbol string, feeCurrency string) ([]types.Trade, error)

func (*TradeService) QueryLast

func (s *TradeService) QueryLast(ex types.ExchangeName, symbol string) (*types.Trade, error)

QueryLast queries the last trade from the database

Jump to

Keyboard shortcuts

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