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 buySignalColor = '#00ff26';
|
||||
const shortEntrySignalColor = '#00ff26';
|
||||
const sellSignalColor = '#faba25';
|
||||
const shortexitSignalColor = '#faba25';
|
||||
const tradeBuyColor = 'cyan';
|
||||
const tradeSellColor = 'pink';
|
||||
|
||||
|
@ -290,13 +292,33 @@ export default class CandleChart extends Vue {
|
|||
const colLow = this.dataset.columns.findIndex((el) => el === 'low');
|
||||
const colClose = this.dataset.columns.findIndex((el) => el === 'close');
|
||||
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(
|
||||
(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(
|
||||
(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 =
|
||||
'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
|
||||
Object.assign(this.chartOptions, options);
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
<small v-if="dataset" class="ml-2 text-nowrap"
|
||||
>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 class="ml-auto mr-2">
|
||||
<b-select
|
||||
|
|
|
@ -78,13 +78,15 @@ export interface BidStrategy extends PriceBase {
|
|||
|
||||
export interface BotState {
|
||||
version: string;
|
||||
dry_run: boolean;
|
||||
trading_mode?: string;
|
||||
short_allowed?: boolean;
|
||||
state: BotStates;
|
||||
runmode: RunModes;
|
||||
bid_strategy: BidStrategy;
|
||||
ask_strategy: AskStrategy;
|
||||
unfilledtimeout: UnfilledTimeout;
|
||||
order_types: OrderTypes;
|
||||
dry_run: boolean;
|
||||
exchange: string;
|
||||
forcebuy_enabled: boolean;
|
||||
max_open_trades: number;
|
||||
|
@ -160,6 +162,16 @@ export interface PairHistory {
|
|||
buy_signals: number;
|
||||
/** Number of sell signals in this response */
|
||||
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;
|
||||
/** Data start date in as millisecond timestamp */
|
||||
data_start_ts: number;
|
||||
|
|
Loading…
Reference in New Issue
Block a user