removed test entry, sending close event on button
This commit is contained in:
parent
55bfe8824b
commit
054bb0dc04
@ -1,6 +1,6 @@
|
|||||||
import React, {Component} from "react"
|
import React, {Component} from "react"
|
||||||
import {Badge, Button, Container, Table} from "react-bootstrap"
|
import {Badge, Button, Container, Table} from "react-bootstrap"
|
||||||
import {PositionState} from '../';
|
import {NewTickData, PositionState, socket} from '../';
|
||||||
|
|
||||||
|
|
||||||
export class PositionTable extends Component<{}, { positions: Array<PositionState> }> {
|
export class PositionTable extends Component<{}, { positions: Array<PositionState> }> {
|
||||||
@ -14,7 +14,7 @@ export class PositionTable extends Component<{}, { positions: Array<PositionStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
positions: [this.testPosition]
|
positions: []
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -45,15 +45,11 @@ export class PositionTable extends Component<{}, { positions: Array<PositionStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setState({
|
socket.on('new_tick', (data: NewTickData) => {
|
||||||
positions: [this.testPosition]
|
this.setState({
|
||||||
|
positions: data.positions
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// socket.on('new_tick', (data: NewTickData) => {
|
|
||||||
// this.setState({
|
|
||||||
// positions: [...this.state.positions, data.positions]
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tableData() {
|
tableData() {
|
||||||
@ -65,7 +61,9 @@ export class PositionTable extends Component<{}, { positions: Array<PositionStat
|
|||||||
<td className={"align-middle"}>{position.base_price.toFixed(2)}</td>
|
<td className={"align-middle"}>{position.base_price.toFixed(2)}</td>
|
||||||
<td className={"align-middle"}>{position.profit_loss.toFixed(2)}</td>
|
<td className={"align-middle"}>{position.profit_loss.toFixed(2)}</td>
|
||||||
<td className={"align-middle"}>{position.profit_loss_percentage.toFixed(2)} %</td>
|
<td className={"align-middle"}>{position.profit_loss_percentage.toFixed(2)} %</td>
|
||||||
<td className={"align-middle"}><Button size={"sm"} variant={"danger"}>Close</Button></td>
|
<td className={"align-middle"}><Button size={"sm"} variant={"danger"} onClick={() => {
|
||||||
|
socket.emit("close", ({"id": position.id}))
|
||||||
|
}}>Close</Button></td>
|
||||||
</tr>)
|
</tr>)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user