بنية الإشارة التداولية
تخزّن الإشارة التداولية نية إجراء الصفقة وحالة تنفيذها، بما يتيح مراجعتهما لاحقًا.
تشمل الحقول الأساسية:
- الرمز
- اتجاه الصفقة
- الثقة
- الإطار الزمني
- العلاقة بين الإشارة التداولية الأم والإشارات التداولية الفرعية
- الكمية
- عدد العقود
- بنية الدخول
- مستويات جني الأرباح ووقف الخسارة
- المسافة السعرية للوقف المتحرك
- أسعار التنفيذ والإغلاق
- الربح والخسارة المحققان لدى الوسيط والعمولة ورسوم التبييت
- الأوامر التنفيذية التابعة
- سجل الحالة
pub struct Insight { pub insight_id: Uuid, pub parent_id: Option<Uuid>, pub state: InsightState, pub children: Vec<Insight>,
// Order information pub order_id: Option<String>, pub side: OrderSide, pub symbol: String, pub quantity: Option<f64>, pub contracts: Option<f64>,
// Order execution details pub order_type: OrderType, pub order_class: OrderClass, pub limit_price: Option<f64>, pub stop_price: Option<f64>, pub take_profit_levels: Option<Vec<f64>>, pub stop_loss_levels: Option<Vec<f64>>, pub trailing_stop_price: Option<f64>,
// Strategy information pub strategy_type: StrategyType, pub confidence: u8, pub timeframe: TimeFrame, pub period_unfilled: Option<u32>, pub period_till_tp: Option<u32>, pub execution_depends: Vec<StrategyDependentConfirmation>,
// Closing information pub filled_price: Option<f64>, pub close_order_id: Option<String>, pub close_price: Option<f64>, pub broker_realized_pnl: Option<f64>, pub commission: Option<f64>, pub swap: Option<f64>, pub partial_closes: Vec<PartialCloseResult>, pub created_at: DateTime<Utc>, pub updated_at: DateTime<Utc>, pub filled_at: Option<DateTime<Utc>>, pub closed_at: Option<DateTime<Utc>>, pub legs: OrderLegs,
// Market conditions pub market_changed: bool,
// Internal flags pub submitted: bool, pub cancelling: bool, pub closing: bool, pub first_on_fill: bool, pub partial_filled_quantity: Option<f64>,
// State tracking pub state_history: Vec<(DateTime<Utc>, InsightState, Option<String>)>, pub context: Option<InsightStrategyContext>,}إنشاء إشارة تداولية
Section titled “إنشاء إشارة تداولية”النمط الأكثر شيوعًا لإنشاء إشارة تداولية هو:
let mut insight = Insight::new( OrderSide::Buy, "AAPL".to_string(), StrategyType::Testing, ctx.timeframe().clone(), 80, None,);
insight .set_limit_price(Some(200.0)) .set_take_profit_levels(Some(vec![206.0])) .set_stop_loss(Some(197.5)) .set_period_unfilled(Some(5)) .set_period_till_tp(Some(12));
ctx.add_insight(insight);بعد ذلك، يمكن لمسار معالجة الإشارات التداولية تحديد الحجم أو إجراء عمليات التحقق أو إرسال الإشارة التداولية.
ملفات تعريف الارتباط والتخزين الضروريان
نستخدم ملفات تعريف الارتباط والتخزين الضروريين لتسجيل الدخول وحماية الحساب وحفظ تفضيلات المظهر وهذا الإشعار، ولجمع مقاييس PostHog الداخلية اللازمة لقياس الاستخدام وجودة الجلسات والموثوقية. لا نستخدم ملفات تعريف ارتباط إعلانية.
