Skip to content

Instantly share code, notes, and snippets.

@bigsan
Created December 5, 2020 08:04
Show Gist options
  • Save bigsan/77c34150b0fd89657310084cec4661fd to your computer and use it in GitHub Desktop.
Save bigsan/77c34150b0fd89657310084cec4661fd to your computer and use it in GitHub Desktop.
Show APY of lending history on FTX
// ==UserScript==
// @name Show APY of lending history on FTX
// @namespace https://gist.github.com/bigsan/
// @version 0.1
// @description Show APY of lending history on FTX
// @author You
// @match https://ftx.com/spot-margin/lending
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(setup, 3000);
function setup() {
document.body.addEventListener('click', e => {
if (e.target.closest("#pagination-back,#pagination-next")) {
setTimeout(showAPY, 50);
}
});
showAPY();
}
function showAPY() {
[...document.querySelectorAll('.MuiTableCell-body')]
.filter(e => /每小時貸款利率|每小时贷款利率|Hourly Funding Rate/i.test(e.innerHTML))
.forEach(e => {
const [r] = e.nextElementSibling.innerHTML.split(' ');
e.nextElementSibling.innerHTML = `${r} (${(r * 24 * 365 * 100).toFixed(2)}%)`;
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment