Skip to content

ENH: Add option to resample data by a non-timeseries column (e.g. Price) #46794

Closed
@dsstex

Description

@dsstex

Is your feature request related to a problem?

Renko Chart Wiki: https://en.wikipedia.org/wiki/Renko_chart

I'm trying to generate a renko chart using the trade tick data. The data contains Timestamp, Price, Volume. The Timestamp is in unix milliseconds format. e.g. 1649289600174.

Pandas already supports OHLC resampling via df.resample('10Min').agg({'Price': 'ohlc'}). However, I would like resample trade data based on price. Not by Time.

Describe the solution you'd like

I'm looking for a solution that would sort of look like

df.resample('10Num').agg({'Price': 'ohlc', 'Timestamp': 'last'}).

Here 10 is the brick size and it is based on the close price. The keyword Num says, treat this as a numeric value resampling instead of timeseries resampling. i.e. If the close price hits +10 or -10, then I would like to aggregate that data.

We should also have a flag to ignore down movement.

if ignore_down set to True, then the agg function should ignore the down side movement. e.g. 100 to 90.

API breaking implications

N/A

Describe alternatives you've considered

At the moment, I'm creating the renko chart manually using a python loop.

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions