Skip to content

[Question]: history per minutes #715

@RoboWild

Description

@RoboWild

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions