BTC-E API and determining volume for any time interval I've been logging data from BTC-E for a couple of months now and am writing my own charting app for personal use. I've been stumped for a while now on what the difference between "vol" and "vol_cur" is and how to determine the volume for any given interval I want (1min, 60min, 2month, etc):

https://btc-e.com/api/2/ltc_usd/ticker

{"ticker":{"high":11.976,"low":11.35,"avg":11.663,"vol":2147898.06418,"vol_cur":184074.26807,"last":11.35,"buy":11.35,"sell":11.32,"updated":1396883318,"server_time":1396883319}}


Subtracting the "vol" values from the end of my interval to the start sometimes yields negative numbers:

id |   timestamp_open    |   timestamp_close   |   open   |  close  |   high   |   low    |    volume
----+---------------------+---------------------+----------+---------+----------+----------+--------------
2 | 2014-02-15 18:00:00 | 2014-02-15 18:30:00 | 16.05385 | 15.9761 | 16.0675  | 15.9761  | -62044.90371
3 | 2014-02-15 18:30:00 | 2014-02-15 19:00:00 | 15.9761  | 16.049  | 16.05385 | 15.94642 | -40416.73599
4 | 2014-02-15 19:00:00 | 2014-02-15 19:30:00 | 15.94652 | 16.002  | 16.05385 | 15.935   | 32560.39743
5 | 2014-02-15 19:30:00 | 2014-02-15 20:00:00 | 16.002   | 16.05   | 16.05    | 16       | 31619.54125
6 | 2014-02-15 20:00:00 | 2014-02-15 20:30:00 | 16.03175 | 15.999  | 16.0532  | 15.9     | -10595.7155
7 | 2014-02-15 20:30:00 | 2014-02-15 21:00:00 | 15.999   | 15.997  | 15.999   | 15.94    | 61109.18234
8 | 2014-02-15 21:00:00 | 2014-02-15 21:30:00 | 15.997   | 16.132  | 16.25    | 15.997   | -33001.28287


The price did not close down so it is not representative of volume indicative of selling; how do I properly calculate the volume for an interval?
I would not rely on vol or vol_cur as they are computing data in a way you do not want from data which is available to you.

My recommendation would be to save the data of individual trades using btc-e API function TradeHistory. You can run a loop which would take the first result returned and using the timestamp as the parameter "end" for the next API call. Be aware that you will receive this and other transactions with the same timestamp in duplicate (so be sure to check the record doesn't exist in your db before adding it).

This way, you can write your own scripts to get your own averages and volumes over any time period you want :)