Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stakecube-node-sdk

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stakecube-node-sdk

The official StakeCube.net API SDK for Node.js

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

StakeCube-Node-SDK

The official StakeCube API SDK for Node.js - Available on NPM!

Install

NPM: npm i stakecube-node-sdk

...or clone via git and import the module yourself!

Setup

To start using the StakeCube SDK, import the module in the format you prefer below:

let SC = require('stakecube-node-sdk');

or...

import { login, getAccount, ... } from 'stakecube-node-sdk';

After installing the module, grab your API Key and Secret from your StakeCube API interface, to use private APIs with this package, you'll have to call the below method:

// Example code
let SC = require('stakecube-node-sdk');
SC.login("your_api_key", "your_secret");

Then you're ready to roll!


Usage

Note: If you're looking for Advanced REST API documentation, please use this document from DevCube!

Login

Authenticates with your StakeCube account via API Key + Secret, this will allow you to use Private APIs.

  • Method: login(key, secret);
ParameterDescriptionExample
(required) keythe SC account's API keyN/A
(required) secretthe SC account's SecretN/A

Example:

SC.login("api_key", "secret"); // result: 'true'

Get Arbitrage Info

Gets arbitrage information for a chosen coin ticker.

  • Method: getArbitrageInfo(ticker);
ParameterDescriptionExample
(required) tickerthe ticker of a coinSCC

Example:

SC.getArbitrageInfo("SCC").then(res => { console.log(res) }); // result: { 'coingecko-provided market info object' }

Get Markets

Gets a list of all StakeCube markets under the chosen base market, optionally sorted by volume or change, but by default sorted alphabetically.

  • Method: getMarkets(base, orderBy);
ParameterDescriptionExample
(required) basethe chosen base coinBTC
(optional) orderBythe ordering of the listvolume or change

Example:

SC.getMarkets("SCC", "volume").then(res => { console.log(res) }); // result: { SCC_BTC: {}, DASH_BTC: {} ... }

Get OHLC Data

Gets an array of the last 500 candles for the chosen market pair and interval.

  • Method: getOhlcData(market, interval);
ParameterDescriptionExample
(required) marketthe chosen market pairSCC_BTC
(required) intervalthe per-candle timeframe / period1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1mo

Example:

SC.getOhlcData("SCC_BTC", "1d").then(res => { console.log(res) }); // result: { depth: { asks: [], bids: []}, lines: [], trades: [] }

Get MineCube Info

Gets the current real-time info for MineCube, such as total and available workers, the price of workers, and the payouts-in-progress status.

  • Method: getMineCubeInfo();

Example:

SC.getMineCubeInfo().then(res => { console.log(res) }); // result: { totalWorker: 123, workerAvailable: 100, ... }

Get MineCube Miners

Gets a list of all Miners belonging to MineCube, you may optionally specify a coin to see miners for only that coin, such as 'ETH' which uses AMD GPUs, or 'DASH' which uses StrongU ASICs.

  • Method: getMineCubeMiners(coin);

Example:

SC.getMineCubeMiners().then(res => { console.log(res) }); // result: { BTC: { minerCount: 200, miner: [ ... ], ... }, DASH: ...  }

Get Rate Limits

Gets the current global StakeCube rate-limits for APIs.

  • Method: getRatelimits();

Example:

SC.getRatelimits().then(res => { console.log(res) }); // result: [ { rate_limit_type: "REQUEST_WEIGHT", interval: "DAY" ... } ... ]

Get Trades

Returns the last trades of a specified market pair, optionally with a custom results limit.

  • Method: getTrades(market);
ParameterDescriptionExample
(required) marketthe chosen market pairSCC_BTC
(optional) limitthe maximum returned trades100

Example:

SC.getTrades("SCC_BTC").then(res => { console.log(res) }); // result: [ { direction: "BUY", amount: "1.23", price: ... } ... ]

Get Orderbook

Gets the orderbook of a chosen market, optionally a specified side, but by default will load both orderbook sides.

  • Method: getOrderbook(market);
ParameterDescriptionExample
(required) marketthe chosen market pairSCC_BTC
(optional) sidethe orderbook sidebuy or sell

Example:

SC.getOrderbook("SCC_BTC").then(res => { console.log(res) }); // result: { asks: [], bids: [] }

Private APIs

These APIs require you to be logged-in with an API key of sufficient permissions to perform the private action, for example, withdrawals will work on any key with the Withdrawals Permission enabled, order placing/cancelling will work on a key with "Full Permissions", but will not work on a "Read only" key, be aware of this and customize your keys accordingly for security!

To login, please use the login(key, secret); method provided by the SDK, and key/secret provided by the StakeCube v3 API Dashboard.


Get Account (Auth Required)

Returns general information about your StakeCube account, including wallets, balances, fee-rate in percentage and your account username.

  • Method: getAccount();

Example:

SC.login("your_key", "your_secret"); // result: true
SC.getAccount().then(res => { console.log(res) }); // result: { user: "JSKitty", exchangeFee: 0.05, wallets: [ ... ], ... }

Withdraw (Auth Required)

Creates a withdrawal request with a specified coin, address and amount.

  • Method: withdraw(ticker, address, amount);
ParameterDescriptionExample
(required) tickerthe withdrawal coinSCC
(required) addressthe withdrawal addresssWdSgX...
(required) amountthe withdrawal amount1.23

Example:

SC.login("your_key", "your_secret"); // result: true
SC.withdraw("SCC", "sWdSgX...", 1.23).then(res => { console.log(res) }); // result: { success: true }

Get Open Orders (Auth Required)

Returns a list of all open orders for all StakeCube Exchange markets.

  • Method: getOpenOrders();

Example:

SC.login("your_key", "your_secret"); // result: true
SC.getOpenOrders().then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", id: 123, side: "BUY", ... }, ... ]

Get My Trades (Auth Required)

Returns a list of all trades, you can leave the market empty ("") to return all trades, or specify a market such as "SCC_BTC" to return those market orders, you may also specify a limit of the amount of returned trades, of which the default is 100 trades.

  • Method: getMyTrades(market, limit);
ParameterDescriptionExample
(optional) marketthe market pairSCC_BTC
(optional) limitthe maximum returned trades100

Example:

SC.login("your_key", "your_secret"); // result: true
SC.getMyTrades().then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", id: 123, direction: "BUY", ... }, ... ]

Get Order History (Auth Required)

Returns a list of all orders from a specified market such as "SCC_BTC", you may also specify a limit of the amount of returned orders, of which the default is 100 orders.

  • Method: getOrderHistory(market, limit);
ParameterDescriptionExample
(required) marketthe market pairSCC_BTC
(optional) limitthe maximum returned trades100

Example:

SC.login("your_key", "your_secret"); // result: true
SC.getOrderHistory("SCC_BTC").then(res => { console.log(res) }); // result: [ { market: "SCC_BTC", type: "MARKET", side: "BUY", ... }, ... ]

Post Order (Auth Required)

Creates an exchange order for the specified market pair, orderbook side, price and amount.

  • Method: postOrder(market, side, price, amount);
ParameterDescriptionExample
(required) marketthe market pairSCC_BTC
(required) sidethe trade sideBUY
(required) pricethe price in the base coin0.00002000 (BTC)
(required) amountthe amount of the trade coin1000 (SCC)

Example:

SC.login("your_key", "your_secret"); // result: true
SC.postOrder("SCC_BTC", "BUY", 0.00002000, 1000).then(res => { console.log(res) }); // result: { orderId: 123, executedAmount: 0, fills: [], ... }

Cancel Order (Auth Required)

Cancels an open order by it's orderId

  • Method: cancel(orderId);
ParameterDescriptionExample
(required) orderIdthe ID of your order123

Example:

SC.login("your_key", "your_secret"); // result: true
SC.cancel(123).then(res => { console.log(res) }); // result: { originalAmount: 1000, executedAmount: 0, canceledAmount: 0.02, ... }

Cancel All (Auth Required)

Cancels all orders in a specified market pair.

  • Method: cancelAll(market);
ParameterDescriptionExample
(required) marketthe market pairSCC_BTC

Example:

SC.login("your_key", "your_secret"); // result: true
SC.cancelAll("SCC_BTC").then(res => { console.log(res) }); // result: [ { originalAmount: 1000, executedAmount: 0, canceledAmount: 0.02, ... }, ... ]

Set MineCube Payout Coin (Auth Required)

Sets a coin as the preferred payout coin to receive upon future MineCube payouts.

  • Method: setMineCubePayoutCoin(coin);
ParameterDescriptionExample
(required) cointhe MineCube payout coinSCC

Example:

SC.login("your_key", "your_secret"); // result: true
SC.setMineCubePayoutCoin("SCC").then(res => { console.log(res) }); // result: { success: true, ... }

Buy MineCube Workers (Auth Required)

Buys a specified amount of MineCube workers using the chosen payment method.

  • Method: buyMineCubeWorkers(method, workers);
ParameterDescriptionExample
(required) methodthe payment methodSCC or CREDITS
(required) workersthe worker quantity10

Example:

SC.login("your_key", "your_secret"); // result: true
SC.buyMineCubeWorkers("SCC", 10).then(res => { console.log(res) }); // result: { success: true, ... }

Keywords

FAQs

Package last updated on 30 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc