max_pain_chart #23

Open
ntorres wants to merge 2 commits from max_pain_chart into max_pain_deribit
Collaborator

Here we have a replicate for the deribit’s max pain chart.

Using pyqtgprah and the following classes BarGraphItem (OI calls/puts by strikes), ScatterPlotItem (Intrinsic value by strikes) and InfiniteLine (Max pain’s strike price): commit

Math and logic for the intrinsic_values and max_pain’s strike price) in a separate function: commit

How to test it? (same as #13)

Before start: in order to get this working with uv, you must use my tractor fork and this branch: aio_abandons, the reason is that I cherry-pick the uv_migration that guille made, for some reason that a didn’t dive into, my system needs tractor using uv too. quite hacky I guess.

  1. uv lock

  2. uv run --no-dev python examples/max_pain.py

  3. A message should be display, enter one of the expiration date available.

image
Here we have a replicate for the [deribit's max pain chart](https://www.deribit.com/statistics/BTC/metrics/options). Using pyqtgprah and the following classes `BarGraphItem` (OI calls/puts by strikes), `ScatterPlotItem` (Intrinsic value by strikes) and `InfiniteLine` (Max pain's strike price): [commit](https://pikers.dev/pikers/piker/commit/988f9c9455cc12630d31dd4a48b5210dcbfd291a) Math and logic for the `intrinsic_values` and `max_pain`'s strike price) in a separate function: [commit](https://pikers.dev/pikers/piker/commit/f0fd447af777085e15d623c6fc781ec131b30975) ### How to test it? (same as #13) **Before start:** in order to get this working with `uv`, you must use my `tractor` fork and this branch: `aio_abandons`, the reason is that I `cherry-pick` the `uv_migration` that guille made, for some reason that a didn’t dive into, my system needs tractor using uv too. quite hacky I guess. 1. `uv lock` 2. `uv run --no-dev python examples/max_pain.py` 3. A message should be display, enter one of the expiration date available. ![image](/attachments/bf3ed69c-20f7-4805-8c8d-60220b928d1d)
ntorres added 2 commits 2025-02-04 01:40:44 +00:00
f0fd447af7 Extract logic from get_max_pain()
All the max pain math now is in this two functions:

- get_total_intrinsic_values(): calculate the total value for all strike_prices and stores then in a dict[str, Decimal]

- `get_intrinsic_value_and_max_pain()` given the `intrinsic_values` dict, returns the `max_pain` strike price and the `total_intrinsic_value` for that `strike_price`
d2b6e9c00e Add Plot
Here is the `plot_graph()` that is in char of the bars and scatter plot items.

Also all the necessary code  for the graph to be shown.
ntorres force-pushed max_pain_chart from d2b6e9c00e to 54e5f4bb4e 2025-02-04 03:30:35 +00:00 Compare
ntorres force-pushed max_pain_chart from 54e5f4bb4e to 833a4f1d1c 2025-02-04 20:31:15 +00:00 Compare
ntorres force-pushed max_pain_chart from 833a4f1d1c to dc2e41e550 2025-02-04 20:53:13 +00:00 Compare
ntorres force-pushed max_pain_chart from dc2e41e550 to 988f9c9455 2025-02-05 16:50:17 +00:00 Compare
ntorres force-pushed max_pain_chart from 988f9c9455 to 490aaa3874 2025-02-18 00:11:39 +00:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b max_pain_chart max_pain_deribit
git pull origin max_pain_chart

Step 2:

Merge the changes and update on Gitea.
git checkout max_pain_deribit
git merge --no-ff max_pain_chart
git push origin max_pain_deribit
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pikers/piker#23
There is no content yet.