jetlend

Удобства пользования сайтом

当前为 2024-02-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         jetlend
// @description  Удобства пользования сайтом
// @author       Я
// @match        *://jetlend.ru/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=jetlend.ru
// @grant        none
// @license MIT
// @version 0.0.1.20240207165431
// @namespace https://gf.qytechs.cn/users/1256967
// ==/UserScript==

/*
document.querySelectorAll('[data-colindex="3"]').forEach((item, i)=>{
    if (i > 1) {
        if (Number(item.textContent) < 16) {
            item.closest('tr').style.background = "pink";
            console.log(item.textContent)
        }
    }
})
*/

(function () {
  "use strict";
})();

// Инфо обо мне
const url1 = "https://jetlend.ru/invest/api/account/details?exclude_npd=true";

// Инфо о Первичном рынке
const urlRequests = "https://jetlend.ru/invest/api/requests/waiting";

// Инфо о Вторичном рынке
const urlLoans = "https://jetlend.ru/invest/api/exchange/loans";

// Инфо о всех нотификациях
const url4 = "https://jetlend.ru/invest/api/account/notifications/v3";

// Инфо о конкретном займе
const url5 = "https://jetlend.ru/invest/api/exchange/loans/11988/overview";

// инфо о стакане займа
const url6 = "https://jetlend.ru/invest/api/exchange/loans/11988/dom/records";

// Аналитика по id займа https://jetlend.ru/invest/api/requests/18163/analytics
// На сколько использован лимит на платформе https://jetlend.ru/invest/api/requests/18163/limits
// Инфо о займе по id, в том числе статус Игнора https://jetlend.ru/invest/api/requests/18163/info

async function fetchAsync(url) {
  let response = await fetch(url);
  let data = await response.json();
  console.log(data?.data);
  window.myInfo = data?.data;

  if (window.location.href.includes("jetlend.ru/invest")) {
    updateMyInfoBlock();
  }

  return data?.data;
}

console.log("Hello from Greasy Fork镜像");

if (window.location.href.includes("jetlend.ru/invest")) {
  fetchAsync(url1);

  console.log("это должно быть только после дата инфо");
}

function createMyInfoBlock() {
  const htmlBlock = createMyInfoBlockEl();
  const blockContent1El = document.querySelectorAll(
    'div [class^="block_content__"]'
  )[0];
  blockContent1El.insertAdjacentHTML("beforeEnd", htmlBlock);

  console.log("InfoBlockEl created");
}
window.createMyInfoBlock = createMyInfoBlock();

function updateMyInfoBlock() {
  if (document.querySelector("#infoblock")) {
    document.querySelector("#infoblock").innerHTML = `
            <div>Свободно сейчас = <b style="font-size: 1.25rem;">${window.myInfo.balance.free.toFixed(
              2
            )} руб</b></div>
        <div>ПРОФИТ = <b style="color: green; font-size: 1.25rem;">${window.myInfo.summary.profit.toFixed(
          2
        )} руб</b></div>
         <div>В сейфе = <b>${window.myInfo.balance.safe.toFixed(
           2
         )} руб</b></div>
         <div>Потери / Дефолты = <b style="color: red;">${window.myInfo.summary.loss.toFixed(
           2
         )} руб</b></div>
      <div>Моя доходность = <b>${(
        window.myInfo.summary.yield_rate * 100
      ).toFixed(2)}%</b></div>
      <div>Мой XIRR = <b>${(
        window.myInfo.summary.yield_rate_xirr * 100
      ).toFixed(2)}%</b></div> 
      <div>В резерве = <b>${window.myInfo.balance.reserved.toFixed(
        2
      )} руб</b></div>
      <div>Interest / APY = <b>${window.myInfo.summary_year.details.interest.toFixed(
        2
      )}%</b></div>
      <div>Fine = <b>${(window.myInfo.summary_year.details.fine * 100).toFixed(
        2
      )}%</b></div>
      <div>Годовой процент = <b>${window.myInfo.summary_year.yield_rate.toFixed(
        2
      )}%</b></div>
      <div>Годовой процент xirr = <b>${window.myInfo.summary_year.yield_rate_xirr.toFixed(
        2
      )}%</b></div>
      <div>${JSON.stringify(window?.newBigReq)}</div>
      <div>${JSON.stringify(window?.filteredLoans)}</div>`;
  } else {
    createMyInfoBlock();
  }

  console.log("InfoBlockEl updated");

  setTimeout(() => {
    fetchAsync(url1);
  }, "10000");
}

window.updateMyInfoBlock = updateMyInfoBlock();

function createMyInfoBlockEl() {
  return `<div id="infoblock">
        <div>Свободно сейчас = <b style="font-size: 1.25rem;">${window.myInfo.balance.free.toFixed(
          2
        )} руб</b></div>
        <div>ПРОФИТ = <b style="color: green; font-size: 1.25rem;">${window.myInfo.summary.profit.toFixed(
          2
        )} руб</b></div>
         <div>В сейфе = <b>${window.myInfo.balance.safe.toFixed(
           2
         )} руб</b></div>
         <div>Потери / Дефолты = <b style="color: red;">${window.myInfo.summary.loss.toFixed(
           2
         )} руб</b></div>
      <div>Моя доходность = <b>${(
        window.myInfo.summary.yield_rate * 100
      ).toFixed(2)}%</b></div>
      <div>Мой XIRR = <b>${(
        window.myInfo.summary.yield_rate_xirr * 100
      ).toFixed(2)}%</b></div> 
      <div>В резерве = <b>${window.myInfo.balance.reserved.toFixed(
        2
      )} руб</b></div>
      <div>Interest / APY = <b>${window.myInfo.summary_year.details.interest.toFixed(
        2
      )}%</b></div>
      <div>Fine = <b>${(window.myInfo.summary_year.details.fine * 100).toFixed(
        2
      )}%</b></div>
      <div>Годовой процент = <b>${window.myInfo.summary_year.yield_rate.toFixed(
        2
      )}%</b></div>
      <div>Годовой процент xirr = <b>${window.myInfo.summary_year.yield_rate_xirr.toFixed(
        2
      )}%</b></div>
      <div>${JSON.stringify(window.newBigReq)}</div>
      <div>${JSON.stringify(window.filteredLoans)}</div>
      </div>`;
}

window.createMyInfoBlockEl = createMyInfoBlockEl();

// получить первичный рынок и записать с большим процентом.
async function fetchRequests(url) {
  let response = await fetch(url);
  let data = await response.json();
  console.log(data.requests);
  window.requests = data.requests;

  window.bigInterestRequests = window.requests.filter((element) => {
    return element.interest_rate > 0.3;
  });

  bigRequests();

  return data.requests;
}

function bigRequests() {
  window.bigInterestRequests = window.requests.filter((element) => {
    return element.interest_rate > window.levelBigInterest;
  });
}

function checkBigInterestRequests() {
  window.newBigReq = [];
  window.bigInterestRequests.requests.forEach((element) => {
    if (!element.investing_amount) {
      console.log("Найден первичный займ с большой ставкой.");
      console.log(element);
      window.newBigReq.push(element);
    }
  });
}

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

// получить Вторичный рынок .
async function fetchLoans(url) {
  let response = await fetch(url);
  let data = await response.json();
  console.log(data?.data);
  window.loans = data?.data;

  window.filteredLoans = getLoansByOptions(window.loanOptions);

  return data?.data;
}
// ------------------------------------

// Получить займы по опциям.
function getLoansByOptions(options) {
  const loansArray = window.loans.filter((loan) => {
    return (
      loan.financial_discipline > options.financial_discipline &&
      loan.progress > options.progress &&
      loan.min_price < options.min_price &&
      loan.ytm > options.ytm &&
      loan.loan_id > 9999 &&
      loan.status === "active"
    );
  });

  console.log("Отфильтрованные займы");
  console.log(loansArray);

  if (loansArray.length === 0) {
    console.log("Нет займов соответствующих фильтру поиска.");
    return "Нет займов соответствующих фильтру поиска.";
  }

  return loansArray;
}

function updateFilteredLoans() {
  window.filteredLoans = getLoansByOptions(window.loanOptions);
}
// ------------------------------------

window.levelBigInterest = 0.4;
window.loanOptions = {
  interest_rate: 0.218,
  financial_discipline: 0,
  term: 720,
  term_left: 744,
  ytm: 0.3,
  progress: 0.65,
  min_price: 0.99,
  status: "active",
  status2: "restructured",
};

tikTak(5000);

function tikTak(time) {
  console.log("TitTak started");
  fetchRequests(urlRequests);
  fetchLoans(urlLoans);

  if (window.bigInterestRequests.length > 0) {
    checkBigInterestRequests();
  }

  setTimeout(() => {
    tikTak();
  }, time);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址