With this api wrapper you can use the nicehash api v2 in node js. You can read the api documentation here: https://www.nicehash.com/docs/rest/.
Run the following code in your npm environment.
npm i --save nicehash-api-wrapper-v2
Now you have to create an api key.
- Go to your API Keys settings in NH.
- Click on "Create new API Key".
- You can now give your key a name and you can select what permissions the key should have.
- Click "Generate API key" and verify it with your OTP.
- Now you have to save your API key and the secret. We will need it later.
- Activate your key with the email code.
This is an example code which will show you your mining address.
const NHApi = require('nicehash-api-wrapper-v2');
const api = new NHApi({apiKey: "your api key", apiSecret: "your api secret", orgId: "your organization Id"});
api.MinerPrivate.getMiningAddress().then((res) => {
console.log(res);
});
Returns the NH-MiningAddress.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-miningAddress
List rigs and their statuses.
Parameter | required | type | default | remark |
---|---|---|---|---|
size | int | 25 | ||
page | int | 0 | ||
path | string | filter by group name | ||
sort | enum | NAME | NAME,PROFITABILITY,ACTIVE,INACTIVE | |
system | enum | NHM,NHOS,NHQM | ||
status | enum | Mining,Offline |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs2
List mining algos with basic statistics for organization (and for rig id if specified).
Parameter | required | type | default | remark |
---|---|---|---|---|
rigid | string |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-algo-stats
List of groups with list of rigs in the groups.
Parameter | required | type | default | remark |
---|---|---|---|---|
extendedResponse | bool | false | shows more informations |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-groups-list
Get statistical streams for selected rigs and selected algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
rigid | * | string | ||
algorithm | int | 20 | id from algorith (20=daggerhashimoto) | |
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig-stats-algo
Get statistical streams for selected rig.
Parameter | required | type | default | remark |
---|---|---|---|---|
rigid | * | string | ||
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig-stats-unpaid
Get mining rig detailed information for selected rig.
Parameter | required | type | default | remark |
---|---|---|---|---|
rigid | * | string |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rig2-rigId
Get a list of active worker.
Parameter | required | type | default | remark |
---|---|---|---|---|
size | int | 100 | ||
page | int | 0 | ||
sortParameter | enum | RIG_NAME | ||
sortDirection | enum | ASC |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-activeWorkers
Get list of payouts.
Parameter | required | type | default | remark |
---|---|---|---|---|
size | int | 10 | ||
page | int | 0 | ||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-payouts
Get statistical streams for all mining rigs for selected algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
algorithm | int | 20 | id of algorithm (20 = daggerhashimoto) | |
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-stats-algo
Get statistical streams for all mining rigs.
Parameter | required | type | default | remark |
---|---|---|---|---|
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-rigs-stats-unpaid
Update status for one or more rigs.
https://www.nicehash.com/docs/rest/post-main-api-v2-mining-rigs-status2
Get balance for selected currency.
Parameter | required | type | default | remark |
---|---|---|---|---|
currency | * | enum | ||
extendedResponse | bool | false |
https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-account2-currency
Get total balance and for each currency separated.
Parameter | required | type | default | remark |
---|---|---|---|---|
extendedResponse | bool | false | ||
fiat | string |
https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-accounts2
Get activities for specified currency matching the filtering criteria as specified by request parameters.
Parameter | required | type | default | remark |
---|---|---|---|---|
currency | * | enum | ||
type | enum | |||
timestamp | timestamp | |||
stage | enum | |||
limit | int | 10 |
https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-activity-currency
Get deposit address for selected currency for all wallet types.
Parameter | required | type | default | remark |
---|---|---|---|---|
currency | * | enum | ||
walletType | enum |
https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-depositAddresses
List of deposit transactions details matching the filtering criteria as specified by request parameters.
Parameter | required | type | default | remark |
---|---|---|---|---|
currency | * | enum | ||
statuses | array | |||
op | enum | LT | ||
timestamp | timestamp | |||
page | int | 0 | ||
size | int | 100 |
https://www.nicehash.com/docs/rest/get-main-api-v2-accounting-deposits-currency
Parameter | required | type | default | remark |
---|---|---|---|---|
btcAddress | * | string | ||
size | int | 25 | ||
page | int | 0 | ||
sort | enum | NAME | [ "NAME", "PROFITABILITY", "ACTIVE", "INACTIVE" ] |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs2
Getting active workers and information about active workers on external miner, such as current mining algorithm, speed, profitability, etc.
Parameter | required | type | default | remark |
---|---|---|---|---|
btcAddress | * | string | ||
size | int | 25 | ||
page | int | 0 | ||
sortParameter | enum | RIG_NAME | [ "RIG_NAME", "TIME", "MARKET", "ALGORITHM", "UNPAID_AMOUNT", "DIFFICULTY", "SPEED_ACCEPTED", "SPEED_REJECTED", "PROFITABILITY" ] | |
sortDirection | enum | ASC | [ "ASC", "DESC" ] |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-activeWorkers
Get statistical streams for all mining rigs with external BTC address for selected algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
btcAddress | * | string | ||
algorithm | int | 20 | id of algorithm (20 = daggerhashimoto) | |
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-stats-algo
Get statistical streams for all mining rigs with external BTC address.
Parameter | required | type | default | remark |
---|---|---|---|---|
btcAddress | * | string | ||
afterTimestamp | int | |||
beforeTimestamp | int |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-stats-unpaid
Parameter | required | type | default | remark |
---|---|---|---|---|
btcAddress | * | string | ||
afterTimestamp | int | |||
size | int | 100 | ||
page | int | 0 |
https://www.nicehash.com/docs/rest/get-main-api-v2-mining-external-btcAddress-rigs-withdrawals
Parameter | required | type | default | remark |
---|---|---|---|---|
op | enum | GT | ||
limit | int | 100 | ||
ts | timestamp | current timestamp | ||
algorithm | enum | |||
status | enum | |||
active | bool | |||
market | enum |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-myOrders
Create hashpower order. Use parameters from API-doc as JSON.
https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order
Get hashpower order detailed information using order id.
Parameter | required | type | default | remark |
---|---|---|---|---|
id | * | order id |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-order-id
Cancel hashpower order using order id.
Parameter | required | type | default | remark |
---|---|---|---|---|
id | * | order id |
https://www.nicehash.com/docs/rest/delete-main-api-v2-hashpower-order-id
When order is active, amount on the order can be increased and prolong duration of active order in marketplace. The limitation for minimal and maximal amount are defined for each algorithm and can be fetched using /main/api/v2/public/buy/info endpoint.
Parameter | required | type | default | remark |
---|---|---|---|---|
id | * | order id | ||
amount | * | int |
https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order-id-refill
Get statistical streams for selected order using order id.
Parameter | required | type | default | remark |
---|---|---|---|---|
id | * | order id | ||
afterTimestamp | timestamp |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-order-id-stats
At any time order speed limit and price can be altered when hashpower order is active. Use parameters from API-doc as JSON.
Parameter | required | type | default | remark |
---|---|---|---|---|
id | * | order id |
https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-order-id-updatePriceAndLimit
Estimated duration of a hashpower order from the order type, amount, price and limit. The maximal value for STANDARD order is 10 days. Use parameters from API-doc as JSON.
https://www.nicehash.com/docs/rest/post-main-api-v2-hashpower-orders-calculateEstimateDuration
Hashpower order book for specified algorithm. Response contains orders for all markest and their stats. When there a lot of orders, response will be paged.
Parameter | required | type | default | remark |
---|---|---|---|---|
algorithm | * | enum | ||
size | int | 100 | ||
page | int | 0 |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orderBook
Get accepted and rejected speeds for rigs and pools, rig count and paying price for selected market and/or algorithm. When no market or algorithm is specified all markets and algorithms are returned.
Parameter | required | type | default | remark |
---|---|---|---|---|
market | enum | |||
algorithm | enum |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orders-summaries
Get accepted and rejected speed from pools and rigs, rig count and paying price for selected market and algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
market | * | enum | ||
algorithm | * | enum |
https://www.nicehash.com/docs/rest/get-main-api-v2-hashpower-orders-summary
Whole history for the selected algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
algorithm | * | enum |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-algo-history
Information for each enabled algorithm needed for buying hashpower.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-buy-info
Get all hashpower orders. Request parameter work as filter to fine tune the result. The result is paged, when needed.
Parameter | required | type | default | remark |
---|---|---|---|---|
algorithm | enum | |||
market | enum | |||
op | enum | |||
timestamp | timestamp | |||
page | int | 0 | ||
size | int | 100 |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-orders
Get information about speed and price for each enabled algorithm.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-simplemultialgo-info
Get average price and hashpower speed for all enabled algorithms in average for past 24 hours.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-stats-global-24h
Get current price and hashpower speed for all enabled algorithms in average for last 5 minutes.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-main-api-v2-public-stats-global-current
Get candlesticks for specified resolution.
Parameter | required | type | default | remark |
---|---|---|---|---|
market | * | enum | ||
to | timestamp | current timestamp | ||
from | timestamp | |||
countBack | int | |||
resolution | int | 1 |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-candlesticks
Get statistics for all markets.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-marketStats
Get list of last prices for all markets.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-prices
Get detailed exchange status information for each market.
Parameter | required | type | default | remark |
---|---|---|---|---|
none |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-status
Get trades for specific market. Limit, sort direction and timestamp can be optionally selected.
Parameter | required | type | default | remark |
---|---|---|---|---|
market | * | enum | ||
sortDirection | enum | DESC | ||
limit | int | 25 | ||
timestamp | timestamp |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-info-trades
Get a list of asks and bids. Limit determines the size of asks and bids lists.
Parameter | required | type | default | remark |
---|---|---|---|---|
market | * | enum | ||
limit | int | 25 |
https://www.nicehash.com/docs/rest/get-exchange-api-v2-orderbook
- implement more endpoints
Feel free to report bugs.