NautilusTrader Docs · ภาษาไทย

Index Instrument

IndexInstrument แทน index อ้างอิง เช่น ดัชนีหุ้น, ดัชนีความผันผวน หรือชุดราคา benchmark มันมี metadata ของ precision และ increment เพื่อให้ Nautilus จัดเก็บและ route ราคาได้อย่างสม่ำเสมอ แต่ไม่ใช่สัญญาที่ซื้อขายได้โดยตรง

ตัวอย่างเช่น SPX.XCBO, VIX.XCBO และ index อ้างอิงเฉพาะของแต่ละ venue

Field

FieldRust typeจำเป็น/ค่าเริ่มต้นหมายเหตุ
instrument_idInstrumentIdจำเป็นใน Rust เก็บเป็น id
raw_symbolSymbolจำเป็นsymbol ดั้งเดิมของ venue
currencyCurrencyจำเป็นสกุลเงินอ้างอิงของค่าที่ quote
price_precisionu8จำเป็นจำนวนทศนิยมที่อนุญาตสำหรับราคา
size_precisionu8จำเป็นจำนวนทศนิยมที่อนุญาตสำหรับ quantity
price_incrementPriceจำเป็นขั้นราคาที่เล็กที่สุดที่ใช้ได้
size_incrementQuantityจำเป็นขั้นขนาดที่เล็กที่สุดที่ใช้ได้
ts_eventUnixNanosจำเป็นtimestamp ของ event หน่วยนาโนวินาที
ts_initUnixNanosจำเป็นtimestamp ตอน initialize หน่วยนาโนวินาที
tick_schemeOption<Ustr>Noneชื่อ variable tick scheme ที่ลงทะเบียนไว้
infoOption<Params>Nonemetadata ของ adapter

พฤติกรรม

  • IndexInstrument มี asset class เป็น Index และ instrument class เป็น Spot
  • ไม่มี limit, margin, ค่าธรรมเนียม, contract multiplier, วันหมดอายุ หรือ settlement currency
  • สำหรับ derivatives ที่ซื้อขายได้และมี underlying เป็น index ให้ใช้ type ของ option หรือ futures

IndexInstrument เป็น instrument อ้างอิง ไม่ใช่สัญญาที่ซื้อขายได้ อย่าส่ง order ไปที่มัน ให้เทรด instrument futures หรือ option ที่สอดคล้องกันแทน

ตัวอย่าง

use nautilus_core::UnixNanos;
use nautilus_model::{
    identifiers::{InstrumentId, Symbol},
    instruments::IndexInstrument,
    types::{Currency, Price, Quantity},
};

let spx = IndexInstrument::builder()
    .instrument_id(InstrumentId::from("SPX.XCBO"))
    .raw_symbol(Symbol::from("SPX"))
    .currency(Currency::from("USD"))
    .price_precision(2)
    .size_precision(0)
    .price_increment(Price::from("0.01"))
    .size_increment(Quantity::from("1"))
    .ts_event(UnixNanos::default())
    .ts_init(UnixNanos::default())
    .build()
    .unwrap();

Adapter

Adapter Interactive Brokers สร้าง definition ของ IndexInstrument สำหรับ index อ้างอิง

  • Option Contract อธิบาย option ที่จดทะเบียนซื้อขายซึ่งมี underlying เป็น index
  • Futures Contract อธิบาย index futures

แปลจาก เอกสาร NautilusTrader © Nautech Systems Pty Ltd และผู้ร่วมพัฒนา เผยแพร่ภายใต้ LGPL-3.0 ฉบับแปลนี้ตัดเนื้อหาเฉพาะ Python ออกและเน้น Rust