Exemplo n.º 1
0
        public async Task <int> SaveAsync(SnapshotPrice price)
        {
            using (var conn = new MySqlConnection(_appSettings.CoinSongDb))
            {
                await conn.OpenAsync();

                var priceId = await conn.ExecuteAsync($@"
                    INSERT INTO Prices (
                        Coin,
                        Price,
                        Currency,
                        Ask,
                        Bid,
                        Size,
                        Time)
                    VALUES (
                        @Coin,
                        @Price,
                        @Currency,
                        @Ask,
                        @Bid,
                        @Size,
                        @Time
                    )
                ", new
                {
                    Coin = price.Coin.ToUpperString(),
                    price.Price,
                    Currency = price.Currency.ToUpperString(),
                    price.Ask,
                    price.Bid,
                    price.Size,
                    price.Time
                });

                return(priceId);
            }
        }
Exemplo n.º 2
0
        public async Task <int> SaveAsync(SnapshotPrice price)
        {
            return(0);
//            using (var conn = new MySqlConnection(_gdaxOptions.CoinSongDb))
//            {
//                await conn.OpenAsync();
//                var priceId = await conn.ExecuteAsync($@"
//                    INSERT INTO Prices (
//                        Coin,
//                        Price,
//                        Currency,
//                        Ask,
//                        Bid,
//                        Size,
//                        Time)
//                    VALUES (
//                        @Coin,
//                        @Price,
//                        @Currency,
//                        @Ask,
//                        @Bid,
//                        @Size,
//                        @Time
//                    )
//                ", new
//                {
//                    Coin = price.Coin.ToUpperString(),
//                    price.Price,
//                    Currency = price.Currency.ToUpperString(),
//                    price.Ask,
//                    price.Bid,
//                    price.Size,
//                    price.Time
//                });
//
//                return priceId;
//        }
        }