Documentation ¶
Index ¶
- Variables
- func NewDefaultTotpKey() (*otp.Key, error)
- func ReformatMysqlDSN(dsn string) (string, error)
- type AggOrder
- type BacktestService
- func (s *BacktestService) Insert(kline types.KLine) error
- func (s *BacktestService) QueryKLinesBackward(exchange types.ExchangeName, symbol string, interval types.Interval, ...) ([]types.KLine, error)
- func (s *BacktestService) QueryKLinesCh(since, until time.Time, exchange types.Exchange, symbols []string, ...) (chan types.KLine, chan error)
- func (s *BacktestService) QueryKLinesForward(exchange types.ExchangeName, symbol string, interval types.Interval, ...) ([]types.KLine, error)
- func (s *BacktestService) QueryLast(ex types.ExchangeName, symbol string, interval types.Interval) (*types.KLine, error)
- func (s *BacktestService) Sync(ctx context.Context, exchange types.Exchange, symbol string, ...) error
- type DatabaseService
- type JsonPersistenceConfig
- type JsonPersistenceService
- type JsonStore
- type MemoryService
- type MemoryStore
- type OrderService
- type PersistenceService
- type PersistenceServiceFacade
- type QueryOrdersOptions
- type QueryTradesOptions
- type RedisPersistenceConfig
- type RedisPersistenceService
- type RedisStore
- type Store
- type SyncService
- func (s *SyncService) SyncOrders(ctx context.Context, exchange types.Exchange, symbol string, ...) error
- func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exchange, startTime time.Time, ...) error
- func (s *SyncService) SyncTrades(ctx context.Context, exchange types.Exchange, symbol string) error
- type TradeService
- func (s *TradeService) Insert(trade types.Trade) error
- func (s *TradeService) Load(ctx context.Context, id int64) (*types.Trade, error)
- func (s *TradeService) MarkStrategyID(ctx context.Context, id int64, strategyID string) error
- func (s *TradeService) Query(options QueryTradesOptions) ([]types.Trade, error)
- func (s *TradeService) QueryForTradingFeeCurrency(ex types.ExchangeName, symbol string, feeCurrency string) ([]types.Trade, error)
- func (s *TradeService) QueryLast(ex types.ExchangeName, symbol string, isMargin bool, isIsolated bool, ...) ([]types.Trade, error)
- func (s *TradeService) QueryTradingVolume(startTime time.Time, options TradingVolumeQueryOptions) ([]TradingVolume, error)
- func (s *TradeService) UpdatePnL(ctx context.Context, id int64, pnl float64) error
- type TradingVolume
- type TradingVolumeQueryOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPersistenceNotExists = errors.New("persistent data does not exists")
View Source
var ErrTradeNotFound = errors.New("trade not found")
Functions ¶
func NewDefaultTotpKey ¶ added in v1.4.0
func ReformatMysqlDSN ¶ added in v1.11.0
Types ¶
type BacktestService ¶
func (*BacktestService) QueryKLinesBackward ¶
func (*BacktestService) QueryKLinesCh ¶
func (*BacktestService) QueryKLinesForward ¶
type DatabaseService ¶ added in v1.11.0
func NewDatabaseService ¶ added in v1.11.0
func NewDatabaseService(driver, dsn string) *DatabaseService
func (*DatabaseService) Close ¶ added in v1.11.0
func (s *DatabaseService) Close() error
func (*DatabaseService) Connect ¶ added in v1.11.0
func (s *DatabaseService) Connect() error
type JsonPersistenceConfig ¶ added in v1.12.0
type JsonPersistenceConfig struct {
Directory string `json:"directory"`
}
type JsonPersistenceService ¶ added in v1.12.0
type JsonPersistenceService struct {
Directory string
}
type MemoryService ¶ added in v1.12.0
type MemoryService struct {
Slots map[string]interface{}
}
func NewMemoryService ¶ added in v1.12.0
func NewMemoryService() *MemoryService
type MemoryStore ¶ added in v1.12.0
type MemoryStore struct { Key string // contains filtered or unexported fields }
func (*MemoryStore) Load ¶ added in v1.12.0
func (store *MemoryStore) Load(val interface{}) error
func (*MemoryStore) Reset ¶ added in v1.12.0
func (store *MemoryStore) Reset() error
func (*MemoryStore) Save ¶ added in v1.12.0
func (store *MemoryStore) Save(val interface{}) error
type OrderService ¶
func (*OrderService) Query ¶
func (s *OrderService) Query(options QueryOrdersOptions) ([]AggOrder, error)
type PersistenceService ¶ added in v1.12.0
type PersistenceServiceFacade ¶ added in v1.12.0
type PersistenceServiceFacade struct { Redis *RedisPersistenceService Json *JsonPersistenceService Memory *MemoryService }
func (*PersistenceServiceFacade) Get ¶ added in v1.12.0
func (facade *PersistenceServiceFacade) Get() PersistenceService
Get returns the preferred persistence service by fallbacks Redis will be preferred at the first position.
type QueryOrdersOptions ¶ added in v1.11.0
type QueryOrdersOptions struct { Exchange types.ExchangeName Symbol string LastGID int64 Ordering string }
type QueryTradesOptions ¶ added in v1.11.0
type RedisPersistenceConfig ¶ added in v1.12.0
type RedisPersistenceService ¶ added in v1.12.0
type RedisPersistenceService struct {
// contains filtered or unexported fields
}
func NewRedisPersistenceService ¶ added in v1.12.0
func NewRedisPersistenceService(config *RedisPersistenceConfig) *RedisPersistenceService
type RedisStore ¶ added in v1.12.0
type RedisStore struct { ID string // contains filtered or unexported fields }
func (*RedisStore) Load ¶ added in v1.12.0
func (store *RedisStore) Load(val interface{}) error
func (*RedisStore) Reset ¶ added in v1.12.0
func (store *RedisStore) Reset() error
func (*RedisStore) Save ¶ added in v1.12.0
func (store *RedisStore) Save(val interface{}) error
type SyncService ¶
type SyncService struct { TradeService *TradeService OrderService *OrderService }
func (*SyncService) SyncOrders ¶
func (*SyncService) SyncSessionSymbols ¶ added in v1.11.1
func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exchange, startTime time.Time, symbols ...string) error
SyncSessionSymbols syncs the trades from the given exchange session
func (*SyncService) SyncTrades ¶
type TradeService ¶
func NewTradeService ¶
func NewTradeService(db *sqlx.DB) *TradeService
func (*TradeService) MarkStrategyID ¶ added in v1.11.1
func (*TradeService) Query ¶
func (s *TradeService) Query(options QueryTradesOptions) ([]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, isMargin bool, isIsolated bool, limit int) ([]types.Trade, error)
QueryLast queries the last trade from the database
func (*TradeService) QueryTradingVolume ¶ added in v1.11.0
func (s *TradeService) QueryTradingVolume(startTime time.Time, options TradingVolumeQueryOptions) ([]TradingVolume, error)
type TradingVolume ¶ added in v1.11.0
type TradingVolume struct { Year int `db:"year" json:"year"` Month int `db:"month" json:"month,omitempty"` Day int `db:"day" json:"day,omitempty"` Time time.Time `json:"time,omitempty"` Exchange string `db:"exchange" json:"exchange,omitempty"` Symbol string `db:"symbol" json:"symbol,omitempty"` QuoteVolume float64 `db:"quote_volume" json:"quoteVolume"` }
type TradingVolumeQueryOptions ¶ added in v1.11.0
Click to show internal directories.
Click to hide internal directories.