Get Started
Features :
Our API returns the current price of any cryptocurrency and all the trading info (price, vol, open, high, low etc) for the requested pairs. We provide pricing data for 5,300+ coins and 240,000+ currency pairs.
Get daily, hourly and minute historical data, daily data at any given timestamp, daily average price based on hourly vwap and total daily and hourly exchange volume
Installation
$ npm i @mkt-eg/mkt
Price Exchange
Get the current price of any cryptocurrency in any other currency that you need. If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion. If the opposite pair trades we invert it (eg.: BTC-XMR)
Parameters | Value | Default |
---|---|---|
fsym | The cryptocurrency symbol of interest [ Min length - 1] [ Max length - 10] | REQUIRED |
tsyms | Comma separated cryptocurrency symbols list to convert into [ Min length - 1] [ Max length - 500] | REQUIRED |
type | single - multi - full | single |
Full price Request
const { MKT } = require('@mkt-eg/mkt')
const mkt = new MKT(
'bbbc22c3a13c74456a6d4bb7ba5745476ebfdc81c867fc240258122b78eb6a6f'
)
const data = mkt
.exchange({
fsym: 'BTC',
tsyms: 'USD',
type: 'full'
})
.then(response => {
console.log(JSON.stringify(response.data))
})
.catch(error => {
console.log(error)
})
Single/Multi price Request
const { MKT } = require('@mkt-eg/mkt')
const mkt = new MKT(
'bbbc22c3a13c74456a6d4bb7ba5745476ebfdc81c867fc240258122b78eb6a6f'
)
const data = mkt
.exchange({
fsym: 'BTC',
tsyms: 'USD',
type: 'full'
})
.then(response => {
console.log(JSON.stringify(response.data))
})
.catch(error => {
console.log(error)
})
Historical OHLCV
Get open, high, low, close, volumefrom and volumeto from the daily historical data.The values are based on 00:00 GMT time. It uses BTC conversion if data is not available because the coin is not trading in the specified currency. If you want to get all the available historical data, you can use limit=2000 and keep going back in time using the toTs param. You can then keep requesting batches using: &limit=2000&toTs={the earliest timestamp received}.
Parameters | Value | Default |
---|---|---|
fsym | The cryptocurrency symbol of interest [ Min length - 1] [ Max length - 10] | REQUIRED |
tsyms | Comma separated cryptocurrency symbols list to convert into [ Min length - 1] [ Max length - 500] | REQUIRED |
tryConversion | If set to false, it will try to get only direct trading values [ Default - true] | ture |
aggregate | Time period to aggregate the data over (for daily it's days, for hourly it's hours and for minute histo it's minutes) | [ Min - 1] [ Max - 30] [ Default - 1] |
aggregatePredictableTimePeriods | True by default, only used when the aggregate param is also in use. If false it will aggregate based on the current time.If the param is false and the time you make the call is 1pm - 2pm, with aggregate 2, it will create the time slots: ... 9am, 11am, 1pm.If the param is false and the time you make the call is 2pm - 3pm, with aggregate 2, it will create the time slots: ... 10am, 12am, 2pm.If the param is true (default) and the time you make the call is 1pm - 2pm, with aggregate 2, it will create the time slots: ... 8am, 10am, 12pm.If the param is true (default) and the time you make the call is 2pm - 3pm, with aggregate 2, it will create the time slots: ... 10am, 12am, 2pm. [ Default - true] | [ Default - true] |
limit | The number of data points to return | [ Min - 1] [ Max - 2000] [ Default - 100] |
toTs | Returns historical data before that timestamp. If you want to get all the available historical data, you can use limit=2000 and keep going back in time using the toTs param. You can then keep requesting batches using: &limit=2000&toTs={the earliest timestamp received} | 5676767679200 |
sign | If set to true, the server will sign the requests (by default we don't sign them), this is useful for usage in smart contracts | [ Default - false] |
extraParams | he name of your application (we recommend you send it) | [ Min length - 1] [ Max length - 2000] [ Default - NotAvailable] |
allData | Returns all data (only available on histo day) | [ Default - false] |
apiType | Returns all data (only available on histo period) [day - hour - minute] | [Default - day ] |
Historical price OHLCV
const MKT = new module.exports.MKT('bbbc22c3a13c74456a6d4bb7ba5745476ebfdc81c867fc240258122b78eb6a6f')
MKT.historical({
sympolPrice: 'true',
e: 'CCCAGG',
fsym: 'BTC',
tsyms: 'USD',
type: 'single',
aggregate: '1',
aggregatePredictableTimePeriods: true,
limit: 100,
allData: 'false',
extraParams: 'NotAvailable',
sign: 'false',
apiType: 'hour'
}).then((results)=>{
console.log(results.data)
})