The resource loading... loading...

2.14 How to call an exchange's API

Author: Inventors quantify - small dreams, Created: 2017-05-02 11:53:48, Updated: 2017-10-11 10:23:02

2.14 How to call an exchange's API

  • HttpQuery functions

    img

    When calling some exchange APIs that do not require authentication (e.g. API that is not related to account information), for example:

    https://www.okcoin.com/api/v1/future_estimated_price.do?symbol=btc_usd // 获取交割预估价
    

    HttpQuery(“https://www.okcoin.com/api/v1/future_estimated_price.do?symbol=btc_usd”)

    https://www.okcoin.com/api/v1/future_hold_amount.do?symbol=btc_usd&contract_type=next_week  // 获取合约持仓量
    

    HttpQuery(“https://www.okcoin.com/api/v1/future_hold_amount.do?symbol=btc_usd&contract_type=next_week”)

    The result is a string in JSON format that can be parsed as an object using the JSON.parse function.

  • exchange.IOFunction

    img

    Exchange APIs that call IO functions must be authenticated (not supported by those APIs that can be accessed directly with HttpQuery).

    For specific uses, see the API documentation.


More

qq47898077 因为python不支持HttpQuery,exchange.IO又必须要验证,所以我尝试用自带的urllip获取行情信息。但是Poloniex的API都有人工验证,你们是怎么解决的呢。

Inventors quantify - small dreamsI'm still learning on gihub, too: What's up? def _call ((self, mode, uri, data = None): url = '%s://%s%s' % (SCHEME, self._host, uri) # log (mode +'' + url) # print If you want to change the header, you can change the header. What do you mean? Request (url, data = data, headers = headers, method = mode) # Log (("req:", req) # print with request.urlopen ((req, timeout=TIMEOUT) as resp: If resp.getcode (()!=200: raise ApiNetworkError (('Bad response code: %s %s' % (resp.getcode(), resp.reason)) return resp.read ((() # self._parse (()) What's up? Send a request.