Published
Edited
Dec 9, 2019
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
selectedOptionRolledUp = {
if (!selectedOption) {
return "No trades for this contract. Please pick another...";
}
return d3
.rollups(selectedOption, d => flatMinute(d), d => +d.DT)
.sort((a, b) => d3.ascending(a, b))
.map(x => {
let obj = { ...x[1] };
obj.expiry = new Date(+x.expiry);
return obj;
});
}
Insert cell
Insert cell
Insert cell
textRows = (await (await fetch(fileSelection)).text()).split('\n')
Insert cell
dataCredentials = {
let temp = textRows[0].trim().split(' ');
let symbol = temp[6];
let date = temp[8];
let time = temp[9];
let dt = timeStampParser(date + ' ' + time);

return { Symbol: temp[6], TimeStamped: dt };
}
Insert cell
option_columns = {
return textRows.filter(x => x.startsWith(',,Option Code'))[0].split(',');
}
Insert cell
option_rows = textRows
.filter(x => x.startsWith(`,,${SYMBOL}`))
.map(d3.csvParse)
.map(x => [...x.columns])
Insert cell
// Option Code Volume Open.Int Delta Gamma Theta Vega Rho Impl Vol Theo Price ROC ROR Prob.ITM Prob.Touch Prob.OTM Cov Return Max Cov Return Mark Size BS AS %Change Last LAST LX Open High Low BID BX ASK AX Exp Strike % Change
Insert cell
md`### Option Parsing`
Insert cell
Insert cell
Insert cell
getCall = rowArray => rowArray.split(',').slice(2, strikePosition + 1)
Insert cell
getPut = rowArray => rowArray.split(',').slice(strikePosition - 1, -2)
Insert cell
generate_options_csv = () => option_columns.concat(`${option_rows.join('\n')}`)
Insert cell
md`Do puts and calls share all the same properties??`
Insert cell
new Set(putColumns.filter((x, i) => callColumns.includes(x)))
Insert cell
Insert cell
Insert cell
Insert cell
// buildOptionCode = optionLabel => {
// let option = optionLabel.split(' ');
// let strike = +option[3];
// let optionType = option[option.length - 1];
// let expirationDT = d3.timeParse('%-d %b %y')(
// option[0] + ' ' + option[1] + ' ' + option[2]
// );
// let expiry = d3.timeFormat('%y%m%d')(expirationDT);
// let option_code = '.' + SYMBOL + expiry + optionType + strike;
// // return option_code;
// return option_code;
// }
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { select } from '@jashkenas/inputs'
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