npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smxt

v1.0.19

Published

A JavaScript library for cryptocurrency trading.

Downloads

52

Readme

SMXT – SiMple eXchange Trading

A JavaScript library for cryptocurrency trading.

We aim to easily link multiple exchanges with one strategy code.


Exchange currently supported

CEX

  • Binance Futures
  • Bitget Futures
  • Bybit Futures (Unified, cross, one-way mode)
  • Okx Futures
  • Gate.io Futures

DEX

  • Orderly Futrues

Install

JavaScript (NPM)

smxt in NPM

npm install smxt
//cjs
var smxt = require('smxt')
console.log(smxt) // print all available exchanges

Documentation

market data

  • initSymbolInfo()
  • getSymbolList()
  • getPrice(symbol)
  • getOrderBook(symbol, limit)
  • getKline(symbol, timeframe, limit)

wallet data

  • getSymbolBalance(symbol)
  • getTotalEquity()

trade function

  • getPosition(symbol)
  • getAllPositions()
  • postOrder(symbol, orderType, side, amount, price, reduceOnly, orderTag)
  • cancelOrder(symbol, orderId)
  • cancelAllOrders(symbol)
  • getPendingOrders(symbol)
  • getAllPendingOrders()
  • getTradeHistory(symbol, limit)
  • getPositionHistory(symbol, limit)
  • setLeverage(symbol, leverage)

For Detail

-> Manual

Usage

initialize

var smxt = require('smxt')

let binance = new smxt.Binance(
    apiKey = "YOUR_API_KEY",
    apiSecret = "YOUR_API_SECERT"
)

let bitget = new smxt.Bitget(
    apiKey = "YOUR_API_KEY",
    apiSecret = "YOUR_API_SECERT",
    passphrase = "YOUR_PASSPHRASE"
)

let bybit = new smxt.Bybit(
    apiKey = "YOUR_API_KEY", 
    apiSecret = "YOUR_API_SECERT"
)

let okx = new smxt.Okx(
    apiKey = "YOUR_API_KEY",
    apiSecret = "YOUR_API_SECERT",
    passphrase = "YOUR_PASSPHRASE"
)

let gateIo = new smxt.GateIo(
    apiKey = "YOUR_API_KEY",
    apiSecret = "YOUR_API_SECERT"
)

let orderly = new smxt.Orderly(
    accountId = "YOUR_ACCOUNT_ID",
    apiSecret = "YOUR_API_SECERT"
)

get wallet data

let totalEquity = await bybit.getTotalEquity()
console.log(totalEquity) // 1000.0

let symbolBalance = await bybit.getSymbolBalance("USDT")
console.log(symbolBalance) // 700.0

get market data

// init symbol info (tick step, qty step, min qty)
await bybit.initSymbolInfo()
console.log(bybit.symbolInfo)
// {
//    BTCUSDT: { amountTick: 0.001, priceTick: 0.1, minValue: 0.001, maxOrderSize: 100, contractValue: 1}
//    ETHUSDT: { amountTick: 1, priceTick: 0.0001, minValue: 1, maxOrderSize: 10000, contractValue: 1}
// }

let timeframe = "1d" // or 4h, 1h, 30m, 15m, 5m, 1m
let kline = await bybit.getKline("ETHUSDT", timeframe)
console.log(kline)
// [
//  {
//     open: 3138.75,
//     high: 3169.63,
//     low: 3126.45,
//     close: 3135.52,
//     volume: 10228.3683,
//     timestamp: 1714003200000
//  },
//  {
//     open: 3219.37,
//     high: 3292.7,
//     low: 3103.04,
//     close: 3138.74,
//     volume: 53623.2576,
//     timestamp: 1713916800000
//  }
// ]

trade function

let orderType = "limit" // or market
let side = "buy" // or sell
let amount = 10
let price = 0.4
let orderId = await bybit.postOrder(
    "XRPUSDT", 
    orderType, 
    side, 
    amount, 
    price
)
console.log(orderId) 

let position = await bybit.getPosition("XRPUSDT")
console.log(position) // 10.0(long) or -10.0(short)

await bybit.cancelAllOrders("XRPUSDT")

Contact Us

For business inquiries: [email protected]