-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make use of latest quote #1878
Make use of latest quote #1878
Conversation
Signed-off-by: Philipp Hoenisch <[email protected]>
Also use the quote to calculate PnL. Signed-off-by: Philipp Hoenisch <[email protected]>
1f0425d
to
61161e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
just minor nits
@@ -38,6 +40,7 @@ class _ScaffoldWithNestedNavigation extends State<ScaffoldWithNestedNavigation> | |||
|
|||
String version = "unknown"; | |||
Balance balance = Balance.zero(); | |||
BestQuote? bestQuote; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We should probably start to use change notifiers to keep these states.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed :D
const SizedBox( | ||
width: 20, | ||
height: 20, | ||
child: CircularProgressIndicator(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 It's weird to have a spinner here, since it will never go away unless the user navigates or refreshes the page. But I guess it will help us once we implement websockets.
final response = await HttpClientManager.instance.get(Uri(path: '/api/quotes/BtcUsd')); | ||
|
||
if (response.statusCode == 200) { | ||
var quote2 = BestQuote.fromJson(jsonDecode(response.body) as Map<String, dynamic>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ why quote2
and not quote
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, because of reasons.
isBuy = widget.isLong; | ||
_isLoading = false; | ||
context.read<QuoteService>().fetchQuote().then((q) => setState(() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 This is already third time I am seeing this, I think using a change notifier would really make sense for the quote service.
resolves #1872