-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from coinranking/feat/bitfxt
feat: bitfxt driver
- Loading branch information
Showing
3 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const Driver = require('../models/driver'); | ||
const request = require('../lib/request'); | ||
const Ticker = require('../models/ticker'); | ||
const { parseToFloat } = require('../lib/utils.js'); | ||
|
||
/** | ||
* @memberof Driver | ||
* @augments Driver | ||
*/ | ||
class Bitfxt extends Driver { | ||
/** | ||
* @augments Driver.fetchTickers | ||
* @returns {Promise.Array<Ticker>} Returns a promise of an array with tickers. | ||
*/ | ||
async fetchTickers() { | ||
const pairs = await request('https://bitfxt.com/api/v1/ticker'); | ||
|
||
return Object.keys(pairs).map((pair) => { | ||
const [base, quote] = pair.split('_'); | ||
const ticker = pairs[pair]; | ||
|
||
return new Ticker({ | ||
base, | ||
quote, | ||
close: parseToFloat(ticker.last_price), | ||
baseVolume: parseToFloat(ticker.base_volume), | ||
quoteVolume: parseToFloat(ticker.quote_volume), | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = Bitfxt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
[ | ||
{ | ||
"scope": "https://bitfxt.com:443", | ||
"method": "GET", | ||
"path": "/api/v1/ticker", | ||
"body": "", | ||
"status": 200, | ||
"response": { | ||
"BTC_NGN": { | ||
"last_price": "4311157.44000000", | ||
"quote_volume": "12933472.32000000", | ||
"base_volume": "0.00255532" | ||
}, | ||
"BMCT_BTC": { | ||
"last_price": "0.00059000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BMCT_NGN": { | ||
"last_price": "4000.00000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BKY_NGN": { | ||
"last_price": "0.01000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"ETH_BTC": { | ||
"last_price": "0.02765600", | ||
"quote_volume": "0.12873026", | ||
"base_volume": "-0.00800000" | ||
}, | ||
"DASH_BTC": { | ||
"last_price": "0.00760600", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"EOS_BTC": { | ||
"last_price": "0.00027570", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"FLASH_BTC": { | ||
"last_price": "0.00000040", | ||
"quote_volume": "0.00000319", | ||
"base_volume": "57756.00000000" | ||
}, | ||
"BXT_NGN": { | ||
"last_price": "5.69000000", | ||
"quote_volume": "18.37000000", | ||
"base_volume": "131.89915053" | ||
}, | ||
"ARDOR_BTC": { | ||
"last_price": "0.00000647", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BMT_BTC": { | ||
"last_price": "0.00065000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BMT_NGN": { | ||
"last_price": "2499.00000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BPY_NGN": { | ||
"last_price": "458.78000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"TAT_BTC": { | ||
"last_price": "0.00000160", | ||
"quote_volume": "0.00005386", | ||
"base_volume": "41122.29964181" | ||
}, | ||
"TAT_ETH": { | ||
"last_price": "0.00000800", | ||
"quote_volume": "0.00018100", | ||
"base_volume": "769.66920797" | ||
}, | ||
"TAT_NGN": { | ||
"last_price": "0.30000000", | ||
"quote_volume": "1851.91000000", | ||
"base_volume": "196567.22564375" | ||
}, | ||
"TAT_BPY": { | ||
"last_price": "0.02000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"BNB_NGN": { | ||
"last_price": false, | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"DGB_BTC": { | ||
"last_price": "0.00000222", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"DGB_NGN": { | ||
"last_price": "9.61000000", | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
}, | ||
"DGB_BPY": { | ||
"last_price": false, | ||
"quote_volume": 0, | ||
"base_volume": 0 | ||
} | ||
}, | ||
"rawHeaders": [ | ||
"Date", | ||
"Thu, 23 Jul 2020 11:46:30 GMT", | ||
"Content-Type", | ||
"text/html; charset=UTF-8", | ||
"Transfer-Encoding", | ||
"chunked", | ||
"Connection", | ||
"keep-alive", | ||
"Set-Cookie", | ||
"__cfduid=df035614b094c9a1ad9fc9107a703faff1595504790; expires=Sat, 22-Aug-20 11:46:30 GMT; path=/; domain=.bitfxt.com; HttpOnly; SameSite=Lax", | ||
"Set-Cookie", | ||
"csrf_bvue_cfd=71fbdd0c6efaf7aeb068928f713eab6a; expires=Thu, 23-Jul-2020 13:46:30 GMT; Max-Age=7200; path=/", | ||
"Set-Cookie", | ||
"ci_session=30c8c39415b4a2fe2cd5b4c0d9f8713af943052c; expires=Thu, 23-Jul-2020 13:46:30 GMT; Max-Age=7200; path=/; HttpOnly", | ||
"Expires", | ||
"Thu, 19 Nov 1981 08:52:00 GMT", | ||
"Cache-Control", | ||
"no-store, no-cache, must-revalidate, post-check=0, pre-check=0", | ||
"Pragma", | ||
"no-cache", | ||
"Vary", | ||
"Accept-Encoding", | ||
"CF-Cache-Status", | ||
"DYNAMIC", | ||
"cf-request-id", | ||
"041d18232b00009139ff207200000001", | ||
"Expect-CT", | ||
"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", | ||
"Server", | ||
"cloudflare" | ||
], | ||
"responseIsBinary": false | ||
} | ||
] |