delta-exchange / python-rest-client

https://pypi.org/project/delta-rest-client/
13 stars 19 forks source link

OHLCV Not giving right data #43

Open Vortex1806 opened 7 months ago

Vortex1806 commented 7 months ago

I have used the below code to fetch ohlcv data def fetch_ohlcv(self, symbol, resolution, num_bars): endpoint = '/v2/history/candles' end_timestamp = int(datetime.datetime.now().timestamp()) start_timestamp = end_timestamp - (num_bars * self.resolution_to_seconds(resolution)) params = { 'symbol': symbol, 'resolution': resolution, 'start': start_timestamp, 'end': end_timestamp } try: response = self.request(method="GET",path=endpoint,query=params) response.raise_for_status() # Raise an exception for 4xx or 5xx status codes return response.json() except requests.exceptions.RequestException as err: print(f"Error: {err}") return None

But the result i get is the same number for all the columns and rows

 close     high      low     open                time  volume

0 34522.5 34522.5 34522.5 34522.5 2023-11-30 00:00:00 1000 1 34522.5 34522.5 34522.5 34522.5 2023-11-29 20:00:00 0 2 34522.5 34522.5 34522.5 34522.5 2023-11-29 16:00:00 0 3 34522.5 34522.5 34522.5 34522.5 2023-11-29 12:00:00 0 4 34522.5 34522.5 34522.5 34522.5 2023-11-29 08:00:00 0 .. ... ... ... ... ... ... 62 34521.0 34521.0 34521.0 34521.0 2023-11-19 16:00:00 10000 63 34521.0 34521.0 34521.0 34521.0 2023-11-19 12:00:00 0 64 34521.0 34521.0 34521.0 34521.0 2023-11-19 08:00:00 1000 65 34521.0 34521.0 34521.0 34521.0 2023-11-19 04:00:00 0 66 34521.0 34521.0 34521.0 34521.0 2023-11-19 00:00:00 17619

all values are almost same is the api not working????