public SpotInstrumentFees GetSpotInstrumentFees(string brokerId, string spotInstrumentId)
        {
            var entity = _spotInstrumentsReader.Get(SpotInstrumentFeesNoSqlEntity.GeneratePartitionKey(brokerId),
                                                    SpotInstrumentFeesNoSqlEntity.GenerateRowKey(spotInstrumentId));

            if (entity == null)
            {
                entity = _spotInstrumentsReader.Get(SpotInstrumentFeesNoSqlEntity.GeneratePartitionKey(brokerId),
                                                    SpotInstrumentFeesNoSqlEntity.GenerateRowKey(SpotInstrumentFeesNoSqlEntity.DEFAULT_FEES));
                if (entity == null)
                {
                    return(new SpotInstrumentFees {
                        FeeType = FeeType.NoFee
                    });
                }
            }

            var result = entity.SpotInstrumentFees;

            if (string.IsNullOrEmpty(result.AccountId) ||
                string.IsNullOrEmpty(result.WalletId))
            {
                var settings = _feesSettingsReader.Get(FeesSettingsNoSqlEntity.GeneratePartitionKey(brokerId),
                                                       FeesSettingsNoSqlEntity.GenerateRowKey());
                if (settings != null)
                {
                    result.BrokerId  = settings.FeesSettings.BrokerId;
                    result.AccountId = settings.FeesSettings.AccountId;
                    result.WalletId  = settings.FeesSettings.WalletId;
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
    public async Task <CountryModel> GetCountry(CountryRequest request)
    {
        var entity = _reader.Get(KycCountryNoSqlEntity.GeneratePartitionKey(),
                                 KycCountryNoSqlEntity.GenerateRowKey(request.CountryCode));

        return(entity?.Country ?? await _grpcService.GetCountry(request));
    }
        public async Task <SnapshotEntity> GetSnapshot(GetSnapshotRequest request)
        {
            var snapshotNoSql = _snapshotReader.Get(SnapshotNoSqlEntity.GeneratePartitionKey(request.WalletId),
                                                    SnapshotNoSqlEntity.GenerateRowKey(request.AssetId));

            if (snapshotNoSql.Entity != null)
            {
                return(snapshotNoSql.Entity);
            }

            var snapshot = await _snapshotGrpcService.GetSnapshot(request);

            return(snapshot);
        }
Ejemplo n.º 4
0
        public AssetFees GetAssetFees(string brokerId, string groupId, string assetId, OperationType operationType)
        {
            var entity = _assetFeesReader.Get(AssetFeesNoSqlEntity.GeneratePartitionKey(brokerId, groupId),
                                              AssetFeesNoSqlEntity.GenerateRowKey(assetId, operationType));

            if (entity == null)
            {
                return(new AssetFees {
                    FeeType = FeeType.NoFee
                });
            }

            var result = entity.AssetFees;

            if (string.IsNullOrEmpty(result.AccountId) ||
                string.IsNullOrEmpty(result.WalletId))
            {
                var settings = _feesSettingsReader.Get(FeesSettingsNoSqlEntity.GeneratePartitionKey(brokerId),
                                                       FeesSettingsNoSqlEntity.GenerateRowKey());
                if (settings != null)
                {
                    result.BrokerId  = settings.FeesSettings.BrokerId;
                    result.AccountId = settings.FeesSettings.AccountId;
                    result.WalletId  = settings.FeesSettings.WalletId;
                }
            }

            return(entity?.AssetFees);
        }
Ejemplo n.º 5
0
        public KycStatusResponse GetClientKycStatus(KycStatusRequest request)
        {
            var existingEntity = _readerKycStatuses.Get(
                KycProfileNoSqlEntity.GeneratePartitionKey(),
                KycProfileNoSqlEntity.GenerateRowKey(request.ClientId));

            if (existingEntity != null)
            {
                return(new KycStatusResponse
                {
                    ClientId = existingEntity.Profile.ClientId,
                    Level = existingEntity.Profile.KycLevel,
                    RequiredDocuments = KycLevelHelper.GetRequiredDocuments(existingEntity.Profile),
                    RequiredVerifications = existingEntity.Profile.RequiredVerifications,
                    DepositStatus = existingEntity.Profile.DepositStatus,
                    TradeStatus = existingEntity.Profile.TradeStatus,
                    WithdrawalStatus = existingEntity.Profile.WithdrawalStatus,
                    VerificationInProgress = !string.IsNullOrEmpty(existingEntity.Profile.ActiveVerificationId)
                });
            }

            var entity = _kycStatusService.GetKycStatusAsync(new KycStatusRequest()
            {
                ClientId = request.ClientId
            }).Result;

            return(entity);
        }
Ejemplo n.º 6
0
        public async static Task ReadInstrumentsFees()
        {
            //http://192.168.1.80:5123
            // var writer = new MyNoSqlServerDataWriter<SpotInstrumentFeesNoSqlEntity>(GetUrl, SpotInstrumentFeesNoSqlEntity.TableName, false);
            // var entities = await writer.GetAsync();
            // Console.WriteLine(JsonConvert.SerializeObject(entities));

            //192.168.1.80:5125
            var myNoSqlClient = new MyNoSqlTcpClient(GetUrl, "local");
            var subs          = new MyNoSqlReadRepository <SpotInstrumentFeesNoSqlEntity>(myNoSqlClient,
                                                                                          SpotInstrumentFeesNoSqlEntity.TableName);

            myNoSqlClient.Start();
            Thread.Sleep(10000);

            var entities = subs.Get();

            Console.WriteLine(JsonConvert.SerializeObject(entities));
            //
            // var entity = subs.Get(SpotInstrumentFeesNoSqlEntity.GeneratePartitionKey("jetwallet"),
            //     SpotInstrumentFeesNoSqlEntity.GenerateRowKey("ALGOUSD"));
            //
            // Console.WriteLine(JsonConvert.SerializeObject(entity));
            //
            // var entities = subs.Get(SpotInstrumentFeesNoSqlEntity.GeneratePartitionKey("jetwallet"));
            //
            // Console.WriteLine(JsonConvert.SerializeObject(entities));
            //
            // var entities1 = subs.Get();
            //
            // Console.WriteLine(JsonConvert.SerializeObject(entities1));
        }
Ejemplo n.º 7
0
        public FeesSettings GetFeesSettings(string brokerId)
        {
            var entity = _reader.Get(FeesSettingsNoSqlEntity.GeneratePartitionKey(brokerId),
                                     FeesSettingsNoSqlEntity.GenerateRowKey());

            return(entity?.FeesSettings);
        }
Ejemplo n.º 8
0
        private static void GetData(MyNoSqlReadRepository <ReplaceEntity> dataReader)
        {
            Console.WriteLine("--------");
            var data = dataReader.Get();
            var i    = 0;

            foreach (ReplaceEntity item in data)
            {
                Console.WriteLine($"{++i} :{item.Value}");
            }

            Console.WriteLine("========");
        }
Ejemplo n.º 9
0
        public DepositFees GetDepositFees(string brokerId, string groupId, string assetId)
        {
            var entity = _depositFeesReader.Get(DepositFeesNoSqlEntity.GeneratePartitionKey(brokerId, groupId),
                                                DepositFeesNoSqlEntity.GenerateRowKey(assetId));

            if (entity == null)
            {
                return(new DepositFees {
                    FeeType = FeeType.NoFee
                });
            }

            return(entity?.DepositFees);
        }
        public async Task <ClientWalletList> GetWalletsByClient(JetClientIdentity clientId)
        {
            var entity = _reader.Get(ClientWalletNoSqlEntity.GeneratePartitionKey(clientId.BrokerId),
                                     ClientWalletNoSqlEntity.GenerateRowKey(clientId.ClientId));

            if (entity != null)
            {
                return new ClientWalletList()
                       {
                           Wallets = entity.Wallets
                       }
            }
            ;

            var wallets = await _grpcService.GetWalletsByClient(clientId);

            return(wallets);
        }
        public BidAsk GetPrice(string brokerId, string symbol)
        {
            var price = _reader.Get(BidAskNoSql.GeneratePartitionKey(brokerId), BidAskNoSql.GenerateRowKey(symbol));

            return(price?.Quote);
        }
        public List <OrderBookLevelNoSql> GetOrderBook(string brokerId, string symbol)
        {
            var orderBook = _reader.Get(OrderBookNoSql.GeneratePartitionKey(brokerId, symbol));

            return(orderBook.Select(e => e.Level).ToList());
        }