mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2026-01-25 14:04:19 +01:00
feat: Add digital asset endpoints (Crypto, Forex)
Add OpenAPI specifications for alternative assets: - Crypto prices, metadata, and top-of-book data - Forex currency pair rates and historical data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
303
openapi/schemas/crypto-schemas.yaml
Normal file
303
openapi/schemas/crypto-schemas.yaml
Normal file
@@ -0,0 +1,303 @@
|
||||
# Crypto Schema Definitions for Tiingo API
|
||||
# Reference these using: $ref: '../schemas/crypto-schemas.yaml#/SchemaName'
|
||||
|
||||
CryptoCurrency: &CryptoCurrency
|
||||
type: string
|
||||
pattern: '^[a-z0-9]+$'
|
||||
description: Cryptocurrency code (lowercase)
|
||||
example: 'btc'
|
||||
|
||||
CryptoTicker: &CryptoTicker
|
||||
type: string
|
||||
pattern: '^[a-z0-9]+$'
|
||||
description: Cryptocurrency ticker (e.g., btcusd, ethusd)
|
||||
example: 'btcusd'
|
||||
|
||||
ResampleFreq: &ResampleFreq
|
||||
type: string
|
||||
pattern: '^[0-9]+(min|hour|day)$'
|
||||
description: Resampling frequency for historical data
|
||||
enum:
|
||||
- '1min'
|
||||
- '5min'
|
||||
- '15min'
|
||||
- '30min'
|
||||
- '1hour'
|
||||
- '2hour'
|
||||
- '4hour'
|
||||
- '1day'
|
||||
example: '5min'
|
||||
|
||||
# Price Data Schemas
|
||||
|
||||
PriceDataItem: &PriceDataItem
|
||||
type: object
|
||||
description: OHLCV price data for a specific time period
|
||||
properties:
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: The datetime this data pertains to, dependent on resampleFreq parameter
|
||||
example: '2019-01-02T00:00:00.000Z'
|
||||
open:
|
||||
type: number
|
||||
format: float
|
||||
description: The opening price for the asset
|
||||
example: 3690.01
|
||||
high:
|
||||
type: number
|
||||
format: float
|
||||
description: The high price for the asset
|
||||
example: 3701.0
|
||||
low:
|
||||
type: number
|
||||
format: float
|
||||
description: The low price for the asset
|
||||
example: 3600.65
|
||||
close:
|
||||
type: number
|
||||
format: float
|
||||
description: The closing price for the asset
|
||||
example: 3610.32
|
||||
volume:
|
||||
type: number
|
||||
format: float
|
||||
description: The volume in the base currency
|
||||
example: 1234.56
|
||||
volumeNotional:
|
||||
type: number
|
||||
format: float
|
||||
description: The volume in the quote currency (volumeNotional = close * volume)
|
||||
example: 4456789.12
|
||||
tradesDone:
|
||||
type: integer
|
||||
format: int32
|
||||
description: The number of trades executed
|
||||
example: 5000
|
||||
required:
|
||||
- date
|
||||
- open
|
||||
- high
|
||||
- low
|
||||
- close
|
||||
- volume
|
||||
- volumeNotional
|
||||
- tradesDone
|
||||
|
||||
ExchangeDataItem: &ExchangeDataItem
|
||||
type: object
|
||||
description: Raw exchange-level price data
|
||||
additionalProperties:
|
||||
type: object
|
||||
description: Exchange-specific data keyed by exchange name
|
||||
properties:
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
open:
|
||||
type: number
|
||||
format: float
|
||||
high:
|
||||
type: number
|
||||
format: float
|
||||
low:
|
||||
type: number
|
||||
format: float
|
||||
close:
|
||||
type: number
|
||||
format: float
|
||||
volume:
|
||||
type: number
|
||||
format: float
|
||||
volumeNotional:
|
||||
type: number
|
||||
format: float
|
||||
tradesDone:
|
||||
type: integer
|
||||
|
||||
CryptoPrice: &CryptoPrice
|
||||
type: object
|
||||
description: Cryptocurrency price response with metadata and price data
|
||||
properties:
|
||||
ticker:
|
||||
type: string
|
||||
description: Ticker related to the asset
|
||||
example: 'btcusd'
|
||||
baseCurrency:
|
||||
type: string
|
||||
description: The base pair of the cryptocurrency (e.g., "btc" for "btcusd")
|
||||
example: 'btc'
|
||||
quoteCurrency:
|
||||
type: string
|
||||
description: The quote pair of the cryptocurrency (e.g., "usd" for "btcusd")
|
||||
example: 'usd'
|
||||
priceData:
|
||||
type: array
|
||||
description: Array of price data points
|
||||
items:
|
||||
$ref: '#/PriceDataItem'
|
||||
exchangeData:
|
||||
$ref: '#/ExchangeDataItem'
|
||||
description: Underlying data for each exchange (only included if includeRawExchangeData=true)
|
||||
required:
|
||||
- ticker
|
||||
- baseCurrency
|
||||
- quoteCurrency
|
||||
- priceData
|
||||
|
||||
# Metadata Schemas
|
||||
|
||||
CryptoMetadata: &CryptoMetadata
|
||||
type: object
|
||||
description: Cryptocurrency metadata information
|
||||
properties:
|
||||
ticker:
|
||||
type: string
|
||||
description: Ticker related to the asset
|
||||
example: 'btcusd'
|
||||
baseCurrency:
|
||||
type: string
|
||||
description: The base pair of the cryptocurrency
|
||||
example: 'btc'
|
||||
quoteCurrency:
|
||||
type: string
|
||||
description: The quote pair of the cryptocurrency
|
||||
example: 'usd'
|
||||
name:
|
||||
type: string
|
||||
description: Full-length name of the asset
|
||||
example: 'Bitcoin'
|
||||
description:
|
||||
type: string
|
||||
description: Long-form description of the asset
|
||||
example: 'Bitcoin is a cryptocurrency and worldwide payment system.'
|
||||
required:
|
||||
- ticker
|
||||
- baseCurrency
|
||||
- quoteCurrency
|
||||
- name
|
||||
|
||||
# Top-of-Book Schemas
|
||||
|
||||
TopOfBookData: &TopOfBookData
|
||||
type: object
|
||||
description: Top-of-book data with bid/ask and last trade information
|
||||
properties:
|
||||
quoteTimestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Timestamp when quote (bid/ask) data was last received
|
||||
example: '2019-01-02T12:34:56.789Z'
|
||||
lastSaleTimestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Timestamp when last trade data was received
|
||||
example: '2019-01-02T12:34:56.789Z'
|
||||
lastPrice:
|
||||
type: number
|
||||
format: float
|
||||
description: Last executed price on any exchange
|
||||
example: 3610.32
|
||||
lastSize:
|
||||
type: number
|
||||
format: float
|
||||
description: Volume of the last trade in base currency
|
||||
example: 0.5
|
||||
lastSizeNotional:
|
||||
type: number
|
||||
format: float
|
||||
description: Notional value of last trade (lastSizeNotional = lastPrice * lastSize)
|
||||
example: 1805.16
|
||||
lastExchange:
|
||||
type: string
|
||||
description: Full name of the exchange where last trade occurred
|
||||
example: 'Coinbase'
|
||||
bidSize:
|
||||
type: number
|
||||
format: float
|
||||
description: Amount at the bid price
|
||||
example: 1.2
|
||||
bidPrice:
|
||||
type: number
|
||||
format: float
|
||||
description: Current bid price
|
||||
example: 3609.50
|
||||
bidExchange:
|
||||
type: string
|
||||
description: Full name of the exchange with the best bid
|
||||
example: 'Binance'
|
||||
askSize:
|
||||
type: number
|
||||
format: float
|
||||
description: Amount at the ask price
|
||||
example: 0.8
|
||||
askPrice:
|
||||
type: number
|
||||
format: float
|
||||
description: Current ask price
|
||||
example: 3611.00
|
||||
askExchange:
|
||||
type: string
|
||||
description: Full name of the exchange with the best ask
|
||||
example: 'Kraken'
|
||||
|
||||
TopOfBookExchangeData: &TopOfBookExchangeData
|
||||
type: object
|
||||
description: Exchange-level top-of-book data
|
||||
additionalProperties:
|
||||
type: object
|
||||
description: Exchange-specific top-of-book data keyed by exchange name
|
||||
properties:
|
||||
quoteTimestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
lastSaleTimestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
lastPrice:
|
||||
type: number
|
||||
format: float
|
||||
lastSize:
|
||||
type: number
|
||||
format: float
|
||||
bidSize:
|
||||
type: number
|
||||
format: float
|
||||
bidPrice:
|
||||
type: number
|
||||
format: float
|
||||
askSize:
|
||||
type: number
|
||||
format: float
|
||||
askPrice:
|
||||
type: number
|
||||
format: float
|
||||
|
||||
CryptoTopOfBook: &CryptoTopOfBook
|
||||
type: object
|
||||
description: Cryptocurrency top-of-book response with metadata and book data (DEPRECATED)
|
||||
deprecated: true
|
||||
properties:
|
||||
ticker:
|
||||
type: string
|
||||
description: Ticker related to the asset
|
||||
example: 'btcusd'
|
||||
baseCurrency:
|
||||
type: string
|
||||
description: The base pair of the cryptocurrency
|
||||
example: 'btc'
|
||||
quoteCurrency:
|
||||
type: string
|
||||
description: The quote pair of the cryptocurrency
|
||||
example: 'usd'
|
||||
topOfBookData:
|
||||
$ref: '#/TopOfBookData'
|
||||
description: Top-of-book data
|
||||
exchangeData:
|
||||
$ref: '#/TopOfBookExchangeData'
|
||||
description: Underlying data for each exchange (only included if includeRawExchangeData=true)
|
||||
required:
|
||||
- ticker
|
||||
- baseCurrency
|
||||
- quoteCurrency
|
||||
- topOfBookData
|
||||
106
openapi/schemas/forex-schemas.yaml
Normal file
106
openapi/schemas/forex-schemas.yaml
Normal file
@@ -0,0 +1,106 @@
|
||||
# Tiingo Forex API Schema Definitions
|
||||
# Reference these using: $ref: './forex-schemas.yaml#/ForexTopOfBook'
|
||||
|
||||
ForexTopOfBook: &ForexTopOfBook
|
||||
type: object
|
||||
description: Real-time top-of-book data for a forex pair including bid/ask prices and sizes
|
||||
properties:
|
||||
ticker:
|
||||
type: string
|
||||
description: Forex ticker pair
|
||||
pattern: '^[a-z]{6}$'
|
||||
example: eurusd
|
||||
quoteTimestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
description: The timestamp when the data was last refreshed (ISO 8601 format with timezone)
|
||||
example: '2019-07-01T21:00:01.289000+00:00'
|
||||
midPrice:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: The mid price calculated as (bidPrice + askPrice) / 2.0 when both bid and ask prices are not null
|
||||
example: 1.11865
|
||||
bidSize:
|
||||
type: number
|
||||
format: float
|
||||
description: The amount of units available at the bid price
|
||||
example: 1000000.0
|
||||
bidPrice:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: The current bid price
|
||||
example: 1.1186
|
||||
askSize:
|
||||
type: number
|
||||
format: float
|
||||
description: The amount of units available at the ask price
|
||||
example: 1000000.0
|
||||
askPrice:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: The current ask price
|
||||
example: 1.1187
|
||||
required:
|
||||
- ticker
|
||||
- quoteTimestamp
|
||||
- bidSize
|
||||
- askSize
|
||||
example:
|
||||
ticker: eurusd
|
||||
quoteTimestamp: '2019-07-01T21:00:01.289000+00:00'
|
||||
bidPrice: 1.1186
|
||||
bidSize: 1000000.0
|
||||
askPrice: 1.1187
|
||||
askSize: 1000000.0
|
||||
midPrice: 1.11865
|
||||
|
||||
ForexPrice: &ForexPrice
|
||||
type: object
|
||||
description: Historical OHLC (Open, High, Low, Close) price data for a forex pair
|
||||
properties:
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: The date/time this data pertains to (ISO 8601 format). Format depends on resampleFreq parameter
|
||||
example: '2019-06-28T20:00:00.000Z'
|
||||
open:
|
||||
type: number
|
||||
format: float
|
||||
description: The opening price for the asset in the given period
|
||||
example: 1.1232
|
||||
high:
|
||||
type: number
|
||||
format: float
|
||||
description: The high price for the asset in the given period
|
||||
example: 1.1254
|
||||
low:
|
||||
type: number
|
||||
format: float
|
||||
description: The low price for the asset in the given period
|
||||
example: 1.1220
|
||||
close:
|
||||
type: number
|
||||
format: float
|
||||
description: The closing price for the asset in the given period
|
||||
example: 1.1245
|
||||
volume:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: Trading volume for the period (when available)
|
||||
example: null
|
||||
required:
|
||||
- date
|
||||
- open
|
||||
- high
|
||||
- low
|
||||
- close
|
||||
example:
|
||||
date: '2019-06-28T20:00:00.000Z'
|
||||
open: 1.1232
|
||||
high: 1.1254
|
||||
low: 1.1220
|
||||
close: 1.1245
|
||||
Reference in New Issue
Block a user