Exemplo n.º 1
0
 public QuoteAdded(NodaTime.Instant date, double close, double open, double low, double high)
 {
     Date  = date;
     Close = close;
     Open  = open;
     Low   = low;
     High  = high;
 }
Exemplo n.º 2
0
 public TransactionInfo(string txId, NodaTime.Instant date, Quantity quantity, Transaction.TransactionType transactionType, string comment)
 {
     TxId            = txId;
     Date            = date;
     Quantity        = quantity;
     TransactionType = transactionType;
     Comment         = comment;
 }
Exemplo n.º 3
0
 public AddQuote(string fordom, NodaTime.Instant date, double close, double open = 0, double low = 0, double high = 0)
 {
     Fordom = fordom;
     Date   = date;
     Close  = close;
     Open   = open;
     Low    = low;
     High   = high;
 }
Exemplo n.º 4
0
 public EmailSent(NodaTime.Instant instant, EmailAddress from, string subject, string body, bool isBodyHtml, IEnumerable <EmailAttachment> attachments)
 {
     Guard.Against.Default(instant, nameof(instant));
     Guard.Against.Null(from, nameof(from));
     Guard.Against.Null(subject, nameof(subject));
     Guard.Against.Null(body, nameof(body));
     Guard.Against.Null(attachments, nameof(attachments));
     Instant     = instant;
     From        = from;
     Subject     = subject;
     Body        = body;
     IsBodyHtml  = isBodyHtml;
     Attachments = attachments.ToArray();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Convert IANA timezone to a UTC offset.
        /// </summary>
        /// <param name="IanaTimezone">eg "America/Vancouver"</param>
        /// <returns>The offset eg -7</returns>
        public static Int16 GetUtcOffset(String IanaTimezone)
        {
            Int16 utcOffset = 0;

            try {
                NodaTime.IDateTimeZoneProvider tzProvider = NodaTime.DateTimeZoneProviders.Tzdb;
                if (!tzProvider.Ids.Contains(IanaTimezone))
                {
                    log.Warn("Could not map IANA timezone '" + IanaTimezone + "' to UTC offset.");
                }
                else
                {
                    NodaTime.DateTimeZone tz      = tzProvider[IanaTimezone];
                    NodaTime.Instant      instant = NodaTime.Instant.FromDateTimeUtc(DateTime.UtcNow);
                    NodaTime.Offset       offset  = tz.GetUtcOffset(instant);
                    utcOffset = Convert.ToInt16(offset.Seconds / 3600);
                }
            } catch (System.Exception ex) {
                OGCSexception.Analyse("Not able to convert IANA timezone '" + IanaTimezone + "' to UTC offset.", ex);
            }
            return(utcOffset);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Returns the latest possible number of batch (integer) that covers the passed BatchDateRange,
        /// just before the dateTime.
        /// </summary>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public int GetBatchNumberToBeDownloaded(NodaTime.Instant dateTime)
        {
            var currentBatchDateRange = FirstBatchDateRange;

            if (currentBatchDateRange.End >= dateTime)
            {
                // the dateTime is so old, it will never be covered in a batch
                return(0);
            }
            int i = 1;

            while (true)
            {
                var nextBatchDateRange = currentBatchDateRange.GetNext();
                if (currentBatchDateRange.End < dateTime && nextBatchDateRange.End >= dateTime)
                {
                    return(i);
                }
                i++;
                currentBatchDateRange = nextBatchDateRange;
                nextBatchDateRange    = nextBatchDateRange.GetNext();
            }
        }
Exemplo n.º 7
0
 public EmailSent(NodaTime.Instant instant, EmailMessage message) : this(instant, message.From, message.Subject, message.Body, message.IsBodyHtml, message.Attachments)
 {
 }
Exemplo n.º 8
0
 public bool HasResignedTemporarilyAsOf(NodaTime.Instant now) => HasResignedTemporarily && (ResumeDate == null || ResumeDate.Value >= now.InMainTimezone().Date);
Exemplo n.º 9
0
 public AssetPairInfo()
 {
     QuoteDates = new NodaTime.Instant[0];
 }
Exemplo n.º 10
0
 public AddNoteTests()
 {
     Now = NodaTime.SystemClock.Instance.GetCurrentInstant();
 }
Exemplo n.º 11
0
 public SingleAssetPrice(double price, NodaTime.Instant timestamp)
 {
     Price     = price;
     Timestamp = timestamp;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Set the Message's timestamp.
 /// </summary>
 public static Message SetTimestamp(this Message msg, NodaTime.Instant timestamp)
 {
     return(MessageModule.SetTicksEpoch(timestamp.ToUnixTimeTicks(), msg));
 }
Exemplo n.º 13
0
 public CandleEvent[] GetHistoricalPrices(string instrument, int timeframeSeconds, NodaTime.Instant start, NodaTime.Instant end)
 {
     ExchangeSharp.MarketCandle[] foreignCandles = _api.GetCandlesAsync(
         instrument, timeframeSeconds, start.ToDateTime(), end.ToDateTime()).
                                                   Sync().ToArray();
     CandleEvent[] ourEvents = new CandleEvent[foreignCandles.Length];
     for (int i = 0; i < foreignCandles.Length; i++)
     {
         ourEvents[i] = Convert(foreignCandles[i]);
     }
     return(ourEvents);
 }
Exemplo n.º 14
0
        public int GetOldBatchNumber(NodaTime.Instant dateTime)
        {
            var batchNumer = GetBatchNumberToBeDownloaded(dateTime);

            return(batchNumer - 1);
        }
Exemplo n.º 15
0
 public static DateTime ToDateTime(this NodaTime.Instant nodaTime)
 {
     return(nodaTime.ToDateTimeUtc());
 }