GithubHelp home page GithubHelp logo

okx's People

Contributors

pyted avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

okx's Issues

奇怪 我都跑起来是这样

` history_candle = self.market.get_history_candle(
instId='BTC-USDT',
start='2024-01-01 00:00:00',
end='2024-01-01 23:59:00',
bar='2H',
)

    eprint(history_candle)
    print('candle.shape=', history_candle['data'].shape)`

返回的是
{'code': 'CANDLE_START_ERROR', 'data': array([], shape=(0, 9), dtype=float64), 'msg': 'BTC-USDT[candle empty]'} candle.shape= (0, 9)

你好,操作遇到异常,异常只显示'Error response_status_code 401',如何看到具体的错误码?

50101 | 401 | APIKey 与当前环境不匹配
50102 | 401 | 请求时间戳过期
50103 | 401 | 请求头"OK-ACCESS-KEY"不能为空
50104 | 401 | 请求头"OK-ACCESS-PASSPHRASE"不能为空
50105 | 401 | 请求头"OK-ACCESS-PASSPHRASE"错误
50106 | 401 | 请求头"OK-ACCESS-SIGN"不能为空
50107 | 401 | 请求头"OK-ACCESS-TIMESTAMP"不能为空
50108 | 401 | 券商ID不存在
50109 | 401 | 券商域名不存在
50110 | 401 | 您的IP{0}不在APIKey绑定IP名单中 (您可以将您的IP加入到APIKey绑定白名单中)
50111 | 401 | 无效的OK-ACCESS-KEY
50112 | 401 | 无效的OK-ACCESS-TIMESTAMP
50113 | 401 | 无效的签名
50114 | 401 | 无效的授权

仅凭401无法定位错误,具体的错误码如何看到呢?

时区修改, 我好像理解有误? 居然出现4H开盘时间是23:00

我试了一下: examples/4.3 APP K线服务 维护实时历史K线.ipynb

改了一下时区, 尝试下载两个品种的k线, 然后开盘时间不对啊, 4H开盘时间怎么能是23:00

时间相关的代码:

from okx.app.candle_server import CandleRule,CandleServer
class MyCandleRule(CandleRule):
    TIMEZONE = 'Asia/Shanghai'
.......
import datetime
def stmptotime(stmp):
    temp = int(stmp)/1000.0   # open time from milisec to sec
    return datetime.datetime.fromtimestamp(temp)

这样看, 时区修改好像无效, 仍然是跑py代码的服务器的时间, 不是上海时间?

没有返回数据

image
老师,麻烦您看看图上的问题,等了很久,都没有返回数据

请教websocket读取历史k线数据,到底要不要API KEY?

初学,看了几个教程,先开始尝试写一小段实验代码:

from okx.app import OkxSWAP
from okx.app import MarketSWAP
from okx.app import Market

import websocket
import json
import pandas as pd

import datetime

# 对于下述代码 okxSWAP.market 等同于 marketSWAP 等同于 market
# # 单纯使用okxSWAP.market不需要秘钥
okxSWAP = OkxSWAP(
    key="",
    secret="",
    passphrase="",
    # 使用http和https代理,proxies={'http':'xxxxx','https:':'xxxxx'},通requests中的proxies参数规则相同
    proxies={'http':'http://127.0.0.1:7081','https':'http://127.0.0.1:7081'},
    # 转发:需搭建转发服务器,可参考:https://github.com/pyted/okx_resender
    proxy_host=None, 
)

get_history_candle_latest = okxSWAP.market.get_history_candle_latest(
    instId = 'ETH-USDT-SWAP',
    length = 3,
    bar = '5m'
)
get_history_candle_latest

结果提示要填写key。我填了,又说:
[FAILURE] 设置持仓方式为双向持仓失败,请手动设置:posMode="long_short_mode"

这个我还没尝试。我先问问:不是说只是读行情数据,不需要api key?

另外,我的目标是:用ws持续不断地读取所有永续合约的每个品种的5分钟k线数据,只要最新的(尚未完成的)一根k线即可,然后可能不需要保存为文件,直接判断涨幅然后根据涨幅排序。。。我用这个okx项目好,还是okx candle项目好?

API账号登录问题

version okx 2.1.1
account = Account( key=key, secret=secret, passphrase=passphrase, flag=flag, proxies=proxies, proxy_host=proxy_host, ) config_result = account.get_config()
使用香港服务器直接请求会出现下面问题:
okx.api._client.ResponseStatusError: Error response_status_code 401
response_content={"msg":"APIKey does not match current environment.","code":"50101"}

示例代码跑了一下, 出错了

okx/examples/4.1 APP K线服务 下载历史K线.ipynb

把示例代码跑了一下, 所有的下载都出现这样的错误:
2024-02-28 08:08:05,807 [ERROR] [get_history_candle_by_date] code=CANDLE_END_ERROR instId=BSV-USD-SWAP date=2024-02-28 bar=1m msg=BSV-USD-SWAP[valid candle end error]: correct_ts=1709135940000 error_ts=1709125620000.0 2024-02-28 08:08:11,898 [ERROR] [get_history_candle_by_date] code=CANDLE_END_ERROR instId=CRV-USD-SWAP date=2024-02-28 bar=1m msg=CRV-USD-SWAP[valid candle end error]: correct_ts=1709135940000 error_ts=1709125620000.0

是bug还是什么原因?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.