optionlab icon indicating copy to clipboard operation
optionlab copied to clipboard

add: dynamic price increment.

Open arshamalh opened this issue 1 month ago • 2 comments

Current price increment is 0.01 and hard-coded. it causes making many x, y points in some circumstances.

Making this value dynamic and adjustable is helpful specially in cases that the project is used as library for API's, decreasing unnecessary payload size (I faced 16K pairs once).

arshamalh avatar Nov 02 '25 13:11 arshamalh

Reviewing the PR soon.

rgaveiga avatar Nov 02 '25 13:11 rgaveiga

Current price increment is 0.01 and hard-coded. it causes making many x, y points in some circumstances.

Making this value dynamic and adjustable is helpful specially in cases that the project is used as library for API's, decreasing unnecessary payload size (I faced 16K pairs once).

I understand the argument about the potential gains when the library is heavily used, but one issue here is that the PL of each leg of a strategy is calculated for each stock price point, cent by cent, and then summed to obtain the PL of the entire strategy. It's based on the PL that the PoP will then be calculated and, soon (work in progress, slow progress, I know...), the expected profit and loss ​​will also be determined. If the price spacing changes, the PL calculation changes, and this would also affect the PoP and other calculations.

One alternative to save memory would be to use generators, but it would be necessary to consider the impact on performance of using them instead of a static numpy array.

rgaveiga avatar Nov 09 '25 11:11 rgaveiga