added currency pair in app state
This commit is contained in:
parent
c14b0afb5a
commit
3c1a25f051
@ -6,15 +6,18 @@ import {PositionTable} from "./Tables";
|
|||||||
import {EventProp, Events} from "./Events";
|
import {EventProp, Events} from "./Events";
|
||||||
import {Helmet} from "react-helmet";
|
import {Helmet} from "react-helmet";
|
||||||
import {CurrencyDropdown} from "./Currency";
|
import {CurrencyDropdown} from "./Currency";
|
||||||
import {FirstConnectMessage, NewEventMessage, NewTickMessage, PositionState} from "../types";
|
import {CurrencyPair, FirstConnectMessage, NewEventMessage, NewTickMessage, PositionProp} from "../types";
|
||||||
import {socket} from "../index";
|
import {socket} from "../index";
|
||||||
|
import {symbolToPair} from "../utils";
|
||||||
|
|
||||||
type AppState = {
|
type AppState = {
|
||||||
current_price: number,
|
current_price: number,
|
||||||
current_tick: number,
|
current_tick: number,
|
||||||
last_update: Date,
|
last_update: Date,
|
||||||
positions: Array<PositionState>,
|
positions: Array<PositionProp>,
|
||||||
events: Array<EventProp>
|
events: Array<EventProp>,
|
||||||
|
active_pair: CurrencyPair,
|
||||||
|
available_pairs: Array<CurrencyPair>
|
||||||
}
|
}
|
||||||
|
|
||||||
class App extends Component<{}, AppState> {
|
class App extends Component<{}, AppState> {
|
||||||
@ -25,7 +28,9 @@ class App extends Component<{}, AppState> {
|
|||||||
current_tick: 0,
|
current_tick: 0,
|
||||||
last_update: new Date(),
|
last_update: new Date(),
|
||||||
positions: [],
|
positions: [],
|
||||||
events: []
|
events: [],
|
||||||
|
active_pair: symbolToPair("tBTCUSD"),
|
||||||
|
available_pairs: []
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -81,7 +86,7 @@ class App extends Component<{}, AppState> {
|
|||||||
|
|
||||||
<Navbar bg="light" expand="lg" className="border-bottom">
|
<Navbar bg="light" expand="lg" className="border-bottom">
|
||||||
<Navbar.Brand href="#" className={"mr-auto"}>Rustico - BfxBot</Navbar.Brand>
|
<Navbar.Brand href="#" className={"mr-auto"}>Rustico - BfxBot</Navbar.Brand>
|
||||||
<CurrencyDropdown active_pair={{base: "BTC", quote: "USD"}} pairs={[{base: "XMR", quote: "USD"}]}/>
|
<CurrencyDropdown active_pair={this.state.active_pair} pairs={this.state.available_pairs}/>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
|
|
||||||
<Container fluid className="mt-2 border flex-fill d-flex">
|
<Container fluid className="mt-2 border flex-fill d-flex">
|
||||||
|
Loading…
Reference in New Issue
Block a user