https://github.com/zaber-dev/stellar-price-api
A lightweight API that provides real-time price data for a token on Stellar Blockchain in both XLM and USD.
https://github.com/zaber-dev/stellar-price-api
blockchain learn price price-api sdex stellar stellar-api stellar-network
Last synced: 2 months ago
JSON representation
A lightweight API that provides real-time price data for a token on Stellar Blockchain in both XLM and USD.
- Host: GitHub
- URL: https://github.com/zaber-dev/stellar-price-api
- Owner: zaber-dev
- License: mit
- Created: 2025-03-25T07:12:30.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-25T08:07:46.000Z (2 months ago)
- Last Synced: 2025-03-25T08:38:47.111Z (2 months ago)
- Topics: blockchain, learn, price, price-api, sdex, stellar, stellar-api, stellar-network
- Language: Python
- Homepage: https://stellar-price-api.onrender.com/
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stellar Price API
A lightweight API that provides real-time price data for a Stellar token in both XLM and USD.
## Features
- Fetches live token prices from the Stellar DEX (Decentralized Exchange)
- Calculates price using both recent trades and liquidity pool data
- Converts token price to USD using current XLM/USD exchange rates
- Provides a simple REST API endpoint to access the pricing data## Installation
1. Clone the repository
```
git clone https://github.com/zaber-dev/Stellar-Price-API
```
2. Install the required dependencies:
```
pip install -r requirements.txt
```## Configuration
Create a `.env` file in the project root with the following variables:
```
TOKEN_CODE=OVRL
TOKEN_ISSUER=GBZH36ATUXJZKFRMQTAAW42MWNM34SOA4N6E7DQ62V3G5NVITC3QOVRL
```Replace OVRL and the issuer address with your own token details if needed.
## Usage
Start the server:
```python main.py```The API will be available at `http://localhost:5000/`
### API Endpoints
- `GET /`: Returns the current token price in both XLM and USD
Example Response:
```json
{
"xlm": "0.0123456",
"usd": "0.0012345"
}
```
### License
MIT