From 3e45135809353b31bb132339d129ca7b268da7de Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 14 Dec 2020 13:55:33 +0000 Subject: [PATCH] reorganized layout with navbar and two cols --- bfxbot/models.py | 11 +++------- templates/index.html | 9 +------- websrc/components/App.tsx | 44 ++++++++++++++++++++++++++++--------- websrc/components/HCard.tsx | 2 +- websrc/components/RPlot.tsx | 2 +- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/bfxbot/models.py b/bfxbot/models.py index 576089f..a05be84 100644 --- a/bfxbot/models.py +++ b/bfxbot/models.py @@ -108,15 +108,10 @@ class SymbolStatus: return self.positions[self.current_tick] def all_ticks(self) -> List[int]: - return [x for x in range(self.current_tick)] + return [x for x in range(1, self.current_tick + 1)] def all_prices(self) -> List[float]: - res = [] - - for x in range(1, self.current_tick): - res.append(self.prices[x]) - - return res + return list(map(lambda x: self.prices[x], range(1, self.current_tick + 1))) # Applies strategy and adds position to list async def add_position(self, position: Position): @@ -247,4 +242,4 @@ class EventHandler: def registerhandle(handler): self.any_state.append(handler) return handler - return registerhandle \ No newline at end of file + return registerhandle diff --git a/templates/index.html b/templates/index.html index d3ac6d1..a29b2cd 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,9 +10,7 @@ Hello world! -
- -
+
- \ No newline at end of file diff --git a/websrc/components/App.tsx b/websrc/components/App.tsx index 7f58db8..dd3beb0 100644 --- a/websrc/components/App.tsx +++ b/websrc/components/App.tsx @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { Col, Container, Navbar, Row } from "react-bootstrap"; +import { Col, Container, Nav, Navbar, Row } from "react-bootstrap"; import Plot from "react-plotly.js"; import HCard from "./HCard"; import RPlot from "./RPlot"; @@ -31,16 +31,40 @@ class App extends Component { render() { return ( - - - - - +
+ + Rustico - BfxBot + - - - - + + + {/* Toolbar column */} + + + + + + + + {/* Graph column */} + +
+

Price graph:

+ +
+ + +
+ {/* + + */} +
+
+ + Made with ❤️ by the Pepe + +
+
) } } diff --git a/websrc/components/HCard.tsx b/websrc/components/HCard.tsx index 2534353..7ef0a3a 100644 --- a/websrc/components/HCard.tsx +++ b/websrc/components/HCard.tsx @@ -16,7 +16,7 @@ class HCard extends Component { render() { return ( - +

{this.props.title}

diff --git a/websrc/components/RPlot.tsx b/websrc/components/RPlot.tsx index 83e9af8..ea36df8 100644 --- a/websrc/components/RPlot.tsx +++ b/websrc/components/RPlot.tsx @@ -66,7 +66,7 @@ class RPlot extends Component<{}, PlotState> { displayModeBar: false, responsive: true, }} - style={{ width: '90%', height: '90%' }} + style={{ width: '100%', height: '90%' }} /> ) }