示例#1
0
 /// <summary>
 /// Initializes a new instance of the TradingPosition class.
 /// </summary>
 /// <param name="status">Possible values include: 'Open',
 /// 'Closed'</param>
 /// <param name="direction">Possible values include: 'Buy',
 /// 'Sell'</param>
 /// <param name="closeReason">Possible values include: 'None', 'Close',
 /// 'StopLoss', 'TakeProfit', 'StopOut', 'Canceled',
 /// 'CanceledBySystem'</param>
 /// <param name="fillType">Possible values include: 'FillOrKill',
 /// 'PartialFill'</param>
 public TradingPosition(PositionStatus status, TradingOrderDirection direction, double volume, double openPrice, OrderCloseReason closeReason, double openCommission, double closeCommission, double swapCommission, OrderFillType fillType, string id = default(string), string traderCounterPartyId = default(string), string traderAccountId = default(string), string symbol = default(string), double?matchedVolume = default(double?), double?requestedPrice = default(double?), string traderAccountAssetId = default(string), double?matchedCloseVolume = default(double?), double?closePrice = default(double?), System.DateTime?openDate = default(System.DateTime?), System.DateTime?closeDate = default(System.DateTime?), double?fpl = default(double?), double?pnL = default(double?), double?pnlInUsd = default(double?), double?volumeUsdAtOpen = default(double?), double?volumeUsdAtClose = default(double?))
 {
     Id = id;
     TraderCounterPartyId = traderCounterPartyId;
     TraderAccountId      = traderAccountId;
     Symbol               = symbol;
     MatchedVolume        = matchedVolume;
     Status               = status;
     Direction            = direction;
     RequestedPrice       = requestedPrice;
     TraderAccountAssetId = traderAccountAssetId;
     Volume               = volume;
     MatchedCloseVolume   = matchedCloseVolume;
     OpenPrice            = openPrice;
     ClosePrice           = closePrice;
     OpenDate             = openDate;
     CloseDate            = closeDate;
     CloseReason          = closeReason;
     OpenCommission       = openCommission;
     CloseCommission      = closeCommission;
     SwapCommission       = swapCommission;
     FillType             = fillType;
     Fpl              = fpl;
     PnL              = pnL;
     PnlInUsd         = pnlInUsd;
     VolumeUsdAtOpen  = volumeUsdAtOpen;
     VolumeUsdAtClose = volumeUsdAtClose;
     CustomInit();
 }
示例#2
0
        internal static string ToSerializedValue(this OrderFillType value)
        {
            switch (value)
            {
            case OrderFillType.FillOrKill:
                return("FillOrKill");

            case OrderFillType.PartialFill:
                return("PartialFill");
            }
            return(null);
        }
示例#3
0
        }//todo assetPairId is used as FxAssetPairId which is not very correct

        public static Order CreateNewOrder(OrderType orderType, string assetPairId, IMarginTradingAccount account,
                                           string tradingConditionId, decimal volume, OrderFillType fillType = OrderFillType.FillOrKill,
                                           DateTime?validity       = null, decimal?price    = null, bool forceOpen = false, string parentOrderId = null,
                                           string parentPositionId = null, DateTime?created = null)
        {
            created = created ?? DateTime.UtcNow;
            return(new Order(Guid.NewGuid().ToString("N"), 0, assetPairId, volume, created.Value, created.Value,
                             validity, account.Id, tradingConditionId, account.BaseAssetId, price, "EUR", fillType,
                             null, "LYKKETEST", forceOpen, orderType, parentOrderId, parentPositionId, OriginatorType.Investor, 1,
                             1, assetPairId, FxToAssetPairDirection.Straight, OrderStatus.Placed, null, Guid.NewGuid().ToString()));
        }//todo assetPairId is used as FxAssetPairId which is not very correct