Author

Topic: Timestamp to time? (Read 373 times)

member
Activity: 118
Merit: 12
Passionate software developer and crypto guy.
April 17, 2016, 08:18:54 AM
#4
Just got an email from C-CEX support. It was a bug in their system. Now the timestamp is working like Bitstamp.

member
Activity: 118
Merit: 12
Passionate software developer and crypto guy.
April 17, 2016, 07:58:54 AM
#3
I don't know if anyone else has any better answer to this, but it honestly seems like c-cex have messed up the time configuration on their API.

Looking at their API documentation, it seems they use a new time format for every API call, which is not good at all.

As for a fix for this, if you know their API is offset by X days you could just subtract that from the timestamp c-cex returns. It's really not an optimal solution, but their API seems really bad.

Yeah...I have also thought of that, but honestly it's a temporary workaround not a real solution. But thanks for your input anyway. I wrote C-CEX support about the problem. The issue still persist even after new trades have been made. In short the timestamp is not updated.

member
Activity: 72
Merit: 10
April 17, 2016, 07:50:47 AM
#2
I don't know if anyone else has any better answer to this, but it honestly seems like c-cex have messed up the time configuration on their API.

Looking at their API documentation, it seems they use a new time format for every API call, which is not good at all.

As for a fix for this, if you know their API is offset by X days you could just subtract that from the timestamp c-cex returns. It's really not an optimal solution, but their API seems really bad.
member
Activity: 118
Merit: 12
Passionate software developer and crypto guy.
April 17, 2016, 03:07:51 AM
#1
If you look at a rest request on C-CEX for bitcoin prices

https://c-cex.com/t/btc-usd.json you get

{"ticker":{"high":438,"low":432.999999,"avg":435.4999995,"lastbuy":433.2,"lastsell":438,"buy":433.2001,"sell":435.0000002,"lastprice":433.2,"buysupport":2690.15560102,"updated":1461225600}}

-----------------------------------------------------------------------------------------------

If you do the same on Bitstamp

https://www.bitstamp.net/api/ticker/

You get:

{"high": "432.87", "last": "430.01", "timestamp": "1460823147", "bid": "430.02", "vwap": "429.08", "volume": "2780.11282927", "low": "426.61", "ask": "430.06", "open": 429.29}

-------------------------------------------------------------------------------------------

Now the "timestamp" and the "updated" json fields represent the time of the last trade.

On Bitstamp if you want to convert that timestamp to a human readable local time you do like this:
// Unix timestamp is seconds past epoch
DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
dt = dt.AddSeconds(Timestamp).ToLocalTime();

So basically it's the total seconds since January 1'th 1970.

On C-CEX as you can see the updated value is higher. If I use the same procedure as above I get April 21 10.00 AM.....Is there anybody who can explain how C-CEX returns their timestamp (updated)?
Jump to: