Author

Topic: Coding -- how to convert Trading History to OHLCV Format? (Read 69 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
How are you going to get today's OHLCV data when the close/high/low prices aren't even known for sure yet?

What is the timeframe of trading data you are trying to get? Is it like 5m, 30m, a day, or something else?
newbie
Activity: 137
Merit: 0
Can you share your current code?
Just to make it easier to see the problem

Hi, I'm currently in conception and have no code. Before starting with code I'm trying to figure out how OHLCV data is being generated. I already know how it would be possible to convert OHLCV into historic ticker data (like this format: https://cex.io/api/trade_history/ATOM/EUR containing array of amount, time, order-type and price). But to create OHLCV for todays trades I would require to understand when the "snapshots" for OHLCV are created or if the entries are an agregation of multiple trades done for a given time-frame.

It doesn't make any sense to start any coding without concept here.
full member
Activity: 251
Merit: 102
Coffee, Coding, Crypto
Ok, here's my current progress.

I've been trying to understand the data-invertal for data1m. I thought there might be a constant interval the entries are created for. But so far I can't find the scheme comparing the timestamps (which are the long numbers on position #1 in first data-entry).

I really hope someone knows more about that and can explain me how to compute it myself or at least which intervals the data is based on if it may be such simple and there is no more compution for some kind of data calculations between 1m and 1h and so on.

Can you share your current code?
Just to make it easier to see the problem
newbie
Activity: 137
Merit: 0
Ok, here's my current progress.

I've been trying to understand the data-invertal for data1m. I thought there might be a constant interval the entries are created for. But so far I can't find the scheme comparing the timestamps (which are the long numbers on position #1 in first data-entry).

I really hope someone knows more about that and can explain me how to compute it myself or at least which intervals the data is based on if it may be such simple and there is no more compution for some kind of data calculations between 1m and 1h and so on.
newbie
Activity: 137
Merit: 0
Hello to all coders,

I'm trying to make a trading bot using php which also uses some indicators for custom strategies. I would like to know how to calculate/compute a OHLCV Data-Array from today current History. I'm using CEX.io API for my first trials as some time ago I already was using it and I think the functions provided should be adoptable to other exchanges as well.


I'm currently trying to understand this:

I've already studied what OHLCV data represents:
https://www.kaiko.com/collections/ohlcv

CEX.io API has API method for OHLCV, but only historical (only until yesterday, but no live data for today)

This are the API Requests I'm trying to use:
https://cex.io/rest-api#historical-1m-ohlcv-chart
https://cex.io/rest-api#trade-history

OHLCV Feed Result for yesterday
https://cex.io/api/ohlcv/hd/20210530/ATOM/EUR

Current Feed Result for TradeHistory
https://cex.io/api/trade_history/ATOM/EUR


I would like to record all trade-data history and append today's recent trade history as OHLCV on top. I think the trade-history feed has all data required, but I don't know how to compute reduced f.e. data1m array from trade-history data.

Does anyone how such chart-data is generated? Thanks in advice.

Jump to: