Published
Edited
Apr 15, 2020
Insert cell
Insert cell
Insert cell
Insert cell
viewof dice = html`<input type=range min=-1 max=7 step=1 list=tickmarks/>`
Insert cell
viewof pluses = html`<input type=range min=0 max=1000 step=1 list=tickmarks/>`
Insert cell
viewof minuses = html`<input type=range min=0 max=100 step=1 list=tickmarks/>`
Insert cell
viewof chat_members_count = html`<input type=range min=0 max=30000 step=1 list=tickmarks/>`
Insert cell
viewof current_user_daily_limit = html`<input type=range min=1 max=10 step=1 list=tickmarks/>`
Insert cell
viewof current_user_daily_won = html`<input type=range min=0 max=${current_user_daily_limit} step=0.01 list=tickmarks/>`
Insert cell
viewof current_chat_daily_limit = html`<input type=range min=1 max=200 step=1 list=tickmarks/>`
Insert cell
viewof current_chat_daily_won = html`<input type=range min=0 max=${current_chat_daily_limit} step=0.01 list=tickmarks/>`
Insert cell
viewof total_daily_limit = html`<input type=range min=1 max=4000 step=1 list=tickmarks/>`
Insert cell
viewof total_daily_won = html`<input type=range min=1 max=${total_daily_limit} step=0.01 list=tickmarks/>`
Insert cell
Insert cell
user_reputation = calculateReputation(pluses, minuses)
Insert cell
Insert cell
Insert cell
Insert cell
coinPrice = getCoinPriceInBIP(`TIME`)
Insert cell
//Получение курса указаной монеты в бипах
async function getCoinPriceInBIP(coinTicker) {
let coinInfo = await getDataFromAPI(
`https://api.minter.one/`,
`coin_info?symbol=${coinTicker}`
);
let coinSupply = coinInfo.result.volume / PIPs;
let coinReserve = coinInfo.result.reserve_balance / PIPs;
let coinCRR = coinInfo.result.crr / 100;

return calcCoinSell(coinSupply, 1, coinReserve, coinCRR);
}
Insert cell
function calcCoinSell(supply, sellAmount, reserve, crr) {
return reserve * (1 - Math.pow(1 - sellAmount / supply, 1 / crr));
}
Insert cell
//Получение данных из API ноды

async function getDataFromAPI(API_url, endpoint, headers) {
const result = await fetch(API_url + endpoint);

return result.json();
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more