정홍주

Tracking coin price in binance(KRW)

...@@ -27,12 +27,12 @@ app.get('/price', function(req, res) { ...@@ -27,12 +27,12 @@ app.get('/price', function(req, res) {
27 coinJson.price = json[0].trade_price; 27 coinJson.price = json[0].trade_price;
28 responseList.push(coinJson); 28 responseList.push(coinJson);
29 console.log(i) 29 console.log(i)
30 - if(i>115){ 30 + if(responseList.length>116){
31 resolve(responseList); 31 resolve(responseList);
32 } 32 }
33 }) 33 })
34 .catch(err => console.error('error:' + err)); 34 .catch(err => console.error('error:' + err));
35 - },i*180); 35 + },i*110);
36 })(i); 36 })(i);
37 } 37 }
38 } 38 }
......
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
13 "negotiator": "0.6.2" 13 "negotiator": "0.6.2"
14 } 14 }
15 }, 15 },
16 + "agent-base": {
17 + "version": "4.3.0",
18 + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
19 + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
20 + "requires": {
21 + "es6-promisify": "^5.0.0"
22 + }
23 + },
16 "ajv": { 24 "ajv": {
17 "version": "6.12.6", 25 "version": "6.12.6",
18 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 26 "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
...@@ -42,6 +50,11 @@ ...@@ -42,6 +50,11 @@
42 "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 50 "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
43 "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 51 "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
44 }, 52 },
53 + "async": {
54 + "version": "3.2.0",
55 + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz",
56 + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw=="
57 + },
45 "asynckit": { 58 "asynckit": {
46 "version": "0.4.0", 59 "version": "0.4.0",
47 "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 60 "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
...@@ -65,6 +78,16 @@ ...@@ -65,6 +78,16 @@
65 "tweetnacl": "^0.14.3" 78 "tweetnacl": "^0.14.3"
66 } 79 }
67 }, 80 },
81 + "bignumber.js": {
82 + "version": "9.0.1",
83 + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
84 + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
85 + },
86 + "bluebird": {
87 + "version": "3.7.2",
88 + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
89 + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
90 + },
68 "body-parser": { 91 "body-parser": {
69 "version": "1.19.0", 92 "version": "1.19.0",
70 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 93 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
...@@ -99,11 +122,44 @@ ...@@ -99,11 +122,44 @@
99 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 122 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
100 "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" 123 "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
101 }, 124 },
125 + "call-bind": {
126 + "version": "1.0.2",
127 + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
128 + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
129 + "requires": {
130 + "function-bind": "^1.1.1",
131 + "get-intrinsic": "^1.0.2"
132 + }
133 + },
102 "caseless": { 134 "caseless": {
103 "version": "0.12.0", 135 "version": "0.12.0",
104 "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 136 "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
105 "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 137 "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
106 }, 138 },
139 + "coingecko-api": {
140 + "version": "1.0.10",
141 + "resolved": "https://registry.npmjs.org/coingecko-api/-/coingecko-api-1.0.10.tgz",
142 + "integrity": "sha512-7YLLC85+daxAw5QlBWoHVBVpJRwoPr4HtwanCr8V/WRjoyHTa1Lb9DQAvv4MDJZHiz4no6HGnDQnddtjV35oRA=="
143 + },
144 + "coinmarketcap-api": {
145 + "version": "3.1.1",
146 + "resolved": "https://registry.npmjs.org/coinmarketcap-api/-/coinmarketcap-api-3.1.1.tgz",
147 + "integrity": "sha512-fXTJq3YyiI54m9W0T5CwxQAKEpZqXRZdKbb10Zld/vINfdM83Y8so+m6RVWoJktl8tMIAxCtkVVC5aGwSs1keQ==",
148 + "requires": {
149 + "node-fetch": "^2.6.0",
150 + "qs": "^6.7.0"
151 + },
152 + "dependencies": {
153 + "qs": {
154 + "version": "6.10.1",
155 + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
156 + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
157 + "requires": {
158 + "side-channel": "^1.0.4"
159 + }
160 + }
161 + }
162 + },
107 "combined-stream": { 163 "combined-stream": {
108 "version": "1.0.8", 164 "version": "1.0.8",
109 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 165 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
...@@ -212,6 +268,19 @@ ...@@ -212,6 +268,19 @@
212 "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 268 "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
213 "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 269 "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
214 }, 270 },
271 + "es6-promise": {
272 + "version": "4.2.8",
273 + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
274 + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
275 + },
276 + "es6-promisify": {
277 + "version": "5.0.0",
278 + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
279 + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
280 + "requires": {
281 + "es6-promise": "^4.0.3"
282 + }
283 + },
215 "escape-html": { 284 "escape-html": {
216 "version": "1.0.3", 285 "version": "1.0.3",
217 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 286 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
...@@ -330,6 +399,21 @@ ...@@ -330,6 +399,21 @@
330 "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 399 "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
331 "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 400 "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
332 }, 401 },
402 + "function-bind": {
403 + "version": "1.1.1",
404 + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
405 + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
406 + },
407 + "get-intrinsic": {
408 + "version": "1.1.1",
409 + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
410 + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
411 + "requires": {
412 + "function-bind": "^1.1.1",
413 + "has": "^1.0.3",
414 + "has-symbols": "^1.0.1"
415 + }
416 + },
333 "getpass": { 417 "getpass": {
334 "version": "0.1.7", 418 "version": "0.1.7",
335 "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 419 "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
...@@ -352,6 +436,19 @@ ...@@ -352,6 +436,19 @@
352 "har-schema": "^2.0.0" 436 "har-schema": "^2.0.0"
353 } 437 }
354 }, 438 },
439 + "has": {
440 + "version": "1.0.3",
441 + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
442 + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
443 + "requires": {
444 + "function-bind": "^1.1.1"
445 + }
446 + },
447 + "has-symbols": {
448 + "version": "1.0.2",
449 + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
450 + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
451 + },
355 "http-errors": { 452 "http-errors": {
356 "version": "1.7.2", 453 "version": "1.7.2",
357 "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 454 "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
...@@ -374,6 +471,25 @@ ...@@ -374,6 +471,25 @@
374 "sshpk": "^1.7.0" 471 "sshpk": "^1.7.0"
375 } 472 }
376 }, 473 },
474 + "https-proxy-agent": {
475 + "version": "3.0.1",
476 + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz",
477 + "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==",
478 + "requires": {
479 + "agent-base": "^4.3.0",
480 + "debug": "^3.1.0"
481 + },
482 + "dependencies": {
483 + "debug": {
484 + "version": "3.2.7",
485 + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
486 + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
487 + "requires": {
488 + "ms": "^2.1.1"
489 + }
490 + }
491 + }
492 + },
377 "iconv-lite": { 493 "iconv-lite": {
378 "version": "0.4.24", 494 "version": "0.4.24",
379 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 495 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
...@@ -387,6 +503,11 @@ ...@@ -387,6 +503,11 @@
387 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 503 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
388 "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 504 "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
389 }, 505 },
506 + "ip": {
507 + "version": "1.1.5",
508 + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
509 + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
510 + },
390 "ipaddr.js": { 511 "ipaddr.js": {
391 "version": "1.9.1", 512 "version": "1.9.1",
392 "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 513 "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
...@@ -407,6 +528,14 @@ ...@@ -407,6 +528,14 @@
407 "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 528 "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
408 "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 529 "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
409 }, 530 },
531 + "json-bigint": {
532 + "version": "1.0.0",
533 + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
534 + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
535 + "requires": {
536 + "bignumber.js": "^9.0.0"
537 + }
538 + },
410 "json-schema": { 539 "json-schema": {
411 "version": "0.2.3", 540 "version": "0.2.3",
412 "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 541 "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
...@@ -469,6 +598,11 @@ ...@@ -469,6 +598,11 @@
469 "safe-buffer": "^5.0.1" 598 "safe-buffer": "^5.0.1"
470 } 599 }
471 }, 600 },
601 + "lodash": {
602 + "version": "4.17.21",
603 + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
604 + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
605 + },
472 "lodash.includes": { 606 "lodash.includes": {
473 "version": "4.3.0", 607 "version": "4.3.0",
474 "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", 608 "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
...@@ -547,6 +681,29 @@ ...@@ -547,6 +681,29 @@
547 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 681 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
548 "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 682 "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
549 }, 683 },
684 + "node-binance-api": {
685 + "version": "0.12.5",
686 + "resolved": "https://registry.npmjs.org/node-binance-api/-/node-binance-api-0.12.5.tgz",
687 + "integrity": "sha512-tapf/OCGaMiHrfvOgPu67osXwq03jFq+WtKgDB0XR6uRvSnOf+fMWMsnbyioHcJSXpd3sdcyR5VkjPGZmkUuHw==",
688 + "requires": {
689 + "async": "^3.1.0",
690 + "https-proxy-agent": "^3.0.1",
691 + "json-bigint": "^1.0.0",
692 + "request": "^2.88.0",
693 + "socks-proxy-agent": "^4.0.2",
694 + "string-hash": "^1.1.3",
695 + "url": "^0.11.0",
696 + "ws": "^7.2.0"
697 + }
698 + },
699 + "node-coinmarketcap": {
700 + "version": "0.2.0",
701 + "resolved": "https://registry.npmjs.org/node-coinmarketcap/-/node-coinmarketcap-0.2.0.tgz",
702 + "integrity": "sha512-jbxakP16Qi4mN4+cfEYlyOQeVKqN4DX8+vkNxg2Lw6MohPC/+/xPvPvzXQE4+0grXUVKEhumaZNUjoZIyB6a4w==",
703 + "requires": {
704 + "request": "^2.81.0"
705 + }
706 + },
550 "node-fetch": { 707 "node-fetch": {
551 "version": "2.6.1", 708 "version": "2.6.1",
552 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", 709 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
...@@ -557,6 +714,11 @@ ...@@ -557,6 +714,11 @@
557 "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 714 "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
558 "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 715 "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
559 }, 716 },
717 + "object-inspect": {
718 + "version": "1.10.3",
719 + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz",
720 + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw=="
721 + },
560 "on-finished": { 722 "on-finished": {
561 "version": "2.3.0", 723 "version": "2.3.0",
562 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 724 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
...@@ -604,6 +766,11 @@ ...@@ -604,6 +766,11 @@
604 "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 766 "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
605 "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 767 "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
606 }, 768 },
769 + "querystring": {
770 + "version": "0.2.0",
771 + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
772 + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
773 + },
607 "range-parser": { 774 "range-parser": {
608 "version": "1.2.1", 775 "version": "1.2.1",
609 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 776 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -647,6 +814,25 @@ ...@@ -647,6 +814,25 @@
647 "uuid": "^3.3.2" 814 "uuid": "^3.3.2"
648 } 815 }
649 }, 816 },
817 + "request-promise": {
818 + "version": "4.2.6",
819 + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz",
820 + "integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==",
821 + "requires": {
822 + "bluebird": "^3.5.0",
823 + "request-promise-core": "1.1.4",
824 + "stealthy-require": "^1.1.1",
825 + "tough-cookie": "^2.3.3"
826 + }
827 + },
828 + "request-promise-core": {
829 + "version": "1.1.4",
830 + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
831 + "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
832 + "requires": {
833 + "lodash": "^4.17.19"
834 + }
835 + },
650 "safe-buffer": { 836 "safe-buffer": {
651 "version": "5.2.1", 837 "version": "5.2.1",
652 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 838 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
...@@ -705,6 +891,49 @@ ...@@ -705,6 +891,49 @@
705 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 891 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
706 "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 892 "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
707 }, 893 },
894 + "side-channel": {
895 + "version": "1.0.4",
896 + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
897 + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
898 + "requires": {
899 + "call-bind": "^1.0.0",
900 + "get-intrinsic": "^1.0.2",
901 + "object-inspect": "^1.9.0"
902 + }
903 + },
904 + "smart-buffer": {
905 + "version": "4.1.0",
906 + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz",
907 + "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw=="
908 + },
909 + "socks": {
910 + "version": "2.3.3",
911 + "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz",
912 + "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==",
913 + "requires": {
914 + "ip": "1.1.5",
915 + "smart-buffer": "^4.1.0"
916 + }
917 + },
918 + "socks-proxy-agent": {
919 + "version": "4.0.2",
920 + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz",
921 + "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==",
922 + "requires": {
923 + "agent-base": "~4.2.1",
924 + "socks": "~2.3.2"
925 + },
926 + "dependencies": {
927 + "agent-base": {
928 + "version": "4.2.1",
929 + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
930 + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
931 + "requires": {
932 + "es6-promisify": "^5.0.0"
933 + }
934 + }
935 + }
936 + },
708 "sshpk": { 937 "sshpk": {
709 "version": "1.16.1", 938 "version": "1.16.1",
710 "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 939 "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
...@@ -726,6 +955,16 @@ ...@@ -726,6 +955,16 @@
726 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 955 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
727 "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 956 "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
728 }, 957 },
958 + "stealthy-require": {
959 + "version": "1.1.1",
960 + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
961 + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
962 + },
963 + "string-hash": {
964 + "version": "1.1.3",
965 + "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz",
966 + "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs="
967 + },
729 "toidentifier": { 968 "toidentifier": {
730 "version": "1.0.0", 969 "version": "1.0.0",
731 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 970 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
...@@ -775,6 +1014,22 @@ ...@@ -775,6 +1014,22 @@
775 "punycode": "^2.1.0" 1014 "punycode": "^2.1.0"
776 } 1015 }
777 }, 1016 },
1017 + "url": {
1018 + "version": "0.11.0",
1019 + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz",
1020 + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=",
1021 + "requires": {
1022 + "punycode": "1.3.2",
1023 + "querystring": "0.2.0"
1024 + },
1025 + "dependencies": {
1026 + "punycode": {
1027 + "version": "1.3.2",
1028 + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
1029 + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
1030 + }
1031 + }
1032 + },
778 "utils-merge": { 1033 "utils-merge": {
779 "version": "1.0.1", 1034 "version": "1.0.1",
780 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1035 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
...@@ -799,6 +1054,11 @@ ...@@ -799,6 +1054,11 @@
799 "core-util-is": "1.0.2", 1054 "core-util-is": "1.0.2",
800 "extsprintf": "^1.2.0" 1055 "extsprintf": "^1.2.0"
801 } 1056 }
1057 + },
1058 + "ws": {
1059 + "version": "7.4.6",
1060 + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
1061 + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="
802 } 1062 }
803 } 1063 }
804 } 1064 }
......
...@@ -16,9 +16,14 @@ ...@@ -16,9 +16,14 @@
16 "license": "ISC", 16 "license": "ISC",
17 "dependencies": { 17 "dependencies": {
18 "body-parser": "^1.19.0", 18 "body-parser": "^1.19.0",
19 + "coingecko-api": "^1.0.10",
20 + "coinmarketcap-api": "^3.1.1",
19 "express": "^4.17.1", 21 "express": "^4.17.1",
20 "jsonwebtoken": "^8.5.1", 22 "jsonwebtoken": "^8.5.1",
23 + "node-binance-api": "^0.12.5",
24 + "node-coinmarketcap": "^0.2.0",
21 "node-fetch": "^2.6.1", 25 "node-fetch": "^2.6.1",
22 - "request": "^2.88.2" 26 + "request": "^2.88.2",
27 + "request-promise": "^4.2.6"
23 } 28 }
24 } 29 }
......
...@@ -24,7 +24,7 @@ fs.readFile('coin_name.txt', 'utf8', function(err,data){ ...@@ -24,7 +24,7 @@ fs.readFile('coin_name.txt', 'utf8', function(err,data){
24 console.log(i) 24 console.log(i)
25 }) 25 })
26 .catch(err => console.error('error:' + err)); 26 .catch(err => console.error('error:' + err));
27 - },i*180); 27 + },i*10);
28 })(i); 28 })(i);
29 } 29 }
30 } 30 }
......
...@@ -17,3 +17,14 @@ console.log("끝") ...@@ -17,3 +17,14 @@ console.log("끝")
17 17
18 const list = [1, 2, 3, 4, 5, 6, 7] 18 const list = [1, 2, 3, 4, 5, 6, 7]
19 loop(list) 19 loop(list)
20 +
21 +
22 +// const result = async (list) => {
23 +// for (const data of list) {
24 +// await delay()
25 +// .then(() => console.log(data))
26 +// }
27 +// }
28 +
29 +// const list = [1, 2, 3, 4, 5, 6, 7]
30 +// result(list)
...\ No newline at end of file ...\ No newline at end of file
......
1 +var express = require('express');
2 +const request = require('request');
3 +const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'
4 +const TOKEN = '6lwsXwectIjTZ1NWp6c1t5l8nXaOjWgfeYfTOWNRRTVftaXMb4eSMj2zeficMr4/FWtyPPBuUB120kxZp58bwDilssdU5Uhc4mWz4kCPfcgiEcVwzXUktbYRE3xKAJU1zdYAsZZvI+87KY8qZvaRngdB04t89/1O/w1cDnyilFU='
5 +const fs = require('fs');
6 +const path = require('path');
7 +const HTTPS = require('https');
8 +const domain = "2018102235.oss2021.tk"
9 +const sslport = 23023;
10 +
11 +const fetch = require('node-fetch');
12 +const bodyParser = require('body-parser');
13 +var app = express();
14 +app.use(bodyParser.json());
15 +
16 +app.post('/hook', function(req, res) {
17 + var eventObj = req.body.events[0];
18 + var source = eventObj.source;
19 + var message = eventObj.message;
20 + // request log
21 + console.log('======================', new Date() ,'======================');
22 + console.log('[request]', req.body);
23 + console.log('[request source] ', source);
24 + console.log('[request message]', message);
25 +
26 + fs.readFile('coin_name.txt', 'utf8', function(err,data){
27 + arr = data.split(",");
28 + // console.log(arr);
29 + var responseList = new Array();
30 + function print_coin(){
31 + var promise = new Promise(function(resolve,reject){
32 + for(j=0;j<arr.length/10;j++){
33 + for(i=j*10;i<(j+1)*10;i++){
34 + (function(i){
35 + setTimeout(function(){
36 + const url = 'https://api.upbit.com/v1/candles/minutes/1?market='+arr[i]+'&count=1';
37 + const options = {method: 'GET', headers: {Accept: 'application/json'}};
38 + var coinJson = new Object();
39 + fetch(url, options)
40 + .then(res => res.json())
41 + .then(json => {
42 + coinJson.coin = arr[i];
43 + coinJson.price = json[0].trade_price;
44 + responseList.push(coinJson);
45 + console.log(i)
46 + if(responseList.length>116){
47 + resolve(responseList);
48 + }
49 + })
50 + .catch(err => console.error('error:' + err));
51 + },i*110);
52 + })(i);
53 + }
54 + }
55 +
56 + });
57 + return promise;
58 + }
59 +
60 + request.post(
61 + {
62 + url: TARGET_URL,
63 + headers: {
64 + 'Authorization': `Bearer ${TOKEN}`
65 + },
66 + json: {
67 + "replyToken":eventObj.replyToken,
68 + "messages":[
69 + {
70 + "type":"text",
71 + "text":resList[0].coin
72 + }
73 + ]
74 + }
75 + },(error, response, body) => {
76 + console.log(body)
77 + });
78 + res.sendStatus(200);
79 + })
80 +})
81 +
82 +app.post('/hook', function (req, res) {
83 +
84 + var eventObj = req.body.events[0];
85 + var source = eventObj.source;
86 + var message = eventObj.message;
87 + // request log
88 + console.log('======================', new Date() ,'======================');
89 + console.log('[request]', req.body);
90 + console.log('[request source] ', eventObj.source);
91 + console.log('[request message]', eventObj.message);
92 +
93 +
94 + request.post(
95 + {
96 + url: TARGET_URL,
97 + headers: {
98 + 'Authorization': `Bearer ${TOKEN}`
99 + },
100 + json: {
101 + "replyToken":eventObj.replyToken,
102 + "messages":[
103 + {
104 + "type":"text",
105 + "text":"Hello, user"
106 + },
107 + {
108 +
109 + }
110 + ]
111 + }
112 + },(error, response, body) => {
113 + console.log(body)
114 + });
115 +
116 +
117 + res.sendStatus(200);
118 +});
119 +
120 +try {
121 + const option = {
122 + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
123 + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(),
124 + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(),
125 + };
126 +
127 + HTTPS.createServer(option, app).listen(sslport, () => {
128 + console.log(`[HTTPS] Server is started on port ${sslport}`);
129 + });
130 + } catch (error) {
131 + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
132 + console.log(error);
133 + }
134 +
1 +const fetch = require('node-fetch');
2 +const url = 'https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT';
3 +const options = {method: 'GET', headers: {Accept: 'application/json'}};
4 +const rp = require('request-promise');
5 +const requestOptions = {
6 + method: 'GET',
7 + uri: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest',
8 + qs: {
9 + 'start': '1',
10 + 'limit': '10',
11 + 'convert': 'KRW'
12 + },
13 + headers: {
14 + 'X-CMC_PRO_API_KEY': 'c2f8e0b0-a253-4de3-a63f-9f564c8cdd1f'
15 + },
16 + json: true,
17 + gzip: true
18 +};
19 +fetch(url, options)
20 + .then(res => res.json())
21 + .then(json =>
22 + rp(requestOptions).then(response =>{
23 + var i=0;
24 + while(response.data[i].id !== 825){
25 + i = i+1;
26 + }
27 + console.log('API call response:', json.price*response.data[i].quote.KRW.price);
28 + })
29 +
30 + )
31 + .catch(err => console.error('error:' + err));