mexcsdk

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 3 Imported by: 0

README

mexc-api-sdk

MEXC Official Market and trade api sdk, easy to connection and send request to MEXC open api !

Table of APIS

Init

//Javascript
import * as Mexc from 'mexc-sdk';
const apiKey = 'apiKey'
const apiSecret = 'apiSecret'
const client = new Mexc.Spot(apiKey, apiSecret);
// Go
package main
import (
	"fmt"
	"mexc-sdk/mexcsdk"
)

func main() {
	apiKey := "apiKey"
	apiSecret := "apiSecret"
	spot := mexcsdk.NewSpot(apiKey, apiSecret)
}
# python
from mexc_sdk import Spot
spot = Spot(api_key='apiKey', apiSecret='apiSecret')
// java
import Mexc.Sdk.*;
class MyClass {
  public static void main(String[] args) {
    String apiKey= "apiKey";
    String apiSecret= "apiSecret";
    Spot mySpot = new Spot(apiKey, apiSecret);
  }
}
// dotnet
using System;
using System.Collections.Generic;
using Mxc.Sdk;

namespace dotnet
{
    class Program
    {
        static void Main(string[] args)
        {
            string  apiKey = "apiKey";
            string  apiSecret= "apiSecret";
            var spot = new Spot(apiKey, apiSecret);
        }
    }
}

Market

Ping
client.ping()
Check Server Time
client.time()
Exchange Information
client.exchangeInfo(options: any)
options:{symbol, symbols}
/**
 * choose one parameter
 *
 * symbol :
 *      example "BNBBTC";
 *
 * symbols :
 *      array of symbol
 *      example ["BTCUSDT","BNBBTC"];
 *
 */
Recent Trades List
client.trades(symbol: string, options: any = { limit: 500 })
options:{limit}
/**
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 */
Order Book
client.depth(symbol: string, options: any = { limit: 100 })
options:{limit}
/**
 * limit :
 *      Number of returned data
 *      Default 100;
 *      max 5000;
 *      Valid:[5, 10, 20, 50, 100, 500, 1000, 5000]
 *
 */
Old Trade Lookup
client.historicalTrades(symbol: string, options: any = { limit: 500 })
options:{limit, fromId}
/**
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 * fromId:
 *      Trade id to fetch from. Default gets most recent trades
 *
 */

Aggregate Trades List
client.aggTrades(symbol: string, options: any = { limit: 500 })
options:{fromId, startTime, endTime, limit}
/**
 *
 * fromId :
 *      id to get aggregate trades from INCLUSIVE
 *
 * startTime:
 *      start at
 *
 * endTime:
 *      end at
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 */
kline Data
client.klines(symbol: string, interval: string, options: any = { limit: 500 })
options:{ startTime, endTime, limit}
/**
 *
 * interval :
 *      m :minute;
 *      h :Hour;
 *      d :day;
 *      w :week;
 *      M :month
 *      example : "1m"
 *
 * startTime :
 *      start at
 *
 * endTime :
 *      end at
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 */
Current Average Price
client.avgPrice(symbol: string)
24hr Ticker Price Change Statistics
client.ticker24hr(symbol?: string)
Symbol Price Ticker
client.tickerPrice(symbol?: string)
Symbol Order Book Ticker
client.bookTicker(symbol?: string)

Trade

Test New Order
client.newOrderTest(symbol: string, side: string, orderType: string, options: any = {})
options:{ timeInForce, quantity, quoteOrderQty, price, newClientOrderId, stopPrice, icebergQty, newOrderRespType, recvWindow}
/**
 *
 * side:
 *      Order side
 *      ENUM:
 *        BUY
 *        SELL
 *
 * orderType:
 *      Order type
 *      ENUM:
 *        LIMIT
 *        MARKET
 *        STOP_LOSS
 *        STOP_LOSS_LIMIT
 *        TAKE_PROFIT
 *        TAKE_PROFIT_LIMIT
 *        LIMIT_MAKER
 *
 * timeInForce :
 *      How long an order will be active before expiration.
 *      GTC: Active unless the order is canceled
 *      IOC: Order will try to fill the order as much as it can before the order expires
 *      FOK: Active unless the full order cannot be filled upon execution.
 *
 * quantity :
 *      target quantity
 *
 * quoteOrderQty :
 *      Specify the total spent or received
 *
 * price :
 *      target price
 *
 * newClientOrderId :
 *      A unique id among open orders. Automatically generated if not sent
 *
 * stopPrice :
 *      sed with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders
 *
 * icebergQty :
 *      Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order
 *
 * newOrderRespType :
 *      Set the response JSON. ACK, RESULT, or FULL;
 *      MARKET and LIMIT order types default to FULL, all other orders default to ACK
 *
 * recvWindow :
 *      Delay accept time
 *      The value cannot be greater than 60000
 *      defaults: 5000
 *
 */

