Beispiel #1
0
        public override string ToString()
        {
            var array = new string[] { Date.ToString(), Open.ToString(),
                High.ToString(), Low.ToString(),
                Close.ToString(), AdjClose.ToString(), Volume.ToString() };

            return(string.Join(",", array));
        }
Beispiel #2
0
 /// <summary>
 /// Format this PointPair value using a general format string.
 /// Example:  a format string of "e2" would give "( 1.23e+001, -1.69e+001 )".
 /// If <see paramref="isShowAll"/>
 /// is true, then the third all coordinates are shown.
 /// </summary>
 /// <param name="format">A format string that will be used to format each of
 /// the two double type values (see <see c_ref="System.Double.ToString()"/>).</param>
 /// <returns>A string representation of the PointPair</returns>
 /// <param name="isShowAll">true to show all the value coordinates</param>
 override public string ToString(string format, bool isShowAll)
 {
     return("( " + XDate.ToString(Date, "g") +
            ", " + Close.ToString(format) +
            (isShowAll ? (
                 ", " + Low.ToString(format) +
                 ", " + Open.ToString(format) +
                 ", " + Close.ToString(format)) : "") + " )");
 }
Beispiel #3
0
        // public double OpenInterest { get; set; }

        /// <summary>
        /// override
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return(TimeStamp.ToString() + ',' +
                   Open.ToString() + ',' +
                   High.ToString() + ',' +
                   Low.ToString() + ',' +
                   Last.ToString() + ',' +
                   Volume.ToString());
        }
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("perLowLimit", PercentLowLimit.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("perHighLimit", PercentHighLimit.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("perOutSpec", PercentOutSpec.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("low", Low.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("high", High.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("range", Range.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("sigmaLevel", SigmaLevel);
 }
Beispiel #5
0
 /// <summary>
 /// Method used to decide which Low temperature property to use based on <paramref name="pref"/> (Fahrenheit/Celsius).
 /// </summary>
 /// <param name="pref"></param>
 /// <returns>Low or CelsiusLow formatted as a string with no decimal denoted F or C.</returns>
 public string DisplayLow(string pref)
 {
     if (pref == "Fahrenheit" || pref == null)
     {
         return(Low.ToString("N0") + " F");
     }
     else
     {
         return(CelsiusLow.ToString("N0") + " C");
     }
 }
 public override string ToString()
 {
     return(string.Format("[{0},{1}], Max = '{2}', Color = '{3}', Left = [{4}], Rigth = [{5}]",
                          Low.ToString(),
                          High.ToString(),
                          Max.ToString(),
                          this.Color.ToString(),
                          LeftChild == null ? string.Empty : string.Format("{0},{1}", LeftChild.Low.ToString(), LeftChild.High.ToString()),
                          RigthChild == null ? string.Empty : string.Format("{0},{1}", RigthChild.Low.ToString(), RigthChild.High.ToString())
                          ));
 }
Beispiel #7
0
        public override string ToString()
        {
            string        prefix = string.Empty;
            StringBuilder sb     = new StringBuilder(Value.ToString());

            sb.Append(" between (");
            sb.Append(Low.ToString());
            sb.Append(" .. ");
            sb.Append(High.ToString());
            sb.Append(")");
            return(sb.ToString());
        }
Beispiel #8
0
        public override string ToString()
        {
            StringBuilder Builder = new StringBuilder();

            Builder.Append(string.Format("<Expected>{0}</Expected><Result>{1}</Result><ErrorText>{2}</ErrorText><Trace>{3}</Trace><ErrorType>{4}</ErrorType>",
                                         ((Low == null) ? "" : Low.ToString().StripIllegalXML()) + " - " +
                                         ((High == null) ? "" : High.ToString().StripIllegalXML()),
                                         (Result == null) ? "" : Result.ToString().StripIllegalXML(),
                                         this.Message.StripIllegalXML(),
                                         this.StackTrace.StripIllegalXML(),
                                         this.GetType().Name.StripIllegalXML()));
            return(Builder.ToString());
        }
Beispiel #9
0
        public string MilSubject()
        {
            string _out = Call + " " + Stock;

            if (Call == "BUY")
            {
                _out += " Above " + High.ToString(numStyle);
            }
            else
            {
                _out += " Below " + Low.ToString(numStyle);
            }
            return(_out);
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Ticker).Append(",");
            sb.Append(DateTime).Append(",");
            sb.Append(Open.ToString()).Append(",");
            sb.Append(Close.ToString()).Append(",");
            sb.Append(High.ToString()).Append(",");
            sb.Append(Low.ToString()).Append(",");
            sb.Append(Volume.ToString());

            return(sb.ToString());
        }
        public string ToStringNice()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Ticker:").Append(Ticker).Append(" ");
            sb.Append("DateTime:").Append(DateTime).Append(" ");
            sb.Append("Open:").Append(Open.ToString()).Append(" ");
            sb.Append("Close:").Append(Close.ToString()).Append(" ");
            sb.Append("High:").Append(High.ToString()).Append(" ");
            sb.Append("Low:").Append(Low.ToString()).Append(" ");
            sb.Append("Volume:").Append(Volume.ToString());

            return(sb.ToString());
        }
Beispiel #12
0
        public override string ToString()
        {
            if (Low == 0)
            {
                return("0x0");
            }

            // If our guid has an entry and it is an unit or a GO, print its
            // name next to the entry (from a database, if enabled)
            if (HasEntry())
            {
                var type = Utilities.ObjectTypeToStore(GetObjectType());

                return("Full: 0x" + Low.ToString("X8") + " Type: " + GetHighType()
                       + " Entry: " + StoreGetters.GetName(type, (int)GetEntry()) + " Low: " + GetLow());
            }

            var name = StoreGetters.GetName(this);

            switch (GetHighGuidTypeLegacy())
            {
            case HighGuidTypeLegacy.BattleGround1:
            {
                var bgType = Low & 0x00000000000000FF;
                return("Full: 0x" + Low.ToString("X8") + " Type: " + GetHighType()
                       + " BgType: " + StoreGetters.GetName(StoreNameType.Battleground, (int)bgType));
            }

            case HighGuidTypeLegacy.BattleGround2:
            {
                var bgType    = (Low & 0x00FF0000) >> 16;
                var unkId     = (Low & 0x0000FF00) >> 8;
                var arenaType = (Low & 0x000000FF) >> 0;
                return("Full: 0x" + Low.ToString("X8") + " Type: " + GetHighType()
                       + " BgType: " + StoreGetters.GetName(StoreNameType.Battleground, (int)bgType)
                       + " Unk: " + unkId + (arenaType > 0 ? (" ArenaType: " + arenaType) : String.Empty));
            }
            }

            return("Full: 0x" + Low.ToString("X8") + " Type: " + GetHighType()
                   + " Low: " + GetLow() + (String.IsNullOrEmpty(name) ? String.Empty : (" Name: " + name)));
        }
Beispiel #13
0
        public override string ToString()
        {
            string result = "";

            // Changed format here to support type converter

            if (HasLow)
            {
                result += Low.ToString();
            }

            result += ",";

            if (HasHigh)
            {
                result += High.ToString();
            }

            return(result);
        }
Beispiel #14
0
        public string ToStringNice(bool verbose = true)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Ticker:").Append(Ticker).Append(" ");
            sb.Append("DateTime:").Append(DateTime).Append(" ");
            sb.Append("Open:").Append(Open.ToString()).Append(" ");
            sb.Append("Close:").Append(Close.ToString()).Append(" ");
            sb.Append("High:").Append(High.ToString()).Append(" ");
            sb.Append("Low:").Append(Low.ToString()).Append(" ");
            sb.Append("Volume:").Append(Volume.ToString()).Append(" ");
            sb.Append("Gap:").Append(Gap.ToString("f4"));

            if (verbose)
            {
                sb.AppendLine();
                foreach (var marketDataPoint in DataPoints)
                {
                    sb.Append("\t").AppendLine(marketDataPoint.ToStringNice());
                }
            }
            return(sb.ToString());
        }
Beispiel #15
0
        public string CsvGet()
        {
            string[] values = { Symbol, Tick.ToString(), Open.ToString(), Close.ToString(), High.ToString(), Low.ToString(), Volume.ToString() };
            string   line   = string.Join <string>(CONST_CSV_SEPARATOR, values.ToArray());

            return(line);
        }
Beispiel #16
0
        private async Task <Tuple <string, string> > GenerateYffResponse()
        {
            try
            {
                // 1. Prepare input parameters
                string uriQuery = Request.QueryString.ToString(); // "?s=VXX,SVXY,^vix&f=ab&o=csv" from the URL http://localhost:58213/api/rtp?s=VXX,XIV,^vix&f=ab&o=csv
                if (uriQuery.Length > 8192)
                {                                                 //When you try to pass a string longer than 8192 charachters, a faultException will be thrown. There is a solution, but I don't want
                    return(new Tuple <string, string>(@"{ ""Message"":  ""Error caught by WebApi Get():: uriQuery is longer than 8192: we don't process that. Uri: " + uriQuery + @""" }", "application/json"));
                }

                Dictionary <string, StringValues> allParamsDict = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uriQuery);   // unlike ParseQueryString in System.Web, this returns a dictionary of type IDictionary<string, string[]>, so the value is an array of strings. This is how the dictionary handles multiple query string parameters with the same name.
                if (!allParamsDict.TryGetValue("yffOutFormat", out StringValues queryStrVal))
                {
                    return(new Tuple <string, string>(@"{ ""Message"":  ""Error: yffOutFormat= was not found. Uri: " + uriQuery + @""" }", "application/json"));
                }
                string outputFormat = queryStrVal[0];
                bool   isOutputJson = !String.Equals(outputFormat, "csv", StringComparison.CurrentCultureIgnoreCase);

                string?       yffColumns     = null;
                List <string> yffColumnsList = new List <string>();
                if (allParamsDict.TryGetValue("yffColumns", out queryStrVal))
                {
                    yffColumns     = queryStrVal[0];
                    yffColumnsList = new List <string>();
                    int    columnsFormatStartIdx = 0;
                    string?previousCommand       = null;
                    for (int k = 1; k < yffColumns.Length; k++)
                    {
                        if (Char.IsLetter(yffColumns[k]))
                        {
                            // process previous command
                            previousCommand = yffColumns.Substring(columnsFormatStartIdx, k - columnsFormatStartIdx);
                            yffColumnsList.Add(previousCommand);
                            columnsFormatStartIdx = k;
                        }
                    }
                    previousCommand = yffColumns.Substring(columnsFormatStartIdx, yffColumns.Length - columnsFormatStartIdx);
                    yffColumnsList.Add(previousCommand);
                }
                else
                {
                    yffColumnsList = new List <string>()
                    {
                        "d", "o", "h", "l", "c", "c1", "v"
                    };
                }


                string?jsonpCallback = null, outputVariable = null;
                if (isOutputJson)
                {
                    if (allParamsDict.TryGetValue("jsonp", out queryStrVal))
                    {
                        jsonpCallback = queryStrVal[0];
                    }
                    if (allParamsDict.TryGetValue("yffOutVar", out queryStrVal))
                    {
                        outputVariable = queryStrVal[0];
                    }
                    if (jsonpCallback == null && outputVariable == null)
                    {
                        return(new Tuple <string, string>(@"{ ""Message"":  ""Error: nor yffOutVar= , neiher jsonp= was found. Uri: " + uriQuery + @""" }", "application/json"));
                    }
                    else if (jsonpCallback != null && outputVariable != null)
                    {
                        return(new Tuple <string, string>(@"{ ""Message"":  ""Error: Both yffOutVar= ,  jsonp= were found. Uri: " + uriQuery + @""" }", "application/json"));
                    }
                }

                string?targetUriWithoutHttp = null;
                string ticker = string.Empty;
                if (allParamsDict.TryGetValue("yffUri", out queryStrVal))   // yffUri=query1.finance.yahoo.com/v7/finance/download/AAPL&period1=2017-02-02&period2=2017-05-22&interval=1d&events=history
                {
                    targetUriWithoutHttp = queryStrVal[0];
                    int indSlash = targetUriWithoutHttp.LastIndexOf('/');
                    if (indSlash != -1)
                    {
                        ticker = targetUriWithoutHttp.Substring(indSlash + 1);
                    }
                }


                // 2. Obtain Token.Cookie and Crumb (maybe from cache until 12 hours) that is needed for Y!F API from 2017-05
                // after 2017-05: https://query1.finance.yahoo.com/v7/finance/download/VXX?period1=1492941064&period2=1495533064&interval=1d&events=history&crumb=VBSMphmA5gp
                // but we will accept standard dates too and convert to Unix epoch before sending it to YF
                // https://query1.finance.yahoo.com/v7/finance/download/VXX?period1=2017-02-31&period2=2017-05-23&interval=1d&events=history&crumb=VBSMphmA5gp
                // https://github.com/dennislwy/YahooFinanceAPI
                // int maxTryCrumb = 10;                 //first get a valid token from Yahoo Finance
                // while (maxTryCrumb >= 0 && (string.IsNullOrEmpty(Token.Cookie) || string.IsNullOrEmpty(Token.Crumb)))
                // {
                //     //await Token.RefreshAsync().ConfigureAwait(false);
                //     bool tokenSuccess = Token.RefreshAsync().ConfigureAwait(false).GetAwaiter().GetResult();
                //     maxTryCrumb--;
                // }

                // 3. With the Token.Cookie and Crumb download YF CSV file
                string   startTimeStr = allParamsDict["period1"];
                string   endTimeStr = allParamsDict["period2"];
                DateTime startTime = DateOnly.MinValue, endTime = DateTime.UtcNow;
                if (startTimeStr.IndexOf('-') != -1)    // format '2017-05-20' has hyphen in it; if it has hyphen, try to convert to Date.
                {
                    startTime = DateTime.ParseExact(startTimeStr, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                }
                else
                {
                    startTime = Utils.UnixTimeStampToDateTimeUtc(long.Parse(startTimeStr)); // it is in UnixTimestamp string, we have to convert to Date
                }

                if (String.Equals(endTimeStr, "UtcNow", StringComparison.CurrentCultureIgnoreCase))    // format '2017-05-20' has hyphen in it; if it has hyphen, try to convert to Date.
                {
                    endTime = DateTime.UtcNow;
                }
                else
                {
                    if (endTimeStr.IndexOf('-') != -1)    // format '2017-05-20' has hyphen in it; if it has hyphen, try to convert to Date.
                    {
                        endTime = DateTime.ParseExact(endTimeStr, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        endTime = Utils.UnixTimeStampToDateTimeUtc(long.Parse(endTimeStr));
                    }

                    if (endTime.Date == DateTime.UtcNow.Date)  // if today is included, we think the caller wants the real-time (latest) data; so change endTime to UtcNow
                    {
                        endTime = DateTime.UtcNow;
                    }
                    else
                    {
                        endTime = endTime.AddHours(12);    // endTimeStr Date is excluded from daily data, so Add a little bit more to the middle of the UTC day
                    }
                }

                Period period = Period.Daily;
                if (allParamsDict["interval"] == "1w")
                {
                    period = Period.Weekly;
                }
                else if (allParamsDict["interval"] == "1m")
                {
                    period = Period.Monthly;
                }

                var history = await Yahoo.GetHistoricalAsync(ticker, startTime, endTime, period);


                // 4.1 Process YF CSV file either as JSON or as CSV: Header
                StringBuilder responseStrBldr    = new StringBuilder();
                bool          wasDataLineWritten = false; // real data line, not header line
                if (isOutputJson)
                {
                    if (outputVariable != null)
                    {
                        responseStrBldr.Append("var " + outputVariable + " = [\n");
                    }
                    if (jsonpCallback != null)
                    {
                        responseStrBldr.Append(jsonpCallback + "([\n");
                    }
                }
                else
                {   // output is CSV
                    WriteRow(isOutputJson, yffColumnsList, new string[] { "Date", "Open", "High", "Low", "Close", "Adj Close", "Volume" }, responseStrBldr, ref wasDataLineWritten);
                }

                foreach (var candle in history)
                {
                    string[] cells = new string[7];
                    if (isOutputJson)
                    {
                        cells[0] = String.Format(@"Date.UTC({0},{1},{2})", candle !.DateTime.Year, candle !.DateTime.Month - 1, candle !.DateTime.Day);
                    }
                    else
                    {
                        cells[0] = String.Format(@"{0}-{1}-{2}", candle !.DateTime.Year, candle !.DateTime.Month, candle !.DateTime.Day);
                    }

                    // Prices in the given CSV as "15.830000" is pointless. Convert it to "15.8" if possible,       "16.059999"	should be converted too
                    cells[1] = candle !.Open.ToString("0.###");
                    cells[2] = candle !.High.ToString("0.###");
                    cells[3] = candle !.Low.ToString("0.###");
                    cells[4] = candle !.Close.ToString("0.###");
                    cells[5] = candle !.AdjustedClose.ToString("0.###");
                    cells[6] = candle !.Volume.ToString("0.###");

                    WriteRow(isOutputJson, yffColumnsList, cells, responseStrBldr, ref wasDataLineWritten);
                }


                // // 4.2 Process YF CSV file either as JSON or as CSV: Data lines
                // // First is the header, so skip it. Previously, it was upside down, so the latest was the first, but from 2017-05, the oldest is the first. Fine. Leave it like that.
                // string[] lines = csvDownload.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                // for (int i = 1; i < lines.Length; i++)
                // {
                //     string[] cells = lines[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                //     if (cells.Length != 7)
                //     {
                //         return new Tuple<string, string>(@"{ ""Message"":  ""Error: yF row doesn't have 7 cells: " + lines[i] + @""" }", "application/json");
                //     }

                //     DateTime date;
                //     if (!DateTime.TryParseExact(cells[0], "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
                //     {
                //         return new Tuple<string, string>(@"{ ""Message"":  ""Error: problem with date format: " + cells[0] + @""" }", "application/json");
                //     }
                //     if (isOutputJson)
                //         cells[0] = String.Format(@"Date.UTC({0},{1},{2})", date.Year, date.Month - 1, date.Day);
                //     else
                //         cells[0] = String.Format(@"{0}-{1}-{2}", date.Year, date.Month, date.Day);

                //     // Prices in the given CSV as "15.830000" is pointless. Convert it to "15.8" if possible,        "16.059999"	should be converted too
                //     for (int j = 1; j < 6; j++)
                //     {
                //         if (Double.TryParse(cells[j], out double price))
                //             cells[j] = price.ToString("0.###");
                //     }

                //     //Volume is sometimes "000"; convert it to "0"
                //     if (Int64.TryParse(cells[6], out long volume))  // Volume was the 5th index, not it is the 6th index (the last item)
                //         cells[6] = volume.ToString();

                //     WriteRow(isOutputJson, yffColumnsList, cells, responseStrBldr, ref wasDataLineWritten);
                // }

                // 4.3 Process YF CSV file either as JSON or as CSV: Footer and finalizing it
                if (isOutputJson)
                {
                    if (outputVariable != null)
                    {
                        responseStrBldr.Append("];");
                    }
                    if (jsonpCallback != null)
                    {
                        responseStrBldr.Append("]);");
                    }
                }

                return(new Tuple <string, string>(responseStrBldr.ToString(), "application/javascript"));
            }
            catch (Exception e)
            {
                return(new Tuple <string, string>(@"{ ""Message"":  ""Exception caught by WebApi Get(): " + e.Message + @""" }", "application/json"));
            }
        }
Beispiel #17
0
        public string csvString()
        {
            string word = ID.ToString() + ',' + ChannelID.ToString() + ',' + Name.Replace(',', '-') + ',' + AlarmTypeID.ToString() + ',' + Severity.ToString() + ',' + High.ToString() + ',' + Low.ToString() + ',' + RangeInclusive.ToString() + ','
                          + PerUnit.ToString() + ',' + Enabled.ToString() + ',' + MeasurementType + ',' + MeasurementTypeID.ToString() + ',' + MeasurementCharacteristic + ',' + MeasurementCharacteristicID.ToString() + ',' +
                          Phase + ',' + PhaseID.ToString() + ',' + HarmonicGroup.ToString() + ',' + IsDefault.ToString();

            return(word);
        }
 public override string ToString()
 {
     return(Time.ToShortDateString() + " " + Open.ToString() + " " + High.ToString() + " " + Low.ToString() + " " + Close.ToString());
 }
Beispiel #19
0
 public override string ToString() => High.ToString("X16") + Low.ToString("X16");
Beispiel #20
0
 public override string ToString()
 {
     return(string.Format("From {0} to {1}", Low.ToString(), High.ToString()));
 }
Beispiel #21
0
        public override string ToString()
        {
            if (Low == 0 && High == 0)
            {
                return("Full: 0x0");
            }

            if (HasEntry())
            {
                var type = Utilities.ObjectTypeToStore(GetObjectType());

                return(string.Format("Full: 0x{0}{1} {2}/{3} R{4}/S{5} Map: {6} Entry: {7} Low: {8}", High.ToString("X16"), Low.ToString("X16"),
                                     GetHighType(), GetSubType(), GetRealmId(), GetServerId(), StoreGetters.GetName(StoreNameType.Map, GetMapId()),
                                     StoreGetters.GetName(type, (int)GetEntry()), GetLow()));
            }

            // TODO: Implement extra format for battleground, see WowGuid64.ToString()

            var name = StoreGetters.GetName(this);

            return(string.Format("Full: 0x{0}{1} {2}/{3} R{4}/S{5} Map: {6} Low: {7}", High.ToString("X16"), Low.ToString("X16"),
                                 GetHighType(), GetSubType(), GetRealmId(), GetServerId(), StoreGetters.GetName(StoreNameType.Map, GetMapId()),
                                 GetLow() + (String.IsNullOrEmpty(name) ? String.Empty : (" Name: " + name))));
        }
Beispiel #22
0
        public void Print()
        {
            var color = IsGreen ? "Green" : "Red";

            Console.WriteLine($"O={Open.ToString("0.00")}, H={High.ToString("0.00")}, L={Low.ToString("0.00")}, C={Close.ToString("0.00")}, V={Volume}, NV={CandleVolume}, Color = {color}");
        }
Beispiel #23
0
 public override string ToString()
 {
     return(High + "," + (Low > 9 ? Low.ToString() : "0" + Low));
 }
Beispiel #24
0
 /// <summary>
 ///This method returns the string representation of this class.
 /// </summary>
 /// <returns>The string representation of this class</returns>
 public override string ToString()
 {
     return(Low.ToString() + ", " + High.ToString() + ", " + STEL.ToString() + "," + TWA.ToString());
 }
Beispiel #25
0
 public string[] ToStrings()
 {
     return(new string[] { DateTime.FromFileTime(_dateTime).ToString(), Open.ToString(), Close.ToString(),
                           Low.ToString(), High.ToString(), Volume.ToString() });
 }
Beispiel #26
0
        public override string ToString()
        {
            var date = OpenTime.ToDefaultString();

            var chars   = 8;
            var padChar = ' ';
            //var padChar = '0';
            var vol = Volume > 0 ? $" [v:{Volume.ToString().PadLeft(chars)}]" : "";

            return($"{date} o:{Open.ToString().PadRight(chars, padChar)} h:{High.ToString().PadRight(chars, padChar)} l:{Low.ToString().PadRight(chars, padChar)} c:{Close.ToString().PadRight(chars, padChar)}{vol}");
        }
Beispiel #27
0
        public string ToString(int decimalPlaces)
        {
            var date = OpenTime.ToDefaultString();

            var padChar = ' ';
            //var padChar = '0';
            var vol = Volume > 0 ? $" [v:{Volume.ToString().PadLeft(decimalPlaces)}]" : "";

            return($"{date} o:{Open.ToString().PadRight(decimalPlaces, padChar)} h:{High.ToString().PadRight(decimalPlaces, padChar)} l:{Low.ToString().PadRight(decimalPlaces, padChar)} c:{Close.ToString().PadRight(decimalPlaces, padChar)}{vol}");
        }
Beispiel #28
0
 public string LowAsString()
 {
     return(Low.ToString(CultureInfo.InvariantCulture));
 }
Beispiel #29
0
 public override string ToString()
 {
     return("OHLC (" + _time + ") " + Open.ToString("F2") + "," + High.ToString("F2") + "," + Low.ToString("F2") + "," + Close.ToString("F2"));
 }
Beispiel #30
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (X.HasValue)
            {
                writer.WriteAttributeString("x", X.ToString());
            }

            if (Open.HasValue)
            {
                writer.WriteAttributeString("open", Open.ToString());
            }
            if (Close.HasValue)
            {
                writer.WriteAttributeString("close", Close.ToString());
            }
            if (High.HasValue)
            {
                writer.WriteAttributeString("high", High.ToString());
            }
            if (Low.HasValue)
            {
                writer.WriteAttributeString("low", Low.ToString());
            }
            if (Volume.HasValue)
            {
                writer.WriteAttributeString("volume", Volume.ToString());
            }

            if (ValueText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("valueText", ValueText);
            }
            if (Color.HasValue)
            {
                writer.WriteAttributeString("color", Color.Value.ToHexString());
            }
            if (BorderColor.HasValue)
            {
                writer.WriteAttributeString("borderColor", BorderColor.Value.ToHexString());
            }
            if (Alpha.HasValue)
            {
                writer.WriteAttributeString("alpha", Alpha.ToString());
            }
            if (Dashed.HasValue)
            {
                writer.WriteAttributeString("dashed", Dashed.GetHashCode().ToString());
            }

            if (_link != null)
            {
                _link.GenerateXmlAttributes(writer);
            }

            if (ToolText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("toolText", ToolText);
            }
        }