mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
prepare Chart for short trades
This commit is contained in:
parent
df5d96492c
commit
2891146673
|
@ -64,7 +64,9 @@ const downColor = '#EF5350';
|
||||||
const downBorderColor = '#EF5350';
|
const downBorderColor = '#EF5350';
|
||||||
|
|
||||||
const buySignalColor = '#00ff26';
|
const buySignalColor = '#00ff26';
|
||||||
|
const shortEntrySignalColor = '#00ff26';
|
||||||
const sellSignalColor = '#faba25';
|
const sellSignalColor = '#faba25';
|
||||||
|
const shortexitSignalColor = '#faba25';
|
||||||
const tradeBuyColor = 'cyan';
|
const tradeBuyColor = 'cyan';
|
||||||
const tradeSellColor = 'pink';
|
const tradeSellColor = 'pink';
|
||||||
|
|
||||||
|
@ -290,13 +292,33 @@ export default class CandleChart extends Vue {
|
||||||
const colLow = this.dataset.columns.findIndex((el) => el === 'low');
|
const colLow = this.dataset.columns.findIndex((el) => el === 'low');
|
||||||
const colClose = this.dataset.columns.findIndex((el) => el === 'close');
|
const colClose = this.dataset.columns.findIndex((el) => el === 'close');
|
||||||
const colVolume = this.dataset.columns.findIndex((el) => el === 'volume');
|
const colVolume = this.dataset.columns.findIndex((el) => el === 'volume');
|
||||||
// TODO: REmove below *signal_open after December 2021
|
// TODO: Remove below *signal_open after December 2021
|
||||||
const colBuyData = this.dataset.columns.findIndex(
|
const colBuyData = this.dataset.columns.findIndex(
|
||||||
(el) => el === '_buy_signal_open' || el === '_buy_signal_close',
|
(el) =>
|
||||||
|
el === '_buy_signal_open' ||
|
||||||
|
el === '_buy_signal_close' ||
|
||||||
|
el === '_enter_long_signal_close',
|
||||||
);
|
);
|
||||||
const colSellData = this.dataset.columns.findIndex(
|
const colSellData = this.dataset.columns.findIndex(
|
||||||
(el) => el === '_sell_signal_open' || el === '_sell_signal_close',
|
(el) =>
|
||||||
|
el === '_sell_signal_open' ||
|
||||||
|
el === '_sell_signal_close' ||
|
||||||
|
el === '_exit_long_signal_close',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasShorts =
|
||||||
|
this.dataset.enter_short_signals &&
|
||||||
|
this.dataset.enter_short_signals > 0 &&
|
||||||
|
this.dataset.exit_short_signals &&
|
||||||
|
this.dataset.exit_short_signals > 0;
|
||||||
|
const colShortEntryData = this.dataset.columns.findIndex(
|
||||||
|
(el) => el === '_enter_short_signal_close',
|
||||||
|
);
|
||||||
|
const colShortExitData = this.dataset.columns.findIndex(
|
||||||
|
(el) => el === '_exit_short_signal_close',
|
||||||
|
);
|
||||||
|
console.log('short_exit', colShortExitData);
|
||||||
|
|
||||||
const subplotCount =
|
const subplotCount =
|
||||||
'subplots' in this.plotConfig ? Object.keys(this.plotConfig.subplots).length + 1 : 1;
|
'subplots' in this.plotConfig ? Object.keys(this.plotConfig.subplots).length + 1 : 1;
|
||||||
|
|
||||||
|
@ -405,6 +427,46 @@ export default class CandleChart extends Vue {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (hasShorts) {
|
||||||
|
// Add short support
|
||||||
|
if (!Array.isArray(this.chartOptions.legend) && this.chartOptions.legend?.data) {
|
||||||
|
this.chartOptions.legend.data.push('Short');
|
||||||
|
this.chartOptions.legend.data.push('Short exit');
|
||||||
|
}
|
||||||
|
if (Array.isArray(options.series)) {
|
||||||
|
options.series.push({
|
||||||
|
name: 'Short',
|
||||||
|
type: 'scatter',
|
||||||
|
symbol: 'pin',
|
||||||
|
symbolSize: 10,
|
||||||
|
xAxisIndex: 0,
|
||||||
|
yAxisIndex: 0,
|
||||||
|
itemStyle: {
|
||||||
|
color: shortEntrySignalColor,
|
||||||
|
},
|
||||||
|
encode: {
|
||||||
|
x: colDate,
|
||||||
|
y: colShortEntryData,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
options.series.push({
|
||||||
|
name: 'Short exit',
|
||||||
|
type: 'scatter',
|
||||||
|
symbol: 'pin',
|
||||||
|
symbolSize: 8,
|
||||||
|
xAxisIndex: 0,
|
||||||
|
yAxisIndex: 0,
|
||||||
|
itemStyle: {
|
||||||
|
color: shortexitSignalColor,
|
||||||
|
},
|
||||||
|
encode: {
|
||||||
|
x: colDate,
|
||||||
|
y: colShortExitData,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Merge this into original data
|
// Merge this into original data
|
||||||
Object.assign(this.chartOptions, options);
|
Object.assign(this.chartOptions, options);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,12 @@
|
||||||
<small v-if="dataset" class="ml-2 text-nowrap"
|
<small v-if="dataset" class="ml-2 text-nowrap"
|
||||||
>SellSignals: {{ dataset.sell_signals }}</small
|
>SellSignals: {{ dataset.sell_signals }}</small
|
||||||
>
|
>
|
||||||
|
<small v-if="dataset && dataset.enter_short_signals" class="ml-2 text-nowrap"
|
||||||
|
>Short entries: {{ dataset.enter_short_signals }}</small
|
||||||
|
>
|
||||||
|
<small v-if="dataset && dataset.exit_short_signals" class="ml-2 text-nowrap"
|
||||||
|
>Short exits: {{ dataset.exit_short_signals }}</small
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto mr-2">
|
<div class="ml-auto mr-2">
|
||||||
<b-select
|
<b-select
|
||||||
|
|
|
@ -78,13 +78,15 @@ export interface BidStrategy extends PriceBase {
|
||||||
|
|
||||||
export interface BotState {
|
export interface BotState {
|
||||||
version: string;
|
version: string;
|
||||||
|
dry_run: boolean;
|
||||||
|
trading_mode?: string;
|
||||||
|
short_allowed?: boolean;
|
||||||
state: BotStates;
|
state: BotStates;
|
||||||
runmode: RunModes;
|
runmode: RunModes;
|
||||||
bid_strategy: BidStrategy;
|
bid_strategy: BidStrategy;
|
||||||
ask_strategy: AskStrategy;
|
ask_strategy: AskStrategy;
|
||||||
unfilledtimeout: UnfilledTimeout;
|
unfilledtimeout: UnfilledTimeout;
|
||||||
order_types: OrderTypes;
|
order_types: OrderTypes;
|
||||||
dry_run: boolean;
|
|
||||||
exchange: string;
|
exchange: string;
|
||||||
forcebuy_enabled: boolean;
|
forcebuy_enabled: boolean;
|
||||||
max_open_trades: number;
|
max_open_trades: number;
|
||||||
|
@ -160,6 +162,16 @@ export interface PairHistory {
|
||||||
buy_signals: number;
|
buy_signals: number;
|
||||||
/** Number of sell signals in this response */
|
/** Number of sell signals in this response */
|
||||||
sell_signals: number;
|
sell_signals: number;
|
||||||
|
|
||||||
|
/** Number of long entry signals in this response */
|
||||||
|
enter_long_signals?: number;
|
||||||
|
/** Number of long exit signals in this response */
|
||||||
|
exit_long_signals?: number;
|
||||||
|
/** Number of short entry signals in this response */
|
||||||
|
enter_short_signals?: number;
|
||||||
|
/** Number of short exit signals in this response */
|
||||||
|
exit_short_signals?: number;
|
||||||
|
|
||||||
last_analyzed: number;
|
last_analyzed: number;
|
||||||
/** Data start date in as millisecond timestamp */
|
/** Data start date in as millisecond timestamp */
|
||||||
data_start_ts: number;
|
data_start_ts: number;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user