Loopring Exchange
Definition: Loopring Dex Main API for get Exchange Information, L2 Block, ERC20 Token Information, AMM Information, Market Config and so on static and dynamic information
getExchangeInfo
const response = await LoopringAPI.exchangeAPI.getExchangeInfo();
console.log(response);
getTokens
const {tokensMap, coinMap, totalCoinMap, idIndex, addressIndex} =
await LoopringAPI.exchangeAPI.getTokens<any>();
console.log(
"tokenMap:",
tokensMap,
coinMap,
totalCoinMap,
idIndex,
addressIndex
);
getMixMarkets
const {markets, pairs, tokenArr, tokenArrStr, marketArr, marketArrStr} =
await LoopringAPI.exchangeAPI.getMixMarkets();
console.log("markets:", markets);
console.log("pairs:", pairs);
console.log("tokenArr:", tokenArr);
console.log("tokenArrStr:", tokenArrStr);
console.log("marketArr", marketArr);
console.log("marketArrStr", marketArrStr);
getAmmPoolConf
const response = await LoopringAPI.ammpoolAPI.getAmmPoolConf();
console.log(response.ammpools);
console.log(response.pairs);
getAvailableBroker
const result = await LoopringAPI.exchangeAPI.getAvailableBroker();
console.log(result);
getTokenPrices
const response = await LoopringAPI.walletAPI.getTokenPrices({
token: TOKEN_INFO.tokenMap.LRC.address,
});
console.log(response);
getLatestTokenPrices
const response = await LoopringAPI.walletAPI.getLatestTokenPrices();
console.log(response);
getLatestTokenPrices_cny
const response = await LoopringAPI.walletAPI.getLatestTokenPrices({
currency: sdk.Currency.cny,
});
console.log(response);
getWithdrawalAgents
const response = await LoopringAPI.exchangeAPI.getWithdrawalAgents({
tokenId: 1,
amount: "10000000000",
});
console.log(response);
getCandlestick
const response = await LoopringAPI.exchangeAPI.getCandlestick({
market: "LRC-ETH",
interval: sdk.TradingInterval.min15,
limit: 96,
});
console.log(response);
getAccountServices
const response = await LoopringAPI.exchangeAPI.getAccountServices({});
console.log(response);
getExchangeFeeInfo
const response = await LoopringAPI.exchangeAPI.getExchangeFeeInfo<any>();
console.log(response);
console.log(
response.raw_data[sdk.VipCatergory.ORDERBOOK_TRADING_FEES_STABLECOIN]
);
getProtocolPortrait
const response = await LoopringAPI.exchangeAPI.getProtocolPortrait();
console.log(response);
getRecommendedMarkets
const response = await LoopringAPI.exchangeAPI.getRecommendedMarkets();
console.log(response);
getGasPrice
const response = await LoopringAPI.exchangeAPI.getGasPrice();
console.log(response);
getGasPriceRange
const response = await LoopringAPI.exchangeAPI.getGasPriceRange();
console.log(response);
getMarketTrades
const response = await LoopringAPI.exchangeAPI.getMarketTrades<any>({
market: "ETH-USDT",
});
console.log(response.raw_data.trades);
getRelayerCurrentTime
const response = await LoopringAPI.exchangeAPI.getRelayerCurrentTime();
console.log(response);
getFiatPriceUSD
const response = await LoopringAPI.exchangeAPI.getFiatPrice({
legal: "USD",
});
console.log(response);
getFiatPriceCNY
const response = await LoopringAPI.exchangeAPI.getFiatPrice({
legal: "CNY",
});
console.log(response);
getMarkets
const response = await LoopringAPI.exchangeAPI.getMarkets();
console.log(response);
console.log(response.pairs.LRC.tokenList);
console.log(
"hasMarket LRC-ETH:",
sdk.hasMarket(response.marketArr, "LRC-ETH")
);
console.log(
"market 1:",
sdk.getExistedMarket(response.marketArr, "LRC", "ETH")
);
console.log(
"market 2:",
sdk.getExistedMarket(response.marketArr, "ETH", "LRC")
);
getDepth
const response = await LoopringAPI.exchangeAPI.getDepth({
market: "LRC-ETH",
});
console.log(response);
getTicker
const response = await LoopringAPI.exchangeAPI.getTicker({
market: "LRC-ETH",
});
console.log(response);
getAllTickers
const response = await LoopringAPI.exchangeAPI.getAllTickers();
console.log(response);
getMixDepth
const response = await LoopringAPI.exchangeAPI.getMixDepth({
market: "LRC-ETH",
});
console.log(response);
console.log(response.depth.bids);
getMixTicker
const response = await LoopringAPI.exchangeAPI.getMixTicker({
market: ["LRC-ETH", "ETH-USDC", "DAI-USDT"].join(","),
});
console.log(response.tickMap["DAI-USDT"]);
getAllMixTickers
const response: any = await LoopringAPI.exchangeAPI.getAllMixTickers();
console.log(response?.tickMap);
getMixCandlestickAMM
const response = await LoopringAPI.exchangeAPI.getMixCandlestick({
market: "AMM-LRC-ETH",
interval: sdk.TradingInterval.min15,
limit: 96,
});
console.log(response);
});