示例#1
0
        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);
        }
示例#2
0
        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());
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 public string[] InitAvailableAssets([FromBody] ClientIdBackendRequest request)
 {
     return(GetAvailableAssets(request.ClientId).ToArray());
 }