gateio / gateapi-python

247 stars 92 forks source link

Gate api exception, label: INVALID_PARAM_VALUE, message: Invalid request parameter `limit` value: 100 #100

Closed 61go closed 2 years ago

61go commented 2 years ago

Gate api exception, label: INVALID_PARAM_VALUE, message: Invalid request parameter limit value: 100

from future import print_function import matplotlib.pyplot as plt import pandas as pd import requests import gate_api from gate_api.exceptions import ApiException, GateApiException

class KLines(object):

画图

def draw(self):
    # 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.FuturesApi(api_client)
    settle = 'usdt'  # str | Settle currency
    contract = 'BTC_USDT'  # str | Futures contract
    _from = 1546905600  # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)
    to = 1546935600  # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional)
    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)
    interval = '5m'  # str | Interval time between data points (optional) (default to '5m')

    try:
        # Get futures candlesticks
        api_response = api_instance.list_futures_candlesticks(settle, contract, _from=_from, to=to, limit=limit,
                                                              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 FuturesApi->list_futures_candlesticks: %s\n" % e)

if name == "main": kl = KLines() kl.draw()

61go commented 2 years ago

DONE

61go commented 2 years ago

DONE I see。