Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Crypto
/
Crypto-auto-trading
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
June
2021-11-06 17:34:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
123de3054872101003b63ce961f4e0a91c4be1a7
123de305
1 parent
5ae08dbf
Get market list & info
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
index.js
index.js
View file @
123de30
const
fetch
=
(...
args
)
=>
import
(
'node-fetch'
).
then
(({
default
:
fetch
})
=>
fetch
(...
args
));
const
url
=
'https://api.upbit.com/v1/market/all'
;
const
options
=
{
method
:
'GET'
,
headers
:
{
Accept
:
'application/json'
}
};
const
express
=
require
(
'express'
);
const
app
=
express
();
async
function
test
()
{
async
function
get_marketName
()
{
var
data
=
new
Array
();
//전체 암호화폐 리스트 불러오기
let
response
=
await
fetch
(
url
,
options
)
.
then
(
res
=>
res
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
console
.
log
(
json
.
length
);
return
json
;
for
(
i
in
json
){
data
.
push
(
json
[
i
].
market
);
}
})
var
hello
=
await
(
await
fetch
(
url
,
options
)).
json
();
return
hello
;
return
data
;
}
app
.
get
(
'/fetch_test'
,
async
(
req
,
res
)
=>
{
res
.
json
(
await
test
());
async
function
get_marketInfo
(
name_list
){
//각 암호화폐 정보 조회
const
url
=
`https://api.upbit.com/v1/ticker/?markets=
${
name_list
}
`
;
var
arr
=
new
Array
();
let
response2
=
await
fetch
(
url
,
options
)
.
then
(
res
=>
res
.
json
())
.
then
(
json
=>
{
for
(
i
in
json
){
if
(
json
[
i
].
acc_trade_price_24h
>
100000000000
){
arr
.
push
([
json
[
i
].
market
,
json
[
i
].
acc_trade_price_24h
,
json
[
i
].
trade_price
]);
}
}
})
return
arr
;
}
app
.
get
(
'/get_market'
,
async
(
req
,
res
)
=>
{
var
name_list
=
(
await
get_marketName
());
var
market_info
=
(
await
get_marketInfo
(
name_list
));
res
.
json
(
market_info
);
})
app
.
listen
(
5000
,()
=>
{
console
.
log
(
'server'
)
...
...
Please
register
or
login
to post a comment