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-04 19:47:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
79492b0d26faf69539f3efffe6b8397a2483c3da
79492b0d
1 parent
e62fd7be
최솟값 parameter 추가
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
39 deletions
.gitignore
package-lock.json
package.json
test.js
.gitignore
View file @
79492b0
/node_modules
apikey
test.
js
test.
*
README.md
\ No newline at end of file
...
...
package-lock.json
View file @
79492b0
...
...
@@ -4,6 +4,11 @@
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"@types/node"
:
{
"version"
:
"15.6.1"
,
"resolved"
:
"https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz"
,
"integrity"
:
"sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA=="
},
"accepts"
:
{
"version"
:
"1.3.7"
,
"resolved"
:
"https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz"
,
...
...
@@ -374,6 +379,11 @@
"version"
:
"1.1.2"
,
"resolved"
:
"https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
,
"integrity"
:
"sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"ws"
:
{
"version"
:
"7.4.6"
,
"resolved"
:
"https://registry.npmjs.org/ws/-/ws-7.4.6.tgz"
,
"integrity"
:
"sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="
}
}
}
...
...
package.json
View file @
79492b0
...
...
@@ -13,7 +13,9 @@
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"@types/node"
:
"^15.6.1"
,
"express"
:
"^4.17.1"
,
"node-fetch"
:
"^2.6.1"
"node-fetch"
:
"^2.6.1"
,
"ws"
:
"^7.4.6"
}
}
...
...
test.js
View file @
79492b0
const
express
=
require
(
'express'
);
const
app
=
express
();
const
fetch
=
require
(
'node-fetch'
);
const
api_key
=
'4h4PrjdPl04aplYHbM5xUK1xoGPffEfE'
;
//Delete before commit API ddaro bonae jum.
const
url
=
'https://api.whale-alert.io/v1/status?api_key='
+
api_key
;
const
options
=
{
method
:
'GET'
,
headers
:
{
Accept
:
'application/json'
}};
fetch
(
url
,
options
)
.
then
(
res
=>
res
.
json
())
.
then
(
json
=>
console
.
log
(
json
))
.
catch
(
err
=>
console
.
error
(
'error:'
+
err
));
const
url2
=
'https://api.whale-alert.io/v1/transactions?api_key='
+
api_key
;
function
data_collector
(
data
){
var
ret
=
''
;
var
str
=
''
;
for
(
var
i
=
0
;
i
<
data
.
transactions
.
length
;
i
++
){
str
=
'#'
+
(
i
+
1
)
+
' ChainName: '
+
data
.
transactions
[
i
].
blockchain
+
'\tAmount: '
+
data
.
transactions
[
i
].
amount
+
' USD'
if
(
data
.
transactions
[
i
].
amount
>
1000000
){
str
=
'=====!WARNING!=====\n</br>'
+
str
+
'\n</br>=====!WARNING!====='
console
.
log
(
str
)
}
else
{
console
.
log
(
str
)
}
ret
+=
'</br>'
+
str
;
}
console
.
log
(
data
.
transactions
)
console
.
log
(
typeof
(
data
.
transactions
))
return
ret
;
}
app
.
get
(
'/'
,
function
(
req
,
res
)
{
fetch
(
url2
,
options
)
.
then
(
res
=>
res
.
json
())
.
then
(
json
=>
res
.
send
(
data_collector
(
json
)))
.
catch
(
err
=>
console
.
error
(
'error:'
+
err
));
result
=
""
if
(
req
.
query
.
hi
==
"hi"
){
result
=
"yes!"
}
else
{
result
=
"no!"
}
res
.
send
(
result
)
})
var
server
=
app
.
listen
(
23023
)
\ No newline at end of file
...
...
Please
register
or
login
to post a comment