mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-14 16:53:35 -07:00
kibo: add priceline
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
/** @import {IChartApi, ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData, SeriesType, IPaneApi, LineSeriesOptions, BaselineStyleOptions} from './v5.0.6-treeshaked/types' */
|
||||
/** @import {IChartApi, ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData, SeriesType, IPaneApi, BaselineStyleOptions} from './v5.0.6-treeshaked/types' */
|
||||
|
||||
/**
|
||||
* @typedef {[number, number, number, number]} OHLCTuple
|
||||
@@ -434,15 +434,9 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
paneIndex,
|
||||
);
|
||||
|
||||
const createPriceLine = options?.createPriceLine;
|
||||
if (createPriceLine) {
|
||||
series.createPriceLine({
|
||||
price: createPriceLine.value || 0,
|
||||
color: colors.gray(),
|
||||
axisLabelVisible: false,
|
||||
lineWidth: 1,
|
||||
lineStyle: 4,
|
||||
});
|
||||
const priceLineOptions = options?.createPriceLine;
|
||||
if (priceLineOptions) {
|
||||
createPriceLine(series, priceLineOptions, colors);
|
||||
}
|
||||
|
||||
let url = /** @type {string | undefined} */ (undefined);
|
||||
@@ -534,15 +528,9 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
paneIndex,
|
||||
);
|
||||
|
||||
const createPriceLine = options?.createPriceLine;
|
||||
if (createPriceLine) {
|
||||
series.createPriceLine({
|
||||
price: createPriceLine.value || 0,
|
||||
color: colors.gray(),
|
||||
axisLabelVisible: false,
|
||||
lineWidth: 1,
|
||||
lineStyle: 4,
|
||||
});
|
||||
const priceLineOptions = options?.createPriceLine;
|
||||
if (priceLineOptions) {
|
||||
createPriceLine(series, priceLineOptions, colors);
|
||||
}
|
||||
|
||||
let url = /** @type {string | undefined} */ (undefined);
|
||||
@@ -1040,3 +1028,18 @@ function createPaneHeightObserver({ ichart, paneIndex, signals, utils }) {
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ISeriesApi<SeriesType>} series
|
||||
* @param {DeepPartial<CreatePriceLine>} options
|
||||
* @param {Colors} colors
|
||||
*/
|
||||
function createPriceLine(series, options, colors) {
|
||||
series.createPriceLine({
|
||||
price: options.value || 0,
|
||||
color: colors.gray(),
|
||||
axisLabelVisible: false,
|
||||
lineWidth: 1,
|
||||
lineStyle: 4,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, ChartableIndex,CreatePriceLineOptions } from "./options"
|
||||
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, ChartableIndex,CreatePriceLineOptions, CreatePriceLine } from "./options"
|
||||
* @import {Valued, SingleValueData, CandlestickData, ChartData, OHLCTuple} from "../packages/lightweight-charts/wrapper"
|
||||
* @import * as _ from "../packages/ufuzzy/v1.0.14/types"
|
||||
* @import { createChart as CreateClassicChart, LineStyleOptions, DeepPartial, ChartOptions, IChartApi, IHorzScaleBehavior, WhitespaceData, ISeriesApi, Time, LineData, LogicalRange, BaselineStyleOptions, SeriesOptionsCommon, BaselineData, CandlestickStyleOptions } from "../packages/lightweight-charts/v5.0.6-treeshaked/types"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* @typedef {Object} CandlestickSeriesBlueprintSpecific
|
||||
* @property {"Candlestick"} type
|
||||
* @property {Color} [color]
|
||||
* @property {DeepPartial<CandlestickStyleOptions & SeriesOptionsCommon & CreatePriceLineOptions>} [options]
|
||||
* @property {DeepPartial<CandlestickStyleOptions & SeriesOptionsCommon>} [options]
|
||||
* @property {Accessor<CandlestickData[]>} [data]
|
||||
* @typedef {BaseSeriesBlueprint & CandlestickSeriesBlueprintSpecific} CandlestickSeriesBlueprint
|
||||
*
|
||||
@@ -1199,12 +1199,12 @@ function createPartialOptions(colors) {
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `price-${key}-ago`,
|
||||
name: `lump sum`,
|
||||
name: `lump sum price`,
|
||||
color: colors.cyan,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-dca-avg-price`,
|
||||
name: `dca`,
|
||||
name: `dca avg. price`,
|
||||
color: colors.orange,
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user