Skip to content
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

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

bonomat
Copy link
Contributor

@bonomat bonomat commented Jan 23, 2024

resolves #1872

Signed-off-by: Philipp Hoenisch <[email protected]>
Also use the quote to calculate PnL.

Signed-off-by: Philipp Hoenisch <[email protected]>
@bonomat bonomat force-pushed the feat/orders-in-webapp branch from 1f0425d to 61161e6 Compare January 23, 2024 13:00
Copy link
Contributor

@holzeis holzeis left a 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;
Copy link
Contributor

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.

Copy link
Contributor Author

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(),
Copy link
Contributor

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>);
Copy link
Contributor

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 😅

Copy link
Contributor Author

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(() {
Copy link
Contributor

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.

@bonomat bonomat added this pull request to the merge queue Jan 23, 2024
Merged via the queue into get10101:main with commit ee6609a Jan 23, 2024
9 checks passed
@bonomat bonomat deleted the feat/orders-in-webapp branch January 23, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrieve latest orders from orderbook
2 participants