MCPcopy Create free account
hub / github.com/ccxt/ccxt / parseLedgerComment

Method parseLedgerComment

ts/src/luno.ts:1266–1296  ·  view source on GitHub ↗
(comment)

Source from the content-addressed store, hash-verified

1264 }
1265
1266 parseLedgerComment (comment) {
1267 const words = comment.split (' ');
1268 const types: Dict = {
1269 'Withdrawal': 'fee',
1270 'Trading': 'fee',
1271 'Payment': 'transaction',
1272 'Sent': 'transaction',
1273 'Deposit': 'transaction',
1274 'Received': 'transaction',
1275 'Released': 'released',
1276 'Reserved': 'reserved',
1277 'Sold': 'trade',
1278 'Bought': 'trade',
1279 'Failure': 'failed',
1280 };
1281 let referenceId: Str = undefined;
1282 const firstWord = this.safeString (words, 0);
1283 const thirdWord = this.safeString (words, 2);
1284 const fourthWord = this.safeString (words, 3);
1285 let type = this.safeString (types, firstWord);
1286 if ((type === undefined) && (thirdWord === 'fee')) {
1287 type = 'fee';
1288 }
1289 if ((type === 'reserved') && (fourthWord === 'order')) {
1290 referenceId = this.safeString (words, 4);
1291 }
1292 return {
1293 'type': type,
1294 'referenceId': referenceId,
1295 };
1296 }
1297
1298 parseLedgerEntry (entry, currency: Currency = undefined): LedgerEntry {
1299 // const details = this.safeValue (entry, 'details', {});

Callers 1

parseLedgerEntryMethod · 0.95

Calls 2

splitMethod · 0.80
safeStringMethod · 0.45

Tested by

no test coverage detected