// Use this for initialization void Start() { inventorySystem = GameObject.Find("InventorySystem"); player = GameObject.Find("Character"); playerMoney = player.GetComponent <funds>(); inventory = inventorySystem.GetComponentInChildren <Inventory>(); database = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <ItemDatabase>(); }
public void UploadFunds(string path) { String symbol = Path.GetFileNameWithoutExtension(path); string DATE_HEADER = "Date"; string ADJ_CLOSE = "Adj Close"; string SYMBOL = symbol; string OPEN = "Open"; string HIGH = "High"; string LOW = "Low"; string CLOSE = "Close"; string VOLUME = "Volume"; fundIndex = new List <funds>(); if (fundIndex == null) { fundIndex = new List <funds>(); } else { fundIndex.Clear(); } using (CSV reader = new CSV(path)) { while (reader.next()) { DateTime date = reader.getDate(DATE_HEADER); double close_adj = reader.getDouble(ADJ_CLOSE); double open = reader.getDouble(OPEN); double high = reader.getDouble(HIGH); double low = reader.getDouble(LOW); double close = reader.getDouble(CLOSE); int volume = reader.getInt(VOLUME); funds temp = new funds(symbol, date, open, high, low, close, close_adj, volume); fundIndex.Add(temp); if (close_adj > MaxFund) { MaxFund = close_adj; } if (close_adj < MinFund) { MinFund = close_adj; } } reader.close(); fundIndex.Sort(); } if (MaxDate > fundIndex[fundIndex.Count - 1].Date) { MaxDate = fundIndex[fundIndex.Count - 1].Date; } if (MinDate < fundIndex[0].Date) { MinDate = fundIndex[0].Date; } }