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
e0c2ec51
Commit
e0c2ec51
authored
Sep 22, 2018
by
zihan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复processAmount的bug
parent
de4676a9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
kucoinCollector.js
kucoinCollector.js
+4
-2
No files found.
kucoinCollector.js
View file @
e0c2ec51
...
@@ -161,15 +161,17 @@ class BiboxCollector extends BaseCollector{
...
@@ -161,15 +161,17 @@ class BiboxCollector extends BaseCollector{
}
}
processAmount
(
fromCurrency
,
toCurrency
,
amount
){
processAmount
(
fromCurrency
,
toCurrency
,
amount
){
//有可能会由于数值过小,传进来的amount被表示为科学计数法法
//有可能会由于数值过小,传进来的amount被表示为科学计数法法
const
symbolDetail
=
this
.
_getSymbolDetail
(
fromCurrency
,
toCurrency
);
const
currency
=
symbolDetail
.
coinType
;
let
tradePrecision
=
4
;
let
tradePrecision
=
4
;
const
coin
=
coinInfoMap
[
toC
urrency
];
const
coin
=
coinInfoMap
[
c
urrency
];
if
(
coin
){
if
(
coin
){
tradePrecision
=
coin
[
'tradePrecision'
]
||
4
;
tradePrecision
=
coin
[
'tradePrecision'
]
||
4
;
}
}
const
amountStr
=
parseFloat
(
amount
).
toFixed
(
10
);
const
amountStr
=
parseFloat
(
amount
).
toFixed
(
10
);
const
nums
=
amountStr
.
split
(
'.'
);
const
nums
=
amountStr
.
split
(
'.'
);
if
(
nums
.
length
===
2
&&
nums
[
1
].
length
>
tradePrecision
){
if
(
nums
.
length
===
2
&&
nums
[
1
].
length
>
tradePrecision
){
return
nums
[
0
]
+
"."
+
nums
[
1
].
slice
(
0
,
4
);
return
nums
[
0
]
+
"."
+
nums
[
1
].
slice
(
0
,
tradePrecision
);
}
}
return
amount
;
return
amount
;
}
}
...
...
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