Public
Edited
Feb 9, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
params = {
return {
varCap: 1000
}
}
Insert cell
Insert cell
Insert cell
days = (dateLimit[1] - dateLimit[0] )/ (1000 * 60 * 60 * 24)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
(new Date(parsedPerf[0].date)).toDateString()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof fixCap = {
const d = Inputs.number({ width: 100, value: 100E3, label: "Total fixed side capacity (USDC)"})
return d
}
Insert cell
viewof varCap = {
const d = Inputs.number({ width: 100, value: 1000, label: "Single user capital for variable side (USDC)"})
return d
}
Insert cell
viewof fixedRateAPR = {
const d = Inputs.number({step: 0.01, width: 100, value: 15, label: "Fixed Rate (%APR)"})
return d
}
Insert cell
viewof daysRange = {
const d = Inputs.number({step: 1, width: 100, value: 30, label: "Length of contract (days)"})
return d
}
Insert cell
viewof dateLimit = interval([earliest.getTime(), latest.getTime()],{
title: "Date range selector",
width: "400px",
step: 1000 * 60 * 60 * 24,
// value: [earliest.getTime(), latest.getTime()],
format: ([s, e]) => `${(new Date(s)).toDateString()} → ${(new Date(e)).toDateString()}`,
label: 'Select date interval',
})// Inputs.range([daysToLatest, daysToEarliest], {value: daysToEarliest, step: 1, label: "Past data limit (days)"})
Insert cell
Insert cell
Insert cell
Insert cell
dashi = require('@saffron-finance/dashi@latest')
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more