Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to obtain the real-time trading data of ETH through API interface

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to get real-time trading data of ETH through the API interface. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.

Overview of 1OKCOIN API

OKCoin provides users with a set of simple and powerful development tools designed to help users quickly and efficiently integrate OKCoin trading functions into their applications.

OKCoin API is the basis for providing services. After creating accounts on OKCoin websites, developers can create API with different permissions according to their own needs, and use API to automatically trade or withdraw cash.

With API, you can quickly achieve the following functions:

Get the latest market quotation

Get buying and selling depth information

Query available and frozen amounts

Inquire about the pending orders that have not been closed yet.

Buy and sell quickly

Batch withdrawal of orders

Quickly withdraw cash to your authentication address

After obtaining the permission of the interface, you can help the development by reading this API document.

2 description of the calling method of API

OKCoin provides users with three ways to call the API. Developers can query the market, conduct transactions or withdraw cash in a way that suits them according to their usage scenarios and preferences.

REST API

REST, the abbreviation of Representational State Transfer, is the most popular Internet software architecture at present. Because of its clear structure, standard, easy to understand and easy to expand, it is being adopted by more and more websites. Its advantages are as follows:

In the RESTful architecture, each URL represents a resource

Some kind of presentation layer for passing such resources between the client and the server

The client operates on the server-side resources through four HTTP instructions to achieve the "state transformation of the presentation layer".

It is recommended that developers use REST API for spot transactions or asset withdrawals.

WebSocket API

WebSocket is a new protocol of HTML5 (Protocol). It realizes the full-duplex communication between the client and the server, so that the data can be quickly transmitted in both directions. The connection between the client and the server can be established through a simple handshake, and the server can actively push information to the client according to business rules. Its advantages are as follows:

When the client and the server transfer data, the request header information is relatively small, about 2 bytes.

Both the client and the server can actively send data to each other.

There is no need to create TCP requests and destroy multiple times, saving broadband and server resources.

It is strongly recommended that developers use WebSocket API to obtain information such as market situation and trading depth.

3 REST API reference of spot market

The interface and description of obtaining the latest spot market data of OKCoin

Get / api/v1/ticker take OKCoin quotation

BTC https://www.okcoin.com/api/v1/ticker.do?symbol=btc_usd

LTC https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd

ETH https://www.okcoin.com/api/v1/ticker.do?symbol=eth_usd

ETC https://www.okcoin.com/api/v1/ticker.do?symbol=etc_usd

BCH https://www.okcoin.com/api/v1/ticker.do?symbol=bch_usd

Example

Request

GET https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd

Response

{"date": "1410431279", "ticker": {"buy": "33.15"," high ":" 34.15", "last": "33.15"," low ":" 32.05", "sell": "33.16"," vol ":" 10532696.39199642 "}}

Return value description

Date: server time when data is returned buy: buy one price high: highest price last: latest transaction price low: lowest price sell: sell one price vol: transaction volume (last 24 hours)

Request parameter

The above is how to obtain the real-time trading data of ETH through the API interface. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report