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

Display recent executions #222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Display recent executions #222

wants to merge 2 commits into from

Conversation

grod220
Copy link
Contributor

@grod220 grod220 commented Dec 17, 2024

Populating view for:

Screenshot 2024-12-17 at 12 43 08 PM

Note, route data is not available in pindexer.

Comment on lines +28 to +45
const quoteAssetId = new AssetId({ inner: Uint8Array.from(context_asset_end) });

// Determine trade direction
const isBaseAssetInput = BigInt(delta_1) !== 0n;
const kind = isBaseAssetInput ? 'sell' : 'buy';

// Amount of base & quote asset being traded in or out of
const baseAmount = isBaseAssetInput ? pnum(delta_1) : pnum(lambda_1);
const quoteAmount = isBaseAssetInput ? pnum(lambda_2) : pnum(delta_2);

const price = baseAmount.toBigNumber().div(quoteAmount.toBigNumber()).toNumber();
const timestamp = time.toISOString();

return {
kind,
amount: new Value({ amount: baseAmount.toAmount(), assetId: baseAssetId }),
price: { amount: price, assetId: quoteAssetId },
timestamp,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This math is very off currently. Need to sync with @erwanor in office hours 😅 .

@grod220 grod220 self-assigned this Dec 17, 2024
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.

1 participant