forked from chrisleekr/binance-trading-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SymbolTriggerBuyIcon.js
90 lines (79 loc) · 2.19 KB
/
SymbolTriggerBuyIcon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* eslint-disable no-unused-vars */
/* eslint-disable react/jsx-no-undef */
/* eslint-disable no-undef */
class SymbolTriggerBuyIcon extends React.Component {
constructor(props) {
super(props);
this.state = {
showModal: false
};
this.handleModalShow = this.handleModalShow.bind(this);
this.handleModalClose = this.handleModalClose.bind(this);
this.handleDelete = this.handleDelete.bind(this);
}
handleModalShow() {
this.setState({
showModal: true
});
}
handleModalClose() {
this.setState({
showModal: false
});
}
handleDelete(e) {
e.preventDefault();
const { symbol } = this.props;
this.props.sendWebSocket('symbol-trigger-buy', {
symbol
});
this.handleModalClose();
}
render() {
const { symbol, className, isAuthenticated } = this.props;
if (isAuthenticated === false) {
return '';
}
return (
<span
className={
'header-column-icon-wrapper symbol-trigger-buy-wrapper ' + className
}>
<button
type='button'
className='btn btn-sm btn-trigger-grid-trade mr-1 btn-manual-buy'
onClick={this.handleModalShow}>
<i className='fas fa-bolt'></i> Trigger
</button>
<Modal show={this.state.showModal} onHide={this.handleModalClose}>
<Modal.Header className='pt-1 pb-1'>
<Modal.Title>Trigger Buy Action - {symbol}</Modal.Title>
</Modal.Header>
<Modal.Body>
Are you sure to trigger a buy action for this symbol?
<br />
<br />
The bot will place a STOP-LOSS-LIMIT order for the currently active
grid trade.
</Modal.Body>
<Modal.Footer>
<Button
variant='secondary'
size='sm'
onClick={this.handleModalClose}>
Close
</Button>
<Button
type='button'
variant='success'
size='sm'
className='btn-manual-buy'
onClick={this.handleDelete}>
Trigger Buy
</Button>
</Modal.Footer>
</Modal>
</span>
);
}
}