Skip to content

get_history_candle_latest 报错 #26

@datawz

Description

@datawz
    okx_swap = OkxSWAP(OKX_API_KEY, OKX_API_SECRET, OKX_API_PASSPHRASE, OKX_IS_DEMO)
    trade = okx_swap.trade
    swap_market = okx_swap.market
    history_candle_latest = swap_market.get_history_candle_latest(
        instId='BTC-USDT-SWAP',
        length=200,
        bar='1m'
    )
    eprint(history_candle_latest)

这个输出有报错:
{'code': 'CANDLE_LENGTH_ERROR',
'data': array([[-2.14748365e+09, 1.09488500e+05, 1.09506800e+05,
1.09457300e+05, 1.09506700e+05, 1.12138800e+04,
1.12138800e+02, 1.22765061e+07, 1.00000000e+00]]),
'msg': 'BTC-USDT-SWAP[valid candle length error]: correct_length=200 error_length=1'}

参考的例子是3.4 APP 永续合约行情-历史K线.ipynb
中的4. 获取产品指定数量的最新历史K线数据 get_history_candle_latest
这个参数length有问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions