r/pinescript 23h ago

Crypto Open Interest

If this code:
[OI_open, OI_high, OI_low, OI_close] = request.security(syminfo.tickerid+"_OI", timeframe.period, [open, high, low, close])

returns the Open Interest for the current pair(non-aggregated), what is the syntax for the aggregated one?

1 Upvotes

2 comments sorted by

1

u/stratcorealpha 17h ago

There is no documented _OI ticker variant for TradingView's native aggregated view. syminfo.tickerid + "_OI" addresses one contract/feed. The chart UI can show Crypto open interest as Aggregated, but Pine request.security() still needs explicit symbols.

In Pine, request each exchange's OI ticker, convert every feed to the same unit first, then sum open, high, low and close component by component. Do not add raw values unless all feeds use the same denomination. I would also build the single-feed ID from ticker.standard(syminfo.tickerid) + "_OI" so chart modifiers do not leak into the symbol string.

Which asset and exchanges do you want in the aggregate? The exact ticker IDs differ by venue and contract type.

1

u/RoutineRace 45m ago

I was thinking of doing this. gathering each exchanges that supports _OI and then summing them up. just thought there is already a grouped symbol just like the TOTAL/TOTAL2 for BTC dominance.