Type/to search
8
Follow
1373
Followers
2.14 거래소 API를 호출하는 방법
Tutorials
Created 2017-05-02 11:53:48  Updated 2017-10-11 10:23:02
 2
 3413

2.14 거래소 API를 호출하는 방법

  • HttpQuery 함수

    img

    인증이 필요하지 않은 거래소 API를 호출할 때, 예를 들어:

    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")

    JSON 형식의 문자열을 가져옵니다. JSON.parse 함수를 사용하여 객체로 분석하여 데이터를 가져옵니다.

  • exchange.IO 함수

    img

    IO 함수를 호출하는 거래소 API는 반드시 검증이 필요합니다.

    특정 사용에 대해서는 API 문서 참조하십시오.

Related Recommendations
Comment
All comments (2)

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

    9 years ago

    python 这样写,我也是 看gihub 上的还在学习:

    def _call(self, mode, uri, data = None): url = '%s://%s%s' % (SCHEME, self._host, uri) # Log(mode + ' ' + url) # print headers = DEFAULT_GET_HEADERS if mode=='GET' else DEFAULT_POST_HEADERS req = request.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(resp.read())

    发送 请求。

    9 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)