Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kucoin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rongjun
kucoin
Commits
bb6f53e4
Commit
bb6f53e4
authored
Oct 10, 2018
by
zihan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
尝试结合rest请求
parent
c470d5d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
kucoinCollector.js
kucoinCollector.js
+7
-11
No files found.
kucoinCollector.js
View file @
bb6f53e4
...
...
@@ -5,7 +5,7 @@ const biboxApi = require('./api_kucoin');
const
IPReader
=
require
(
'./util'
);
const
IPs
=
IPReader
.
allIps
;
let
coinInfoMap
=
null
;
const
totalOrderbook
=
{};
//
const totalOrderbook = {};
const
Strategy3MaxAmountMap
=
{
USDT
:
300
,
BTC
:
0.05
,
...
...
@@ -45,18 +45,14 @@ class BiboxCollector extends BaseCollector{
_subscribeSymbols
(
symbols
,
callback
,
subscribeDepth
){
this
.
_fetchDepthByWebsocket
(
symbols
,
subscribeDepth
,
callback
)
setTimeout
(()
=>
{
this
.
_fetchDepthByRest
(
symbols
,
subscribeDepth
,
callback
);
},
20000
);
}
_fetchDepthByRest
(
symbols
,
depth
,
callback
){
const
restSymbols
=
symbols
;
for
(
let
symbol
of
symbols
){
const
midCurrency
=
symbol
.
split
(
"-"
)[
0
];
if
(
restCurrencies
.
includes
(
midCurrency
)){
restSymbols
.
push
(
symbol
);
}
}
const
perInterval
=
8
;
const
totalInterval
=
perInterval
*
restSymbols
.
length
;
// const IPs = IPReader.allIps;
const
perInterval
=
50
;
const
totalInterval
=
perInterval
*
restSymbols
.
length
+
100
;
setInterval
(()
=>
{
const
sortedSymbols
=
restSymbols
.
sort
(()
=>
{
return
Math
.
random
()
>
0.5
...
...
@@ -74,7 +70,7 @@ class BiboxCollector extends BaseCollector{
const
data
=
result
.
data
;
const
timeStamp
=
data
.
timestamp
;
callback
(
data
.
SELL
.
slice
(
0
,
depth
).
map
((
item
)
=>
[
item
[
0
],
item
[
1
]]),
data
.
BUY
.
slice
(
0
,
depth
).
map
((
item
)
=>
[
item
[
0
],
item
[
1
]]),
symbol
,
timeStamp
);
totalOrderbook
[
symbol
]
=
{
asks
:
data
.
SELL
,
bids
:
data
.
BUY
};
//
totalOrderbook[symbol]={asks:data.SELL,bids:data.BUY};
});
},
i
*
perInterval
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment