Skip to main content

TwelveData adapter for NautilusTrader

Project description

nautilus-twelvedata

build crates.io version license

NautilusTrader adapter for TwelveData.

The nautilus-twelvedata crate provides a integration with the TwelveData API for accessing historical market data for US stocks.

NautilusTrader

NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.

Features

  • Fetch historical OHLCV bar data from TwelveData
  • Support for multiple intervals (1min, 5min, 15min, 1hour, 4hour, 1day)
  • Parse data into NautilusTrader Bar objects
  • Python bindings via PyO3
  • High-precision mode support (128-bit values)

Installation

Add this to your Cargo.toml:

[dependencies]
nautilus-twelvedata = "0.1.0"

Usage

Rust

use nautilus_twelvedata::{
    config::TwelveDataConfig,
    http::client::TwelveDataHttpClient,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = TwelveDataConfig::builder()
        .api_key("your_api_key")
        .build();
    
    let client = TwelveDataHttpClient::new(config)?;
    
    let response = client
        .fetch_time_series("AAPL", "1hour", Some(100))
        .await?;
    
    println!("Fetched {} bars", response.values.len());
    
    Ok(())
}

Python

from nautilus_trader.core.nautilus_pyo3 import TwelveDataHttpClient

client = TwelveDataHttpClient(api_key="your_api_key")
bars = await client.fetch_time_series("AAPL", "1hour", start_ns, end_ns)
print(f"Fetched {len(bars)} bars")

Feature flags

  • python: Enables Python bindings from PyO3.
  • high-precision: Enables high-precision mode (128-bit value types).

Limitations

  • Free tier: 800 API calls per day, 8 calls per minute
  • No WebSocket support on free tier
  • Historical data only (no real-time streaming)

License

The source code for NautilusTrader is available on GitHub under the GNU Lesser General Public License v3.0.


NautilusTrader™ is developed and maintained by Nautech Systems. TwelveData adapter is a community contribution.

Use of this software is subject to the Disclaimer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nautilus_twelvedata-0.1.1-cp313-cp313-manylinux_2_38_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

File details

Details for the file nautilus_twelvedata-0.1.1-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for nautilus_twelvedata-0.1.1-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9ad78bbdd01d858d1cbf774c40bca9ef52d8771bbbf30e76e819b701dcc8bf6d
MD5 14a343b23edbd460a46075ab7d39e475
BLAKE2b-256 e4008050a7c1d077129d56f4dfe86c7443171eadfd76aaf8613c926697b290a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page