Skip to main content
GET
https://stocks-dev.up.railway.app
/
api
/
v1
/
crypto
Cryptocurrency Prices
curl --request GET \
  --url https://stocks-dev.up.railway.app/api/v1/crypto
{
  "cryptocurrencies": [
    {
      "symbol": "<string>",
      "name": "<string>",
      "price": 123,
      "change": 123,
      "changesPercentage": 123,
      "marketCap": 123,
      "volume": 123,
      "rank": 123
    }
  ],
  "timestamp": "<string>"
}

Endpoint

GET /api/v1/crypto

Parameters

limit
integer
default:"20"
Number of cryptocurrencies to return (max 100)

Response

cryptocurrencies
array
Array of cryptocurrency data
timestamp
string
Response timestamp in ISO format

Example Response

{
  "cryptocurrencies": [
    {
      "symbol": "BTC",
      "name": "Bitcoin",
      "price": 43250.00,
      "change": 1250.50,
      "changesPercentage": 2.98,
      "marketCap": 850000000000,
      "volume": 28500000000,
      "rank": 1
    },
    {
      "symbol": "ETH",
      "name": "Ethereum",
      "price": 2650.75,
      "change": -125.25,
      "changesPercentage": -4.51,
      "marketCap": 320000000000,
      "volume": 15200000000,
      "rank": 2
    },
    {
      "symbol": "BNB",
      "name": "Binance Coin",
      "price": 315.80,
      "change": 15.60,
      "changesPercentage": 5.20,
      "marketCap": 48500000000,
      "volume": 1800000000,
      "rank": 3
    }
  ],
  "timestamp": "2025-06-28T18:42:12.471731"
}

Use Cases

Monitor cryptocurrency holdings and performance:
def track_crypto_portfolio(holdings):
    response = requests.get("/api/v1/crypto", params={"limit": 100})
    all_cryptos = {crypto["symbol"]: crypto for crypto in response.json()["cryptocurrencies"]}
    
    portfolio_value = 0
    for symbol, amount in holdings.items():
        if symbol in all_cryptos:
            crypto = all_cryptos[symbol]
            value = crypto["price"] * amount
            portfolio_value += value
            print(f"{symbol}: ${value:,.2f} ({crypto['changesPercentage']:+.2f}%)")
    
    return portfolio_value

holdings = {"BTC": 0.5, "ETH": 2.0, "BNB": 10}
total_value = track_crypto_portfolio(holdings)
Analyze cryptocurrency market trends:
def analyze_crypto_market():
    response = requests.get("/api/v1/crypto", params={"limit": 50})
    cryptos = response.json()["cryptocurrencies"]
    
    gainers = [c for c in cryptos if c["changesPercentage"] > 0]
    losers = [c for c in cryptos if c["changesPercentage"] < 0]
    
    print(f"Gainers: {len(gainers)}, Losers: {len(losers)}")
    print(f"Top gainer: {max(gainers, key=lambda x: x['changesPercentage'])['symbol']}")
    print(f"Top loser: {min(losers, key=lambda x: x['changesPercentage'])['symbol']}")
Set up price monitoring and alerts:
def check_price_alerts(alerts):
    response = requests.get("/api/v1/crypto")
    cryptos = {c["symbol"]: c for c in response.json()["cryptocurrencies"]}
    
    triggered_alerts = []
    for symbol, target_price, condition in alerts:
        if symbol in cryptos:
            current_price = cryptos[symbol]["price"]
            if (condition == "above" and current_price > target_price) or \
               (condition == "below" and current_price < target_price):
                triggered_alerts.append({
                    "symbol": symbol,
                    "current_price": current_price,
                    "target_price": target_price,
                    "condition": condition
                })
    
    return triggered_alerts

alerts = [("BTC", 45000, "above"), ("ETH", 2500, "below")]
triggered = check_price_alerts(alerts)