mp_fomo_polish: some feat additions, code styling corrections, general fixes #43
|
@ -90,6 +90,14 @@ bc why install with `python` when you can faster with `rust` ::
|
|||
|
||||
uv lock
|
||||
|
||||
with all GUI support as well::
|
||||
|
||||
uv lock --extra uis
|
||||
|
||||
AND with all dev (hacking) tools::
|
||||
|
||||
uv lock --dev --extra uis
|
||||
|
||||
|
||||
hacky install on nixos
|
||||
**********************
|
||||
|
|
|
@ -18,6 +18,8 @@ import pyqtgraph as pg
|
|||
from PyQt6 import QtCore
|
||||
from pyqtgraph import ScatterPlotItem, InfiniteLine
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
# XXX, use 2 newlines between top level LOC (even between these
|
||||
# imports and the next function line ;)
|
||||
|
||||
def check_if_complete(
|
||||
oi: dict[str, dict[str, Decimal | None]]
|
||||
|
@ -50,6 +52,7 @@ async def max_pain_daemon(
|
|||
expiry_date = input('Please enter a valid expiration date: ').upper()
|
||||
print('Starting little daemon...')
|
||||
|
||||
# maybe move this type annot down to the assignment line?
|
||||
oi_by_strikes: dict[str, dict[str, Decimal]]
|
||||
instruments = await client.get_instruments(
|
||||
expiry_date=expiry_date,
|
||||
|
@ -260,6 +263,28 @@ async def max_pain_daemon(
|
|||
# graph here
|
||||
plot_graph(oi_by_strikes, plot)
|
||||
|
||||
# TODO, use a single multiline string with `()`
|
||||
# and drop the multiple `print()` calls (this
|
||||
# should be done elsewhere in this file as well!
|
||||
#
|
||||
# As per the docs,
|
||||
# https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
|
||||
# you could instead do,
|
||||
# print(
|
||||
# '-----------------------------------------------\n'
|
||||
# f'timestamp: {datetime.fromtimestamp(max_pain['timestamp'])}\n'
|
||||
# )
|
||||
# WHY?
|
||||
# |_ less ctx-switches/calls to `print()`
|
||||
# |_ the `str` can then be modified / passed
|
||||
# around as a variable more easily if needed in
|
||||
# the future ;)
|
||||
#
|
||||
# ALSO, i believe there already is a stdlib
|
||||
# module to do "alignment" of text which you
|
||||
# could try for doing the right-side alignment,
|
||||
# https://docs.python.org/3/library/textwrap.html#textwrap.indent
|
||||
#
|
||||
print('-----------------------------------------------')
|
||||
print(f'timestamp: {datetime.fromtimestamp(max_pain['timestamp'])}')
|
||||
print(f'expiry_date: {max_pain['expiry_date']}')
|
||||
|
|
|
@ -1,19 +1,29 @@
|
|||
## Max Pain Calculation for Deribit Options
|
||||
|
||||
This feature, which calculates the max pain point for options traded on the Deribit exchange using cryptofeed library.
|
||||
This feature, which calculates the max pain point for options traded
|
||||
on the Deribit exchange using cryptofeed library.
|
||||
|
||||
- Functions in the api module for fetching options data from Deribit. [commit](https://pikers.dev/pikers/piker/commit/da55856dd2876291f55a06eb0561438a912d8241)
|
||||
- Functions in the api module for fetching options data from Deribit.
|
||||
[commit](https://pikers.dev/pikers/piker/commit/da55856dd2876291f55a06eb0561438a912d8241)
|
||||
|
||||
- Compute the max pain point based on open interest data using deribit's api. [commit](https://pikers.dev/pikers/piker/commit/0d9d6e15ba0edeb662ec97f7599dd66af3046b94)
|
||||
- Compute the max pain point based on open interest data using
|
||||
deribit's api.
|
||||
[commit](https://pikers.dev/pikers/piker/commit/0d9d6e15ba0edeb662ec97f7599dd66af3046b94)
|
||||
|
||||
### How to test it?
|
||||
|
||||
**Before start:** in order to get this working with `uv`, you **must** use my `tractor` [fork](https://pikers.dev/ntorres/tractor/src/branch/aio_abandons) 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, in my system y need tractor using `uv` too. quite hacky I guess.
|
||||
**Before start:** in order to get this working with `uv`, you
|
||||
**must** use my [`tractor` fork](https://pikers.dev/ntorres/tractor/src/branch/aio_abandons)
|
||||
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, in my system y need 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.
|
||||
3. A message should be display, enter one of the expiration date
|
||||
available.
|
||||
|
||||
4. The script should be up and running.
|
||||
|
|
|
@ -96,6 +96,10 @@ from ._util import (
|
|||
get_logger,
|
||||
)
|
||||
|
||||
# ?TODO? this can now be removed since it was originally to extend
|
||||
# with a `bar_vwap` field that we removed from the default ohlcv
|
||||
# dtype since it's better calculated in an FSP func
|
||||
#
|
||||
_bar_load_dtype: list[tuple[str, type]] = [
|
||||
# NOTE XXX: only part that's diff
|
||||
# from our default fields where
|
||||
|
|
Loading…
Reference in New Issue