예제 #1
0
        public void TestKeyRateXml()
        {
            var document = new KeyRate
            {
                ValidDate = new DateTime(2021, 10, 03),
                Kr        = new Kr
                {
                    Dt   = new DateTime(2021, 10, 04),
                    Rate = 6.25m
                }
            };

            var documentXml = _mapper.Map <KeyRateXml>(document);
            var xml         = documentXml.SerializeToClearXml();
            var newDocument = xml.DeserializeFromXml <KeyRateXml>();

            Assert.Equal(new DateTime(2021, 10, 03), newDocument.ValidDate);
            Assert.Equal(new DateTime(2021, 10, 04), newDocument.Kr.Dt);
            Assert.Equal(6.25m, newDocument.Kr.Rate);
        }
예제 #2
0
 public SyncVarAttribute(KeyRate keyRate = KeyRate.UseDefault)
 {
     this.keyRate = keyRate;
 }
 // Constructor
 public SyncHalfFloatAttribute(IndicatorBit indicatorBit = IndicatorBit.None, KeyRate keyRate = KeyRate.UseDefault)
 {
     this.indicatorBit = indicatorBit;
     this.keyRate      = keyRate;
 }
예제 #4
0
        /// <summary>
        /// Network this field as an Integer type that will remain between the range values. Any values outside of these will be clamped.
        /// By knowing this range, values can automatically be bitpacked to the smallest possible value.
        /// </summary>
        /// <param name="min"></param>
        /// <param name="max"></param>
        public SyncRangedIntAttribute(int min, int max, IndicatorBits indicatorBits = IndicatorBits.None, KeyRate keyRate = KeyRate.UseDefault)
        {
            this.min           = min;
            this.max           = max;
            this.indicatorBits = indicatorBits;
            this.keyRate       = keyRate;

            if (min < max)
            {
                smallest = min;
                biggest  = max;
            }
            else
            {
                smallest = max;
                biggest  = min;
            }
            uint range = (uint)(biggest - smallest);

            bitCount = range.GetBitsForMaxValue();
        }
예제 #5
0
 public PackAttribute(KeyRate keyRate = KeyRate.UseDefault)
 {
     this.keyRate = keyRate;
 }