public MarginTradingAccountBackendContract[] InitAccounts([FromBody] ClientIdBackendRequest request) { var accounts = _accountsCacheService.GetAll(request.ClientId).ToArray(); var result = accounts.Select(item => item.ToFullBackendContract(_marginSettings.IsLive)).ToArray(); return(result); }
public AssetPairBackendContract[] InitAssets([FromBody] ClientIdBackendRequest request) { var availableAssets = GetAvailableAssets(request.ClientId).ToHashSet(); var instruments = _assetPairsCache.GetAll(); return(instruments.Where(a => availableAssets.Contains(a.Id)) .Select(item => item.ToBackendContract()).ToArray()); }
public ClientOrdersBackendResponse GetClientOrders([FromBody] ClientIdBackendRequest request) { var accountIds = _accountsCacheService.GetAll(request.ClientId).Select(item => item.Id).ToArray(); var positions = _ordersCache.ActiveOrders.GetOrdersByAccountIds(accountIds).ToList(); var orders = _ordersCache.WaitingForExecutionOrders.GetOrdersByAccountIds(accountIds).ToList(); var result = BackendContractFactory.CreateClientOrdersBackendResponse(positions, orders); return(result); }
public OrderBackendContract[] GetOpenPositions([FromBody] ClientIdBackendRequest request) { var accountIds = _accountsCacheService.GetAll(request.ClientId).Select(item => item.Id).ToArray(); var positions = _ordersCache.ActiveOrders.GetOrdersByAccountIds(accountIds).Select(item => item.ToBackendContract()).ToList(); var orders = _ordersCache.WaitingForExecutionOrders.GetOrdersByAccountIds(accountIds).Select(item => item.ToBackendContract()).ToList(); positions.AddRange(orders); var result = positions.ToArray(); return(result); }
public InitAccountInstrumentsBackendResponse AccountInstruments([FromBody] ClientIdBackendRequest request) { var accounts = _accountsCacheService.GetAll(request.ClientId).ToArray(); if (accounts.Length == 0) { return(InitAccountInstrumentsBackendResponse.CreateEmpty()); } var accountAssets = _accountAssetsCacheService.GetClientAssets(accounts); var result = BackendContractFactory.CreateInitAccountInstrumentsBackendResponse(accountAssets); return(result); }
public string[] InitAvailableAssets([FromBody] ClientIdBackendRequest request) { return(GetAvailableAssets(request.ClientId).ToArray()); }