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

Problem with open field in OHLCV #163

Open
BMMAIA95 opened this issue Sep 5, 2024 · 2 comments
Open

Problem with open field in OHLCV #163

BMMAIA95 opened this issue Sep 5, 2024 · 2 comments

Comments

@BMMAIA95
Copy link

BMMAIA95 commented Sep 5, 2024

Hey guys!

I'm building a script in Python that returns the value of the OPEN field when using OHLCV, however, when I run the code it returns a value that I don't understand. Could anyone help me please?

This is the code:

import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.SpotApi(api_client)
currency_pair = 'SOL_USDT' # str | Currency pair
limit = 100 # int | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100)
_from = 1725526800 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)
to = 1725526800 # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional)
interval = '1d' # str | Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional) (default to '30m')

try:
    # Market candlesticks
    api_response = api_instance.list_candlesticks(currency_pair, limit=limit, _from=_from, to=to, interval=interval)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling SpotApi->list_candlesticks: %s\n" % e)
This is the result:

Captura de tela 2024-09-05 114654

@revilwang
Copy link
Collaborator

You can find the response explanation here

@BMMAIA95
Copy link
Author

BMMAIA95 commented Sep 5, 2024

You can find the response explanation here

Thanks for the answer. I looked at the page you mentioned and found an explanation of why this happens, but where do I find the solution? How do I convert this value to USDT for example? In the document exemple it is also like this and it does not show how to solve

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

2 participants