Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OHLCV Not giving right data #43

Open
Vortex1806 opened this issue Dec 5, 2023 · 0 comments
Open

OHLCV Not giving right data #43

Vortex1806 opened this issue Dec 5, 2023 · 0 comments

Comments

@Vortex1806
Copy link

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????

@Vortex1806 Vortex1806 changed the title OHLCV data is wrong OHLCV Not giving right data Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant