Diamond Strategies - Trading Automation documentation
Help and documentation for developing automated trading algorithms using the Diamond Strategies automation framework.
Public Member Functions | Properties | List of all members
DiamondStrategies.Domain.Inheritance.ITrade Class Reference

Base class for the trade object used within the backtester and the executor. More...

Public Member Functions

void AddTarget (LimitClose target)
 Recommended method to use to attach a new target order to the trade. More...
 
void AddStop (LimitClose stop)
 Recommended method to use to attach a new stop loss order to the trade. More...
 
override string ToString ()
 Method to use to convert this trade to a human readable text representation. Contains all the properties of the trade. More...
 

Properties

IInstrument Instrument [get, set]
 Financial instrument that was traded. More...
 
object Id [get, set]
 Unique trade id More...
 
string Symbol [get, set]
 Ticker symbol of the traded instrument. More...
 
TradeSides Side [get, set]
 Trade side. Long, Short or Close. More...
 
TradeStates State [get, set]
 Current state of the trader. I.e. pending execution, open, closed etc. More...
 
virtual ? double FloatingPL [get, set]
 Floating profit/loss of the trade. Otherwise known as paper or unrealized profit/loss. More...
 
virtual ? decimal ClosedPL [get, set]
 Realized profit or loss. More...
 
double? LimitEntryPrice [get, set]
 Limit entry price. Value only exists stop loss or limit trades. More...
 
double? ExecutionPrice [get, set]
 Actual fill price of the trade. Only exists on open trades. More...
 
DateTime? CloseDate [get, set]
 Date when the trade was closed. More...
 
DateTime ExecutionDate [get, set]
 Date when the trade was filled. More...
 
DateTime LastUpdateDate [get, set]
 Date when trade values were last refreshed. More...
 
int? CreationBarIndex [get, set]
 Index of the bar that trade was created on. This value is only viable for backtester trades. More...
 
DateTime CreationDate [get, set]
 Date when trade was created. More...
 
double? ClosePrice [get, set]
 Actual average closing price of the trade. More...
 
double Volume [get, set]
 Trade size. More...
 
List< LimitClose > TargetOrders [get, set]
 Target orders attached to the trade. Can contain multiple plartial targets. More...
 
List< LimitClose > StopOrders [get, set]
 Stop loss orders attached to the trade. Can cointain multiple partial stop loss orders. More...
 
string TargetOrdersPrintable [get]
 Readable text representation of the target orders. More...
 
string StopOrdersPrintable [get]
 Readable text representation of the stop loss orders. More...
 
List< LimitClose > InitialTargets [get, set]
 Initial target orders that were created when the trade was submitted. These orders do not change if target orders are modified in the future. More...
 
List< LimitClose > InitialStops [get, set]
 Initial stop loss orders that were created when the trade was submitted. These orders do not change if stop loss orders are modified in the future. More...
 
List< HistoricalValue > HistoricalStops [get, set]
 Log of historical modifications of the stop loss orders. Each change in the stop loss order will create a new entry in the list with the date and value of the change. More...
 
List< HistoricalValue > HistoricalTargets [get, set]
 Log of historical modifications of the target orders. Each change in the target order will create a new entry in the list with the date and value of the change. More...
 
ITrade ParentTrade [get, set]
 Initial trade that this trade was branched out from. For example partially closing a trade will generate two trades - one that was closed and one with the remaining amount. Both of those trades will contain the initial trade as their parent trade value. More...
 
TradeTypes Type [get, set]
 Type of the trade. Market or limit trade. Stop loss trades are treated as limit trades. More...
 
DateTime? TradeExpiryDate [get, set]
 The expiration date of the initial order, provided that a trade is a limit trade of type GTD (Good Til Date). More...
 
string InitiatorStrategyId [get, set]
 Id of that DiamondStrategy that generated this trade. More...
 
string InitiatorSubStrategyType [get, set]
 Id of the Sub strategy that generated the trade if such exists. Often GoLong or GoShort can be specified as the sub strategies. The internal value within the strategy that generated the signal if a startegy generates multiple types of signals. More...
 
