Versions in this module Expand all Collapse all v0 v0.0.1 May 4, 2024 Changes in this version + const DateFormat + const FeeToken + const SessionTimeFormat + var ErrEmptyOrderType = errors.New("order type can not be empty string") + var ErrNegativeQuantity = errors.New("order quantity can not be negative") + var ErrUnimplemented = errors.New("unimplemented method") + var ErrZeroQuantity = errors.New("order quantity can not be zero") + var FS = &fs + func AddReportIndexRun(outputDirectory string, run Run) error + func CollectSubscriptionIntervals(environ *bbgo.Environment) (allKLineIntervals map[types.Interval]struct{}, requiredInterval types.Interval, ...) + func FormatSessionName(sessions []string, symbols []string, startTime, endTime time.Time) string + func InQuoteAsset(balances types.BalanceMap, market types.Market, price fixedpoint.Value) fixedpoint.Value + func WriteReportIndex(outputDirectory string, reportIndex *ReportIndex) error + type Exchange struct + MarketDataStream types.StandardStreamEmitter + Src *ExchangeDataSource + func NewExchange(sourceName types.ExchangeName, sourceExchange types.Exchange, ...) (*Exchange, error) + func (e *Exchange) BindUserData(userDataStream types.StandardStreamEmitter) + func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) error + func (e *Exchange) CloseMarketData() error + func (e *Exchange) ConsumeKLine(k types.KLine, requiredInterval types.Interval) + func (e *Exchange) Name() types.ExchangeName + func (e *Exchange) NewStream() types.Stream + func (e *Exchange) PlatformFeeCurrency() string + func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) + func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error) + func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error) + func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, until time.Time) (allDeposits []types.Deposit, err error) + func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, ...) ([]types.KLine, error) + func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) + func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error) + func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error) + func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error) + func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error) + func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) ([]types.Trade, error) + func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (allWithdraws []types.Withdraw, err error) + func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error) + func (e *Exchange) SubscribeMarketData(startTime, endTime time.Time, requiredInterval types.Interval, ...) (chan types.KLine, error) + type ExchangeDataSource struct + C chan types.KLine + Callbacks []func(types.KLine, *ExchangeDataSource) + Exchange *Exchange + Session *bbgo.ExchangeSession + func InitializeExchangeSources(sessions map[string]*bbgo.ExchangeSession, startTime, endTime time.Time, ...) (exchangeSources []*ExchangeDataSource, err error) + type FeeModeFunction func(order *types.Order, market *types.Market, feeRate fixedpoint.Value) (fee fixedpoint.Value, feeCurrency string) + type Instance interface + ID func() string + InstanceID func() string + type InstancePropertyIndex struct + ID string + InstanceID string + Property string + type KLineDumper struct + OutputDirectory string + func NewKLineDumper(outputDirectory string) *KLineDumper + func (d *KLineDumper) Close() error + func (d *KLineDumper) Filenames() map[symbolInterval]string + func (d *KLineDumper) Record(k types.KLine) error + type ManifestEntry struct + Filename string + StrategyID string + StrategyInstance string + StrategyProperty string + Type string + type Manifests map[InstancePropertyIndex]string + func (m *Manifests) UnmarshalJSON(j []byte) error + func (m Manifests) MarshalJSON() ([]byte, error) + type PriceOrder struct + Order types.Order + Price fixedpoint.Value + type PriceOrderSlice []PriceOrder + func (slice PriceOrderSlice) Find(price fixedpoint.Value, descending bool) (pv PriceOrder, idx int) + func (slice PriceOrderSlice) First() (PriceOrder, bool) + func (slice PriceOrderSlice) InsertAt(idx int, po PriceOrder) PriceOrderSlice + func (slice PriceOrderSlice) Len() int + func (slice PriceOrderSlice) Less(i, j int) bool + func (slice PriceOrderSlice) Remove(price fixedpoint.Value, descending bool) PriceOrderSlice + func (slice PriceOrderSlice) Swap(i, j int) + func (slice PriceOrderSlice) Upsert(po PriceOrder, descending bool) PriceOrderSlice + type ReportIndex struct + Runs []Run + func LoadReportIndex(outputDirectory string) (*ReportIndex, error) + type Run struct + Config *bbgo.Config + ID string + Time time.Time + type SessionSymbolReport struct + Exchange types.ExchangeName + FinalBalances types.BalanceMap + InitialBalances types.BalanceMap + Intervals []types.Interval + LastPrice fixedpoint.Value + Manifests Manifests + Market types.Market + PnL *pnl.AverageCostPnLReport + ProfitFactor fixedpoint.Value + Sharpe fixedpoint.Value + Sortino fixedpoint.Value + StartPrice fixedpoint.Value + Subscriptions []types.Subscription + Symbol string + WinningRatio fixedpoint.Value + func (r *SessionSymbolReport) FinalEquityValue() fixedpoint.Value + func (r *SessionSymbolReport) InitialEquityValue() fixedpoint.Value + func (r *SessionSymbolReport) Print(wantBaseAssetBaseline bool) + type SimplePriceMatching struct + Market types.Market + Symbol string + func (m *SimplePriceMatching) CancelOrder(o types.Order) (types.Order, error) + func (m *SimplePriceMatching) EmitBalanceUpdate(balances types.BalanceMap) + func (m *SimplePriceMatching) EmitOrderUpdate(order types.Order) + func (m *SimplePriceMatching) EmitTradeUpdate(trade types.Trade) + func (m *SimplePriceMatching) OnBalanceUpdate(cb func(balances types.BalanceMap)) + func (m *SimplePriceMatching) OnOrderUpdate(cb func(order types.Order)) + func (m *SimplePriceMatching) OnTradeUpdate(cb func(trade types.Trade)) + func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (*types.Order, *types.Trade, error) + type StateRecorder struct + func NewStateRecorder(outputDir string) *StateRecorder + func (r *StateRecorder) Close() error + func (r *StateRecorder) Manifests() Manifests + func (r *StateRecorder) Scan(instance Instance) error + func (r *StateRecorder) Snapshot() (int, error) + type SummaryReport struct + EndTime time.Time + FinalEquityValue fixedpoint.Value + FinalTotalBalances types.BalanceMap + InitialEquityValue fixedpoint.Value + InitialTotalBalances types.BalanceMap + Intervals []types.Interval + Manifests Manifests + Sessions []string + StartTime time.Time + SymbolReports []SessionSymbolReport + Symbols []string + TotalGrossLoss fixedpoint.Value + TotalGrossProfit fixedpoint.Value + TotalProfit fixedpoint.Value + TotalUnrealizedProfit fixedpoint.Value + func ReadSummaryReport(filename string) (*SummaryReport, error)