New Order
client.newOrder(symbol: string, side: string, orderType: string, options: any = {})
options:{ timeInForce, quantity, quoteOrderQty, price, newClientOrderId, stopPrice, icebergQty, newOrderRespType, recvWindow}
/**
 *
 * side:
 *      Order side
 *      ENUM:
 *        BUY
 *        SELL
 *
 * orderType:
 *      Order type
 *      ENUM:
 *        LIMIT
 *        MARKET
 *        STOP_LOSS
 *        STOP_LOSS_LIMIT
 *        TAKE_PROFIT
 *        TAKE_PROFIT_LIMIT
 *        LIMIT_MAKER
 *
 * timeInForce :
 *      How long an order will be active before expiration.
 *      GTC: Active unless the order is canceled
 *      IOC: Order will try to fill the order as much as it can before the order expires
 *      FOK: Active unless the full order cannot be filled upon execution.
 *
 * quantity :
 *      target quantity
 *
 * quoteOrderQty :
 *      Specify the total spent or received
 *
 * price :
 *      target price
 *
 * newClientOrderId :
 *      A unique id among open orders. Automatically generated if not sent
 *
 * stopPrice :
 *      sed with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders
 *
 * icebergQty :
 *      Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order
 *
 * newOrderRespType :
 *      Set the response JSON. ACK, RESULT, or FULL;
 *      MARKET and LIMIT order types default to FULL, all other orders default to ACK
 *
 * recvWindow :
 *      Delay accept time
 *      The value cannot be greater than 60000
 *      defaults: 5000
 *
 */

cancel-order
client.cancelOrder(symbol: string, options:any = {})
options:{ orderId, origClientOrderId, newClientOrderId}
/**
 *
 * Either orderId or origClientOrderId must be sent
 *
 * orderId:
 *      target orderId
 *
 * origClientOrderId:
 *      target origClientOrderId
 *
 * newClientOrderId:
 *      Used to uniquely identify this cancel. Automatically generated by default.
 *
 */

Cancel all Open Orders on a Symbol
client.cancelOpenOrders(symbol: string)
Query Order
client.queryOrder(symbol: string, options:any = {})
options:{ orderId, origClientOrderId}
/**
 *
 * Either orderId or origClientOrderId must be sent
 *
 * orderId:
 *      target orderId
 *
 * origClientOrderId:
 *      target origClientOrderId
 *
 */
Current Open Orders
client.openOrders(symbol: string)
All Orders
client.allOrders(symbol: string, options: any = { limit: 500 })
options:{ orderId, startTime, endTime, limit}

/**
 *
 * orderId:
 *      target orderId
 *
 * startTime:
 *      start at
 *
 * endTime:
 *      end at
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 */
Account Information
client.accountInfo()
Account Trade List
client.accountTradeList(symbol: string, options:any = { limit: 500 })
options:{ orderId, startTime, endTime, fromId, limit}

/**
 *
 * orderId:
 *      target orderId
 *
 * startTime:
 *      start at
 *
 * endTime:
 *      end at
 *
 * fromId:
 *      TradeId to fetch from. Default gets most recent trades
 *
 * limit :
 *      Number of returned data
 *      Default 500;
 *      max 1000;
 *
 */

Documentation

Overview

mexc sdk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBase_Override

func NewBase_Override(b Base, apiKey *string, apiSecret *string)

func NewCommon_Override

func NewCommon_Override(c Common, apiKey *string, apiSecret *string)

func NewMarket_Override

func NewMarket_Override(m Market, apiKey *string, apiSecret *string)

func NewSpot_Override

func NewSpot_Override(s Spot, apiKey *string, apiSecret *string)

func NewTrade_Override

func NewTrade_Override(t Trade, apiKey *string, apiSecret *string)

func NewUserData_Override

func NewUserData_Override(u UserData, apiKey *string, apiSecret *string)

Types

type Base

type Base interface {
	Config() interface{}
	SetConfig(val interface{})
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
}

func NewBase

func NewBase(apiKey *string, apiSecret *string) Base

type Common

type Common interface {
	Market
	Config() interface{}
	SetConfig(val interface{})
	AggTrades(symbol *string, options interface{}) interface{}
	AvgPrice(symbol *string) interface{}
	BookTicker(symbol *string) interface{}
	Depth(symbol *string, options interface{}) interface{}
	ExchangeInfo(options interface{}) interface{}
	HistoricalTrades(symbol *string, options interface{}) interface{}
	Klines(symbol *string, interval *string, options interface{}) interface{}
	Ping() interface{}
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
	Ticker24hr(symbol *string) interface{}
	TickerPrice(symbol *string) interface{}
	Time() interface{}
	Trades(symbol *string, options interface{}) interface{}
}

