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 🙏

© 2026 – Pkg Stats / Ryan Hefner

bittrexjs

v0.0.4

Published

BittrexJS - typescript based library for the Bittrex API https://bittrex.com/

Readme

BittrexJS

A 'strong typed' Bittrex API client written in typescript.

Typed

All methods have typed request parameters and typed responses using interfaces. Even when using the library in javascript, modern IDE's should be able to provide hints and warnings using the accompanied type files.

How to use

Install

npm install bittrexjs

Example

let BittrexClient = require('bittrexjs').Client;

let bittrex = new BittrexClient();

// using promises
bittrex.getLatestCandle('BTC-ETH').then((response) => {
    console.log(response);
});

// using await
(async () => {
    let response = await client.getLatestCandle('BTC-ETH');
    console.log(response);
})()

Result:

{ success: true,
  message: '',
  result: 
   [ { O: 0.07079,
       H: 0.07079,
       L: 0.07079,
       C: 0.07079,
       V: 49.016782,
       T: '2017-09-11T19:20:00',
       BV: 3.46989793 } ] }

Methods

Client.authenticate(apiCredentials: ApiCredentials)

This method authenticates your client so you can reach account specific endpoints.

Store your api keys wisely!

Example

let client = new BittrexClient();

client.authenticate({
    apikey: '',
    apisecret: ''
});

Request Methods

All request methods return a promise with a BittrexResponse.

interface BittrexResponse<T> {
    result: T,
    success: boolean,
    message: string
}

BittrexResponse.result contains the actual payload.

Client.getMarkets()

Retrieve all markets.

Parameters

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | none | |||

Returns

Promise<BittrexResponse<Market[]>>

Example

client.getMarkets().then((response) => {
    let markets = response.result;
    
    console.log(markets);
});

Result:

[{  MarketCurrency: 'RADS',
    BaseCurrency: 'BTC',
    MarketCurrencyLong: 'Radium',
    BaseCurrencyLong: 'Bitcoin',
    MinTradeSize: 1e-8,
    MarketName: 'BTC-RADS',
    IsActive: true,
    Created: '2016-01-26T23:22:16.193',
    Notice: null,
    IsSponsored: null,
    LogoUrl: 'https://bittrexblobstorage.blob.core.windows.net/public/259f6efd-9b21-43cf-9c6b-8f67b94ca092.png' },
  ... ]

Client.getCurrencies()

Retrieve all currencies.

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | none | |||

Returns

Promise<BittrexResponse<Currency[]>>

Example

client.getCurrencies().then((response) => {
    let currencies = response.result;
    
    console.log(currencies);
});

Result:

[{ Currency: 'XRP',
     CurrencyLong: 'Ripple',
     MinConfirmation: 10,
     TxFee: 0.02,
     IsActive: true,
     CoinType: 'RIPPLE',
     BaseAddress: 'rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy',
     Notice: null },
  ... ]

Client.getMarketTicker(market: string)

Retrieve Highest Bid, Lowest Ask and Price of Latest Trade

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH|

Returns

Promise<BittrexResponse<MarketTick>>

Example

let response = await client.getMarketTicker('BTC-ETH');
let marketTick = response.result;

console.log(marketTick);

Result:

{ 
    Bid: 0.0707, 
    Ask: 0.0709, 
    Last: 0.0707 
}

Client.getMarketCandles(market: string, tickInterval: TickInterval = 'FiveMin')

Retrieve OHLCV and BV (Open, High, Low, Close, Volume, Base Volume)

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH| | tickInterval | string (TickInterval) | no (defaults to FiveMin) | options: OneMin, FiveMin, ThirtyMin, hour, day

Returns

Promise<BittrexResponse<Candle[]>

Example

let response = await client.getMarketCandles('BTC-ETH', 'OneMin');
let marketCandles = response.result;

console.log(marketCandles);

Result:

[{ O: 0.0799,
    H: 0.08,
    L: 0.07988,
    C: 0.08,
    V: 148.09106807,
    T: '2017-09-01T20:08:00',
    BV: 11.83406577 },
  ... ]

Client.getLatestCandle(market: string, tickInterval: TickInterval = 'FiveMin')

Retrieve latest OHLCV and BV (Open, High, Low, Close, Volume, Base Volume)

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH| | tickInterval | string (TickInterval) | no (defaults to FiveMin) | options: OneMin, FiveMin, ThirtyMin, hour, day

Returns

Promise<BittrexResponse<Candle[]>

Example

let response = await client.getLatestCandle('BTC-ETH', 'OneMin');
let marketCandles = response.result;

console.log(marketCandles);

Result:

[ { O: 0.070555,
    H: 0.07094,
    L: 0.07055001,
    C: 0.07094,
    V: 12.22247964,
    T: '2017-09-11T18:30:00',
    BV: 0.86240266 } ]

Client.getMarketSummaries()

Retrieve a summary for each market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | none | || |

Returns

Promise<BittrexResponse<MarketSummary[]>>

Example

let response = await client.getMarketSummaries();
let marketSummaries = response.result;

console.log(marketSummaries);

Result:

[ { MarketName: 'BTC-MCO',
    High: 0.00223017,
    Low: 0.00205001,
    Volume: 196683.6355223,
    Last: 0.00213,
    BaseVolume: 416.9640078,
    TimeStamp: '2017-09-11T18:37:28.14',
    Bid: 0.00213001,
    Ask: 0.00214227,
    OpenBuyOrders: 1025,
    OpenSellOrders: 11446,
    PrevDay: 0.0020872,
    Created: '2017-07-02T00:37:16.957' },
  ... ]

Client.getMarketSummary(market: string)

Retrieve a summary for each market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH|

Returns

Promise<BittrexResponse<MarketSummary[]>>

Example

