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")
Question form pre-submit checklist.
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)