• اللغة وتبديل سعر الصرف
  • إعدادات التفضيلات
    لون الارتفاع / الهبوط
    وقت بداية ونهاية التغيير٪
Web3 تبادل
الإعلانات
نشاط
تقرير نصف أسبوعي
كبار الشخصيات والمؤسسات
Gate Learn
Delisted
Gate Wealth
ما تم إدراجه حديثًا
Gate Charity
التمويل
مسابقة تداول
Deposit&Withdrawal
ETF
حي
Gate Card
rename
إعلان Gate.io Futures API upgrade (New orderbook API with 10ms update)
Gate.io Futures API upgrade (New orderbook API with 10ms update)
2021-03-12 14:23:52 UTC 134653 قراءة
Gate.io has upgraded the Futures websocket API with new orderbook update methods. This upgrade includes:

1) Added a new order book channel futures.book_ticker to push best ask/bid in realtime (10ms)
2) Added a new order book channel futures.order_book_update to push order book change with user specified update frequency (100ms and 1000 ms)


How to maintain local order book using the new orderbook API?

1) Subscribe futures.order_book_update with specified level and update frequency, e.g. ["BTC_USDT", "1000ms", "10"] pushes the first 10 levels' update in BTC_USDT order book every 1s
2) Cache WebSocket notifications. Every notification use U and u to tell the first and last update ID since last notification.
3) Retrieve base order book using REST API (order_book method), and set with_id=true to make sure the order book ID is recorded(referred as baseID below) e.g. https://api.gateio.ws/api/v4/futures/usdt/order_book?contract=BTC_USDT&limit=10&with_id=true retrieves the 10-level base order book of BTC_USDT
4) Iterate the cached WebSocket notifications, and find the first one which contains the baseID, i.e. U <= baseId+1 and u >= baseId+1, then start consuming from it. Note that sizes in notifications are all absolute values. Use them to replace original sizes in corresponding price. If size equals to 0, delete the price from the order book.
5) Dump all notifications which satisfy u < baseID+1. If baseID+1 < first notification U, it means current base order book falls behind notifications. Start from step 3 to retrieve newer base order book.
6) If any subsequent notification which satisfy U > baseID+1 is found, it means some updates are lost. Reconstruct local order book from step 3.

Gate.io is an established exchange that holds integrity, transparency, and fairness to a very high standard. We charge zero listing fees and only choose quality and promising projects. Our exchange consists only of 100% real trading volume. Thanks to everyone who has joined us in our journey. We always intend to improve and innovate to reward our users for their continuous support.


Gate.io Team
March 12, 2021

Get 40% of all referees' trading fees in the affiliate program at https://www.gate.io/referral
Click to Sign up :https://www.gate.io/m#/register
Download it now at: https://www.gate.io/mobileapp

Follow us on social
Facebook: https://facebook.com/gateioglobal
Twitter: https://twitter.com/gate_io
Telegram:https://t.me/gateio
Instagram:https://www.instagram.com/gateioglobal
Medium:https://medium.com/@gateio
مشاركة المنشورات
مقالات ذات صلة
Gate.io Startup Free Offering: Propbase(PROPS) and Announcement of Free Distribution Rules ( 226,757... Gate.io will Adjust Listing time of Catcoin (CATCOIN) إعلان توزيع مكافأة مسابقة التداول Gate.io BRETT وEZSWAP وBRI وBWLD... Gate.io Has Added Merlin Chain (MERL)  Perpetual Contract Gate.io تعرض أحدث أنظمة Web3 البيئية في TOKEN2049 دبي... بدء تشغيل Gate.io: نتيجة بيع عملة Catcoin (CATCOIN) وجدول الإدراج...
اللغة والمنطقة
سعر الصرف
انتقال إلى Gate.tr؟
Gate.tr موجود على الإنترنت الآن.
يمكنك النقر والانتقال إلى Gate.tr أو البقاء في Gate.io.