Versions in this module Expand all Collapse all v1 v1.16.3 May 28, 2021 v1.16.2 May 28, 2021 v1.16.1 May 28, 2021 Changes in this version + const Active + const All + const Buy + const Closed + const OrderStateCancel + const OrderStateConvert + const OrderStateDone + const OrderStateFailed + const OrderStateFinalizing + const OrderStateWait + const OrderTypeIOCLimit + const OrderTypeLimit + const OrderTypeMarket + const OrderTypePostOnly + const OrderTypeStopLimit + const OrderTypeStopMarket + const ProductionAPIURL + const RewardAirdrop + const RewardCommission + const RewardHolding + const RewardMining + const RewardTrading + const RewardVipRebate + const Sell + const TimestampSince + const UserAgent + var ErrIncorrectBookEntryElementLength = errors.New("incorrect book entry element length") + var ErrMessageTypeNotSupported = errors.New("message type currently not supported") + var SubscribeAction = "subscribe" + var UnsubscribeAction = "unsubscribe" + var WebSocketURL = "wss://max-stream.maicoin.com/ws" + func ParseMessage(payload []byte) (interface{}, error) + func ParseUserEvent(v *fastjson.Value) (interface{}, error) + type Account struct + Balance string + Currency string + Locked string + Type string + type AccountService struct + func (s *AccountService) Account(currency string) (*Account, error) + func (s *AccountService) Accounts() ([]Account, error) + func (s *AccountService) Me() (*UserInfo, error) + func (s *AccountService) NewGetDepositHistoryRequest() *GetDepositHistoryRequest + func (s *AccountService) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest + func (s *AccountService) VipLevel() (*VipLevel, error) + type AccountSnapshotEvent struct + Balances []BalanceMessage + type AccountUpdateEvent struct + Balances []BalanceMessage + type AuthEvent struct + Event string + ID string + Timestamp int64 + type AuthMessage struct + APIKey string + Action string + ID string + Nonce int64 + Signature string + type Balance struct + Available int64 + Currency string + Locked int64 + Total int64 + type BalanceMessage struct + Available string + Currency string + Locked string + func (m *BalanceMessage) Balance() (*types.Balance, error) + type BaseEvent struct + Event string + Timestamp int64 + type BookEntry struct + Price string + Side int + Time time.Time + Volume string + func (e *BookEntry) PriceVolumePair() (pv types.PriceVolume, err error) + type BookEvent struct + Asks []BookEntry + Bids []BookEntry + Channel string + Event string + Market string + Timestamp int64 + func (e *BookEvent) OrderBook() (snapshot types.SliceOrderBook, err error) + func (e *BookEvent) Time() time.Time + type CreateMultiOrderRequest struct + func (r *CreateMultiOrderRequest) AddOrders(orders ...Order) *CreateMultiOrderRequest + func (r *CreateMultiOrderRequest) Do(ctx context.Context) (multiOrderResponse *MultiOrderResponse, err error) + func (r *CreateMultiOrderRequest) GroupID(groupID uint32) *CreateMultiOrderRequest + func (r *CreateMultiOrderRequest) Market(market string) *CreateMultiOrderRequest + type CreateOrderRequest struct + func (r *CreateOrderRequest) ClientOrderID(clientOrderID string) *CreateOrderRequest + func (r *CreateOrderRequest) Do(ctx context.Context) (order *Order, err error) + func (r *CreateOrderRequest) Market(market string) *CreateOrderRequest + func (r *CreateOrderRequest) OrderType(orderType string) *CreateOrderRequest + func (r *CreateOrderRequest) Price(price string) *CreateOrderRequest + func (r *CreateOrderRequest) Side(side string) *CreateOrderRequest + func (r *CreateOrderRequest) StopPrice(price string) *CreateOrderRequest + func (r *CreateOrderRequest) Volume(volume string) *CreateOrderRequest + type Deposit struct + Amount string + Confirmations string + CreatedAt int64 + Currency string + CurrencyVersion string + Fee string + State string + TxID string + UpdatedAt int64 + type ErrorEvent struct + CommandID string + Errors []string + Timestamp int64 + func (e ErrorEvent) Time() time.Time + type ErrorField struct + Code int + Message string + type ErrorResponse struct + Err ErrorField + func ToErrorResponse(response *util.Response) (errorResponse *ErrorResponse, err error) + func (r *ErrorResponse) Error() string + type GetDepositHistoryRequest struct + func (r *GetDepositHistoryRequest) Currency(currency string) *GetDepositHistoryRequest + func (r *GetDepositHistoryRequest) Do(ctx context.Context) (deposits []Deposit, err error) + func (r *GetDepositHistoryRequest) From(from int64) *GetDepositHistoryRequest + func (r *GetDepositHistoryRequest) Limit(limit int) *GetDepositHistoryRequest + func (r *GetDepositHistoryRequest) State(state string) *GetDepositHistoryRequest + func (r *GetDepositHistoryRequest) To(to int64) *GetDepositHistoryRequest + type GetDepositHistoryRequestParams struct + Currency string + From int64 + Limit int + State string + To int64 + type GetWithdrawHistoryRequest struct + func (r *GetWithdrawHistoryRequest) Currency(currency string) *GetWithdrawHistoryRequest + func (r *GetWithdrawHistoryRequest) Do(ctx context.Context) (withdraws []Withdraw, err error) + func (r *GetWithdrawHistoryRequest) From(from int64) *GetWithdrawHistoryRequest + func (r *GetWithdrawHistoryRequest) Limit(limit int) *GetWithdrawHistoryRequest + func (r *GetWithdrawHistoryRequest) State(state string) *GetWithdrawHistoryRequest + func (r *GetWithdrawHistoryRequest) To(to int64) *GetWithdrawHistoryRequest + type GetWithdrawHistoryRequestParams struct + Currency string + From int64 + Limit int + State string + To int64 + type GetWithdrawalAddressesRequest struct + func (r *GetWithdrawalAddressesRequest) Currency(currency string) *GetWithdrawalAddressesRequest + func (r *GetWithdrawalAddressesRequest) Do(ctx context.Context) ([]WithdrawalAddress, error) + type Interval int64 + func ParseInterval(a string) (Interval, error) + type KLine struct + Close float64 + Closed bool + EndTime time.Time + High float64 + Interval string + Low float64 + Open float64 + StartTime time.Time + Symbol string + Volume float64 + func (k KLine) KLine() types.KLine + type KLineEvent struct + Channel string + Event string + KLine KLine + Market string + Timestamp int64 + type KLinePayload struct + Close string + Closed bool + EndTime int64 + High string + LastTradeID int + Low string + Market string + Open string + Resolution string + StartTime int64 + Volume string + func (k KLinePayload) KLine() types.KLine + type MarkerInfo struct + Fee string + FeeCurrency string + OrderID int + type Market struct + BaseUnit string + BaseUnitPrecision int + ID string + MinBaseAmount float64 + MinQuoteAmount float64 + Name string + QuoteUnit string + QuoteUnitPrecision int + type MultiOrderRequestParams struct + Market string + Orders []Order + type MultiOrderResponse []struct + type Options map[string]interface + type Order struct + AveragePrice string + ClientOID string + CreatedAt time.Time + CreatedAtMs int64 + ExecutedVolume string + GroupID uint32 + ID uint64 + InsertedAt time.Time + Market string + OrderType OrderType + Price string + RemainingVolume string + Side string + State OrderState + StopPrice string + TradesCount int64 + Volume string + type OrderCancelAllRequest struct + func (r *OrderCancelAllRequest) Do(ctx context.Context) (orders []Order, err error) + func (r *OrderCancelAllRequest) GroupID(groupID uint32) *OrderCancelAllRequest + func (r *OrderCancelAllRequest) Market(market string) *OrderCancelAllRequest + func (r *OrderCancelAllRequest) Side(side string) *OrderCancelAllRequest + type OrderCancelAllRequestParams struct + GroupID int64 + Market string + Side string + type OrderCancelRequest struct + func (r *OrderCancelRequest) ClientOrderID(id string) *OrderCancelRequest + func (r *OrderCancelRequest) Do(ctx context.Context) error + func (r *OrderCancelRequest) ID(id uint64) *OrderCancelRequest + type OrderCancelRequestParams struct + ClientOrderID string + ID uint64 + type OrderService struct + func (s *OrderService) All(market string, limit, page int, states ...OrderState) ([]Order, error) + func (s *OrderService) Cancel(orderID uint64, clientOrderID string) error + func (s *OrderService) CancelAll(side string, market string) error + func (s *OrderService) Closed(market string, options QueryOrderOptions) ([]Order, error) + func (s *OrderService) Create(market string, side string, volume float64, price float64, orderType string, ...) (*Order, error) + func (s *OrderService) CreateMulti(market string, orders []Order) (*MultiOrderResponse, error) + func (s *OrderService) Get(orderID uint64) (*Order, error) + func (s *OrderService) NewCreateMultiOrderRequest() *CreateMultiOrderRequest + func (s *OrderService) NewCreateOrderRequest() *CreateOrderRequest + func (s *OrderService) NewOrderCancelAllRequest() *OrderCancelAllRequest + func (s *OrderService) NewOrderCancelRequest() *OrderCancelRequest + func (s *OrderService) Open(market string, options QueryOrderOptions) ([]Order, error) + type OrderSnapshotEvent struct + Orders []OrderUpdate + type OrderState string + type OrderStateToQuery int + type OrderType string + type OrderUpdate struct + AveragePrice string + ClientOID string + CreatedAtMs int64 + Event string + ExecutedVolume string + GroupID uint32 + ID uint64 + Market string + OrderType OrderType + Price string + RemainingVolume string + Side string + State OrderState + StopPrice string + TradesCount int64 + Volume string + type OrderUpdateEvent struct + Orders []OrderUpdate + type PrivateRequestParams struct + Nonce int64 + Path string + type PrivateTradeRequest struct + func (r *PrivateTradeRequest) Do(ctx context.Context) (trades []Trade, err error) + func (r *PrivateTradeRequest) From(from int64) *PrivateTradeRequest + func (r *PrivateTradeRequest) Limit(limit int64) *PrivateTradeRequest + func (r *PrivateTradeRequest) Market(market string) *PrivateTradeRequest + func (r *PrivateTradeRequest) Offset(offset int64) *PrivateTradeRequest + func (r *PrivateTradeRequest) OrderBy(orderBy string) *PrivateTradeRequest + func (r *PrivateTradeRequest) Pagination(p bool) *PrivateTradeRequest + func (r *PrivateTradeRequest) Timestamp(t int64) *PrivateTradeRequest + func (r *PrivateTradeRequest) To(to int64) *PrivateTradeRequest + type PublicService struct + func (s *PublicService) KLines(symbol string, resolution string, start time.Time, limit int) ([]KLine, error) + func (s *PublicService) Markets() ([]Market, error) + func (s *PublicService) Ticker(market string) (*Ticker, error) + func (s *PublicService) Tickers() (map[string]Ticker, error) + func (s *PublicService) Timestamp() (serverTimestamp int64, err error) + type PublicTradeEvent struct + Channel string + Event string + Market string + Timestamp int64 + Trades []TradeEntry + func (e *PublicTradeEvent) Time() time.Time + type QueryOrderOptions struct + GroupID int + Limit int + Offset int + type QueryTradeOptions struct + From int64 + Limit int64 + Market string + Offset int + OrderBy string + Page int + Timestamp int64 + To int64 + func (options *QueryTradeOptions) Map() map[string]interface{} + func (options *QueryTradeOptions) Params() url.Values + type RestClient struct + APIKey string + APISecret string + AccountService *AccountService + BaseURL *url.URL + OrderService *OrderService + PublicService *PublicService + RewardService *RewardService + TradeService *TradeService + WithdrawalService *WithdrawalService + func NewRestClient(baseURL string) *RestClient + func NewRestClientWithHttpClient(baseURL string, httpClient *http.Client) *RestClient + func (c *RestClient) Auth(key string, secret string) *RestClient + func (c *RestClient) Do(req *http.Request) (resp *http.Response, err error) + func (c *RestClient) GetTrades(market string, lastTradeID int64) ([]byte, error) + type Reward struct + Amount fixedpoint.Value + CreatedAt Timestamp + Currency string + Note string + State string + Type RewardType + UUID string + func (reward Reward) Reward() (*types.Reward, error) + type RewardService struct + func (s *RewardService) NewRewardsByTypeRequest(pathType RewardType) *RewardsRequest + func (s *RewardService) NewRewardsRequest() *RewardsRequest + type RewardType string + func ParseRewardType(s string) (RewardType, error) + func (t *RewardType) UnmarshalJSON(o []byte) error + func (t RewardType) RewardType() (types.RewardType, error) + type RewardsRequest struct + func (r *RewardsRequest) Currency(currency string) *RewardsRequest + func (r *RewardsRequest) Do(ctx context.Context) (rewards []Reward, err error) + func (r *RewardsRequest) From(from int64) *RewardsRequest + func (r *RewardsRequest) Limit(limit int) *RewardsRequest + func (r *RewardsRequest) To(to int64) *RewardsRequest + type SubscribeOptions struct + Depth int + Resolution string + type Subscription struct + Channel string + Depth int + Market string + Resolution string + type SubscriptionEvent struct + CommandID string + Event string + Subscriptions []Subscription + Timestamp int64 + func (e SubscriptionEvent) Time() time.Time + type Ticker struct + At int64 + Buy string + High string + Last string + Low string + Open string + Sell string + Time time.Time + Volume string + VolumeInBTC string + type Timestamp time.Time + func (t *Timestamp) UnmarshalJSON(o []byte) error + func (t Timestamp) String() string + type Trade struct + CreatedAt int64 + CreatedAtMilliSeconds int64 + Fee string + FeeCurrency string + Funds string + ID uint64 + Info TradeInfo + Market string + MarketName string + OrderID uint64 + Price string + Side string + Volume string + func (t Trade) IsBuyer() bool + func (t Trade) IsMaker() bool + type TradeEntry struct + Price string + Timestamp int64 + Trend string + Volume string + func (e TradeEntry) Time() time.Time + type TradeInfo struct + Ask *MarkerInfo + Bid *MarkerInfo + Maker string + type TradeService struct + func (s *TradeService) NewPrivateTradeRequest() *PrivateTradeRequest + type TradeSnapshot []TradeUpdate + type TradeSnapshotEvent struct + Trades []TradeUpdate + type TradeUpdate struct + Fee string + FeeCurrency string + ID uint64 + Maker bool + Market string + OrderID uint64 + Price string + Side string + Timestamp int64 + Volume string + type TradeUpdateEvent struct + Trades []TradeUpdate + type UserBank struct + Account string + Branch string + Name string + State string + type UserInfo struct + Accounts []Account + Bank *UserBank + CountryCode string + Email string + IdentityNumber string + IsActivated bool + IsFrozen bool + KycApproved bool + KycState string + Level int + Name string + PhoneNumber string + PhoneSet bool + ProfileVerified bool + ReferralCode string + Sn string + Type string + VipLevel int + WithDrawable bool + type VipLevel struct + Current VipLevelSettings + Next VipLevelSettings + type VipLevelSettings struct + Level int + MakerFee float64 + MinimumStakingVolume float64 + MinimumTradingVolume float64 + TakerFee float64 + type WebSocketService struct + Subscriptions []Subscription + func NewWebSocketService(wsURL string, key, secret string) *WebSocketService + func (s *WebSocketService) AddSubscription(subscription Subscription) + func (s *WebSocketService) Auth() error + func (s *WebSocketService) ClearSubscriptions() + func (s *WebSocketService) Close() error + func (s *WebSocketService) Connect(ctx context.Context) error + func (s *WebSocketService) EmitAccountSnapshotEvent(e AccountSnapshotEvent) + func (s *WebSocketService) EmitAccountUpdateEvent(e AccountUpdateEvent) + func (s *WebSocketService) EmitBookEvent(e BookEvent) + func (s *WebSocketService) EmitConnect(conn *websocket.Conn) + func (s *WebSocketService) EmitDisconnect() + func (s *WebSocketService) EmitError(err error) + func (s *WebSocketService) EmitErrorEvent(e ErrorEvent) + func (s *WebSocketService) EmitKLineEvent(e KLineEvent) + func (s *WebSocketService) EmitMessage(message []byte) + func (s *WebSocketService) EmitOrderSnapshotEvent(e OrderSnapshotEvent) + func (s *WebSocketService) EmitOrderUpdateEvent(e OrderUpdateEvent) + func (s *WebSocketService) EmitSubscriptionEvent(e SubscriptionEvent) + func (s *WebSocketService) EmitTradeEvent(e PublicTradeEvent) + func (s *WebSocketService) EmitTradeSnapshotEvent(e TradeSnapshotEvent) + func (s *WebSocketService) EmitTradeUpdateEvent(e TradeUpdateEvent) + func (s *WebSocketService) OnAccountSnapshotEvent(cb func(e AccountSnapshotEvent)) + func (s *WebSocketService) OnAccountUpdateEvent(cb func(e AccountUpdateEvent)) + func (s *WebSocketService) OnBookEvent(cb func(e BookEvent)) + func (s *WebSocketService) OnConnect(cb func(conn *websocket.Conn)) + func (s *WebSocketService) OnDisconnect(cb func()) + func (s *WebSocketService) OnError(cb func(err error)) + func (s *WebSocketService) OnErrorEvent(cb func(e ErrorEvent)) + func (s *WebSocketService) OnKLineEvent(cb func(e KLineEvent)) + func (s *WebSocketService) OnMessage(cb func(message []byte)) + func (s *WebSocketService) OnOrderSnapshotEvent(cb func(e OrderSnapshotEvent)) + func (s *WebSocketService) OnOrderUpdateEvent(cb func(e OrderUpdateEvent)) + func (s *WebSocketService) OnSubscriptionEvent(cb func(e SubscriptionEvent)) + func (s *WebSocketService) OnTradeEvent(cb func(e PublicTradeEvent)) + func (s *WebSocketService) OnTradeSnapshotEvent(cb func(e TradeSnapshotEvent)) + func (s *WebSocketService) OnTradeUpdateEvent(cb func(e TradeUpdateEvent)) + func (s *WebSocketService) Reconnect() + func (s *WebSocketService) Resubscribe() + func (s *WebSocketService) SendSubscriptionRequest(action string) error + func (s *WebSocketService) Subscribe(channel, market string, options SubscribeOptions) + type WebsocketCommand struct + Action string + Subscriptions []Subscription + type Withdraw struct + Amount string + Confirmations int + CreatedAt int64 + Currency string + CurrencyVersion string + Fee string + FeeCurrency string + Notes string + State string + TxID string + UUID string + UpdatedAt int64 + type WithdrawalAddress struct + Address string + Currency string + CurrencyVersion string + ExtraLabel string + IsInternal bool + State string + SygnaUserCode string + SygnaUserType string + SygnaVaspCode string + UUID string + type WithdrawalRequest struct + func (r *WithdrawalRequest) AddressUUID(uuid string) *WithdrawalRequest + func (r *WithdrawalRequest) Amount(amount float64) *WithdrawalRequest + func (r *WithdrawalRequest) Currency(currency string) *WithdrawalRequest + func (r *WithdrawalRequest) Do(ctx context.Context) (*Withdraw, error) + type WithdrawalService struct + func (s *WithdrawalService) NewGetWithdrawalAddressesRequest() *GetWithdrawalAddressesRequest + func (s *WithdrawalService) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest + func (s *WithdrawalService) NewWithdrawalRequest() *WithdrawalRequest