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

[Question]: history per minutes #715

Open
3 tasks done
RoboWild opened this issue Aug 14, 2023 · 0 comments
Open
3 tasks done

[Question]: history per minutes #715

RoboWild opened this issue Aug 14, 2023 · 0 comments

Comments

@RoboWild
Copy link

Question form pre-submit checklist.

  • I have searched the existing issues to ensure there isn't already an issue about this question.
  • My question has to do with the Python SDK and isn't a general question about the API. (If it is please open your issue here)
  • My question isn't about how to do a specific algorithm or asking for trade advice (answers to these are outside the scope of this repo).

Question

how can i get from 09:00 to 16:00 per minute we try many ways none working
and did not found any real documentation

import requests
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
from dateutil.parser import parse

...
...

params = {
'start': '2022-01-03T13:00:00Z',
'end': '2022-01-04T16:00:00Z'

}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
data = response.json()
trades = data['trades']
df = pd.DataFrame(trades)

# Convert timestamps to datetime format (using 'ns' unit for nanoseconds)
df['timestamp'] = pd.to_datetime(df['t'], unit='ns')
df.set_index('timestamp', inplace=True)
 # Print all rows in the dataset line by line
for index, row in df.iterrows():
    timestamp = row.iloc[0]
    parsed_timestamp = parse(timestamp)



    date = parsed_timestamp.date()
    time = parsed_timestamp.time()

    print("Date:", date)
    print("Time:", time)
    print(f"Row index: {index}")
    print(f"Column 0: {row.iloc[0]}")
    print(f"Column 1: {row.iloc[1]}")
    print(f"Column 2: {row.iloc[2]}")
    print(f"Column 3: {row.iloc[3]}")
    print(f"Column 4: {row.iloc[4]}")
    print(f"Column 5: {row.iloc[5]}")
    print("\n")
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