public void AssetStatics() { AssetStatics aS = new AssetStatics("BTC", new Currency("USD")); string fileName = SerializeObject(aS, "AssetStatics"); AssetStatics desAs = DeserializeObject <AssetStatics>(fileName); Assert.IsTrue(aS == desAs); }
//public void AddNewCcy(string ccyName, CurrencyStatics ccyStatics, CurrencyPair cp, double cpValue) //{ // bool testAdd = _CcyDB.AddCcy(ccyName, ccyStatics); // if (!testAdd) // MessageBox.Show($"The new Currency [{ccyName}] does already exist."); // else // { // _FXMarket.AddQuote(cp, cpValue); // } //} //public void AddRefCcy(string ccyName, CurrencyStatics ccyStatics) //{ // bool testAdd = _CcyDB.AddCcy(ccyName, ccyStatics); // if (!testAdd) // throw new Exception($"Add Ref Ccy Error {ccyName}"); // _Ccy = new Currency(ccyName); // _FXMarket.SetCcyRef(_Ccy); //} public void AddNewAsset(string assetName, AssetStatics aSt, double acpValue) { bool testAdd = _CcyDB.AddAsset(assetName, aSt); if (!testAdd) { MessageBox.Show($"The new Asset [{assetName}] does already exist."); } else { AssetCcyPair acp = new AssetCcyPair(new Asset(assetName), aSt.Ccy); _AssetMarket.AddQuote(acp, acpValue); } }
public void AddNewAsset(string assetName, AssetStatics aSt, double acpValue) { bool testAdd = _CcyDB.AddAsset(assetName, aSt); if (!testAdd) { MessageBox.Show($"The new Asset [{assetName}] does already exist."); } else { AssetCcyPair acp = new AssetCcyPair(new Asset(assetName), aSt.Ccy); foreach (var item in _Data) { item.Value.SetCcyDB(_CcyDB); item.Value.AssetMarket.AddQuote(acp, acpValue); item.Value.AssetMarket.PopulateWithFXMarket(item.Value.FXMarket); } } }
public void OnDragDop(object sender, DragEventArgs e) { // The mouse locations are relative to the screen, so they must be // converted to client coordinates. Point clientPoint = PointToClient(new Point(e.X, e.Y)); // Get the row index of the item the mouse is below. rowIndexOfItemUnderMouseToDrop = HitTest(clientPoint.X, clientPoint.Y).RowIndex; // If the drag operation was a move then remove and insert the row. if (e.Effect == DragDropEffects.Move) { DataGridViewRow rowToMove = e.Data.GetData( typeof(DataGridViewRow)) as DataGridViewRow; if (rowIndexOfItemUnderMouseToDrop > -1) { Rows.RemoveAt(rowIndexFromMouseDown); if (rowIndexOfItemUnderMouseToDrop < rowIndexFromMouseDown) { rowIndexOfItemUnderMouseToDrop += 1; } Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove); } //Rows[rowIndexOfItemUnderMouseToDrop].DefaultCellStyle.BackColor = Color.Aqua; List <AssetStatics> tempList = new List <AssetStatics> { }; for (int i = 0; i < Rows.Count; i++) { string assetName = (string)Rows[i].Cells[0].Value; AssetStatics a = _Memo.AssetDataBase.Where(x => x.Name == assetName).First(); AssetStatics ac = (AssetStatics)a.Clone(); tempList.Add(ac); } _Memo.AssetDataBase = tempList; } }
internal void AddNewAsset(string assetName, AssetStatics assetStatics, double assetCcyPairQuote) { _had.AddNewAsset(assetName, assetStatics, assetCcyPairQuote); //_ad.AssetMarket.PopulateWithFXMarket(_ad.FXMarket); _view.SetUpMarkets(_view.CcyDB, _ad.FXMarket, _ad.AssetMarket); }