bool IsMargin [get, set]
 Value indicating if the trade is a CASH trade or a MARGIN trade. More...
 
List< object > CustomStrategyProps [get, set]
 List of custom properties that a strategy added to the trade. This is a value that developers can use when creating their strategies if they like to link some information from the strategy to the trade. Maybe an indicator value on the opening of the trader or similar. More...
 
double?? ProfitTargetPrice [get]
 Average target price of all the attached target orders. More...
 
double?? StopPrice [get]
 Average stop loss price based on all the attached stop loss orders. More...
 
DiamondStrategy InitiatorStrategy [get, set]
 Strategy that requested to execute this trade. More...
 

Detailed Description

Base class for the trade object used within the backtester and the executor.

Member Function Documentation

◆ AddStop()

void DiamondStrategies.Domain.Inheritance.ITrade.AddStop ( LimitClose  stop)
inline

Recommended method to use to attach a new stop loss order to the trade.

Parameters
targetObject of the stop loss to attach.

◆ AddTarget()

void DiamondStrategies.Domain.Inheritance.ITrade.AddTarget ( LimitClose  target)
inline

Recommended method to use to attach a new target order to the trade.

Parameters
targetObject of the target to attach.

◆ ToString()

override string DiamondStrategies.Domain.Inheritance.ITrade.ToString ( )
inline

Method to use to convert this trade to a human readable text representation. Contains all the properties of the trade.

Returns
Text containing all the properties of the trade.

Property Documentation

◆ CloseDate

DateTime? DiamondStrategies.Domain.Inheritance.ITrade.CloseDate
getset

Date when the trade was closed.

◆ ClosedPL

virtual ? decimal DiamondStrategies.Domain.Inheritance.ITrade.ClosedPL
getset

Realized profit or loss.

◆ ClosePrice

double? DiamondStrategies.Domain.Inheritance.ITrade.ClosePrice
getset

Actual average closing price of the trade.

◆ CreationBarIndex

int? DiamondStrategies.Domain.Inheritance.ITrade.CreationBarIndex
getset

Index of the bar that trade was created on. This value is only viable for backtester trades.

◆ CreationDate

DateTime DiamondStrategies.Domain.Inheritance.ITrade.CreationDate
getset

Date when trade was created.

◆ CustomStrategyProps

List<object> DiamondStrategies.Domain.Inheritance.ITrade.CustomStrategyProps
getset

List of custom properties that a strategy added to the trade. This is a value that developers can use when creating their strategies if they like to link some information from the strategy to the trade. Maybe an indicator value on the opening of the trader or similar.

◆ ExecutionDate

DateTime DiamondStrategies.Domain.Inheritance.ITrade.ExecutionDate
getset

Date when the trade was filled.

◆ ExecutionPrice

double? DiamondStrategies.Domain.Inheritance.ITrade.ExecutionPrice
getset

Actual fill price of the trade. Only exists on open trades.

◆ FloatingPL

virtual ? double DiamondStrategies.Domain.Inheritance.ITrade.FloatingPL
getset

Floating profit/loss of the trade. Otherwise known as paper or unrealized profit/loss.

◆ HistoricalStops

List<HistoricalValue> DiamondStrategies.Domain.Inheritance.ITrade.HistoricalStops
getset

Log of historical modifications of the stop loss orders. Each change in the stop loss order will create a new entry in the list with the date and value of the change.

◆ HistoricalTargets

List<HistoricalValue> DiamondStrategies.Domain.Inheritance.ITrade.HistoricalTargets
getset

Log of historical modifications of the target orders. Each change in the target order will create a new entry in the list with the date and value of the change.

◆ Id

object DiamondStrategies.Domain.Inheritance.ITrade.Id
getset

Unique trade id

◆ InitialStops

List<LimitClose> DiamondStrategies.Domain.Inheritance.ITrade.InitialStops
getset

Initial stop loss orders that were created when the trade was submitted. These orders do not change if stop loss orders are modified in the future.

