Published
Edited
Dec 21, 2019
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//xAxis is time
//yaxis is strikes
//colored by series
//stroked by option-type
//scaled by $value of trade
Insert cell
Insert cell
Insert cell
mutable selection = OptionTrades
Insert cell
Insert cell
Insert cell
OptionTrades = transactions.filter(x => x.qty > minQuantity)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
xScale(new Date('2019-10-25T09:35'))
Insert cell
Insert cell
Insert cell
OptionTrades
Insert cell
yScale = d3.scaleLinear(d3.extent(OptionTrades, d => +d.strike), [
height - margin.bottom,
margin.top
])
Insert cell
Insert cell
md`<div style="min-width:100%;text-align:center;font-size:2rem;color:purple; background:thistle;">SIZE</div>`
Insert cell
selection
Insert cell
radiusScale = d3
.scaleSqrt()
.range([1, 20])
.domain(d3.extent(OptionTrades, d => d.qty * d.price))
Insert cell
radiusScale(100)
Insert cell
Insert cell
html`<div style="display:flex;">${seriesColorScale
.range()
.map(x => `<div style="background:${x};">${x}</div>`)}</div>`
Insert cell
seriesColorScale = d3.scaleOrdinal(
expirations,
d3.quantize(d3.interpolateViridis, expirations.length - 1)
)
Insert cell
Insert cell
Insert cell
expirationColor = d3
.scaleTime()
.interpolate(() => d3.interpolateCool)
.domain(d3.extent(expirations))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
deltaScale = d3
.scaleDiverging()
.domain([-1, 0, 1])
.interpolator(d3.interpolatePuOr)
Insert cell
d3.scaleDiverging()
Insert cell
Insert cell
Insert cell
d3.timeParse('%Y-%m-%d' + ' %H:%M:%S')(DT + " 15:59:58")
Insert cell
d3.timeParse('%Y-%m-%d %H:%M')('2019-10-25 09:30')
Insert cell
d3.timeParse('%H:%M:%S')("15:59:58")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html`<style>

hr{
border-top: 3px double salmon;

}
</style>`
Insert cell
Insert cell
Insert cell
Insert cell
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