let response = await client.getMarketSummary('BTC-ETH');
let marketSummaries = response.result;

console.log(marketSummaries);

Result:

[ { MarketName: 'BTC-ETH',
    High: 0.07115187,
    Low: 0.06982622,
    Volume: 43389.09963617,
    Last: 0.070699,
    BaseVolume: 3056.27414511,
    TimeStamp: '2017-09-11T18:39:54.32',
    Bid: 0.07059785,
    Ask: 0.070699,
    OpenBuyOrders: 3569,
    OpenSellOrders: 13823,
    PrevDay: 0.07028021,
    Created: '2015-08-14T09:02:24.817' } ]

Client.getOrderbook(market: string, orderBookType: OrderBookType = 'both')

Retrieve a summary for each market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH| | orderBookType | string (OrderBookType) | no (defaults to both) | options: buy, sell, both |

Returns

Promise<BittrexResponse<OrderbookEntry[] | Orderbook>>

'both' returns an orderbook, 'sell' and 'buy' return only a list of quantity-rate pairs.

Example (complete Orderbook)

let response = await client.getOrderbook('BTC-ETH');
let orderbook = response.result;

console.log(orderbook);

Result:

{ buy: 
   [ { Quantity: 0.1, Rate: 0.07059785 },
       ... ],
  sell: 
     [ { Quantity: 1.9251093, Rate: 0.07068 },
       ... ]
}

Example ('buy' orders)

let response = await client.getOrderbook('BTC-ETH', 'buy');
let orderbookentries = response.result;

console.log(orderbookentries);

Result:

[ { Quantity: 0.21277316, Rate: 0.06993263 },
  ... ]

Client.getMarketHistory(market: string)

Retrieve the latest ??? orders for a market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH|

Returns

Promise<BittrexResponse<Trade[]>>

Example

let response = await client.getMarketHistory('BTC-ETH');
let marketHistory = response.result;

console.log(marketHistory);

Result:

[ { Id: 110938880,
    TimeStamp: '2017-09-11T18:43:29.427',
    Quantity: 1.45871041,
    Price: 0.07068,
    Total: 0.10310165,
    FillType: 'PARTIAL_FILL',
    OrderType: 'BUY' },
  { Id: 110938789,
    TimeStamp: '2017-09-11T18:43:10.893',
    Quantity: 0.5179118,
    Price: 0.07050705,
    Total: 0.03651643,
    FillType: 'FILL',
    OrderType: 'SELL' },
  ... ]

Account methods

For the following methods the client needs to be authenticated using client.authenticate(apiCredentials)

Client.buyLimit(market: string, quantity: number, rate: number)

Place limit buy order

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH| | quantity | number|yes| e.g. 0.01 | | rate | number | yes | e.g. 0.07050705 |

Returns

Promise<BittrexResponse<OrderReference[]>>

Client.sellLimit(market: string, quantity: number, rate: number)

Place limit sell order

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string|yes| e.g. BTC-ETH| | quantity | number|yes| e.g. 0.01 | | rate | number | yes | e.g. 0.07050705 |

Returns

Promise<BittrexResponse<OrderReference[]>>

Client.cancel(orderId: string)

Cancel an order

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | orderId | number|yes| e.g. 110938880 |

Returns

Promise<BittrexResponse<OrderReference[]>>

Client.getOpenOrders(market?: string)

Get all open orders for all markets, or for a single market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string |no| e.g. BTC-ETH |

Returns

Promise<BittrexResponse<OpenOrder[]>>

Client.getBalances()

Get all your balances

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | none | || |

Returns

Promise<BittrexResponse<Balance[]>>

Client.getBalance(currency: string)

Get your balance for a single currency

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |yes| e.g. BTC |

Returns

Promise<BittrexResponse<Balance>>

Client.getWithdrawalHistory(currency?: string)

Get all withdrawals or all withdrawals for a single currency

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |no| e.g. BTC |

Returns

Promise<BittrexResponse<Withdrawal[]>>

Client.getWithdrawalHistory(currency?: string)

Get all withdrawals or all withdrawals for a single currency

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |no| e.g. BTC |

Returns

Promise<BittrexResponse<Withdrawal[]>>

Client.getDepositAddress(currency: string)

Get a deposit address for a currency

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |yes| e.g. BTC |

Returns

Promise<BittrexResponse<DepositAddress>>

Client.getDepositHistory(currency?: string)

Get your deposit history for all currencies or for one currency

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |no| e.g. BTC |

Returns

Promise<BittrexResponse<Deposit[]>>

Client.getOrderHistory(market?: string)

Get your order history for all markets or for one market

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | market | string |no| e.g. BTC-ETH |

Returns

Promise<BittrexResponse<Order[]>>

Client.getOrder(orderId: string)

Get an order by id

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | orderId | string |yes| e.g. 12412412 |

Returns

Promise<BittrexResponse<OrderSingle[]>>

Client.withdraw(currency: string, quantity: number, address: string, paymentid?: string)

Withdraw

Parameters

| Name | Type | Required | Description | |-----------|------|----------|-------------| | currency | string |yes| e.g. BTC | | quantity | number|yes| e.g. 0.5 | | address | string|yes| | | paymentid | string|no| An optional description to identify your payment |

Returns

Promise<BittrexResponse<OrderSingle[]>>

Contributing:

git clone https://github.com/stijnbuurman/BittrexJS.git
cd BittrexJS
git checkout -b myfeature master
npm install
gulp

Roadmap

  • Implement Bittrex WebSockets API
  • Implement Bittrex API v2
  • Finalize documentation - add examples for authenticated methods
  • Finalize documentation - add examples for error catching
  • Add 'live build' tool
  • Remove inconsistencies
  • Split client in 'simple' and 'raw'
  • Add tests