package
1.60.0
Repository: https://github.com/c9s/bbgo.git
Documentation: pkg.go.dev

# Packages

Package mocks is a generated GoMock package.

# Functions

Return series that having all the elements positive.
Add two series, result[i] = a[i] + b[i].
Array extracts elements from the Series to a float64 array, following the order of Index(0..limit) if limit is given, will only take the first limit numbers (a.Index[0..limit]) otherwise will operate on all elements.
similar to pandas.Series.autocorr() function.
Difference between current value and previous, a - a[offset] offset: if not given, offset is 1.
similar to pandas.Series.corr() function.
similar to pandas.Series.cov() function with ddof=0 Compute covariance with Series.
CrossEntropy computes the cross-entropy between the two distributions.
a series cross above b series.
a series cross under b series.
Divid two series, result[i] = a[i] / b[i].
Calculate (a dot b).
Entropy computes the Shannon entropy of a distribution or the distance between two distributions.
Filter function filters Series by using a boolean function.
Calculate the average value of the series if limit is given, will only calculate the average of first limit numbers (a.Index[0..limit]) otherwise will operate on all elements.
Multiple two series, result[i] = a[i] * b[i].
This will make prediction using Linear Regression to get the next cross point Return (offset from latest, crossed value, could cross) offset from latest should always be positive lookback param is to use at most `lookback` points to determine linear regression functions You may also refer to excel's FORECAST function.
Determines the Omega ratio of a strategy See https://en.wikipedia.org/wiki/Omega_ratio for more details @param returns (Series): Series of profit/loss percentage every specific interval @param returnThresholds(float64): threshold for returns filtering @return Omega ratio for give return series and threshold.
ParsePriceVolumeKvSliceJSON parses a JSON array of objects into PriceVolumeSlice [{"Price":...,"Volume":...}, ...].
ParsePriceVolumeSliceJSON tries to parse a 2 dimensional string array into a PriceVolumeSlice [["9000", "10"], ["9900", "10"], ..
Percentage change between current and a prior element, a / a[offset] - 1.
Similar to Array but in reverse order.
Sharpe: Calcluates the sharpe ratio of access returns @param returns (Series): Series of profit/loss percentage every specific interval @param periods (int): Freq.
Sigmoid returns the input values in range of -1 to 1 along the sigmoid or s-shaped curve.
similar to pandas.Series.skew() function.
SoftMax returns the input value in the range of 0 to 1 with sum of all the probabilities being equal to one.
Sortino: Calcluates the sotino ratio of access returns ROI_excess E[ROI] - ROI_risk_free sortino = ---------- = ----------------------- risk sqrt(E[ROI_drawdown^2]) @param returns (Series): Series of profit/loss percentage every specific interval @param riskFreeReturns (float): risk-free return rate of year @param periods (int): Freq.
SortOrdersAscending sorts by creation time ascending-ly.
SortOrdersByPrice sorts by creation time ascending-ly.
SortOrdersDescending sorts by creation time descending-ly.
SortOrdersAscending sorts by update time ascending-ly.
Sub two series, result[i] = a[i] - b[i].
Calculate sum of the series if limit is given, will only sum first limit numbers (a.Index[0..limit]) otherwise will sum all elements.

# Constants

ContractInfoChannel is the contract info provided by the exchange.
created but can not withdraw.
channels for futures.
OrderStatusCanceled means the order is canceled without partially filled or filled.
OrderStatusFilled means the order is fully-filled, it's an end state.
OrderStatusNew means the order is active on the orderbook without any filling.
OrderStatusPartiallyFilled means the order is partially-filled, it's an end state, the order might be canceled in the end.
OrderStatusRejected means the order is not placed successfully, it's rejected by the api.
PriceTypeAsk uses the ask price from the given ticker.
PriceTypeBid uses the bid price from the given ticker.
PriceTypeLast uses the last price from the given ticker.
PriceTypeMid calculates the middle price from the given ticker.
SideTypeBoth is only used for the configuration context.

# Variables

# Structs

BollingerSetting contains the bollinger indicator setting propers Interval, Window and BandWidth.
BookTicker time exists in ftx, not in binance last exists in ftx, not in binance.
The result structure that maps to the crossing result of `CrossOver` and `CrossUnder` Accessible through BoolSeries interface.
ExchangeFee stores the exchange fee rate.
go:generate callbackgen -type Float64Updater.
FuturesUserAsset define cross/isolated futures account asset.
IntervalWindow is used by the indicators.
IsolatedMarginAccount defines isolated user assets of margin account.
IsolatedMarginAsset defines isolated margin asset information, like margin level, liquidation price..
IsolatedUserAsset defines isolated user assets of the margin account.
KLine uses binance's kline as the standard structure.
MarginAccount is for the cross margin account.
MarginUserAsset define user assets of margin account.
PeriodProfitStats defined the profit stats for a period TODO: replace AccumulatedPnL and TodayPnL fields from the ProfitStats struct.
Position stores the position data.
PositionRisk stores the position risk data.
PriceHeartBeat is used for monitoring the price volume update.
Profit struct stores the PnL information.
Super basic Series type that simply holds the float64 data with size limit (the only difference compare to float64slice).
RBNode A red node always has black children.
go:generate callbackgen -type RBTOrderBook.
SeriesBase is a wrapper of the Series interface You can assign a data container that implements the Series interface And this SeriesBase struct provides the implemented methods for manipulating your data.
SliceOrderBook is a general order book structure which could be used for RESTful responses and websocket stream parsing go:generate callbackgen -type SliceOrderBook.
go:generate callbackgen -type StandardStream -interface.
StreamOrderBook receives streaming data from websocket connection and update the order book with mutex lock, so you can safely access it.
SubscribeOptions provides the standard stream options.
SyncGroup is essentially a wrapper around sync.WaitGroup, designed for ease of use.
TODO: Add more stats from the reference: See https://www.metatrader5.com/en/terminal/help/algotrading/testing_report.

# Interfaces

The interface maps to pinescript basic type `series` for bool type Access the internal historical data from the latest to the oldest Index(0) always maps to Last().
CsvFormatter is an interface used for dumping object into csv file.
go:generate mockgen -destination=mocks/mock_exchange.go -package=mocks .
ExchangeOrderQueryService provides an interface for querying the order status via order ID or client order ID go:generate mockgen -destination=mocks/mock_exchange_order_query.go -package=mocks .
go:generate mockgen -destination=mocks/mock_exchange_public.go -package=mocks .
go:generate mockgen -destination=mocks/mock_exchange_trade_history.go -package=mocks .
Float64Indicator is the indicators (SMA and EWMA) that we want to use are returning float64 data.
MarginBorrowRepayService provides repay and borrow actions of an crypto exchange.
MarginHistoryService provides the service of querying loan history and repay history.
The interface maps to pinescript basic type `series` Access the internal historical data from the latest to the oldest Index(0) always maps to Last().
go:generate mockgen -destination=mocks/mock_stream.go -package=mocks .

# Type aliases

Color is the RB Tree color.
Duration.
ExchangeBasic is the new type for replacing the original Exchange interface.
HeartBeat keeps connection alive by sending the ping packet.
LooseFormatTime parses date time string with a wide range of formats.
MarginOrderSideEffectType define side effect type for orders.
OrderMap is used for storing orders by their order id.
OrderType define order type.
SideType define side type of order.
StrategyStatus define strategy status.
Time type implements the driver value for sqlite.
Timestamp is used for parsing unix timestamp (seconds).