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

Move the most recent value in sats of an order calculation to the backend #226

Closed

Conversation

KoalaSat
Copy link
Member

@KoalaSat KoalaSat commented Sep 6, 2022

Fixes: #224

The value calculated by

https://github.com/Reckless-Satoshi/robosats/blob/main/frontend/src/components/Charts/DepthChart/index.tsx#L84

Was already being calculated on the back-end, this PR exposes that value so it can be used for the depth chart generation.

@KoalaSat KoalaSat force-pushed the move-chart-satoshis-now-tp-api branch from 718a8a8 to 3eeff8c Compare September 6, 2022 06:58
@KoalaSat KoalaSat marked this pull request as ready for review September 6, 2022 06:59
api/views.py Outdated
@@ -268,6 +268,7 @@ def get(self, request, format=None):
data["is_fiat_sent"] = order.is_fiat_sent
data["is_disputed"] = order.is_disputed
data["ur_nick"] = request.user.username
data["satoshis_now"] = Logics.satoshis_now(order)
Copy link
Collaborator

@Reckless-Satoshi Reckless-Satoshi Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will add the attribute satoshis_now to the responses of the endpoint /api/order/ but not to the responses of /api/book/ . It should be instead somewhere around Line 853 for this attribute to be sent once the list of orders is requested in BookView( ) https://github.com/Reckless-Satoshi/robosats/blob/3eeff8c142d11e776b327fe0d9f2495d4acca86a/api/views.py#L848-L857

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, makes sense, I think I went too fast instead of installing the full platform and test the back-end 😞

@KoalaSat KoalaSat force-pushed the move-chart-satoshis-now-tp-api branch from 21193da to 957227d Compare September 6, 2022 18:43
@KoalaSat
Copy link
Member Author

KoalaSat commented Sep 8, 2022

@Reckless-Satoshi Everything should be ready to be tested, I also included the fix for the max range when you use the price

<div style={{ cursor: "pointer" }}>{parseFloat(parseFloat(params.row.premium).toFixed(4))+"%" }</div>
</Tooltip>
)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the currency code not being displayed on mobile


setCenter(medianValue)
setXRange(maxRange)
setRangeSteps(rangeSteps)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the max range not being calculated for other currencies

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.

Move the most recent value in sats of an order calculation to the backend
2 participants