How can I implement the TV volume profile?

As many have already known, TV implements an indicator called volume profile, however this indicator is only available in the payment options, I would like to be able to implement it in my app, however, I am still not sure which endpoints to use, according to the description. TV’s volume profile highlights the most traded prices during a certain time interval, reviewing the api documentation I found the following endpoints that could possibly help me implement this indicator

GET /api/v3/trades
GET /api/v3/historicalTrades
GET /api/v3/aggTrades

And to keep the data updated I suppose you could use the following streams

< symbol >@aggTrade
< symbol >@trade

Assuming the implementation is similar to the order book, what would be the correct way to implement this indicator?

Hi.
To get the volume profile, I believe kline or ticker data may be more helpful since what you need is the total number. Please take a look at the attribute ‘v’ or ‘q’ in the attached document link.

Also, you may want to collect the past data. Instead of querying from API, to download the csv file might be a faster approach.

I took the liberty of making this image to explain the difference between volume and volume profile, since from the answer you are giving me it seems that it is not clear what I want to implement

kline returns the volume and there is no way of knowing how that volume was distributed with only that data therefore it does not serve me

Thanks for the clarification. In this case, aggTrade should be good enough. If you want to be more precise, trade is the option.

Just a quick try. I downloaded the aggregated trades and processed in Julia

using CSV, PlotlyJS, DataFrames, Pipe

file = "c:/temp/delete/LUNAUSDT-aggTrades-2021-11-05.csv"
data = CSV.File(file, header=[:TradeId, :Price, :Quantity, :FirstTradeId, :LastTradeId, :TimeStamp, :WasMaker, :WasBestPriceMatch]) |> DataFrame

minprice = minimum(data.Price)
maxprice = maximum(data.Price)
steps = 50
step = (maxprice-minprice) / steps

# this adds new column. It takes one value from vector 'data.Price' after 
# another and calls the lambda function on it (the body is 'floor((price - minprice) / step')
data.Bin = (price -> floor((price - minprice) / step)).(data.Price)
# group by bins, for each bin compute sum over Quantity
volume = @pipe groupby(data, :Bin) |>
        combine(_, :Quantity => sum => :Quantity) |>
        sort(_, :Bin)

#plotting
traces=[
    bar(;x = volume.Bin, y = volume.Quantity)
]
PlotlyJS.plot(traces, Layout(title = "Volume", yaxis=attr(title="Traded amount")))

The result:

I don’t have paid TD account, so I can’t check whether I’m close or not.