@icgio/icg-utils 1.6.25 → 1.6.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/coingecko.js CHANGED
@@ -8,6 +8,10 @@ let get_coingecko_rates = (cb, pair) => {
8
8
  let [cur, base_cur] = parse_pair(pair)
9
9
  let cur_id = coins_map[cur], vs_cur = ['USDT', 'TUSD', 'PAX', 'BUSD', 'USDK', 'USDC', 'HUSD', 'DAI'].indexOf(base_cur) > -1 ? 'usd' : base_cur.toLowerCase()
10
10
  needle.get(`https://api.coingecko.com/api/v3/simple/price?ids=${cur_id}&vs_currencies=${vs_cur}`, (err, res, body) => {
11
+ if (err) {
12
+ console.error(pair, err)
13
+ return
14
+ }
11
15
  cb(body[cur_id][vs_cur])
12
16
  })
13
17
  return
@@ -91,4 +95,19 @@ let get_coingecko_rates = (cb, pair) => {
91
95
  // console.log(res)
92
96
  // })
93
97
 
98
+ // https://api.coingecko.com/api/v3/coins/list
99
+
100
+ // const _ = require('lodash')
101
+ // needle.get('https://api.coingecko.com/api/v3/coins/list', (err, res, body) => {
102
+ // let list = body
103
+
104
+ // let map = {}
105
+ // for (let line of list) {
106
+ // let cur = line.symbol.toUpperCase()
107
+ // _.set(map, [cur], line.id)
108
+ // }
109
+
110
+ // console.log(JSON.stringify(map, null, 4))
111
+ // })
112
+
94
113
  module.exports = get_coingecko_rates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.6.25",
3
+ "version": "1.6.27",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {