Documentation ¶
Index ¶
- Constants
- type Exchange
- func (e Exchange) CancelOrders(ctx context.Context, orders ...types.Order) error
- func (e *Exchange) Done() chan struct{}
- 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) 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) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (createdOrders types.OrderSlice, err error)
- type PriceOrder
- type PriceOrderSlice
- 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 SimplePriceMatching
- func (m *SimplePriceMatching) BuyToPrice(price fixedpoint.Value) (closedOrders []types.Order, trades []types.Trade)
- 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) (closedOrders *types.Order, trades *types.Trade, err error)
- func (m *SimplePriceMatching) SellToPrice(price fixedpoint.Value) (closedOrders []types.Order, trades []types.Trade)
- type Stream
Constants ¶
View Source
const DefaultFeeRate = 0.15 * 0.001
DefaultFeeRate set the fee rate for most cases BINANCE uses 0.1% for both maker and taker
for BNB holders, it's 0.075% for both maker and taker
MAX uses 0.050% for maker and 0.15% for taker
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func NewExchange ¶
func NewExchange(sourceName types.ExchangeName, srv *service.BacktestService, config *bbgo.Backtest) *Exchange
func (Exchange) CancelOrders ¶
func (Exchange) Name ¶
func (e Exchange) Name() types.ExchangeName
func (Exchange) PlatformFeeCurrency ¶
func (Exchange) QueryAccount ¶
func (*Exchange) QueryAccountBalances ¶
func (Exchange) QueryClosedOrders ¶
func (Exchange) QueryDepositHistory ¶
func (Exchange) QueryKLines ¶
func (Exchange) QueryMarkets ¶
func (Exchange) QueryOpenOrders ¶
func (Exchange) QueryTrades ¶
func (Exchange) QueryWithdrawHistory ¶
func (Exchange) SubmitOrders ¶
func (e Exchange) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (createdOrders types.OrderSlice, err error)
type PriceOrder ¶
type PriceOrder struct { Price fixedpoint.Value Order types.Order }
type PriceOrderSlice ¶
type PriceOrderSlice []PriceOrder
func (PriceOrderSlice) Find ¶
func (slice PriceOrderSlice) Find(price fixedpoint.Value, descending bool) (pv PriceOrder, idx int)
FindPriceVolumePair finds the pair by the given price, this function is a read-only operation, so we use the value receiver to avoid copy value from the pointer If the price is not found, it will return the index where the price can be inserted at. true for descending (bid orders), false for ascending (ask orders)
func (PriceOrderSlice) First ¶
func (slice PriceOrderSlice) First() (PriceOrder, bool)
func (PriceOrderSlice) InsertAt ¶
func (slice PriceOrderSlice) InsertAt(idx int, po PriceOrder) PriceOrderSlice
func (PriceOrderSlice) Len ¶
func (slice PriceOrderSlice) Len() int
func (PriceOrderSlice) Less ¶
func (slice PriceOrderSlice) Less(i, j int) bool
func (PriceOrderSlice) Remove ¶
func (slice PriceOrderSlice) Remove(price fixedpoint.Value, descending bool) PriceOrderSlice
func (PriceOrderSlice) Swap ¶
func (slice PriceOrderSlice) Swap(i, j int)
func (PriceOrderSlice) Upsert ¶
func (slice PriceOrderSlice) Upsert(po PriceOrder, descending bool) PriceOrderSlice
type SimplePriceMatching ¶
type SimplePriceMatching struct { Symbol string Market types.Market LastPrice fixedpoint.Value CurrentTime time.Time Account *types.Account MakerCommission int `json:"makerCommission"` TakerCommission int `json:"takerCommission"` // contains filtered or unexported fields }
SimplePriceMatching implements a simple kline data driven matching engine for backtest
func (*SimplePriceMatching) BuyToPrice ¶
func (m *SimplePriceMatching) BuyToPrice(price fixedpoint.Value) (closedOrders []types.Order, trades []types.Trade)
func (*SimplePriceMatching) CancelOrder ¶
func (*SimplePriceMatching) EmitBalanceUpdate ¶
func (m *SimplePriceMatching) EmitBalanceUpdate(balances types.BalanceMap)
func (*SimplePriceMatching) EmitOrderUpdate ¶
func (m *SimplePriceMatching) EmitOrderUpdate(order types.Order)
func (*SimplePriceMatching) EmitTradeUpdate ¶
func (m *SimplePriceMatching) EmitTradeUpdate(trade types.Trade)
func (*SimplePriceMatching) OnBalanceUpdate ¶
func (m *SimplePriceMatching) OnBalanceUpdate(cb func(balances types.BalanceMap))
func (*SimplePriceMatching) OnOrderUpdate ¶
func (m *SimplePriceMatching) OnOrderUpdate(cb func(order types.Order))
func (*SimplePriceMatching) OnTradeUpdate ¶
func (m *SimplePriceMatching) OnTradeUpdate(cb func(trade types.Trade))
func (*SimplePriceMatching) PlaceOrder ¶
func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (closedOrders *types.Order, trades *types.Trade, err error)
func (*SimplePriceMatching) SellToPrice ¶
func (m *SimplePriceMatching) SellToPrice(price fixedpoint.Value) (closedOrders []types.Order, trades []types.Trade)
type Stream ¶
type Stream struct { types.StandardStream // contains filtered or unexported fields }
func (*Stream) SetPublicOnly ¶ added in v1.5.0
func (s *Stream) SetPublicOnly()
Click to show internal directories.
Click to hide internal directories.