◆ InitialTargets

List<LimitClose> DiamondStrategies.Domain.Inheritance.ITrade.InitialTargets
getset

Initial target orders that were created when the trade was submitted. These orders do not change if target orders are modified in the future.

◆ InitiatorStrategy

DiamondStrategy DiamondStrategies.Domain.Inheritance.ITrade.InitiatorStrategy
getset

Strategy that requested to execute this trade.

◆ InitiatorStrategyId

string DiamondStrategies.Domain.Inheritance.ITrade.InitiatorStrategyId
getset

Id of that DiamondStrategy that generated this trade.

◆ InitiatorSubStrategyType

string DiamondStrategies.Domain.Inheritance.ITrade.InitiatorSubStrategyType
getset

Id of the Sub strategy that generated the trade if such exists. Often GoLong or GoShort can be specified as the sub strategies. The internal value within the strategy that generated the signal if a startegy generates multiple types of signals.

◆ Instrument

IInstrument DiamondStrategies.Domain.Inheritance.ITrade.Instrument
getset

Financial instrument that was traded.

◆ IsMargin

bool DiamondStrategies.Domain.Inheritance.ITrade.IsMargin
getset

Value indicating if the trade is a CASH trade or a MARGIN trade.

◆ LastUpdateDate

DateTime DiamondStrategies.Domain.Inheritance.ITrade.LastUpdateDate
getset

Date when trade values were last refreshed.

◆ LimitEntryPrice

double? DiamondStrategies.Domain.Inheritance.ITrade.LimitEntryPrice
getset

Limit entry price. Value only exists stop loss or limit trades.

◆ ParentTrade

ITrade DiamondStrategies.Domain.Inheritance.ITrade.ParentTrade
getset

Initial trade that this trade was branched out from. For example partially closing a trade will generate two trades - one that was closed and one with the remaining amount. Both of those trades will contain the initial trade as their parent trade value.

◆ ProfitTargetPrice

double?? DiamondStrategies.Domain.Inheritance.ITrade.ProfitTargetPrice
get

Average target price of all the attached target orders.

◆ Side

TradeSides DiamondStrategies.Domain.Inheritance.ITrade.Side
getset

Trade side. Long, Short or Close.

◆ State

TradeStates DiamondStrategies.Domain.Inheritance.ITrade.State
getset

Current state of the trader. I.e. pending execution, open, closed etc.

◆ StopOrders

List<LimitClose> DiamondStrategies.Domain.Inheritance.ITrade.StopOrders
getset

Stop loss orders attached to the trade. Can cointain multiple partial stop loss orders.

◆ StopOrdersPrintable

string DiamondStrategies.Domain.Inheritance.ITrade.StopOrdersPrintable
get

Readable text representation of the stop loss orders.

◆ StopPrice

double?? DiamondStrategies.Domain.Inheritance.ITrade.StopPrice
get

Average stop loss price based on all the attached stop loss orders.

◆ Symbol

string DiamondStrategies.Domain.Inheritance.ITrade.Symbol
getset

Ticker symbol of the traded instrument.

◆ TargetOrders

List<LimitClose> DiamondStrategies.Domain.Inheritance.ITrade.TargetOrders
getset

Target orders attached to the trade. Can contain multiple plartial targets.

◆ TargetOrdersPrintable

string DiamondStrategies.Domain.Inheritance.ITrade.TargetOrdersPrintable
get

Readable text representation of the target orders.

◆ TradeExpiryDate

DateTime? DiamondStrategies.Domain.Inheritance.ITrade.TradeExpiryDate
getset

The expiration date of the initial order, provided that a trade is a limit trade of type GTD (Good Til Date).

◆ Type

TradeTypes DiamondStrategies.Domain.Inheritance.ITrade.Type
getset

Type of the trade. Market or limit trade. Stop loss trades are treated as limit trades.

◆ Volume

double DiamondStrategies.Domain.Inheritance.ITrade.Volume
getset

Trade size.


The documentation for this class was generated from the following file: