max_pain_deribit #13

Open
ntorres wants to merge 29 commits from max_pain_deribit into fix_deribit_hist_queries
Collaborator

Max Pain Calculation for Deribit Options

This feature, which calculates the max pain point for options traded on the Deribit exchange using cryptofeed library.

  • Added a new module to fetch options data from Deribit .
  • Implemented functions to compute the max pain point based on open interest data.

How its calculated the max_pain value?

  1. Data Retrieval:
    • Fetch options data from Deribit’s API, including:
      • Strike prices
      • Open interest (OI) for both calls and puts
      • Expiration dates
  2. Data Organization:
    • Process the data to associate each strike price with its respective OI for call and put options.
  3. Cash Calculation:
    • For each possible settlement price (typically every strike price), calculate the total cash payout required to settle all outstanding options at expiration:
      • Call Options Cash Calculation:
        • Call Options: If the settlement price is below the strike price, the cash payout is the difference multiplied by the open interest.
        • Put Options: If the settlement price is above the strike price, the cash payout is the difference multiplied by the open interest.
    • Combine the payouts for calls and puts to calculate the total cash payout at each strike price.
  4. Find Max Pain Point:
    • Identify the strike price where the total cash payout across all options is maximized. This is the max pain point, where option sellers (writers) face the least total cash payout.
  5. Output:
    • The function outputs the max pain point, representing the strike price where the market might gravitate to minimize payouts by option sellers.
## Max Pain Calculation for Deribit Options This feature, which calculates the max pain point for options traded on the Deribit exchange using cryptofeed library. - Added a new module to fetch options data from Deribit . - Implemented functions to compute the max pain point based on open interest data. How its calculated the max_pain value? 1. **Data Retrieval:** - Fetch options data from Deribit’s API, including: - Strike prices - Open interest (OI) for both calls and puts - Expiration dates 2. **Data Organization:** - Process the data to associate each strike price with its respective OI for call and put options. 3. **Cash Calculation:** - For each possible settlement price (typically every strike price), calculate the total cash payout required to settle all outstanding options at expiration: - **Call Options Cash Calculation:** - **Call Options**: If the settlement price is below the strike price, the cash payout is the difference multiplied by the open interest. - **Put Options**: If the settlement price is above the strike price, the cash payout is the difference multiplied by the open interest. - Combine the payouts for calls and puts to calculate the **total cash payout** at each strike price. 4. **Find Max Pain Point:** - Identify the strike price where the **total cash payout** across all options is maximized. This is the **max pain point**, where option sellers (writers) face the least total cash payout. 5. **Output:** - The function outputs the max pain point, representing the strike price where the market might gravitate to minimize payouts by option sellers.
ntorres added 14 commits 2024-12-03 17:37:39 +00:00
7b02df9b49 Update api.py
This function receive a date in this format DDMMMYY and returns timestamps int
4ccda643b8 Update api.py
covers cases when option_type comes as PUT or P, same with calls CALL or C
24bf19c1fb Update api.py
get_currencies function
9abbd8ca1e Update api.py
open_interest for each strike price and each expiry date
a9110b1196 Update api.py
Now we get the data for an e specific expiration date if and expiry_date is passed, or for all expiration if expiry_date is None
ntorres added 1 commit 2024-12-04 22:18:45 +00:00
ntorres added 3 commits 2024-12-06 02:32:22 +00:00
bf86772d4b oi max_pain major refactor
Now the max_pain is calculated taking into account all strike prices and all close prices to find the intrinsic value as deribit.
ntorres added 1 commit 2024-12-06 02:43:24 +00:00
cbc5168b8d renaming variable
fixed variable name for better understanding.
ntorres added 1 commit 2024-12-06 02:49:11 +00:00
ec1da6134b Update api.py
Now intrinsic values list is initialize in the aio_open_interest_feed_relay instead in the scope above.
ntorres added 1 commit 2024-12-06 10:42:02 +00:00
ntorres force-pushed max_pain_deribit from f3d7d87303 to e37fb00e7d 2024-12-06 10:57:33 +00:00 Compare
ntorres force-pushed max_pain_deribit from e37fb00e7d to ca5e1b6ed1 2024-12-06 11:09:58 +00:00 Compare
ntorres added 3 commits 2024-12-07 13:17:50 +00:00
3e613ab2a0 fix the input values
for acm related to oi
0563b916a3 major refactor
all the logic now in the max_pain script
ntorres added 1 commit 2024-12-07 13:38:00 +00:00
ntorres added 1 commit 2024-12-07 14:15:56 +00:00
3295303e37 More configs refactor
Now in the broker config file are the log configs for cryptofeed.
ntorres added 1 commit 2024-12-08 13:51:32 +00:00
ntorres added 2 commits 2024-12-08 16:38:35 +00:00
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_deribit fix_deribit_hist_queries
git pull origin max_pain_deribit

Step 2:

Merge the changes and update on Gitea.
git checkout fix_deribit_hist_queries
git merge --no-ff max_pain_deribit
git push origin fix_deribit_hist_queries
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#13
There is no content yet.