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.2-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.2-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for nautilus_twelvedata-0.1.2-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 7b4922e31bd28dfa857bf168d7c6f09780f5eec6015e5603e743ef1a5c17ec44
MD5 f0e972f33c6d91a38e4ac6a850d24c3b
BLAKE2b-256 8f7655cc921c3a3f85b591c44f7ecb18f5368a5b7b2668f843f260c3d1acb405

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