func NewCommon

func NewCommon(apiKey *string, apiSecret *string) Common

type Market

type Market interface {
	Base
	Config() interface{}
	SetConfig(val interface{})
	AggTrades(symbol *string, options interface{}) interface{}
	AvgPrice(symbol *string) interface{}
	BookTicker(symbol *string) interface{}
	Depth(symbol *string, options interface{}) interface{}
	ExchangeInfo(options interface{}) interface{}
	HistoricalTrades(symbol *string, options interface{}) interface{}
	Klines(symbol *string, interval *string, options interface{}) interface{}
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
	Ticker24hr(symbol *string) interface{}
	TickerPrice(symbol *string) interface{}
	Trades(symbol *string, options interface{}) interface{}
}

func NewMarket

func NewMarket(apiKey *string, apiSecret *string) Market

type Spot

type Spot interface {
	Trade
	Config() interface{}
	SetConfig(val interface{})
	AccountInfo() interface{}
	AccountTradeList(symbol *string, options interface{}) interface{}
	AggTrades(symbol *string, options interface{}) interface{}
	AllOrders(symbol *string, options interface{}) interface{}
	AvgPrice(symbol *string) interface{}
	BookTicker(symbol *string) interface{}
	CancelOpenOrders(symbol *string) interface{}
	CancelOrder(symbol *string, options interface{}) interface{}
	Depth(symbol *string, options interface{}) interface{}
	ExchangeInfo(options interface{}) interface{}
	HistoricalTrades(symbol *string, options interface{}) interface{}
	Klines(symbol *string, interval *string, options interface{}) interface{}
	NewOrder(symbol *string, side *string, orderType *string, options interface{}) interface{}
	NewOrderTest(symbol *string, side *string, orderType *string, options interface{}) interface{}
	OpenOrders(symbol *string) interface{}
	Ping() interface{}
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	QueryOrder(symbol *string, options interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
	Ticker24hr(symbol *string) interface{}
	TickerPrice(symbol *string) interface{}
	Time() interface{}
	Trades(symbol *string, options interface{}) interface{}
}

func NewSpot

func NewSpot(apiKey *string, apiSecret *string) Spot

type Trade

type Trade interface {
	UserData
	Config() interface{}
	SetConfig(val interface{})
	AccountInfo() interface{}
	AccountTradeList(symbol *string, options interface{}) interface{}
	AggTrades(symbol *string, options interface{}) interface{}
	AllOrders(symbol *string, options interface{}) interface{}
	AvgPrice(symbol *string) interface{}
	BookTicker(symbol *string) interface{}
	CancelOpenOrders(symbol *string) interface{}
	CancelOrder(symbol *string, options interface{}) interface{}
	Depth(symbol *string, options interface{}) interface{}
	ExchangeInfo(options interface{}) interface{}
	HistoricalTrades(symbol *string, options interface{}) interface{}
	Klines(symbol *string, interval *string, options interface{}) interface{}
	NewOrder(symbol *string, side *string, orderType *string, options interface{}) interface{}
	NewOrderTest(symbol *string, side *string, orderType *string, options interface{}) interface{}
	OpenOrders(symbol *string) interface{}
	Ping() interface{}
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	QueryOrder(symbol *string, options interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
	Ticker24hr(symbol *string) interface{}
	TickerPrice(symbol *string) interface{}
	Time() interface{}
	Trades(symbol *string, options interface{}) interface{}
}

func NewTrade

func NewTrade(apiKey *string, apiSecret *string) Trade

type UserData

type UserData interface {
	Common
	Config() interface{}
	SetConfig(val interface{})
	AccountInfo() interface{}
	AccountTradeList(symbol *string, options interface{}) interface{}
	AggTrades(symbol *string, options interface{}) interface{}
	AvgPrice(symbol *string) interface{}
	BookTicker(symbol *string) interface{}
	Depth(symbol *string, options interface{}) interface{}
	ExchangeInfo(options interface{}) interface{}
	HistoricalTrades(symbol *string, options interface{}) interface{}
	Klines(symbol *string, interval *string, options interface{}) interface{}
	Ping() interface{}
	PublicRequest(method *string, path *string, paramsObj interface{}) interface{}
	SignRequest(method *string, path *string, paramsObj interface{}) interface{}
	Ticker24hr(symbol *string) interface{}
	TickerPrice(symbol *string) interface{}
	Time() interface{}
	Trades(symbol *string, options interface{}) interface{}
}

func NewUserData

func NewUserData(apiKey *string, apiSecret *string) UserData

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL