Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
stocks-exchange-client
Advanced tools
Readme
STEX (former Stocks.Exchange) provides all the core exchange functionality, and additional merchant tools available via the HTTP API where all returned messages are in JSON. It's much easier to work with the API by using one of the clients provided by STEX, so while this page describes the API in case you want or need to build your own client, the examples use the Node JS client.
The base URL for all the requests other than public methods is
https://api3.stex.com
To get started with the Node JS API client, here's a snippet for creating a client with existing credentials:
In order to use the API functions, you must have an API key and API secret, which is generated in the user profile.
npm install stocks-exchange-client --save
After install use for example this code!
const StocksExchange = require('stocks-exchange-client').client;
const option = {
client: {
id: '',
secret: ''
},
tokenObject: {
'access_token': '',
'refresh_token': '',
},
accessTokenUrl: 'https://api3.stex.com/oauth/token',
scope: 'trade profile reports withdrawal',
};
const se = new StocksExchange(option, null);
se.subscribeOrderFillCreated(702,function (res) {
console.log('subscribeOrderFillCreated', res);
});
se.subscribeGlassTotalChanged(702, 'buy', function (res) {
console.log('subscribeGlassTotalChanged', res);
});
se.subscribeGlassRowChanged(702, 'sell', function (res) {
console.log('subscribeGlassRowChanged', res);
});
se.subscribeBestPriceChanged(702, 'ask', function (res) {
console.log('subscribeBestPriceChanged', res);
});
se.subscribeCandleChanged(702, '1', function (res) {
console.log('subscribeCandleChanged', res);
});
se.subscribeBalanceChanged(1, function (res) {
console.log('subscribeBalanceChanged', res);
});
se.subscribeUserOrder(0, 702, 'sell', function (res) {
console.log('subscribeUserOrder', res);
});
se.subscribeUserOrderDeleted(0, 702, function (res) {
console.log('subscribeUserOrderDeleted', res);
});
se.subscribeUserOrderFillCreated(0, 702, function (res) {
console.log('subscribeUserOrderFillCreated', res);
});
const StocksExchange = require('stocks-exchange-client').client;
const option = {
client: {
id: '',
secret: ''
},
tokenObject: {
'access_token': '',
'refresh_token': '',
},
accessTokenUrl: 'https://api3.stex.com/oauth/token',
scope: 'push',
};
const se = new StocksExchange(option, null);
// Get general information about the current user
se.profileInfo(function (res) {
console.log(res);
});
//Get a list of user wallets
se.profileWallets({
sort:'DESC',
sortBy: 'BALANCE'
}, function (res) {
console.log(res);
});
//Single wallet information
se.profileWalletsById(0, function (res) {
console.log(res);
});
//Create a wallet for given currency
se.newProfileWalletsByCurrencyId(0, function (res) {
console.log(res);
});
//Get deposit address for given wallet
se.profileWalletsAddressById(0, function (res) {
console.log(res);
});
//Create new deposit address
se.newProfileWalletsAddressById(0, function (res) {
console.log(res);
});
//Get a list of deposits made by user
se.profileDeposits({
sort:'DESC',
limit: 100
}, function (res) {
console.log(res);
});
//Get deposit by id
se.profileDepositsById(0, function (res) {
console.log(res);
});
//Get a list of withdrawals made by user
se.profileWithdrawals({
sort:'DESC',
limit: 100
}, function (res) {
console.log(res);
});
//Get withdrawal by id
se.profileWithdrawalsById(0, function (res) {
console.log(res);
});
//Create withdrawal request
se.createProfileWithdrawals(0, 1, 'test', null,function (res) {
console.log(res);
});
//Cancel unconfirmed withdrawal
se.profileWithdrawalCancelById(0, function (res) {
console.log(res);
});
//Get past orders
se.reportsOrders({
orderStatus:'ALL',
limit: 100
}, function (res) {
console.log(res);
});
//Get specified order details
se.reportsOrdersById(0, function (res) {
console.log(res);
});
//List your currently open orders
se.tradingOrders(function (res) {
console.log(res);
});
//Delete all active orders
se.deleteAllTradingOrders(function (res) {
console.log(res);
});
//List your currently open orders for given currency pair
se.tradingOrdersById(756, function (res) {
console.log(res);
});
//Delete active orders for given currency pair
se.deleteTradingOrdersById(756, function (res) {
console.log(res);
});
//Create new order and put it to the orders processing queue
se.createTradingOrdersById(0, {
type: 'SELL',
amount: 1,
price: 1
}, function (res) {
console.log(res);
});
//Get a single order
se.tradingOrderByOrderId(53518170, function (res) {
console.log(res);
});
//Cancel order
se.cancelTradingOrderByOrderId(0, function (res) {
console.log(res);
});
//Test API is working and get server time
se.publicPing(function (res) {
console.log(res);
});
//A list of candles for given currency pair
se.publicChart(756, '1D', {
limit: 100,
timeStart: 1514805801,
timeEnd: new Date().getTime()
}, function (res) {
console.log(res);
});
//Orderbook for given currency pair
se.publicOrderbook(756, {
limit_bids: 100,
limit_asks: 100
}, function (res) {
console.log(res);
});
//Trades for given currency pair
se.publicTrades(756, {
sort: 'DESC',
from: 1514805801,
till: new Date().getTime(),
limit: 100
}, function (res) {
console.log(res);
});
//Ticker for currency pair
se.publicTicker(756 , function (res) {
console.log(res);
});
//Tickers list for all currency pairs
se.allPublicTicker( function (res) {
console.log(res);
});
//Get currency pair information
se.publicCurrencyPairsById(756, function (res) {
console.log(res);
});
//Available currency pairs
se.publicCurrencyPairsListByCode('BTC', function (res) {
console.log(res);
});
//Available markets
se.publicMarkets(function (res) {
console.log(res);
});
//Get currency info
se.publicCurrencyById(1, function (res) {
console.log(res);
});
//Available Currencies
se.publicCurrency(function (res) {
console.log(res);
});
const StocksExchange = require('stocks-exchange-client').client;
const option = {
tokenObject: {
'access_token': '<access_token_hash>',
},
accessTokenUrl: 'https://api3.stex.com/oauth/token',
scope: 'profile trade withdrawal reports push settings',
s2s:true
};
const se = new StocksExchange(option, null);
FAQs
STEX (former Stocks.Exchange) provides all the core exchange functionality, and additional merchant tools available via the HTTPS API where all returned messages are in JSON. It's much easier to work with the API by using one of the clients provided by St
The npm package stocks-exchange-client receives a total of 7 weekly downloads. As such, stocks-exchange-client popularity was classified as not popular.
We found that stocks-exchange-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.