LogoLogo
  • Analytics
    • Create Chart
      • Select Mode
      • Function mode
        • 1. How to import data
          • Select Data
          • Select Time Range
          • Data Setting
        • 2. How to analyze data
          • Data Details
          • Function Setting
          • How to write functions
          • Function Library
          • Function Chart Examples
        • 3. How to visualize data
          • Line & Bar Chart
          • Doughnut Chart
          • Number Chart
          • Table Chart
          • Color Setting
      • Python mode
        • 1. How to preview data
        • 2. How to analyze data
          • Python Setting
          • How to write Python
          • Python Chart Examples
        • 3. How to visualize data
          • Line & Bar Chart
          • Table Chart
    • Publish Chart
    • Chart Examples
    • Fork Chart
  • Terminal
    • Create Bot Strategy
      • 0. How to write code
      • 1. How to preview data
    • Fork Strategy
    • Strategy Examples
    • 🔜Deploy Bot
  • Workspace
    • Manage Strategy
      • Strategy Published
      • Strategy saved as draft
    • 🔜Manage Bot
  • Account Setting
    • Change Password
    • 🔜Register Exchange Account
    • 🔜Register OTP
    • 🔜Register Payment
  • library
    • 📍Function Library
    • 📍Python Library
      • Private API
        • Binance
      • Public API
  • FAQ
    • Data
      • Dataset
        • data list
      • What type of data can I use?
      • How customizable are the data?
    • Security
      • Is UnBlinked safe?
    • Account
      • I forgot my OTP device
      • I forgot password
Powered by GitBook

Copyright © 2023, UnBlinked Co., Ltd. | All rights reserved.

On this page
  • Common Functions
  • 1. Get Current Price
  1. library
  2. Python Library

Public API

A python class to send the public APIs.

The private API is a class to send API requests without authorization, e.g. get the price of some symbol in Binance spot market and etc.

It is initialized prior to your code as a variable named publicAPI.

Currently, the public API is available for terminal only for now. We will support this in analytics/python mode too in the future.

...

import PublicAPI

# `publicAPI` object is automatically initialized
# before running your code.
publicAPI = PublicAPI()

# your python code is placed here
# In your code, you can send public API requests like below:
## publicAPI.recent_price('binance', 'ETHUSDT')


Common Functions

The common functions are the methods of the public API, available for (almost) any exchanges we support. By using these functions, you can easily switch the exchanges you want to send API request to.

Every common function has its first argument as an exchange. It specifies which exchange should the request be sent to. For example, you can get the up-to-date price of BTCUSDT in Binance spot by publicAPI.recent_price('binance', 'BTCUSDT'), while publicAPI.recent_price('binance_um_futures', 'BTCUSDT') returns the price of BTCUSDT perpetual in Binance USDⓈ-M futures.

For now, the available exchanges are,

  • binance : Binance Spot

  • binance_um_futures : Binance USDⓈ-M Futures

  • binance_cm_futures : Binance COIN-M Futures

1. Get Current Price

publicAPI.recent_price(exchange :str, symbol: str) -> float

It is a function to get to the up-to-date price of a symbol in the selected exchange.

Arguments

  • exchange : (string). The name of the exchange

  • symbol : (string) The name of the symbol.

Returns

float


PreviousBinanceNextData

Last updated 1 year ago

📍