0
$\begingroup$

We are all familiar with time-based candlestick charts, such as 1 Minut, 15 Minuts, 1 Hour and so on.

The dataset is more or less something similar:

+---------------------+----------+----------+----------+----------+--------------------+
|        Time         |   Open   |   High   |   Low    |  Close   |    Volume(USD)     |
+---------------------+----------+----------+----------+----------+--------------------+
| 2022-06-29 14:01:00 | 20060.21 | 20168.00 | 20009.13 | 20105.95 | 2611402.1200130694 |
| 2022-06-29 14:02:00 | 20004.42 | 20114.45 | 19869.01 | 20059.86 | 1734828.9886544214 |
| 2022-06-29 14:03:00 | 20083.56 | 20149.16 | 19934.92 | 19981.85 | 1947443.4393927378 |
| 2022-06-29 14:04:00 | 20075.98 | 20096.67 | 19827.00 | 20070.78 | 1907937.9701368865 |
| 2022-06-29 14:05:00 | 20046.89 | 20114.89 | 20013.52 | 20075.97 |  688260.0234476988 |
| 2022-06-29 14:06:00 | 19969.56 | 20210.42 | 19950.91 | 20045.04 | 1208377.8560085073 |
| 2022-06-29 14:07:00 | 20062.85 | 20118.59 | 19950.91 | 19966.78 |   846215.676035613 |
| 2022-06-29 14:08:00 | 19919.26 | 20102.00 | 19883.32 | 20073.66 | 2265398.8555667275 |
| 2022-06-29 14:09:00 | 20152.82 | 20192.67 | 19883.32 | 19929.74 |  2869901.761308003 |
| 2022-06-29 14:10:00 | 20278.17 | 20321.43 | 20043.81 | 20157.19 | 1877821.0294715543 |
+---------------------+----------+----------+----------+----------+--------------------+

What I would like to understand is how it is possible to convert this dataset into a tick chart. If I'm not mistaken, a Tick is the value of transactions, therefore if I set the tick to 3000, a candle will only be formed when at least 3000 transactions are carried out. This is quite clear. What I don't understand is what is meant by Transactions? Are we talking about volume? the last column of the table? or should we make a difference between purchase volume and sales volume?

Let's take Bitcoin vs USD Tether for example with a sample dataset of the last 7 days (just because of its ease of obtaining data): This is a 1 hour chart:

BTC-USDT 1 Hour Candlestick Chart - Sample is the last 7 days (Blue Vertical dashed line

And this is another example of Bitcoin vs USD Tether: 10 000 Ticks chart:

BTC-USDT 10000 Ticks Candlestick Chart - Sample is the last 7 days (Blue Vertical dashed line

Beyond the subjective taste for data visualization. I was wondering would an OHCLV dataset be possible to convert to Tick simply using python. However, I need to understand well what data is needed to do this. Also because I don't understand the meaning of the wicks on a Tick chart?

I searched a lot online before asking here, from Investopedia to some Quantitative Finance books but it seems that no one deals with this topic in detail. If anyone has any Articles, Journals or Books to suggest I would be really grateful.

Thanks in advance to all of you

$\endgroup$
1
  • $\begingroup$ Converting from tick to OHLCV is a one-way, irrecoverable, lossy operation. You cannot go in the reverse direction. $\endgroup$
    – databento
    Commented Jan 16 at 4:45

2 Answers 2

0
$\begingroup$

The issue is you are working backwards. You're taking data that has been summarized and trying to asses each part. You can't do that. Tick data is the lowest level of knowledge.

For example ... If you know where you at at 9:30 and 9:35 do you know where you are at 9:33?

If you have sufficiently small timesteps you can aggregate that data and resample it however, if you get a surge of volume even in that small timestep it might overpower your tick threshold. An example of that would be say on the open or near the close where you get a large influx of volume. Even if your data was around 15s of time data you'd get more than 3k ticks in there for /ES futures. But if you were looking around noon/lunchtime you might go a full minute or two before getting 3k ticks.

The only way to truly get a tick chart is to have tick data.

If you want to go from one time_set to another (1m to 3m as an example) you need the lowest level time_set then you would resample your dataframe. To do that you'd use: https://pandas.pydata.org/docs/reference/api/pandas.Series.resample.html

Hopefully that helps you.

$\endgroup$
1
  • $\begingroup$ Well, now it's much clearer. What you say is correct. I had no idea that time-based datasets were a derivative of a previous dataset. I searched and actually found the tick datasets have a time based on milliseconds and 2 columns one for Ask and another for Bid. You were very helpful. Although it is still not clear to me how I can convert them (tick dataframe) to a larger format Like 10, or 20 ticks, since I don't see the volume columns. Because it's the volume I have to take into account, right? Anyway, thanks so much for the help Dude. $\endgroup$ Commented Oct 24, 2023 at 16:10
0
$\begingroup$

Although it is still not clear to me how I can convert them (tick dataframe) to a larger format Like 10, or 20 ticks, since I don't see the volume columns.

Converting tick-level data to a larger format can be done even if the original data doesn't include a specific volume column.

Typically, tick data includes a timestamp, price, and sometimes the trade volume for each transaction. If the volume is not present, you can still aggregate based on the number of ticks or the time interval. Here's a general approach to aggregate every 10 or 20 ticks:

Creating Batches: Group the data into batches of 10 or 20 ticks. Each batch will represent an aggregated data point.

Calculating Aggregated Metrics: For each batch, you can calculate various metrics such as the highest price, the lowest price, and the price at the beginning and end of the batch.

Calculating Timestamps of Each Batch: You can use the timestamp of the first tick in each batch.

Now you will have a new DataFrame.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.