python-bitget icon indicating copy to clipboard operation
python-bitget copied to clipboard

Missing "Get History Candle Data"

Open Chrisi1993 opened this issue 1 year ago • 1 comments

Hi,

Thank you very much for your great work. I have noticed that the "Get History Candle Data" is missing in your Code (https://bitgetlimited.github.io/apidoc/en/mix/#get-history-candle-data). The "Get Candle Data" is included but this is only limited to 30 days of history by Bitget.

Kind regards, Chris

Chrisi1993 avatar Feb 12 '24 02:02 Chrisi1993

Hi Chris

You can just add the following to client.py. I have been working to amend client.py to use V2 API.

def mix_get_historycandles(self, symbol, granularity, startTime, endTime, limit=100):
    """
    Get Candle Data: https://bitgetlimited.github.io/apidoc/en/mix/#get-candle-data
    Limit rule: 20 times/1s (IP)
    Required: symbol, granularity, startTime, endTime
    :return:
    """
    params = {}
    if symbol and granularity and startTime and endTime:
        params["symbol"] = symbol
        params["granularity"] = granularity
        params["startTime"] = startTime
        params["endTime"] = endTime
        params["limit"] = limit
        return self._request_with_params(GET, MIX_MARKET_V1_URL + '/history-candles', params)
    else:
        logger.error("pls check args")
        return False

Thanks

novicetopython avatar Feb 23 '24 17:02 novicetopython