🧙Price Oracle
Overview
The LN Exchange Price Oracle is the cornerstone of decentralized finance within the Lightning Network, primarily serving RFQ (Request for Quote) services. This platform provides dynamic pricing, including price fluctuations and a spread between buy and sell prices, ensuring accurate and reliable rates for assets traded on the network.
This guide will walk you through integrating with the platform, fetching prices, and adding currency pairs.
Unified Interface Domain
GRPC: oracle.ln.exchange:443
REST: https://oracle.ln.exchange
Fetching Prices
GRPC Calls
REST Calls
Adding Currency Pairs & Prices
There are 2 methods for adding assets/currency pairs:
Method 1: Using BTC/USDT Price
This method is intended for assets that are tied to the USDT stablecoin. When this method is used, the system automatically fetches the current BTC/USDT price, ensuring that your asset's value reflects real-time market conditions.
Method 2: Manual Price Specification
This method is useful for testing purposes. You can manually specify the price of the assets.
After adding prices using either method, prices can be fetched immediately.
If a currency pair or currency doesn’t exist, the system will automatically create them.
Prices can be added multiple times; the system will always use the most recently added price when fetching.
Note: For dynamic BTC-USDT pricing, set price=0 when adding the price. This value is fixed, and subsequent modifications are restricted.
Please refer to the API section for more details.
Price Oracle API
Quick Start
GRPC Section
Fetch Price
URL:
oracle.ln.exchange:443
Method:
priceoraclerpc.PriceOracle.QueryRateTick
Request Parameters
subjectAsset.assetidStr
String
Yes
Quoted currency asset ID (e.g., USDT)
subjectAsset.assetidStr
String
Yes
Base currency asset ID (e.g., BTC)
Request Example
Response Parameters
rate_tick
rate
String
Price rate
expiry_timestamp
String
Expiry Timestamp
REST Section API
REST Request Authentication
All private REST requests must include the following header
Header Parameters
Content-Type:
String
Yes
application/json
Fetch Price List
URL:
/napi/price/getList
Method:
GET
Request Parameters
symbolAssetsId
String
Yes
Currency pair asset ID
transaction_type
String
Yes
Transaction type: 0 = buy, 1 = sell
current
String
No
Page number (default is 1)
size
String
No
Number of items per page (default is 10)
Request Example
Response Parameters
total
String
Total number of records
pages
String
Total number of pages
transaction_type
String
Transaction type: 0 = buy, 1 = sell
list
List
symbol
String
Currency pair name
price
String
Price
base
String
Base currency name (e.g, BTC)
baseAssetsId
String
Base currency asset ID
quote
String
Quoted currency name (e.g, USDT)
quoteAssetsId
String
Quoted currency asset ID
ctime
String
Creation time
Add Currency Pair & Price
URL:
/napi/price/custom
Method:
POST
Request Parameters
paymentAssetName
String
Yes
Base currency name (e.g., BTC)
paymentAssetId
String
Yes
Base currency asset ID
subjectAssetName
String
Yes
Quoted currency name (e.g., USDT)
subjectAssetId
String
Yes
Quoted currency asset ID
subjectAssetDemical
String
Yes
Quoted currency asset precision (e.g., 4)
price
String
Yes
Price (Note: setting price = 0 will fetch real-time BTC-USDT price)
priceFluctuationRate
String
Yes
Price fluctuation rate: Default is 2%
Request Example (Price not equal to 0)
Request Example (Price equal to 0)
Response Parameters
code
String
0 indicates successful addition
data
String
true indicates successful addition
Last updated