डेवलपर्स
रियल-टाइम और ऐतिहासिक कीमतें इंटीग्रेट करने के लिए सब कुछ: एक इंटरैक्टिव संदर्भ, Python और JavaScript के SDK, OpenAPI स्पेसिफ़िकेशन और एक Postman कलेक्शन।
त्वरित शुरुआत
Python
# one file, standard library only (Python 3.9+)
curl -O https://app.marketapi.app/sdk/marketapi.py
pip install websockets # only if you use the live stream
from marketapi import MarketAPI
api = MarketAPI("YOUR_API_KEY")
print(api.latest(["EURUSD", "XAUUSD"]))JavaScript
// one ES module, no dependencies (Node 18+ and browsers)
curl -O https://app.marketapi.app/sdk/marketapi.mjs
npm install ws # only for the live stream in Node.js
import { MarketAPI } from "./marketapi.mjs";
const api = new MarketAPI({ apiKey: process.env.API_KEY });
console.log(await api.latest(["EURUSD"]));क्लाइंट एकल फ़ाइलें हैं जिन्हें आप अपने प्रोजेक्ट में रखते हैं, इसलिए पैकेज रजिस्ट्री से कुछ इंस्टॉल नहीं करना और किसी तीसरे पक्ष के कोड पर भरोसा नहीं करना। फ़ाइल को अपनी स्क्रिप्ट के पास या अपने इम्पोर्ट पाथ के किसी भी फ़ोल्डर में रखें।
marketapi.py marketapi.mjs OpenAPI 3.1 स्पेसिफ़िकेशन · Postman कलेक्शन · गाइड · बदलाव सूची · ओरेकल (स्मार्ट कॉन्ट्रैक्ट)
स्मार्ट कॉन्ट्रैक्ट बना रहे हैं?
ऑन-चेन प्राइस ओरेकल आपके कॉन्ट्रैक्ट को वही कीमतें हस्ताक्षरित रिपोर्ट के रूप में देता है जिन्हें वह ऑन-चेन सत्यापित कर सकता है: GET https://api.marketapi.app/v1/oracle/report?symbols=XAUUSD&chain_id=10, फिर submit(report, signature) और getPriceNoOlderThan(feedId, maxAge)। Solidity और ethers v6 उदाहरण, कॉन्ट्रैक्ट पते और फ़ीड ID ओरेकल दस्तावेज़ में हैं।
इंटरैक्टिव संदर्भ
General
GET /v1/status Service status
API कुंजी की ज़रूरत नहीं · बिलिंग: free
GET /v1/openapi.json This API description (OpenAPI 3.1)
API कुंजी की ज़रूरत नहीं · बिलिंग: free
GET /v1/postman.json Postman collection
API कुंजी की ज़रूरत नहीं · बिलिंग: free
GET /v1/account Your balance, plan and limits
कोई भी मान्य API कुंजी · बिलिंग: free
GET /v1/cost-preview Credits a request would cost
कोई भी मान्य API कुंजी · बिलिंग: free
Symbols
GET /v1/symbols Search the symbol list
स्कोप read:symbols · बिलिंग: free
GET /v1/symbols/{canonical} One symbol's specification
स्कोप read:metadata · बिलिंग: free
GET /v1/symbols/{canonical}/properties/history Specification change history
स्कोप read:metadata · बिलिंग: free
Prices
GET /v1/market-status Market status per symbol
स्कोप read:latest · बिलिंग: free
GET /v1/prices/latest Latest bid/ask
स्कोप read:latest · बिलिंग: 1 credit per symbol returned
History
GET /v1/bars Historical OHLC candles
स्कोप read:ohlcv · बिलिंग: credits per block of rows
GET /v1/ticks Historical ticks
स्कोप read:history · बिलिंग: credits per block of rows
Analytics
GET /v1/patterns/stats Pattern strategy statistics
स्कोप read:metadata · बिलिंग: 25 credits per call
Free tier
GET /v1/free/prices/latest Delayed prices, no key
API कुंजी की ज़रूरत नहीं · बिलिंग: free (fair-use limits)
GET /v1/free/symbols Free-tier symbol list, no key
API कुंजी की ज़रूरत नहीं · बिलिंग: free (fair-use limits)
GET /v1/free/market-status Market status, no key
API कुंजी की ज़रूरत नहीं · बिलिंग: free (fair-use limits)
Oracle
GET /v1/oracle/feeds Oracle feeds, networks and signer (when the oracle is enabled)
API कुंजी की ज़रूरत नहीं · बिलिंग: free
GET /v1/oracle/catalog Oracle feeds by network: asset name, category, contract, decimals (when enabled)
API कुंजी की ज़रूरत नहीं · बिलिंग: free
GET /v1/oracle/report Signed EIP-712 price reports (when the oracle is enabled)
स्कोप read:oracle · बिलिंग: credits per signed report
त्रुटियाँ
त्रुटियाँ RFC 9457 प्रॉब्लम डिटेल्स का उपयोग करती हैं: {"type", "title", "status", "code", "detail", "request_id"}। सहायता से संपर्क करते समय request_id बताएँ।
| HTTP | कोड | अर्थ | क्या करें |
|---|---|---|---|
| 400 | invalid_parameter | A parameter is missing or malformed. | Check the parameter named in detail. |
| 400 | too_many_symbols | Too many symbols in one request. | Split the request (up to 100 symbols). |
| 400 | range_too_large | The time range is too long for this endpoint. | Request shorter ranges and page. |
| 400 | credentials_in_query | The API key was sent in the URL. | Send it in the Authorization header. |
| 401 | unauthenticated | No or an invalid API key. | Send Authorization: Bearer <key>. |
| 401 | key_revoked | The API key was revoked. | Create a new key in the dashboard. |
| 401 | key_expired | The API key has expired. | Create a new key or extend it. |
| 402 | insufficient_balance | No credits left. | Top up or choose a plan. |
| 402 | plan_credits_used_up | The plan's credits for this month are used up (your balance is never used while a plan runs). | Add credits to the month or upgrade on the billing page. |
| 402 | plan_ended | The API plan has ended; the balance is not used until you choose. | Renew, pick a plan, or choose pay as you go on the billing page. |
| 403 | insufficient_scope | The key lacks the scope this endpoint needs. | Create a key with that scope. |
| 403 | ip_not_allowed | The request came from an IP the key does not allow. | Update the key's IP list. |
| 403 | account_inactive | The account is suspended or not verified. | Verify your email or contact support. |
| 403 | sandbox_not_billable | Test keys cannot call billable endpoints. | Use a live key. |
| 404 | not_found | Resource not available. | Check the URL; some features may be switched off. |
| 404 | unknown_symbol | The symbol does not exist. | Search /symbols or the ticker list. |
| 404 | free_tier_disabled | The free tier is switched off. | Use an API key. |
| 405 | method_not_allowed | Wrong HTTP method. | Use GET. |
| 409 | idempotency_mismatch | Same Idempotency-Key reused with different parameters. | Use a new key. |
| 409 | idempotency_key_used | The Idempotency-Key was used and its answer is no longer kept (24 h, 2 MB). | Send a new key for current data. |
| 429 | rate_limited | Too many requests per minute or hour. | Wait for Retry-After; batch symbols. |
| 429 | too_many_concurrent_requests | Too many requests in parallel. | Limit concurrency. |
| 429 | daily_limit | Free-tier daily limit reached. | Retry tomorrow or use an API key. |
| 503 | oracle_unavailable | The oracle signing service is temporarily unavailable. | Retry with back-off. |
| 503 | free_tier_unavailable | The free tier is temporarily unavailable. | Retry later. |
| 503 | free_tier_busy | The free tier is busy. | Retry later or use an API key. |