![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@evanshortiss/bittrex.js
Advanced tools
No nonsense Bittrex API wrapper for Node.js and Browsers, written in TypeScript
Lightweight JavaScript wrapper for the Bittrex API, written in TypeScript.
crypto
module when used with Node.js to greatly improve
performance of HMAC generation vs. other modules.npm install @evanshortiss/bittrex.js --save
This is a Node.js example using ES5 syntax, but you can use ES6 and TypeScript too.
'use strict'
const Bittrex = require('@evanshortiss/bittrex.js')
const client = new Bittrex.RestClient({
apikey: 'YOUR KEY GOES HERE',
apisecret: 'YOUR KEY GOES HERE'
})
function getBalances () {
return client.getBalances()
.then((balances) => {
// Do something with your account balance information
})
}
To use this library you'll need to get an API Key and Secret from the Settings screen of your Bittrex account.
You can read the specific details for API credentials on the Bittrex Developers Guide. It's just a single paragraph - read it. It's important to understand the permission levels.
All responses from this module are true to the original format specified in the Bittrex API docs - no magic, classes, or odd stuff here!
As an example, the /public/getticker
endpoint returns this format:
{
"success" : true,
"message" : "",
"result" : {
"Bid" : 2.05670368,
"Ask" : 3.35579531,
"Last" : 3.35579531
}
}
Using the RestClient.getTicker()
function of this module you'll be returned
the result
Object as shown. This is the same for all other functions.
client.getTicker('BTC', 'LTC')
.then((result) => {
// Result will be:
// {
// "Bid" : 2.05670368,
// "Ask" : 3.35579531,
// "Last" : 3.35579531
// }
})
To use this module in a browser you need to run a single script. There's potential to make this more streamlined in the future.
Here are the steps:
$ git clone git@github.com:evanshortiss/bittrex.js.git bittrex.js
$ cd bittrex.js
$ npm install
$ npm run browserify
This will produce a file at dist/bittrex.js
that you can add to your project.
You can require('@evanshortiss/bittrex.js')
it, or access it via
window.Bittrex
.
Since this module is written in TypeScript it works great in other TypeScript projects and offers intellisense in VSCode, even if you don't use TypeScript.
import * as Bittrex from 'bittrex.js'
const client = new Bittrex.RestClient({
apikey: 'YOUR KEY GOES HERE',
apisecret: 'YOUR KEY GOES HERE'
})
async function getBalances () {
const balances = await client.getBalances()
return balances
}
Internally this module uses the debug
module for logging. If you'd like to
enable logging just run your program with the environment variable DEBUG
set
to bittrex.js:*
.
For example, on macOS or Linux you can run:
$ DEBUG=bittrex.js:* node your-app.js
This is only available for TypeScript users. Use these to interact with the types used by this module.
import * as Bittrex from 'bittrex.js'
// Ensure only Bittrex API currency Objects can be pushed to the array
const tickers: Models.Currency = []
const client = new Bittrex.RestClient({
apikey: 'YOUR API KEY'
apisecret: 'YOUR API SECRET'
})
const btc = await client.getTicker('btc')
tickers.push(btc)
This is a subclass of the standard JavaScript Error that will be thrown if the
Bittrex API returns an unexpected status code (anything besides HTTP 200), or if
the success
field in their response JSON is not set to true
.
Sample usage:
import * as Bittrex from 'bittrex.js'
const client = new Bittrex.RestClient({
apikey: 'YOUR KEY'
apisecret: 'YOUR SECRET'
})
client.getMarkets()
.then((markets) => doSomethingWithMarkets(markets))
.then((result) => doSomethingElse(result))
.catch((e) => {
if (e instanceof Bittrex.RestApiError) {
console.log('bittrex api returned an error', e)
} else {
console.log('some other type of error occurred', e)
}
})
The RestClient allows you to perform HTTPS requests against the Bittrex API. It supports the following options:
v1.1
RestClient behaviours:
result
entry from Bittrex API responses
to save you the trouble of continuously typing response.result
..catch()
function on promises and try/catch
if using Async/Await.All of the following functions and the returned data types are detailed in the
Bittrex API docs. For details of the types shown below visit the src/models
folder in this repo and the Bittrex API docs.
Optional parameters are denoted using the ?
character.
Perform a HTTPS request to the Bittrex API. You should only provide the relative
path, e.g /public/getmarkets
since this library will create the fully formed
url.
Resolves the Promise with an AxiosResponse Object.
// Example call to the Bittrex API
client.http('/public/getmarkets', { timeout: 5000 })
.then((result) => {})
.catch((error) => {})
You probably won't need to use this much, but if you need to make a custom request to the Bittrex API this will allow you to do so.
Returns a result like that shown below. This is the result
field from the
Bittrex API documentation as mentioned previosuly.
client.getMarkets()
.then((markets) => {
// Markets be an Array of Market Objects similar to this:
// [
// {
// "MarketCurrency": "LTC",
// "BaseCurrency": "BTC",
// "MarketCurrencyLong": "Litecoin",
// "BaseCurrencyLong": "Bitcoin",
// "MinTradeSize": 0.01,
// "MarketName": "BTC-LTC",
// "IsActive": true,
// "Created": "2014-02-13T00:00:00"
// },
// {
// "MarketCurrency": "DOGE",
// "BaseCurrency": "BTC",
// "MarketCurrencyLong": "Dogecoin",
// "BaseCurrencyLong": "Bitcoin",
// "MinTradeSize": 100,
// "MarketName": "BTC-DOGE",
// "IsActive": true,
// "Created": "2014-02-13T00:00:00"
// }
// ]
})
.catch(errorHandler)
Returns a summary for the given pair. tickerA
and tickerB
are combined to
form a pair, e.g BTC-LTC
or similar.
The Bittrex API actually returns an Array for this call, but this function returns an Object since the Array returned by Bittrex always contains just one entry.
client.getMarketSummary('btc', 'ltc')
.then((summary) => {
// Summary will be an Object like so:
// {
// "MarketName": "BTC-LTC",
// "High": 0.02,
// "Low": 0.01790001,
// "Volume": 320125.18706995,
// "Last": 0.01966999,
// "BaseVolume": 6117.00242171,
// "TimeStamp": "2017-12-19T21:21:56.16",
// "Bid": 0.0196,
// "Ask": 0.01966999,
// "OpenBuyOrders": 5598,
// "OpenSellOrders": 4891,
// "PrevDay": 0.01812,
// "Created": "2014-02-13T00:00:00"
// }
})
FAQs
No nonsense Bittrex API wrapper for Node.js and Browsers, written in TypeScript
The npm package @evanshortiss/bittrex.js receives a total of 1 weekly downloads. As such, @evanshortiss/bittrex.js popularity was classified as not popular.
We found that @evanshortiss/bittrex.js 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.