Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정홍주
/
Coin-trade-assistant
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
전현진
2021-06-06 17:28:33 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a198cbe5aa20e46340df293b75a6c7b5a44b35cc
a198cbe5
1 parent
37262aaf
Add descending ordered pumpingRatio
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
app.js
index.js
package-lock.json
app.js
View file @
a198cbe
...
...
@@ -6,6 +6,18 @@ var bodyParser = require('body-parser');
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
app
.
use
(
bodyParser
.
json
());
var
sortingArr
=
function
(
data
,
ratio
)
{
return
data
.
sort
(
function
(
first
,
second
)
{
var
a
=
first
[
ratio
];
var
b
=
second
[
ratio
];
return
a
>
b
?
-
1
:
a
<
b
?
1
:
0
;
});
};
app
.
get
(
'/pumping'
,
function
(
req
,
res
)
{
fs
.
readFile
(
'coin_name.txt'
,
'utf8'
,
function
(
err
,
data
){
...
...
@@ -86,7 +98,6 @@ app.get('/pumping', function(req, res) {
coinJson
.
name
=
coinNameArr
[
i
];
coinJson
.
pumpingRatio
=
minArr
[
i
].
tradeVolumePerThreeMin
/
volArr
[
i
].
tradeVolumePerWeek
*
1000000
pumpingArr
.
push
(
coinJson
);
console
.
log
(
coinJson
);
if
(
pumpingArr
.
length
>=
coinNameArr
.
length
)
resolve
(
pumpingArr
);
}
...
...
@@ -95,18 +106,21 @@ app.get('/pumping', function(req, res) {
}
// get
getWeekVolume
().
then
(
function
(
volArr
){
getThreeMinVolume
().
then
(
function
(
minArr
){
getResultArr
(
volArr
,
minArr
).
then
(
function
(
result
){
res
.
send
(
result
);
//console.log(sortingArr(result, "pumpingRatio"));
res
.
send
(
sortingArr
(
result
,
"pumpingRatio"
));
})
})
})
})
})
var
server
=
app
.
listen
(
8082
);
...
...
index.js
View file @
a198cbe
...
...
@@ -8,22 +8,6 @@
// .then(json => console.log(json))
// .catch(err => console.error('error:' + err));
// const url = 'https://api.upbit.com/v1/candles/weeks/?market=' + data + '&count=1';
// var pumpingArr = new Array();
// const options = {method: 'GET', headers: {Accept: 'application/json'}};
// var coinJson = new Object();
// fetch(url, options)
// .then(res => res.json())
// .then(json => {
// coinJson.coin = 'KRW-BTC';
// coinJson.tradeVolume = json[0].candle_acc_trade_volume;
// console.log(coinJson);
// pumpingArr.push(coinJson);
// console.log(pumpingArr);
// })
// .catch(err => console.error('error:' + err));
const
fetch
=
require
(
'node-fetch'
);
const
url
=
'https://api.upbit.com/v1/candles/minutes/1?market=KRW-BTC&count=1'
;
...
...
package-lock.json
View file @
a198cbe
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment