Skip to content

HistoricalOrder

Summary

Represents a historical order.

Signature

1
public abstract interface HistoricalOrder

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 using cAlgo.API;
 namespace cAlgo.Robots;
 [Robot(AccessRights = AccessRights.None)]
 public class Test : Robot
 {
     protected override void OnStart()
     {
         if (HistoricalOrders.FindLast("Order Label") is not {} historicalOrder)
         {
             Print("Order not found");
             return;
         }
         Print($"Id: {historicalOrder.Id} | OrderType: {historicalOrder.OrderType} | TradeType: {historicalOrder.TradeType} | Time: {historicalOrder.SubmittedTime}");
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 import clr
 clr.AddReference("cAlgo.API")
 # Import cAlgo API types
 from cAlgo.API import *
 # Import trading wrapper functions
 from robot_wrapper import *
 class Test():
     def on_start(self):
         historicalOrder = api.HistoricalOrders.FindLast("Order Label")
         if historicalOrder is None:
             print("Order not found")
             return
         print(f"Id: {historicalOrder.Id} | OrderType: {historicalOrder.OrderType} | TradeType: {historicalOrder.TradeType} | Time: {historicalOrder.SubmittedTime}")

See Also

Properties

Id

Summary

Unique order Id.

Signature

1
public abstract long Id {get;}

Return Value

long

PositionId

Summary

Unique position Id.

Signature

1
public abstract int? PositionId {get;}

Return Value

int?

TradeType

Summary

Order Trade type (buy or sell)

Signature

1
public abstract TradeType TradeType {get;}

Return Value

TradeType

VolumeInUnits

Summary

Order volume in units.

Signature

1
public abstract double VolumeInUnits {get;}

Return Value

double

OrderType

Summary

Order type.

Signature

1
public abstract HistoricalOrderType OrderType {get;}

Return Value

HistoricalOrderType

TargetPrice

Summary

Order target price

Signature

1
public abstract double TargetPrice {get;}

Return Value

double

ExpirationTime

Summary

Order expiration time.

Signature

1
public abstract DateTime? ExpirationTime {get;}

Return Value

DateTime?

StopLoss

Summary

Order stop loss in Price.

Signature

1
public abstract double? StopLoss {get;}

Return Value

double?

StopLossPips

Summary

Order stop loss in Pips.

Signature

1
public abstract double? StopLossPips {get;}

Return Value

double?

TakeProfit

Summary

Order take profit in Price.

Signature

1
public abstract double? TakeProfit {get;}

Return Value

double?

TakeProfitPips

Summary

Order take profit in Pips.

Signature

1
public abstract double? TakeProfitPips {get;}

Return Value

double?

Quantity

Summary

Order quantity (lots).

Signature

1
public abstract double Quantity {get;}

Return Value

double

HasTrailingStop

Summary

Returns true if order has trailing stop loss.

Signature

1
public abstract bool HasTrailingStop {get;}

Return Value

bool

StopLossTriggerMethod

Summary

Trigger method for order's StopLoss

Signature

1
public abstract StopTriggerMethod? StopLossTriggerMethod {get;}

Return Value

StopTriggerMethod?

StopOrderTriggerMethod

Summary

StopOrder trigger method.

Signature

1
public abstract StopTriggerMethod? StopOrderTriggerMethod {get;}

Return Value

StopTriggerMethod?

SymbolName

Summary

Order symbol name.

Signature

1
public abstract string SymbolName {get;}

Return Value

string

Symbol

Summary

Order symbol.

Signature

1
public abstract Symbol Symbol {get;}

Return Value

Symbol

Status

Summary

Order status.

Signature

1
public abstract HistoricalOrderStatus Status {get;}

Return Value

HistoricalOrderStatus

SubmittedTime

Summary

Order submitted time.

Signature

1
public abstract DateTime SubmittedTime {get;}

Return Value

DateTime

FilledTime

Summary

Order filled time.

Signature

1
public abstract DateTime? FilledTime {get;}

Return Value

DateTime?

FilledVolumeInUnits

Summary

Order filled volume in units.

Signature

1
public abstract double? FilledVolumeInUnits {get;}

Return Value

double?

FilledQuantity

Summary

Order filled quantity (lots).

Signature

1
public abstract double? FilledQuantity {get;}

Return Value

double?

Label

Summary

Order label.

Signature

1
public abstract string Label {get;}

Return Value

string

Comment

Summary

Order comment.

Signature

1
public abstract string Comment {get;}

Return Value

string

Channel

Summary

Order channel.

Signature

1
public abstract string Channel {get;}

Return Value

string