Skip to content

Commit

Permalink
Merge pull request ccxt#8905 from frosty00/lykke-precise
Browse files Browse the repository at this point in the history
lykke precise
  • Loading branch information
kroitor authored Apr 9, 2021
2 parents 9a3a070 + 2d0c709 commit 0f2d8ff
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions js/lykke.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// ---------------------------------------------------------------------------

const Exchange = require ('./base/Exchange');
const Precise = require ('./base/Precise');

// ---------------------------------------------------------------------------

Expand Down Expand Up @@ -184,18 +185,16 @@ module.exports = class lykke extends Exchange {
const id = this.safeString2 (trade, 'id', 'Id');
const orderId = this.safeString (trade, 'OrderId');
const timestamp = this.parse8601 (this.safeString2 (trade, 'dateTime', 'DateTime'));
const price = this.safeNumber2 (trade, 'price', 'Price');
let amount = this.safeNumber2 (trade, 'volume', 'Amount');
const priceString = this.safeString2 (trade, 'price', 'Price');
let amountString = this.safeString2 (trade, 'volume', 'Amount');
let side = this.safeStringLower (trade, 'action');
if (side === undefined) {
if (amount < 0) {
side = 'sell';
} else {
side = 'buy';
}
side = (amountString[0] === '-') ? 'sell' : 'buy';
}
amount = Math.abs (amount);
const cost = price * amount;
amountString = (amountString[0] === '-') ? amountString.slice (1) : amountString;
const price = this.parseNumber (priceString);
const amount = this.parseNumber (amountString);
const cost = this.parseNumber (Precise.stringMul (priceString, amountString));
const fee = {
'cost': 0, // There are no fees for trading. https://www.lykke.com/wallet-fees-and-limits/
'currency': market['quote'],
Expand Down

0 comments on commit 0f2d8ff

Please sign in to comment.