Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Latest commit

 

History

History
773 lines (477 loc) · 17 KB

File metadata and controls

773 lines (477 loc) · 17 KB

DexApiNodejs.MarketApi

All URIs are relative to https://dex-api.coinex.org

Method HTTP request Description
cancelOrder POST /market/cancel-order Cancel the order
cancelTradingPair POST /market/cancel-trading-pair Cancel the trading-pair
createGteOrder POST /market/gte-orders Create GTE order in blockchain
createIocOrder POST /market/ioc-orders Create IOC order in blockchain
createTradingPair POST /market/trading-pairs Create trading-pair in blockchain
getMarketParams GET /market/parameters Get the current market parameters
getOrder GET /market/orders/{order-id} Query order info
getOrders GET /market/orders/account/{address} Query user order-id list
getOrdersInMarket GET /market/orderbook/{stock}/{money} Query trading-pair's orderbook
getTradingPair GET /market/trading-pairs/{stock}/{money} Query trading-pair info
modifyPricePrecision POST /market/price-precision Modify the price precision of the trading pair in the dex
queryCandleStick GET /market/candle-sticks Query market candleStick
queryDeal GET /market/deals Query market deal
queryDepth GET /market/depths Query market depth
queryOrder GET /market/user-orders Query account's order
queryTickers GET /market/tickers Query market tickers
queryTradingPairs GET /market/exist-trading-pairs Query all trading-pair infos in blockchain

cancelOrder

StdTx cancelOrder(orderInfo)

Cancel the order

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let orderInfo = new DexApiNodejs.InlineObject27(); // InlineObject27 | 
apiInstance.cancelOrder(orderInfo).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
orderInfo InlineObject27

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

cancelTradingPair

StdTx cancelTradingPair(info)

Cancel the trading-pair

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let info = new DexApiNodejs.InlineObject28(); // InlineObject28 | 
apiInstance.cancelTradingPair(info).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
info InlineObject28

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createGteOrder

StdTx createGteOrder(orderInfo)

Create GTE order in blockchain

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let orderInfo = new DexApiNodejs.UNKNOWN_BASE_TYPE(); // UNKNOWN_BASE_TYPE | create order tx
apiInstance.createGteOrder(orderInfo).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
orderInfo UNKNOWN_BASE_TYPE create order tx

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createIocOrder

StdTx createIocOrder(orderInfo)

Create IOC order in blockchain

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let orderInfo = new DexApiNodejs.UNKNOWN_BASE_TYPE(); // UNKNOWN_BASE_TYPE | create order tx
apiInstance.createIocOrder(orderInfo).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
orderInfo UNKNOWN_BASE_TYPE create order tx

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createTradingPair

StdTx createTradingPair(info)

Create trading-pair in blockchain

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let info = new DexApiNodejs.UNKNOWN_BASE_TYPE(); // UNKNOWN_BASE_TYPE | Create trading-pair
apiInstance.createTradingPair(info).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
info UNKNOWN_BASE_TYPE Create trading-pair

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getMarketParams

InlineResponse20042 getMarketParams()

Get the current market parameters

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
apiInstance.getMarketParams().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

InlineResponse20042

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOrder

InlineResponse20046 getOrder(orderId)

Query order info

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let orderId = coinex1dmz7e2fddhejdz5n7e3qc5szx3zn2gj3ta8rwj; // String | The order id
apiInstance.getOrder(orderId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
orderId String The order id

Return type

InlineResponse20046

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOrders

InlineResponse20047 getOrders(address)

Query user order-id list

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let address = coinex1dmz7e2fddhejdz5n7e3qc5szx3zn2gj3ta8rwj; // String | The user address
apiInstance.getOrders(address).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
address String The user address

Return type

InlineResponse20047

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOrdersInMarket

InlineResponse20045 getOrdersInMarket(stock, money)

Query trading-pair's orderbook

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let stock = btc; // String | stock symbol
let money = cet; // String | money symbol
apiInstance.getOrdersInMarket(stock, money).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
stock String stock symbol
money String money symbol

Return type

InlineResponse20045

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getTradingPair

InlineResponse20044 getTradingPair(stock, money)

Query trading-pair info

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let stock = btc; // String | stock symbol
let money = cet; // String | money symbol
apiInstance.getTradingPair(stock, money).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
stock String stock symbol
money String money symbol

Return type

InlineResponse20044

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

modifyPricePrecision

StdTx modifyPricePrecision(info)

Modify the price precision of the trading pair in the dex

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let info = new DexApiNodejs.InlineObject26(); // InlineObject26 | 
apiInstance.modifyPricePrecision(info).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
info InlineObject26

Return type

StdTx

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

queryCandleStick

[CandleStick] queryCandleStick(market, timespan, time, sid, count)

Query market candleStick

Query candleStick until to given time

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let market = "market_example"; // String | stock/money
let timespan = "timespan_example"; // String | 1min/1hour/1day
let time = 789; // Number | Unix timestamp
let sid = 789; // Number | Sequence id
let count = 56; // Number | Querier candleStick count limited to 1024
apiInstance.queryCandleStick(market, timespan, time, sid, count).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
market String stock/money
timespan String 1min/1hour/1day
time Number Unix timestamp
sid Number Sequence id
count Number Querier candleStick count limited to 1024

Return type

[CandleStick]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

queryDeal

InlineResponse20056 queryDeal(market, time, sid, count)

Query market deal

Query market deal until to given time

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let market = "market_example"; // String | stock/money
let time = 789; // Number | Unix timestamp
let sid = 789; // Number | Sequence id
let count = 56; // Number | Querier deal count limited to 1024
apiInstance.queryDeal(market, time, sid, count).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
market String stock/money
time Number Unix timestamp
sid Number Sequence id
count Number Querier deal count limited to 1024

Return type

InlineResponse20056

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

queryDepth

InlineResponse20055 queryDepth(market, count)

Query market depth

Query purchases and sales of a market at all price levels

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let market = "market_example"; // String | stock/money
let count = 56; // Number | Querier count limited to 1024
apiInstance.queryDepth(market, count).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
market String stock/money
count Number Querier count limited to 1024

Return type

InlineResponse20055

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

queryOrder

UserOrder queryOrder(account, time, sid, count, opts)

Query account's order

Query account's order activities in all markets until to given time

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let account = "account_example"; // String | Bech32 address
let time = 789; // Number | Unix timestamp
let sid = 789; // Number | Sequence id
let count = 56; // Number | Querier order count limited to 1024
let opts = {
  'token': "token_example", // String | Symbol
  'tag': "tag_example" // String | Filter responses type by tag string create/fill/cancel
};
apiInstance.queryOrder(account, time, sid, count, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
account String Bech32 address
time Number Unix timestamp
sid Number Sequence id
count Number Querier order count limited to 1024
token String Symbol [optional]
tag String Filter responses type by tag string create/fill/cancel [optional]

Return type

UserOrder

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

queryTickers

[Tickers] queryTickers(marketList)

Query market tickers

Query tickers info

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
let marketList = ["null"]; // [String] | Market count limited to 1~100
apiInstance.queryTickers(marketList).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
marketList [String] Market count limited to 1~100

Return type

[Tickers]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

queryTradingPairs

InlineResponse20043 queryTradingPairs()

Query all trading-pair infos in blockchain

Example

import DexApiNodejs from 'dex-api-nodejs';

let apiInstance = new DexApiNodejs.MarketApi();
apiInstance.queryTradingPairs().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

InlineResponse20043

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json