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

feat(examples): implement a jupyter notebook example #186

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

Conversation

peyha
Copy link
Contributor

@peyha peyha commented Apr 17, 2024

Motivation

There is no example on how to use Cryo in Python (and subsequently on a notebook)

Solution

Made a short script example to query and to parse data using the Cryo Python module.

PR Checklist

  • Added Tests -> No need for an example
  • Added Documentation -> the code is commented
  • Breaking changes -> No breaking changes

examples/morpho_blue.ipynb Show resolved Hide resolved
examples/morpho_blue.ipynb Outdated Show resolved Hide resolved
examples/morpho_blue.ipynb Outdated Show resolved Hide resolved
examples/morpho_blue.ipynb Outdated Show resolved Hide resolved
examples/morpho_blue.ipynb Outdated Show resolved Hide resolved
examples/morpho_blue.ipynb Outdated Show resolved Hide resolved
Comment on lines +116 to +118
" indexed_types.append((parts[0], parts[-1]))\n",
" else:\n",
" data_types.append((parts[0], parts[-1]))\n",

Choose a reason for hiding this comment

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

it will break when the name is not specified (and I think that it's optionnal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not optional in the signature but it's quite cool to have the column renamed to the attribute name

"┌───────────┬───────────┬───────────┬───────────┬───┬───────────┬───────────┬───────────┬──────────┐\n",
"│ id ┆ block_num ┆ transacti ┆ log_index ┆ … ┆ collatera ┆ oracle ┆ irm ┆ lltv │\n",
"│ --- ┆ ber ┆ on_index ┆ --- ┆ ┆ lToken ┆ --- ┆ --- ┆ --- │\n",
"│ str ┆ --- ┆ --- ┆ u32 ┆ ┆ --- ┆ str ┆ str ┆ f64 │\n",

Choose a reason for hiding this comment

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

why collateral etc are str and not addresses

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because polars does not handle eth types yet (even though there are bounties for that)

"cell_type": "markdown",
"metadata": {},
"source": [
"## Withdraw"

Choose a reason for hiding this comment

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

do we really need to do each event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it's worth it as an example

Choose a reason for hiding this comment

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

@peyha, I think that you have a slightly updated version of helper functions right?

Otherwise, you can resolve the open comment that I thumbed up. You should also probably rename the PR with a slightly better name

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.

2 participants