alt/services/worker/internal/storage/ports.go
toki 38b68315fc feat: backtest engine baseline implementation
- Add backtest proto definitions and generated code
- Update domain types for backtest results and fixtures
- Add PostgreSQL migrations for backtest tables
- Implement storage layer for backtest result persistence
- Add backtest job definitions and execution pipeline
- Remove obsolete agent-task documents for completed items
2026-05-30 12:13:45 +09:00

34 lines
1.1 KiB
Go

package storage
import (
"context"
"errors"
"time"
"git.toki-labs.com/toki/alt/packages/domain/backtest"
"git.toki-labs.com/toki/alt/packages/domain/market"
)
var ErrRunNotFound = errors.New("backtest run not found")
var ErrResultNotFound = errors.New("backtest result not found")
type InstrumentStore interface {
UpsertInstrument(ctx context.Context, inst market.Instrument) error
GetInstrument(ctx context.Context, id market.InstrumentID) (market.Instrument, error)
ListInstruments(ctx context.Context) ([]market.Instrument, error)
}
type BarStore interface {
UpsertBar(ctx context.Context, bar market.Bar) error
GetBars(ctx context.Context, id market.InstrumentID, timeframe market.Timeframe, from, to time.Time) ([]market.Bar, error)
}
type BacktestRunStore interface {
UpsertRun(ctx context.Context, run backtest.Run) error
GetRun(ctx context.Context, id backtest.RunID) (backtest.Run, error)
}
type BacktestResultStore interface {
UpsertResult(ctx context.Context, result backtest.Result) error
GetResult(ctx context.Context, id backtest.RunID) (backtest.Result, error)
}