added amount to tables. removed test position.
This commit is contained in:
parent
9ae8389f83
commit
2c6aaadc2f
1
main.py
1
main.py
@ -88,6 +88,7 @@ def on_new_tick(event: Event, status: SymbolStatus):
|
|||||||
def pos_to_json(pw: PositionWrapper):
|
def pos_to_json(pw: PositionWrapper):
|
||||||
return {
|
return {
|
||||||
"id": pw.position.id,
|
"id": pw.position.id,
|
||||||
|
"amount": pw.position.amount,
|
||||||
"base_price": pw.position.base_price,
|
"base_price": pw.position.base_price,
|
||||||
"state": str(pw.state()),
|
"state": str(pw.state()),
|
||||||
"symbol": pw.position.symbol,
|
"symbol": pw.position.symbol,
|
||||||
|
@ -4,15 +4,6 @@ import {NewTickData, PositionState, socket} from '../';
|
|||||||
|
|
||||||
|
|
||||||
export class PositionTable extends Component<{}, { positions: Array<PositionState> }> {
|
export class PositionTable extends Component<{}, { positions: Array<PositionState> }> {
|
||||||
testPosition: PositionState = {
|
|
||||||
base_price: 1,
|
|
||||||
id: 1,
|
|
||||||
profit_loss: 1000,
|
|
||||||
profit_loss_percentage: 1000,
|
|
||||||
state: "loss",
|
|
||||||
symbol: "PAPARCOIN"
|
|
||||||
}
|
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
positions: []
|
positions: []
|
||||||
}
|
}
|
||||||
@ -59,6 +50,7 @@ export class PositionTable extends Component<{}, { positions: Array<PositionStat
|
|||||||
variant={this.stateVariantFromStr(position.state)}>{position.state}</Badge></td>
|
variant={this.stateVariantFromStr(position.state)}>{position.state}</Badge></td>
|
||||||
<td className={"align-middle"}>{position.symbol}</td>
|
<td className={"align-middle"}>{position.symbol}</td>
|
||||||
<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.amount.toFixed(5)}</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"} onClick={() => {
|
<td className={"align-middle"}><Button size={"sm"} variant={"danger"} onClick={() => {
|
||||||
@ -80,6 +72,7 @@ export class PositionTable extends Component<{}, { positions: Array<PositionStat
|
|||||||
<th>State</th>
|
<th>State</th>
|
||||||
<th>Symbol</th>
|
<th>Symbol</th>
|
||||||
<th>Base price</th>
|
<th>Base price</th>
|
||||||
|
<th>Amount</th>
|
||||||
<th>P/L</th>
|
<th>P/L</th>
|
||||||
<th>P/L %</th>
|
<th>P/L %</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
|
@ -16,6 +16,7 @@ export type PositionState = {
|
|||||||
id: number,
|
id: number,
|
||||||
state: string,
|
state: string,
|
||||||
base_price: number,
|
base_price: number,
|
||||||
|
amount: number,
|
||||||
symbol: string,
|
symbol: string,
|
||||||
profit_loss: number,
|
profit_loss: number,
|
||||||
profit_loss_percentage: number
|
profit_loss_percentage: number
|
||||||
|
Loading…
Reference in New Issue
Block a user