Exemple #1
0
        static void Main(string[] args)
        {
            HitReport report = new HitReport();
            report.PrintAllHits();

            Console.Write("Press 'Enter' to end sample ...");
            Console.ReadLine();
        }
Exemple #2
0
        private MessageOpenOrder CreateOpenOrder(HitReport hitReport)
        {
            var message = this.CreateOpenOrder(hitReport as HitOrder);

            if (hitReport.ReportType == HitReportType.Replaced)
            {
                message.Status = OrderStatus.Modified;
            }

            return(message);
        }
        internal static string ShotCalculationTipString(Thing target)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (Find.Selector.SingleSelectedThing != null)
            {
                Pawn pawn = Find.Selector.SingleSelectedThing as Pawn;
                if (pawn != null && pawn != target && pawn.equipment != null && pawn.equipment.Primary != null)
                {
                    Verb_LaunchProjectile verb_LaunchProjectile = pawn.equipment.PrimaryEq.PrimaryVerb as Verb_LaunchProjectile;
                    if (verb_LaunchProjectile != null)
                    {
                        stringBuilder.AppendLine();
                        stringBuilder.Append("ShotBy".Translate(new object[]
                        {
                            pawn.LabelBaseShort
                        }) + ":");
                        if (verb_LaunchProjectile.CanHitTarget(target))
                        {
                            HitReport hitReport = verb_LaunchProjectile.HitReportFor(target);
                            stringBuilder.Append(hitReport.GetTextReadout());
                        }
                        else
                        {
                            stringBuilder.Append("CannotHit".Translate());
                        }
                    }
                    // Append CR tooltip
                    else
                    {
                        Verb_LaunchProjectileCR verbCR = pawn.equipment.PrimaryEq.PrimaryVerb as Verb_LaunchProjectileCR;
                        if (verbCR != null)
                        {
                            stringBuilder.AppendLine();
                            stringBuilder.Append("ShotBy".Translate(new object[] { pawn.LabelBaseShort }) + ":\n");
                            if (verbCR.CanHitTarget(target))
                            {
                                ShiftVecReport report = verbCR.ShiftVecReportFor(target);
                                stringBuilder.Append(report.GetTextReadout());
                            }
                            else
                            {
                                stringBuilder.Append("CannotHit".Translate());
                            }
                        }
                    }
                }
            }
            return(stringBuilder.ToString());
        }
Exemple #4
0
 private MessageTrade CreateTrade(HitReport hitReport) => new MessageTrade
 {
     TradeId   = hitReport.TradeId.ToString(),
     SymbolId  = hitReport.Symbol,
     AccountId = ACCOUNT,
     DateTime  = hitReport.UpdatedAt,
     Fee       = new PnLItem
     {
         AssetID = this.symbolsCache[hitReport.Symbol].FeeCurrency,
         Value   = -1 * (double)hitReport.TradeFee,
     },
     OrderId     = hitReport.ClientOrderId,
     OrderTypeId = this.ConvertOrderType(hitReport.OrderType),
     Price       = (double)hitReport.TradePrice,
     Quantity    = (double)hitReport.TradeQuantity,
     Side        = hitReport.Side == HitSide.Buy ? Side.Buy : Side.Sell
 };
Exemple #5
0
        private MessageOrderHistory CreateOrderHistory(HitReport hitReport)
        {
            var openOrder = this.CreateOpenOrder(hitReport);

            return(new MessageOrderHistory(openOrder));
        }
Exemple #6
0
 private MessageCloseOrder CreateCloseOrder(HitReport hitReport) => new MessageCloseOrder
 {
     OrderId = hitReport.ReportType == HitReportType.Replaced ? hitReport.OriginalRequestClientOrderId : hitReport.ClientOrderId
 };