Documentation
¶
Index ¶
- Variables
- func NewClientOrderID(originalID string, tags ...string) (clientOrderID string)
- type Exchange
- func (e *Exchange) BorrowMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error
- func (e *Exchange) CancelAllOrders(ctx context.Context) ([]types.Order, error)
- func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err2 error)
- func (e *Exchange) CancelOrdersByGroupID(ctx context.Context, groupID uint32) ([]types.Order, error)
- func (e *Exchange) CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
- func (e *Exchange) DefaultFeeRates() types.ExchangeFee
- func (e *Exchange) IsSupportedInterval(interval types.Interval) bool
- 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) QueryAveragePrice(ctx context.Context, symbol string) (fixedpoint.Value, error)
- func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) ([]types.Order, 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) QueryMarginAssetMaxBorrowable(ctx context.Context, asset string) (amount fixedpoint.Value, err 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) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]types.Trade, error)
- func (e *Exchange) QueryRewards(ctx context.Context, startTime time.Time) ([]types.Reward, 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) (trades []types.Trade, err error)
- func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since, until time.Time) (allWithdraws []types.Withdraw, err error)
- func (e *Exchange) RepayMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error
- func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)
- func (e *Exchange) SupportedInterval() map[types.Interval]int
- func (e *Exchange) Withdraw(ctx context.Context, asset string, amount fixedpoint.Value, address string, ...) error
- type Stream
- func (s *Stream) EmitAccountSnapshotEvent(e max.AccountSnapshotEvent)
- func (s *Stream) EmitAccountUpdateEvent(e max.AccountUpdateEvent)
- func (s *Stream) EmitAdRatioEvent(e max.ADRatioEvent)
- func (s *Stream) EmitAuthEvent(e max.AuthEvent)
- func (s *Stream) EmitBookEvent(e max.BookEvent)
- func (s *Stream) EmitDebtEvent(e max.DebtEvent)
- func (s *Stream) EmitErrorEvent(e max.ErrorEvent)
- func (s *Stream) EmitKLineEvent(e max.KLineEvent)
- func (s *Stream) EmitOrderSnapshotEvent(e max.OrderSnapshotEvent)
- func (s *Stream) EmitOrderUpdateEvent(e max.OrderUpdateEvent)
- func (s *Stream) EmitSubscriptionEvent(e max.SubscriptionEvent)
- func (s *Stream) EmitTradeEvent(e max.PublicTradeEvent)
- func (s *Stream) EmitTradeSnapshotEvent(e max.TradeSnapshotEvent)
- func (s *Stream) EmitTradeUpdateEvent(e max.TradeUpdateEvent)
- func (s *Stream) OnAccountSnapshotEvent(cb func(e max.AccountSnapshotEvent))
- func (s *Stream) OnAccountUpdateEvent(cb func(e max.AccountUpdateEvent))
- func (s *Stream) OnAdRatioEvent(cb func(e max.ADRatioEvent))
- func (s *Stream) OnAuthEvent(cb func(e max.AuthEvent))
- func (s *Stream) OnBookEvent(cb func(e max.BookEvent))
- func (s *Stream) OnDebtEvent(cb func(e max.DebtEvent))
- func (s *Stream) OnErrorEvent(cb func(e max.ErrorEvent))
- func (s *Stream) OnKLineEvent(cb func(e max.KLineEvent))
- func (s *Stream) OnOrderSnapshotEvent(cb func(e max.OrderSnapshotEvent))
- func (s *Stream) OnOrderUpdateEvent(cb func(e max.OrderUpdateEvent))
- func (s *Stream) OnSubscriptionEvent(cb func(e max.SubscriptionEvent))
- func (s *Stream) OnTradeEvent(cb func(e max.PublicTradeEvent))
- func (s *Stream) OnTradeSnapshotEvent(cb func(e max.TradeSnapshotEvent))
- func (s *Stream) OnTradeUpdateEvent(cb func(e max.TradeUpdateEvent))
Constants ¶
This section is empty.
Variables ¶
var SupportedIntervals = map[types.Interval]int{ types.Interval1m: 1 * 60, types.Interval5m: 5 * 60, types.Interval15m: 15 * 60, types.Interval30m: 30 * 60, types.Interval1h: 60 * 60, types.Interval2h: 60 * 60 * 2, types.Interval4h: 60 * 60 * 4, types.Interval6h: 60 * 60 * 6, types.Interval12h: 60 * 60 * 12, types.Interval1d: 60 * 60 * 24, types.Interval3d: 60 * 60 * 24 * 3, }
var Two = fixedpoint.NewFromInt(2)
Functions ¶
func NewClientOrderID ¶ added in v1.17.0
Types ¶
type Exchange ¶
type Exchange struct { types.MarginSettings // contains filtered or unexported fields }
func (*Exchange) BorrowMarginAsset ¶ added in v1.33.0
func (*Exchange) CancelAllOrders ¶ added in v1.5.0
func (*Exchange) CancelOrders ¶
func (*Exchange) CancelOrdersByGroupID ¶ added in v1.5.0
func (*Exchange) CancelOrdersBySymbol ¶ added in v1.5.0
func (*Exchange) DefaultFeeRates ¶ added in v1.33.0
func (e *Exchange) DefaultFeeRates() types.ExchangeFee
DefaultFeeRates returns the MAX VIP 0 fee schedule See also https://max-vip-zh.maicoin.com/
func (*Exchange) IsSupportedInterval ¶ added in v1.38.0
func (*Exchange) Name ¶
func (e *Exchange) Name() types.ExchangeName
func (*Exchange) PlatformFeeCurrency ¶
PlatformFeeCurrency
func (*Exchange) QueryAccount ¶
func (*Exchange) QueryAccountBalances ¶
func (*Exchange) QueryAveragePrice ¶
func (*Exchange) QueryClosedOrders ¶
func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) ([]types.Order, error)
lastOrderID is not supported on MAX
func (*Exchange) QueryDepositHistory ¶
func (*Exchange) QueryKLines ¶
func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error)
QueryKLines returns the klines from the MAX exchange API. The KLine API of the MAX exchange uses inclusive time range
https://max-api.maicoin.com/api/v2/k?market=btctwd&limit=10&period=1×tamp=1620202440 The above query will return a kline that starts with 1620202440 (unix timestamp) without endTime. We need to calculate the endTime by ourself.
func (*Exchange) QueryMarginAssetMaxBorrowable ¶ added in v1.33.0
func (*Exchange) QueryMarkets ¶
func (*Exchange) QueryOpenOrders ¶
func (*Exchange) QueryOrder ¶ added in v1.28.0
func (*Exchange) QueryOrderTrades ¶ added in v1.39.0
func (*Exchange) QueryRewards ¶ added in v1.13.0
func (*Exchange) QueryTicker ¶ added in v1.11.1
func (*Exchange) QueryTickers ¶ added in v1.11.0
func (*Exchange) QueryTrades ¶
func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) (trades []types.Trade, err error)
QueryTrades For MAX API spec start_time and end_time need to be within 3 days without any parameters -> return trades within 24 hours give start_time or end_time -> ignore parameter from_id give start_time or from_id -> order by time asc give end_time -> order by time desc limit should b1 1~1000 For this QueryTrades spec (to be compatible with batch.TradeBatchQuery) give LastTradeID -> ignore start_time (but still can filter the end_time) without any parameters -> return trades within 24 hours
func (*Exchange) QueryWithdrawHistory ¶
func (*Exchange) RepayMarginAsset ¶ added in v1.33.0
func (*Exchange) SubmitOrder ¶ added in v1.40.3
func (*Exchange) SupportedInterval ¶ added in v1.38.0
type Stream ¶
type Stream struct { types.StandardStream types.MarginSettings // contains filtered or unexported fields }