Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Hotfix make sure bitfinex importer fetches all trades #2354

Merged
merged 3 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion exchange/wrappers/bitfinex.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const recoverableErrors = [
'443',
'504',
'503',
'500',
'502',
'Empty response',
'Nonce is too small'
Expand Down
8 changes: 6 additions & 2 deletions importers/exchanges/bitfinex.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Fetcher.prototype.getTrades = function(upto, callback, descending) {
tid: trade.ID,
date: moment(trade.MTS).format('X'),
price: +trade.PRICE,
amount: +trade.AMOUNT,
amount: +Math.abs(trade.AMOUNT),
};
});
}
Expand Down Expand Up @@ -76,12 +76,16 @@ var fetch = () => {
if (lastTimestamp) {
// We need to slow this down to prevent hitting the rate limits
setTimeout(() => {
fetcher.getTrades(lastTimestamp, handleFetch);

// make sure we fetch with overlap from last batch
const since = lastTimestamp - 1000;
fetcher.getTrades(since, handleFetch);
}, 2500);
} else {
lastTimestamp = from.valueOf();
batch_start = moment(from);
batch_end = moment(from).add(stride, 'h');

fetcher.getTrades(batch_end, handleFetch);
}
};
Expand Down