From c7e0ba4de28eebb91d2b845987bc2d499c39e17e Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sat, 23 Jan 2021 13:31:05 +0800 Subject: [PATCH 01/96] Add COTI ERC20 (#346) https://coinmarketcap.com/currencies/coti/ https://etherscan.io/address/0xddb3422497e61e13543bea06989c0789117555c5 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 0d09bffb..df6e0aa9 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -8002,6 +8002,12 @@ const Mapping = `[ "token_id": "COTI-CBB", "id": 3992 }, + { + "coin": 60, + "type": "token", + "token_id": "0xDDB3422497E61e13543BeA06989C0789117555c5", + "id": 3992 + }, { "coin": 60, "type": "token", From b374fd8aec1c4e12feaa5ca1c7568927ddac20f5 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Sun, 24 Jan 2021 01:04:16 +0800 Subject: [PATCH 02/96] add_ERC20_WISE (#349) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index df6e0aa9..e7ebc7af 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14050,6 +14050,12 @@ const Mapping = `[ "token_id": "0x5A41F637C3f7553dBa6dDC2D3cA92641096577ea", "id": 8164 }, + { + "coin": 60, + "type": "token", + "token_id": "0x66a0f676479Cee1d7373f3DC2e2952778BfF5bd6", + "id": 8167 + }, { "coin": 20000714, "type": "token", From 4636567447ea1304ba4fb73ff8b0504d6180ec44 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Sat, 23 Jan 2021 22:52:46 -0800 Subject: [PATCH 03/96] Remove request limit (#345) * Remove request limit * Update base_test.go --- config.yml | 1 - config/config.go | 4 ++-- config/config_test.go | 1 - services/controllers/tickers/base.go | 8 -------- services/controllers/tickers/base_test.go | 16 +--------------- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/config.yml b/config.yml index 4f6bd325..8380d5ef 100644 --- a/config.yml +++ b/config.yml @@ -50,7 +50,6 @@ rest_api: info: cache_control: 10m cache: 15m - request_limit: 500 use_memory_cache: true update_time: memory_cache_tickers: 5m diff --git a/config/config.go b/config/config.go index 9938322a..3cceceb5 100644 --- a/config/config.go +++ b/config/config.go @@ -1,12 +1,13 @@ package config import ( - "github.com/pkg/errors" "path/filepath" "reflect" "strings" "time" + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" "github.com/spf13/viper" ) @@ -72,7 +73,6 @@ type Configuration struct { CacheControl time.Duration `mapstructure:"cache_control"` } `mapstructure:"info"` Cache time.Duration `mapstructure:"cache"` - RequestLimit int `mapstructure:"request_limit"` UseMemoryCache bool `mapstructure:"use_memory_cache"` UpdateTime struct { Tickers string `mapstructure:"memory_cache_tickers"` diff --git a/config/config_test.go b/config/config_test.go index 363db7a4..62185f39 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -48,7 +48,6 @@ func TestInit(t *testing.T) { assert.Equal(t, "8421", c.RestAPI.Port) assert.Equal(t, time.Minute*15, c.RestAPI.Cache) - assert.Equal(t, 500, c.RestAPI.RequestLimit) assert.Equal(t, true, c.RestAPI.UseMemoryCache) assert.Equal(t, "5m", c.RestAPI.UpdateTime.Tickers) assert.Equal(t, "5m", c.RestAPI.UpdateTime.Rates) diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 5c472e4f..5232afcf 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -35,10 +35,6 @@ func NewController( } func (c Controller) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { - if tr.Ids == nil || len(tr.Ids) >= c.configuration.RestAPI.RequestLimit { - return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrBadRequest) - } - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) if err != nil { return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrNotFound) @@ -55,10 +51,6 @@ func (c Controller) HandleTickersRequestV2(tr controllers.TickerRequestV2) (cont } func (c Controller) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { - if tr.Assets == nil || len(tr.Assets) >= c.configuration.RestAPI.RequestLimit { - return controllers.TickerResponse{}, errors.New(watchmarket.ErrBadRequest) - } - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) if err != nil { return controllers.TickerResponse{}, errors.New(watchmarket.ErrNotFound) diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index e2ec0a37..6368700c 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -137,13 +137,6 @@ func TestController_HandleTickersRequest(t *testing.T) { assert.Equal(t, wantedResp, response) - oversizeRequest := controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}} - for i := 0; i < c.configuration.RestAPI.RequestLimit; i++ { - oversizeRequest.Assets = append(oversizeRequest.Assets, controllers.Coin{Coin: 60, TokenId: "a"}) - } - _, err = c.HandleTickersRequest(oversizeRequest) - assert.Equal(t, errors.New(watchmarket.ErrBadRequest), err) - controllerWithCache := setupController(t, db, true) assert.NotNil(t, controllerWithCache) wantedTicker1Raw, err := json.Marshal(&wantedTicker1) @@ -187,7 +180,7 @@ func TestController_HandleTickersRequest_Negative(t *testing.T) { assert.NotNil(t, c) _, err := c.HandleTickersRequest(controllers.TickerRequest{}) - assert.Equal(t, err, errors.New(watchmarket.ErrBadRequest)) + assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) } func TestController_HandleTickersRequestV2(t *testing.T) { @@ -297,13 +290,6 @@ func TestController_HandleTickersRequestV2(t *testing.T) { assert.Equal(t, wantedResp, response) - oversizeRequest := controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}} - for i := 0; i < c.configuration.RestAPI.RequestLimit; i++ { - oversizeRequest.Ids = append(oversizeRequest.Ids, "c60_ta") - } - _, err = c.HandleTickersRequestV2(oversizeRequest) - assert.Equal(t, errors.New(watchmarket.ErrBadRequest), err) - controllerWithCache := setupController(t, db, true) assert.NotNil(t, controllerWithCache) wantedTicker1Raw, err := json.Marshal(&watchmarket.Ticker{ From 53376f099b32286752b0f86de0206d0f73e1e9f6 Mon Sep 17 00:00:00 2001 From: hewigovens <360470+hewigovens@users.noreply.github.com> Date: Mon, 25 Jan 2021 15:02:11 +0900 Subject: [PATCH 04/96] Fix unstable tickers_test.go (#350) * update golibs/coin, sorted getCoinBySymbol * clean go.sum --- go.mod | 4 ++-- go.sum | 7 +++++-- services/markets/binancedex/tickers.go | 2 +- services/markets/coingecko/mocks/tickers.json | 2 +- services/markets/coingecko/tickers.go | 12 ++++++++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 119b5517..f68946ea 100644 --- a/go.mod +++ b/go.mod @@ -26,8 +26,8 @@ require ( github.com/stretchr/testify v1.7.0 github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/swag v1.6.7 - github.com/trustwallet/golibs v0.0.35 - github.com/trustwallet/golibs/network v0.0.0-20201217160111-1a8423bbcaa1 + github.com/trustwallet/golibs v0.1.0 + github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect gorm.io/driver/postgres v1.0.6 gorm.io/gorm v1.20.11 diff --git a/go.sum b/go.sum index 6fa97596..b4ce64d9 100644 --- a/go.sum +++ b/go.sum @@ -560,8 +560,10 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/trustwallet/golibs v0.0.35 h1:VqWInO5s4Zg6XyCmqro8/xrEViOedZ3oYtBq/kn4fBg= github.com/trustwallet/golibs v0.0.35/go.mod h1:VI0APImKAYxvJ8MnMD6aHSKvnArXUd3NgNEghX5P+K8= -github.com/trustwallet/golibs/network v0.0.0-20201217160111-1a8423bbcaa1 h1:x2vE676o4hhpq0eq6UF1P3PGFFF1nwfuARKHHd8nLvQ= -github.com/trustwallet/golibs/network v0.0.0-20201217160111-1a8423bbcaa1/go.mod h1:RMMyjp4qUcVhWidjE+XYzQgOtSXuhIKSB5pnLCA3WqY= +github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgtQ6Y= +github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= +github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= @@ -656,6 +658,7 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201216054612-986b41b23924 h1:QsnDpLLOKwHBBDa8nDws4DYNc/ryVW2vCpxCs09d4PY= golang.org/x/net v0.0.0-20201216054612-986b41b23924/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= diff --git a/services/markets/binancedex/tickers.go b/services/markets/binancedex/tickers.go index f97f70b7..fa17753b 100755 --- a/services/markets/binancedex/tickers.go +++ b/services/markets/binancedex/tickers.go @@ -65,7 +65,7 @@ func normalizeTicker(price CoinPrice, provider string) (watchmarket.Ticker, erro } t = watchmarket.Ticker{ - Coin: coin.BNB, + Coin: coin.BINANCE, CoinName: BNBAsset, CoinType: watchmarket.Token, TokenId: strings.ToLower(tokenId), diff --git a/services/markets/coingecko/mocks/tickers.json b/services/markets/coingecko/mocks/tickers.json index 39162713..f44fe08c 100644 --- a/services/markets/coingecko/mocks/tickers.json +++ b/services/markets/coingecko/mocks/tickers.json @@ -28,7 +28,7 @@ "market_cap": 22851909019 }, { - "coin": 10000714, + "coin": 20000714, "coin_name": "BNB", "type": "coin", "price": { diff --git a/services/markets/coingecko/tickers.go b/services/markets/coingecko/tickers.go index a047b561..976351e2 100755 --- a/services/markets/coingecko/tickers.go +++ b/services/markets/coingecko/tickers.go @@ -1,9 +1,9 @@ package coingecko import ( - "strings" - "errors" + "sort" + "strings" "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/pkg/watchmarket" @@ -202,7 +202,15 @@ func isBasicCoin(symbol string) bool { } func getCoinBySymbol(symbol string) coin.Coin { + ids := []int{} for _, c := range coin.Coins { + ids = append(ids, int(c.ID)) + } + sort.Slice(ids, func(i, j int) bool { + return ids[i] > ids[j] + }) + for _, id := range ids { + c := coin.Coins[uint(id)] if strings.EqualFold(c.Symbol, symbol) { return c } From 802460f0f9aa15d9618f35a0e9baf7a20f05953d Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 26 Jan 2021 16:34:15 +0800 Subject: [PATCH 05/96] add_BEP20_ETHb (#352) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index e7ebc7af..e43164d7 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -519,6 +519,12 @@ const Mapping = `[ "token_id": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", "id": 1027 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xc5137E8e017799e71A65e0cFe3F340d719AF17D3", + "id": 1027 + }, { "coin": 524, "type": "coin", From 2eaab35b148b58fd58ee3211f484210907ef6335 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:07:19 +0800 Subject: [PATCH 06/96] add_BEP20_HELMET (#353) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index e43164d7..2d5c813b 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14068,6 +14068,12 @@ const Mapping = `[ "token_id": "0x78650B139471520656b9E7aA7A5e9276814a38e9", "id": 8210 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x948d2a81086A075b3130BAc19e4c6DEe1D2E3fE8", + "id": 8265 + }, { "coin": 20000714, "type": "token", From 8f7a6b875349fe25e6a6c8fe4b34069129dd06a7 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 26 Jan 2021 20:27:23 +0800 Subject: [PATCH 07/96] add_BEP20_EGLD (#354) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 2d5c813b..478a3f11 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13744,6 +13744,12 @@ const Mapping = `[ "type": "coin", "id": 6892 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xbF7c81FFF98BbE61B40Ed186e4AfD6DDd01337fe", + "id": 6892 + }, { "coin": 60, "type": "token", From 82894c6b0a46f9dea6eab359692ac4c2d4a57ca2 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 26 Jan 2021 22:21:40 +0800 Subject: [PATCH 08/96] add_BEP20_MirrorAssets (#355) --- services/markets/coinmarketcap/mapping.go | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 478a3f11..44322196 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14038,6 +14038,36 @@ const Mapping = `[ "token_id": "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7", "id": 7824 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x23396cF899Ca06c4472205fC903bDB4de249D6fC", + "id": 7858 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x62D71B23bF15218C7d2D7E48DBbD9e9c650B173f", + "id": 8003 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xF215A127A196e3988C09d052e16BcFD365Cd7AA3", + "id": 8004 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xa04F060077D90Fe2647B61e4dA4aD1F97d6649dc", + "id": 8005 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x3947B992DC0147D2D89dF0392213781b04B25075", + "id": 8016 + }, { "coin": 60, "type": "token", From 314341712fc9320b5341d2903d3b0cdc52ff8f5f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:00:25 -0800 Subject: [PATCH 09/96] Bump gorm.io/gorm from 1.20.11 to 1.20.12 (#357) Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.20.11 to 1.20.12. - [Release notes](https://github.com/go-gorm/gorm/releases) - [Commits](https://github.com/go-gorm/gorm/compare/v1.20.11...v1.20.12) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f68946ea..6c132a32 100644 --- a/go.mod +++ b/go.mod @@ -30,5 +30,5 @@ require ( github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect gorm.io/driver/postgres v1.0.6 - gorm.io/gorm v1.20.11 + gorm.io/gorm v1.20.12 ) diff --git a/go.sum b/go.sum index b4ce64d9..19aeed2d 100644 --- a/go.sum +++ b/go.sum @@ -828,6 +828,7 @@ gorm.io/driver/postgres v1.0.6/go.mod h1:r0nvX27yHDNbVeXMM9Y+9i5xSePcT18RfH8clP6 gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.11 h1:jYHQ0LLUViV85V8dM1TP9VBBkfzKTnuTXDjYObkI6yc= gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 25e63dfa56a97cb789da279aa6ea4755f626cfd7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 31 Jan 2021 18:45:08 -0800 Subject: [PATCH 10/96] Bump gorm.io/driver/postgres from 1.0.6 to 1.0.7 (#356) Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/go-gorm/postgres/releases) - [Commits](https://github.com/go-gorm/postgres/compare/v1.0.6...v1.0.7) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6c132a32..a53cccef 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,6 @@ require ( github.com/trustwallet/golibs v0.1.0 github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect - gorm.io/driver/postgres v1.0.6 + gorm.io/driver/postgres v1.0.7 gorm.io/gorm v1.20.12 ) diff --git a/go.sum b/go.sum index 19aeed2d..66d4625a 100644 --- a/go.sum +++ b/go.sum @@ -825,6 +825,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.6 h1:9sqNcNC9PCkZ6tMzWF1cEE2PARlCONgSqRobszSTffw= gorm.io/driver/postgres v1.0.6/go.mod h1:r0nvX27yHDNbVeXMM9Y+9i5xSePcT18RfH8clP6wpwI= +gorm.io/driver/postgres v1.0.7/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.11 h1:jYHQ0LLUViV85V8dM1TP9VBBkfzKTnuTXDjYObkI6yc= gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= From 8c175f7a519778fe9d652cb8e0182eff75eeeb11 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 1 Feb 2021 18:18:03 +0800 Subject: [PATCH 11/96] add_BEP20_KEBAB (#361) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 44322196..f488e41e 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14115,5 +14115,11 @@ const Mapping = `[ "type": "token", "token_id": "0xc1D99537392084Cc02D3F52386729b79d01035ce", "id": 8283 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2", + "id": 8334 } ]` From 353cc1f1d542eae8508c665fc2ff57ea2eba3090 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Feb 2021 17:59:36 -0800 Subject: [PATCH 12/96] Bump gorm.io/driver/postgres from 1.0.7 to 1.0.8 (#360) Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.0.7 to 1.0.8. - [Release notes](https://github.com/go-gorm/postgres/releases) - [Commits](https://github.com/go-gorm/postgres/compare/v1.0.7...v1.0.8) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a53cccef..46d9bfc0 100644 --- a/go.mod +++ b/go.mod @@ -29,6 +29,6 @@ require ( github.com/trustwallet/golibs v0.1.0 github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect - gorm.io/driver/postgres v1.0.7 + gorm.io/driver/postgres v1.0.8 gorm.io/gorm v1.20.12 ) diff --git a/go.sum b/go.sum index 66d4625a..eb45fd30 100644 --- a/go.sum +++ b/go.sum @@ -826,6 +826,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gorm.io/driver/postgres v1.0.6 h1:9sqNcNC9PCkZ6tMzWF1cEE2PARlCONgSqRobszSTffw= gorm.io/driver/postgres v1.0.6/go.mod h1:r0nvX27yHDNbVeXMM9Y+9i5xSePcT18RfH8clP6wpwI= gorm.io/driver/postgres v1.0.7/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= +gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.11 h1:jYHQ0LLUViV85V8dM1TP9VBBkfzKTnuTXDjYObkI6yc= gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= From c35d2a58f33f004f0b120c1780ad001cc78b470a Mon Sep 17 00:00:00 2001 From: hewigovens <360470+hewigovens@users.noreply.github.com> Date: Wed, 3 Feb 2021 13:28:25 +0900 Subject: [PATCH 13/96] Remove imroc/req (#359) * remove imroc/req * fix fetchCoinData bad url --- .gitignore | 1 + go.mod | 1 - go.sum | 10 +- services/assets/client.go | 37 ++---- services/assets/client_test.go | 6 - services/markets/binancedex/base_test.go | 5 +- services/markets/binancedex/client.go | 33 ++---- services/markets/binancedex/client_test.go | 13 --- services/markets/coingecko/base.go | 7 +- services/markets/coingecko/base_test.go | 2 +- services/markets/coingecko/client.go | 88 ++++---------- services/markets/coingecko/client_test.go | 13 --- services/markets/coinmarketcap/base_test.go | 6 +- services/markets/coinmarketcap/client.go | 107 ++++++------------ services/markets/coinmarketcap/client_test.go | 14 --- services/markets/fixer/base_test.go | 2 +- services/markets/fixer/client.go | 40 +++---- services/markets/fixer/client_test.go | 14 --- 18 files changed, 107 insertions(+), 292 deletions(-) delete mode 100755 services/markets/binancedex/client_test.go delete mode 100755 services/markets/coingecko/client_test.go delete mode 100755 services/markets/coinmarketcap/client_test.go delete mode 100755 services/markets/fixer/client_test.go diff --git a/.gitignore b/.gitignore index 7d3efea5..81db4e13 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /watchmarket.exe /bin/* *-bin +__debug_bin ### APP ### *.csv diff --git a/go.mod b/go.mod index 46d9bfc0..4a9a80e6 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.6.3 github.com/go-redis/redis v6.15.9+incompatible - github.com/imroc/req v0.3.0 github.com/mitchellh/mapstructure v1.3.3 // indirect github.com/onsi/ginkgo v1.10.1 // indirect github.com/onsi/gomega v1.7.0 // indirect diff --git a/go.sum b/go.sum index eb45fd30..6cd17763 100644 --- a/go.sum +++ b/go.sum @@ -257,8 +257,6 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/imroc/req v0.3.0 h1:3EioagmlSG+z+KySToa+Ylo3pTFZs+jh3Brl7ngU12U= -github.com/imroc/req v0.3.0/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= @@ -823,13 +821,9 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/postgres v1.0.6 h1:9sqNcNC9PCkZ6tMzWF1cEE2PARlCONgSqRobszSTffw= -gorm.io/driver/postgres v1.0.6/go.mod h1:r0nvX27yHDNbVeXMM9Y+9i5xSePcT18RfH8clP6wpwI= -gorm.io/driver/postgres v1.0.7/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= +gorm.io/driver/postgres v1.0.8 h1:PAgM+PaHOSAeroTjHkCHCBIHHoBIf9RgPWGo8dF2DA8= gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= -gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v1.20.11 h1:jYHQ0LLUViV85V8dM1TP9VBBkfzKTnuTXDjYObkI6yc= -gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.12 h1:ebZ5KrSHzet+sqOCVdH9mTjW91L298nX3v5lVxAzSUY= gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/services/assets/client.go b/services/assets/client.go index 87601fc9..22ae99e9 100755 --- a/services/assets/client.go +++ b/services/assets/client.go @@ -4,47 +4,30 @@ import ( "errors" "fmt" - "github.com/imroc/req" - log "github.com/sirupsen/logrus" + "github.com/trustwallet/golibs/client" "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/golibs/network/middleware" "github.com/trustwallet/watchmarket/pkg/watchmarket" ) type Client struct { - api string - r *req.Req + client.Request } func Init(api string) Client { - return Client{r: req.New(), api: api} + return Client{client.InitClient(api, middleware.SentryErrorHandler)} } -func (c Client) GetCoinInfo(coinId uint, token string) (watchmarket.Info, error) { +func (c Client) GetCoinInfo(coinId uint, token string) (info watchmarket.Info, err error) { coinObject, ok := coin.Coins[coinId] if !ok { - return watchmarket.Info{}, errors.New("coin not found " + "token " + token) + err = errors.New("coin not found " + "token " + token) + return } - var ( - path = c.api + fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) - result watchmarket.Info - ) - - resp, err := c.r.Get(path) - if err != nil { - return watchmarket.Info{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("Assets Get Coin Info: ", resp.Response().Status) - - return watchmarket.Info{}, err - } - return result, nil + path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) + err = c.Get(&info, path, nil) + return } func getPathForCoin(c coin.Coin, token string) string { diff --git a/services/assets/client_test.go b/services/assets/client_test.go index 2215fdf2..7fb0e0c8 100755 --- a/services/assets/client_test.go +++ b/services/assets/client_test.go @@ -17,12 +17,6 @@ var ( mockedInfoResponse, _ = mock.JsonStringFromFilePath("mocks/info_response.json") ) -func TestInit(t *testing.T) { - c := Init("url") - assert.NotNil(t, c) - assert.Equal(t, c.api, "url") -} - func TestClient_GetCoinInfo(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() diff --git a/services/markets/binancedex/base_test.go b/services/markets/binancedex/base_test.go index 6e66effa..3e5d1aca 100755 --- a/services/markets/binancedex/base_test.go +++ b/services/markets/binancedex/base_test.go @@ -2,15 +2,16 @@ package binancedex import ( "encoding/json" - "github.com/stretchr/testify/assert" "net/http" "testing" + + "github.com/stretchr/testify/assert" ) func TestInitProvider(t *testing.T) { provider := InitProvider("demo.api") assert.NotNil(t, provider) - assert.Equal(t, "demo.api", provider.client.baseURL) + assert.Equal(t, "demo.api", provider.client.BaseUrl) assert.Equal(t, "binancedex", provider.id) } diff --git a/services/markets/binancedex/client.go b/services/markets/binancedex/client.go index 89438ab5..92896afc 100755 --- a/services/markets/binancedex/client.go +++ b/services/markets/binancedex/client.go @@ -1,36 +1,21 @@ package binancedex import ( - "github.com/imroc/req" - log "github.com/sirupsen/logrus" + "net/url" + + "github.com/trustwallet/golibs/client" + "github.com/trustwallet/golibs/network/middleware" ) type Client struct { - baseURL string - r *req.Req + client.Request } func NewClient(api string) Client { - return Client{ - baseURL: api, - r: req.New(), - } + return Client{client.InitClient(api, middleware.SentryErrorHandler)} } -func (c Client) fetchPrices() ([]CoinPrice, error) { - resp, err := c.r.Get(c.baseURL+"/v1/ticker/24hr", req.Param{"limit": "1000"}) - if err != nil { - return nil, err - } - var result []CoinPrice - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("BinanceDEX Fetch Prices: ", resp.Response().Status) - return nil, err - } - return result, nil +func (c Client) fetchPrices() (result []CoinPrice, err error) { + err = c.Get(&result, "/v1/ticker/24hr", url.Values{"limit": {"1000"}}) + return } diff --git a/services/markets/binancedex/client_test.go b/services/markets/binancedex/client_test.go deleted file mode 100755 index 9ce72ae8..00000000 --- a/services/markets/binancedex/client_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package binancedex - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestNewClient(t *testing.T) { - client := NewClient("demo.api") - assert.NotNil(t, client) - assert.Equal(t, "demo.api", client.baseURL) -} diff --git a/services/markets/coingecko/base.go b/services/markets/coingecko/base.go index 3be2fa07..0bff3914 100755 --- a/services/markets/coingecko/base.go +++ b/services/markets/coingecko/base.go @@ -9,9 +9,10 @@ const ( ) type Provider struct { - id, currency string - client Client - info assets.Client + id string + currency string + client Client + info assets.Client } func InitProvider(api, currency string, info assets.Client) Provider { diff --git a/services/markets/coingecko/base_test.go b/services/markets/coingecko/base_test.go index ec5c2f68..51c97e9a 100755 --- a/services/markets/coingecko/base_test.go +++ b/services/markets/coingecko/base_test.go @@ -24,7 +24,7 @@ var ( func TestInitProvider(t *testing.T) { provider := InitProvider("web.api", "USD", assets.Init("assets.api")) assert.NotNil(t, provider) - assert.Equal(t, "web.api", provider.client.baseURL) + assert.Equal(t, "web.api", provider.client.client.BaseUrl) assert.Equal(t, "USD", provider.currency) assert.Equal(t, "coingecko", provider.id) } diff --git a/services/markets/coingecko/client.go b/services/markets/coingecko/client.go index 107aafb8..c9d12425 100755 --- a/services/markets/coingecko/client.go +++ b/services/markets/coingecko/client.go @@ -2,52 +2,41 @@ package coingecko import ( "fmt" + "net/http" "net/url" "strconv" "strings" "sync" "time" - "github.com/imroc/req" log "github.com/sirupsen/logrus" + "github.com/trustwallet/golibs/client" + "github.com/trustwallet/golibs/network/middleware" ) type Client struct { - baseURL string + client client.Request bucketSize int - r *req.Req } func NewClient(api string, bucketSize int) Client { - r := req.New() - c := Client{r: r, bucketSize: bucketSize, baseURL: api} - c.r.SetTimeout(time.Minute) + c := Client{client: client.InitClient(api, middleware.SentryErrorHandler), bucketSize: bucketSize} + c.client.HttpClient = &http.Client{ + Timeout: time.Minute, + } return c } -func (c Client) fetchCharts(id, currency string, timeStart, timeEnd int64) (Charts, error) { - var ( - result Charts - values = req.Param{ - "vs_currency": currency, - "from": strconv.FormatInt(timeStart, 10), - "to": strconv.FormatInt(timeEnd, 10), - } - ) - resp, err := c.r.Get(c.baseURL+fmt.Sprintf("/v3/coins/%s/market_chart/range", id), values) - if err != nil { - return Charts{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinGecko Fetch Charts: ", resp.Response().Status) - return Charts{}, err +func (c Client) fetchCharts(id, currency string, timeStart, timeEnd int64) (charts Charts, err error) { + + values := url.Values{ + "vs_currency": {currency}, + "from": {strconv.FormatInt(timeStart, 10)}, + "to": {strconv.FormatInt(timeEnd, 10)}, } - return result, nil + + err = c.client.Get(&charts, fmt.Sprintf("/v3/coins/%s/market_chart/range", id), values) + return } func (c Client) fetchRates(coins Coins, currency string) (prices CoinPrices) { @@ -93,42 +82,13 @@ func (c Client) fetchRates(coins Coins, currency string) (prices CoinPrices) { return } -func (c Client) fetchMarkets(ids, currency string) (CoinPrices, error) { - var ( - result CoinPrices - values = url.Values{"vs_currency": {currency}, "sparkline": {"false"}, "ids": {ids}} - ) - - resp, err := c.r.Get(c.baseURL+"/v3/coins/markets", values) - if err != nil { - return CoinPrices{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinGecko Markets: ", resp.Response().Status) - return CoinPrices{}, err - } - return result, nil +func (c Client) fetchMarkets(ids, currency string) (result CoinPrices, err error) { + values := url.Values{"vs_currency": {currency}, "sparkline": {"false"}, "ids": {ids}} + err = c.client.Get(&result, "/v3/coins/markets", values) + return } -func (c Client) fetchCoins() (Coins, error) { - var result Coins - resp, err := c.r.Get(c.baseURL+"/v3/coins/list", req.Param{"include_platform": "true"}) - if err != nil { - return Coins{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinGecko Fetch Coins: ", resp.Response().Status) - return Coins{}, err - } - return result, nil +func (c Client) fetchCoins() (result Coins, err error) { + err = c.client.Get(&result, "/v3/coins/list", url.Values{"include_platform": {"true"}}) + return } diff --git a/services/markets/coingecko/client_test.go b/services/markets/coingecko/client_test.go deleted file mode 100755 index 12ada220..00000000 --- a/services/markets/coingecko/client_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package coingecko - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestNewClient(t *testing.T) { - c := NewClient("api", 500) - assert.NotNil(t, c) - assert.Equal(t, "api", c.baseURL) - assert.Equal(t, 500, c.bucketSize) -} diff --git a/services/markets/coinmarketcap/base_test.go b/services/markets/coinmarketcap/base_test.go index 65c4f69a..51cf6e11 100755 --- a/services/markets/coinmarketcap/base_test.go +++ b/services/markets/coinmarketcap/base_test.go @@ -29,9 +29,9 @@ func TestInitProvider(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - assert.Equal(t, "pro.api", provider.client.proApiURL) - assert.Equal(t, "web.api", provider.client.webApiURL) - assert.Equal(t, "widget.api", provider.client.widgetApiURL) + assert.Equal(t, "pro.api", provider.client.proApi.BaseUrl) + assert.Equal(t, "web.api", provider.client.webApi.BaseUrl) + assert.Equal(t, "widget.api", provider.client.widgetApi.BaseUrl) assert.Equal(t, "USD", provider.currency) assert.Equal(t, "coinmarketcap", provider.id) assert.Less(t, 1, len(provider.Cm)) diff --git a/services/markets/coinmarketcap/client.go b/services/markets/coinmarketcap/client.go index 0919db0e..0080400f 100755 --- a/services/markets/coinmarketcap/client.go +++ b/services/markets/coinmarketcap/client.go @@ -1,94 +1,53 @@ package coinmarketcap import ( - "fmt" + "net/url" "strconv" - "github.com/imroc/req" - log "github.com/sirupsen/logrus" + "github.com/trustwallet/golibs/client" + "github.com/trustwallet/golibs/network/middleware" ) type Client struct { - proApiURL string - webApiURL string - widgetApiURL string - key string - r *req.Req + proApi client.Request + webApi client.Request + widgetApi client.Request } func NewClient(proApi, webApi, widgetApi, key string) Client { - return Client{ - r: req.New(), - proApiURL: proApi, - webApiURL: webApi, - widgetApiURL: widgetApi, - key: key, + c := Client{ + proApi: client.InitClient(proApi, middleware.SentryErrorHandler), + webApi: client.InitClient(webApi, middleware.SentryErrorHandler), + widgetApi: client.InitClient(widgetApi, middleware.SentryErrorHandler), } + c.proApi.AddHeader("X-CMC_PRO_API_KEY", key) + return c } -func (c Client) fetchPrices(currency string) (CoinPrices, error) { - var ( - result CoinPrices - path = c.proApiURL + "/v1/cryptocurrency/listings/latest" - header = req.Header{"X-CMC_PRO_API_KEY": c.key} - ) - - resp, err := c.r.Get(path, req.Param{"limit": "5000", "convert": currency}, header) - if err != nil { - return CoinPrices{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinMarketCap Fetch Prices: ", err) - return CoinPrices{}, err - } - return result, nil +func (c Client) fetchPrices(currency string) (result CoinPrices, err error) { + params := url.Values{"limit": {"5000"}, "convert": {currency}} + err = c.proApi.Get(&result, "/v1/cryptocurrency/listings/latest", params) + return } -func (c Client) fetchChartsData(id uint, currency string, timeStart int64, timeEnd int64, interval string) (Charts, error) { - values := req.Param{ - "convert": currency, - "format": "chart_crypto_details", - "id": strconv.FormatInt(int64(id), 10), - "time_start": strconv.FormatInt(timeStart, 10), - "time_end": strconv.FormatInt(timeEnd, 10), - "interval": interval, - } - var result Charts - resp, err := c.r.Get(c.webApiURL+"/v1/cryptocurrency/quotes/historical", values) - if err != nil { - return Charts{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinMarketCap Fetch Charts Data: ", err) - return Charts{}, err - } - return result, nil +func (c Client) fetchChartsData(id uint, currency string, timeStart int64, timeEnd int64, interval string) (result Charts, err error) { + values := url.Values{ + "convert": {currency}, + "format": {"chart_crypto_details"}, + "id": {strconv.FormatInt(int64(id), 10)}, + "time_start": {strconv.FormatInt(timeStart, 10)}, + "time_end": {strconv.FormatInt(timeEnd, 10)}, + "interval": {interval}, + } + err = c.webApi.Get(&result, "/v1/cryptocurrency/quotes/historical", values) + return } -func (c Client) fetchCoinData(id uint, currency string) (ChartInfo, error) { - var result ChartInfo - resp, err := c.r.Get(c.widgetApiURL + fmt.Sprintf("/v1/cryptocurrency/widget?id=%d&convert=%s", id, currency)) - if err != nil { - return ChartInfo{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("CoinMarketCap Fetch Coin Data: ", err) - return ChartInfo{}, err +func (c Client) fetchCoinData(id uint, currency string) (result ChartInfo, err error) { + values := url.Values{ + "id": {strconv.FormatInt(int64(id), 10)}, + "convert": {currency}, } - return result, nil + err = c.widgetApi.Get(&result, "/v1/cryptocurrency/widget", values) + return } diff --git a/services/markets/coinmarketcap/client_test.go b/services/markets/coinmarketcap/client_test.go deleted file mode 100755 index 3b84c715..00000000 --- a/services/markets/coinmarketcap/client_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package coinmarketcap - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestNewClient(t *testing.T) { - c := NewClient("pro.api", "web.api", "widget.api", "key") - assert.NotNil(t, c) - assert.Equal(t, "pro.api", c.proApiURL) - assert.Equal(t, "web.api", c.webApiURL) - assert.Equal(t, "widget.api", c.widgetApiURL) -} diff --git a/services/markets/fixer/base_test.go b/services/markets/fixer/base_test.go index 80876a3c..47019353 100755 --- a/services/markets/fixer/base_test.go +++ b/services/markets/fixer/base_test.go @@ -17,7 +17,7 @@ var ( func TestInitProvider(t *testing.T) { provider := InitProvider("demo.api", "key", "USD") assert.NotNil(t, provider) - assert.Equal(t, "demo.api", provider.client.api) + assert.Equal(t, "demo.api", provider.client.client.BaseUrl) assert.Equal(t, "key", provider.client.key) assert.Equal(t, "fixer", provider.id) assert.Equal(t, "USD", provider.currency) diff --git a/services/markets/fixer/client.go b/services/markets/fixer/client.go index 4f789702..ae357a36 100755 --- a/services/markets/fixer/client.go +++ b/services/markets/fixer/client.go @@ -1,36 +1,28 @@ package fixer import ( - "github.com/imroc/req" - log "github.com/sirupsen/logrus" + "net/url" + + "github.com/trustwallet/golibs/client" + "github.com/trustwallet/golibs/network/middleware" ) type Client struct { - key, currency, api string - r *req.Req + client client.Request + key string + currency string } func NewClient(api, key, currency string) Client { - return Client{r: req.New(), key: key, currency: currency, api: api} + return Client{ + client: client.InitClient(api, middleware.SentryErrorHandler), + key: key, + currency: currency, + } } -func (c Client) FetchRates() (Rate, error) { - var ( - values = req.Param{"access_key": c.key, "base": c.currency} // Base USD supported only in paid api} - result Rate - ) - resp, err := c.r.Get(c.api+"/latest", values) - if err != nil { - return Rate{}, err - } - err = resp.ToJSON(&result) - if err != nil { - log.WithFields(log.Fields{ - "url": resp.Request().URL.String(), - "status": resp.Response().Status, - "response": resp, - }).Error("Fixer Fetch Rates: ", resp.Response().Status) - return Rate{}, err - } - return result, nil +func (c Client) FetchRates() (rate Rate, err error) { + values := url.Values{"access_key": {c.key}, "base": {c.currency}} // Base USD supported only in paid api} + err = c.client.Get(&rate, "/latest", values) + return } diff --git a/services/markets/fixer/client_test.go b/services/markets/fixer/client_test.go deleted file mode 100755 index 317f1f63..00000000 --- a/services/markets/fixer/client_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package fixer - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestNewClient(t *testing.T) { - client := NewClient("demo.api", "key", "USD") - assert.NotNil(t, client) - assert.Equal(t, "demo.api", client.api) - assert.Equal(t, "key", client.key) - assert.Equal(t, "USD", client.currency) -} From 62689ae2c1d7a22ad420e0dfc8c4d53a4f3abeca Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Thu, 4 Feb 2021 00:15:03 +0800 Subject: [PATCH 14/96] add_ERC20+BEP20_HGET (#363) --- services/markets/coinmarketcap/mapping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f488e41e..72e5af56 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13780,6 +13780,18 @@ const Mapping = `[ "token_id": "0xfF20817765cB7f73d4bde2e66e067E58D11095C2", "id": 6945 }, + { + "coin": 60, + "type": "token", + "token_id": "0x7968bc6a03017eA2de509AAA816F163Db0f35148", + "id": 6949 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xC7d8D35EBA58a0935ff2D5a33Df105DD9f071731", + "id": 6949 + }, { "coin": 60, "type": "token", From b65095b9d674f2ff2c39b97e56699d70e0d0e144 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Wed, 3 Feb 2021 10:03:32 -0800 Subject: [PATCH 15/96] Consolidate usage of description into one field in coin info (#364) --- services/assets/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/assets/client.go b/services/assets/client.go index 22ae99e9..26133176 100755 --- a/services/assets/client.go +++ b/services/assets/client.go @@ -3,6 +3,7 @@ package assets import ( "errors" "fmt" + "time" "github.com/trustwallet/golibs/client" "github.com/trustwallet/golibs/coin" @@ -26,7 +27,9 @@ func (c Client) GetCoinInfo(coinId uint, token string) (info watchmarket.Info, e } path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) - err = c.Get(&info, path, nil) + err = c.GetWithCache(&info, path, nil, time.Hour*12) + //asset info file now only contains description field. + info.ShortDescription = info.Description return } From 8f18d954f96c8024898d53046a30c659fc05c24a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 3 Feb 2021 14:18:30 -0800 Subject: [PATCH 16/96] Bump github.com/trustwallet/golibs from 0.1.0 to 0.1.1 (#362) Bumps [github.com/trustwallet/golibs](https://github.com/trustwallet/golibs) from 0.1.0 to 0.1.1. - [Release notes](https://github.com/trustwallet/golibs/releases) - [Commits](https://github.com/trustwallet/golibs/compare/0.01...v0.1.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4a9a80e6..7890b69b 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/swag v1.6.7 - github.com/trustwallet/golibs v0.1.0 + github.com/trustwallet/golibs v0.1.1 github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect gorm.io/driver/postgres v1.0.8 diff --git a/go.sum b/go.sum index 6cd17763..fd79b428 100644 --- a/go.sum +++ b/go.sum @@ -560,6 +560,7 @@ github.com/trustwallet/golibs v0.0.35 h1:VqWInO5s4Zg6XyCmqro8/xrEViOedZ3oYtBq/kn github.com/trustwallet/golibs v0.0.35/go.mod h1:VI0APImKAYxvJ8MnMD6aHSKvnArXUd3NgNEghX5P+K8= github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgtQ6Y= github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= From 4ab82d63e0767377efb5a9fe62ebfe9722a4eafb Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 4 Feb 2021 10:42:22 +0700 Subject: [PATCH 17/96] Optimize codebase (#358) * Optimize codebase * Update tests * Update services/controllers/models.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Update services/controllers/models.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Update services/controllers/charts/base.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Apply Asset instead coinId, token * Update codebase * Clean codebase: remove controllers/charts/models.go * Merge Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> --- api/api_test.go | 2 +- api/endpoint/charts.go | 44 +++--- api/endpoint/info.go | 35 +++-- api/endpoint/tickers.go | 2 +- cmd/api/main.go | 2 +- go.sum | 1 + services/assets/client.go | 9 +- services/assets/client_test.go | 3 +- services/controllers/charts/base.go | 69 +++++---- services/controllers/charts/base_test.go | 16 ++- services/controllers/charts/models.go | 10 -- services/controllers/charts/normalization.go | 75 ---------- services/controllers/info/base.go | 134 ++++++++++++++---- services/controllers/info/base_test.go | 18 +-- services/controllers/info/models.go | 8 -- services/controllers/info/normalization.go | 127 ----------------- services/controllers/models.go | 60 +++++++- services/controllers/tickers/base_test.go | 4 +- services/controllers/tickers/normalization.go | 8 +- .../controllers/tickers/normalization_test.go | 14 +- services/controllers/tickers/tickers_test.go | 4 +- services/markets/coingecko/charts.go | 19 +-- services/markets/coingecko/charts_test.go | 5 +- services/markets/coinmarketcap/charts.go | 17 +-- services/markets/coinmarketcap/charts_test.go | 5 +- services/markets/markets.go | 5 +- 26 files changed, 326 insertions(+), 370 deletions(-) delete mode 100644 services/controllers/charts/models.go delete mode 100755 services/controllers/charts/normalization.go delete mode 100644 services/controllers/info/models.go delete mode 100644 services/controllers/info/normalization.go diff --git a/api/api_test.go b/api/api_test.go index 60026246..a38b18b4 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -72,7 +72,7 @@ func TestSetupTickersAPI(t *testing.T) { cr1 := controllers.TickerRequest{ Currency: "USD", - Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}}, + Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}}, } rawcr1, err := json.Marshal(&cr1) diff --git a/api/endpoint/charts.go b/api/endpoint/charts.go index 85214a74..faf86ef6 100644 --- a/api/endpoint/charts.go +++ b/api/endpoint/charts.go @@ -1,13 +1,11 @@ package endpoint import ( - "net/http" - "strconv" - "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/services/controllers" + "net/http" ) // @Summary Get charts data for a specific coin @@ -25,12 +23,20 @@ import ( // @Router /v1/market/charts [get] func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { + coinId, err := controllers.GetCoinId(c.Query("coin")) + if err != nil { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.ChartRequest{ - CoinQuery: c.Query("coin"), - Token: c.Query("token"), - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - TimeStartRaw: c.Query("time_start"), - MaxItems: c.Query("max_items"), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: c.Query("token"), + }, + Currency: controllers.GetCurrency(c.Query("currency")), + TimeStart: controllers.GetTimeStart(c.Query("time_start")), + MaxItems: controllers.GetMaxItems(c.Query("max_items")), } response, err := controller.HandleChartsRequest(request) @@ -58,19 +64,25 @@ func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Conte // @Router /v2/market/charts/{id} [get] func GetChartsHandlerV2(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { - coin, token, err := asset.ParseID(c.Param("id")) + coinId, tokenId, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - + if _, ok := coin.Coins[coinId]; !ok { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.ChartRequest{ - CoinQuery: strconv.Itoa(int(coin)), - Token: token, - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - TimeStartRaw: c.Query("time_start"), - MaxItems: c.Query("max_items"), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: tokenId, + }, + Currency: controllers.GetCurrency(c.Query("currency")), + TimeStart: controllers.GetTimeStart(c.Query("time_start")), + MaxItems: controllers.GetMaxItems(c.Query("max_items")), } response, err := controller.HandleChartsRequest(request) diff --git a/api/endpoint/info.go b/api/endpoint/info.go index 498d390a..db0522d1 100644 --- a/api/endpoint/info.go +++ b/api/endpoint/info.go @@ -1,13 +1,12 @@ package endpoint import ( - "net/http" - "strconv" - "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/controllers" + "net/http" ) // @Summary Get charts coin assets data for a specific coin @@ -23,10 +22,18 @@ import ( // @Router /v1/market/info [get] func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { + coinId, err := controllers.GetCoinId(c.Query("coin")) + if err != nil { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.DetailsRequest{ - CoinQuery: c.Query("coin"), - Token: c.Query("token"), - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: c.Query("token"), + }, + Currency: controllers.GetCurrency(c.Query("currency")), } response, err := controller.HandleInfoRequest(request) if err != nil { @@ -51,17 +58,23 @@ func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Conte // @Router /v2/market/info/{id} [get] func GetCoinInfoHandlerV2(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { - coin, token, err := asset.ParseID(c.Param("id")) + coinId, token, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - + if _, ok := coin.Coins[coinId]; !ok { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.DetailsRequest{ - CoinQuery: strconv.Itoa(int(coin)), - Token: token, - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: token, + }, + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), } response, err := controller.HandleInfoRequest(request) if err != nil { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index 4991cb3b..b499fcbf 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -135,7 +135,7 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { tickers := make(watchmarket.Tickers, 0, len(req.Assets)) for _, t := range req.Assets { tickers = append(tickers, watchmarket.Ticker{ - Coin: t.Coin, + Coin: t.CoinId, TokenId: t.TokenId, CoinType: t.CoinType, }) diff --git a/cmd/api/main.go b/cmd/api/main.go index a84fe3bd..3f9a0f5c 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -90,7 +90,7 @@ func init() { } charts = chartscontroller.NewController(redisCache, memoryCache, database, chartsPriority, m.ChartsAPIs, configuration) - info = infocontroller.NewController(database, memoryCache, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, m.ChartsAPIs, configuration) + info = infocontroller.NewController(database, memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) tickers = tickerscontroller.NewController(database, memoryCache, ratesPriority, tickerPriority, configuration) rates = ratescontroller.NewController(database, memoryCache, ratesPriority, configuration) } diff --git a/go.sum b/go.sum index fd79b428..de43b79a 100644 --- a/go.sum +++ b/go.sum @@ -560,6 +560,7 @@ github.com/trustwallet/golibs v0.0.35 h1:VqWInO5s4Zg6XyCmqro8/xrEViOedZ3oYtBq/kn github.com/trustwallet/golibs v0.0.35/go.mod h1:VI0APImKAYxvJ8MnMD6aHSKvnArXUd3NgNEghX5P+K8= github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgtQ6Y= github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs v0.1.1 h1:ZV5zbPbGD/dHcX3jnIcmdq24Llou230xYGHhK2WVvWQ= github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= diff --git a/services/assets/client.go b/services/assets/client.go index 26133176..d4d8e11a 100755 --- a/services/assets/client.go +++ b/services/assets/client.go @@ -3,6 +3,7 @@ package assets import ( "errors" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "time" "github.com/trustwallet/golibs/client" @@ -19,14 +20,14 @@ func Init(api string) Client { return Client{client.InitClient(api, middleware.SentryErrorHandler)} } -func (c Client) GetCoinInfo(coinId uint, token string) (info watchmarket.Info, err error) { - coinObject, ok := coin.Coins[coinId] +func (c Client) GetCoinInfo(asset controllers.Asset) (info watchmarket.Info, err error) { + coinObject, ok := coin.Coins[asset.CoinId] if !ok { - err = errors.New("coin not found " + "token " + token) + err = errors.New(fmt.Sprint("coin not found ", asset.CoinId, "; token ", asset.TokenId)) return } - path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) + path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, asset.TokenId)) err = c.GetWithCache(&info, path, nil, time.Hour*12) //asset info file now only contains description field. info.ShortDescription = info.Description diff --git a/services/assets/client_test.go b/services/assets/client_test.go index 7fb0e0c8..2f7920da 100755 --- a/services/assets/client_test.go +++ b/services/assets/client_test.go @@ -4,6 +4,7 @@ package assets import ( "encoding/json" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "net/http" "net/http/httptest" "testing" @@ -24,7 +25,7 @@ func TestClient_GetCoinInfo(t *testing.T) { c := Init(server.URL) assert.NotNil(t, c) - data, err := c.GetCoinInfo(60, "") + data, err := c.GetCoinInfo(controllers.Asset{CoinId: 60}) assert.Nil(t, err) rawData, err := json.Marshal(data) diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index cd6e932e..b60f30b9 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -17,6 +17,8 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) +const charts = "charts" + type Controller struct { redisCache cache.Provider memoryCache cache.Provider @@ -45,22 +47,18 @@ func NewController( } // ChartsController interface implementation -func (c Controller) HandleChartsRequest(cr controllers.ChartRequest) (ch watchmarket.Chart, err error) { - chartRequest, err := normalizeRequest(cr) - if err != nil { - return ch, errors.New(watchmarket.ErrBadRequest) - } +func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart watchmarket.Chart, err error) { - if !c.hasTickers(chartRequest.Coin, chartRequest.Token) { - return ch, nil + if !c.hasTickers(request.Asset) { + return chart, nil } - ch, err = c.getChartFromRedis(chartRequest) - if err == nil && len(ch.Prices) > 0 { - return ch, nil + chart, err = c.getChartFromRedis(request) + if err == nil && len(chart.Prices) > 0 { + return chart, nil } - rawChart, err := c.getChartsFromApi(chartRequest) + rawChart, err := c.getChartsFromApi(request) if err != nil { return watchmarket.Chart{}, errors.New(watchmarket.ErrInternal) } @@ -69,21 +67,21 @@ func (c Controller) HandleChartsRequest(cr controllers.ChartRequest) (ch watchma return watchmarket.Chart{}, errors.New(watchmarket.ErrNotFound) } - chart := normalizeChart(rawChart, chartRequest.MaxItems) - c.putChartsToRedis(chart, chartRequest) + chart = calculateChartByMaxItems(rawChart, request.MaxItems) + c.putChartsToRedis(chart, request) return chart, nil } -func (c Controller) hasTickers(coin uint, token string) bool { +func (c Controller) hasTickers(assetData controllers.Asset) bool { var tickers []models.Ticker var err error if c.useMemoryCache { - if tickers, err = c.getChartsFromMemory(coin, token); err != nil { + if tickers, err = c.getChartsFromMemory(assetData); err != nil { return false } } else { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: coin, TokenId: strings.ToLower(token)}}) + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) if err != nil { return false } @@ -96,21 +94,21 @@ func (c Controller) hasTickers(coin uint, token string) bool { return len(tickers) > 0 } -func (c Controller) getChartsFromApi(data chartsNormalizedRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartsFromApi(data controllers.ChartRequest) (ch watchmarket.Chart, err error) { for _, p := range c.availableProviders { - price, err := c.api[p].GetChartData(data.Coin, data.Token, data.Currency, data.TimeStart) - if len(price.Prices) > 0 && err == nil { + price, err := c.api[p].GetChartData(data.Asset, data.Currency, data.TimeStart) + if err == nil && len(price.Prices) > 0 { return price, nil } } return watchmarket.Chart{}, nil } -func (c Controller) getRedisKey(request chartsNormalizedRequest) string { - return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Coin, request.Token, request.Currency, request.MaxItems)) +func (c Controller) getRedisKey(request controllers.ChartRequest) string { + return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Asset.CoinId, request.Asset.TokenId, request.Currency, request.MaxItems)) } -func (c Controller) getChartFromRedis(request chartsNormalizedRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartFromRedis(request controllers.ChartRequest) (ch watchmarket.Chart, err error) { key := c.getRedisKey(request) cachedChartRaw, err := c.redisCache.GetWithTime(key, request.TimeStart) if err != nil || len(cachedChartRaw) <= 0 { @@ -120,7 +118,7 @@ func (c Controller) getChartFromRedis(request chartsNormalizedRequest) (ch watch return ch, err } -func (c Controller) putChartsToRedis(chart watchmarket.Chart, request chartsNormalizedRequest) { +func (c Controller) putChartsToRedis(chart watchmarket.Chart, request controllers.ChartRequest) { key := c.getRedisKey(request) chartRaw, err := json.Marshal(&chart) if err != nil { @@ -135,8 +133,8 @@ func (c Controller) putChartsToRedis(chart watchmarket.Chart, request chartsNorm } } -func (c Controller) getChartsFromMemory(coin uint, token string) ([]models.Ticker, error) { - key := strings.ToLower(asset.BuildID(coin, token)) +func (c Controller) getChartsFromMemory(assetData controllers.Asset) ([]models.Ticker, error) { + key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) rawResult, err := c.memoryCache.Get(key) if err != nil { return nil, err @@ -158,3 +156,24 @@ func (c Controller) getChartsFromMemory(coin uint, token string) ([]models.Ticke } return []models.Ticker{result}, nil } + +func calculateChartByMaxItems(chart watchmarket.Chart, maxItems int) watchmarket.Chart { + var newPrices []watchmarket.ChartPrice + if len(chart.Prices) > maxItems && maxItems > 0 { + skip := int(float64(len(chart.Prices) / maxItems)) + i := 0 + for i < len(chart.Prices) { + newPrices = append(newPrices, chart.Prices[i]) + i += skip + 1 + } + lastPrice := chart.Prices[len(chart.Prices)-1] + if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { + newPrices = append(newPrices, lastPrice) + } + } else { + newPrices = chart.Prices + } + + chart.Prices = newPrices + return chart +} diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index d98f67bf..a368ef77 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -91,11 +91,13 @@ func TestController_HandleChartsRequest(t *testing.T) { assert.NotNil(t, c) chart, err := c.HandleChartsRequest(controllers.ChartRequest{ - CoinQuery: "60", - Token: "a", - Currency: "USD", - TimeStartRaw: "1577871126", - MaxItems: "64", + Asset: controllers.Asset{ + CoinId: 60, + TokenId: "a", + }, + Currency: "USD", + TimeStart: 1577871126, + MaxItems: 64, }) assert.Nil(t, err) @@ -212,11 +214,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/charts/models.go b/services/controllers/charts/models.go deleted file mode 100644 index c412571c..00000000 --- a/services/controllers/charts/models.go +++ /dev/null @@ -1,10 +0,0 @@ -package chartscontroller - -type ( - chartsNormalizedRequest struct { - Coin uint - Token, Currency string - TimeStart int64 - MaxItems int - } -) diff --git a/services/controllers/charts/normalization.go b/services/controllers/charts/normalization.go deleted file mode 100755 index 027a81dc..00000000 --- a/services/controllers/charts/normalization.go +++ /dev/null @@ -1,75 +0,0 @@ -package chartscontroller - -import ( - "errors" - "strconv" - "time" - - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -const charts = "charts" - -func normalizeRequest(cr controllers.ChartRequest) (chartsNormalizedRequest, error) { - if len(cr.CoinQuery) == 0 { - return chartsNormalizedRequest{}, errors.New("invalid arguments length") - } - - coinId, err := strconv.Atoi(cr.CoinQuery) - if err != nil { - return chartsNormalizedRequest{}, err - } - - if _, ok := coin.Coins[uint(coinId)]; !ok { - return chartsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) - } - var timeStart int64 - if cr.TimeStartRaw == "" { - timeStart = time.Now().Unix() - 60*60*24 - } else { - timeStart, err = strconv.ParseInt(cr.TimeStartRaw, 10, 64) - if err != nil { - return chartsNormalizedRequest{}, err - } - } - maxItems, err := strconv.Atoi(cr.MaxItems) - if err != nil || maxItems <= 0 { - maxItems = watchmarket.DefaultMaxChartItems - } - - currency := watchmarket.DefaultCurrency - if cr.Currency != "" { - currency = cr.Currency - } - - return chartsNormalizedRequest{ - Coin: uint(coinId), - Token: cr.Token, - Currency: currency, - TimeStart: timeStart, - MaxItems: maxItems, - }, nil -} - -func normalizeChart(chart watchmarket.Chart, maxItems int) watchmarket.Chart { - var newPrices []watchmarket.ChartPrice - if len(chart.Prices) > maxItems && maxItems > 0 { - skip := int(float64(len(chart.Prices) / maxItems)) - i := 0 - for i < len(chart.Prices) { - newPrices = append(newPrices, chart.Prices[i]) - i += skip + 1 - } - lastPrice := chart.Prices[len(chart.Prices)-1] - if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { - newPrices = append(newPrices, lastPrice) - } - } else { - newPrices = chart.Prices - } - - chart.Prices = newPrices - return chart -} diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index abadfb61..5dc201c3 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -3,9 +3,10 @@ package infocontroller import ( "encoding/json" "errors" + "fmt" + "github.com/trustwallet/watchmarket/db/models" log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" @@ -13,73 +14,148 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) +const info = "info" + type Controller struct { database db.Instance cache cache.Provider - chartsPriority []string coinInfoPriority []string ratesPriority []string - tickersPriority []string api markets.ChartsAPIs - configuration config.Configuration } func NewController( database db.Instance, cache cache.Provider, - chartsPriority, coinInfoPriority, ratesPriority, tickersPriority []string, + coinInfoPriority []string, + ratesPriority []string, api markets.ChartsAPIs, - configuration config.Configuration, ) Controller { return Controller{ database, cache, - chartsPriority, coinInfoPriority, ratesPriority, - tickersPriority, api, - configuration, } } -func (c Controller) HandleInfoRequest(dr controllers.DetailsRequest) (controllers.InfoResponse, error) { - var cd controllers.InfoResponse +func (c Controller) HandleInfoRequest(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + result, err := c.getFromCache(request) + if err == nil { + return result, nil + } - req, err := toDetailsRequestData(dr) + result, err = c.getDetailsByPriority(request) if err != nil { - return cd, errors.New(watchmarket.ErrBadRequest) + return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) } - key := c.cache.GenerateKey(info + dr.CoinQuery + dr.Token + dr.Currency) + if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { + result.Info = nil + } - cachedDetails, err := c.cache.Get(key) - if err == nil && len(cachedDetails) > 0 { - if json.Unmarshal(cachedDetails, &cd) == nil { - return cd, nil - } + c.putToCache(request, result) + + return result, nil +} + +func (c Controller) putToCache(request controllers.DetailsRequest, result controllers.InfoResponse) { + if result.Info == nil { + return + } + key := c.getCacheKey(request) + newCache, err := json.Marshal(result) + if err != nil { + return } - result, err := c.getDetailsByPriority(req) + err = c.cache.Set(key, newCache) if err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) + log.Error("failed to save cache") } +} - if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { - result.Info = nil +func (c Controller) getCacheKey(request controllers.DetailsRequest) string { + return c.cache.GenerateKey(fmt.Sprintf("%s%d%s%s", info, request.Asset.CoinId, request.Asset.TokenId, request.Currency)) +} + +func (c Controller) getFromCache(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + key := c.getCacheKey(request) + + cachedDetails, err := c.cache.Get(key) + if err != nil || len(cachedDetails) <= 0 { + return controllers.InfoResponse{}, errors.New("cache is empty") } + var infoResponse controllers.InfoResponse + err = json.Unmarshal(cachedDetails, &infoResponse) + return infoResponse, err +} - newCache, err := json.Marshal(result) +func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: request.Asset.TokenId}}) + + if err != nil || len(dbTickers) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) + } + + ticker, err := c.getTickerDataAccordingToPriority(dbTickers) if err != nil { - log.Error(err) + return controllers.InfoResponse{}, err } + result := c.getCoinDataFromApi(request.Asset, request.Currency) + result.CirculatingSupply = ticker.CirculatingSupply + result.MarketCap = ticker.MarketCap + result.Vol24 = ticker.Volume + result.TotalSupply = ticker.TotalSupply - if result.Info != nil { - err = c.cache.Set(key, newCache) + if request.Currency != watchmarket.DefaultCurrency { + rates, err := c.database.GetRates(request.Currency) + if err != nil || len(rates) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("empty db rate or db error: %w", err) + } + rate, err := c.getRateDataAccordingToPriority(rates) if err != nil { - log.WithFields(log.Fields{"err": err}).Error("failed to save cache") + return controllers.InfoResponse{}, err } + result.MarketCap *= 1 / rate + result.Vol24 *= 1 / rate } - return result, nil } + +func (c Controller) getCoinDataFromApi(assetData controllers.Asset, currency string) controllers.InfoResponse { + var result controllers.InfoResponse + + for _, p := range c.coinInfoPriority { + if data, err := c.api[p].GetCoinData(assetData, currency); err == nil { + result.Info = data.Info + result.Provider = data.Provider + result.ProviderURL = data.ProviderURL + break + } + } + return result +} + +func (c Controller) getTickerDataAccordingToPriority(tickers []models.Ticker) (models.Ticker, error) { + for _, p := range c.coinInfoPriority { + for _, t := range tickers { + if t.Provider == p && t.ShowOption != models.NeverShow { + return t, nil + } + } + } + return models.Ticker{}, errors.New("bad ticker or providers") +} + +func (c Controller) getRateDataAccordingToPriority(rates []models.Rate) (float64, error) { + for _, p := range c.ratesPriority { + for _, r := range rates { + if r.Provider == p && r.ShowOption != models.NeverShow { + return r.Rate, nil + } + } + } + return 0, errors.New("bad ticker or providers") +} diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 9823aa3a..44ee07c2 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -32,13 +32,15 @@ func TestController_HandleDetailsRequest(t *testing.T) { db := getDbMock() db.WantedTickers = []models.Ticker{{CirculatingSupply: 1, TotalSupply: 1, MarketCap: 1, Volume: 1, Provider: "coinmarketcap"}} - db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "fixer"}} + db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "coinmarketcap"}} c := setupController(t, db, getCacheMock(), cm) assert.NotNil(t, c) details, err := c.HandleInfoRequest(controllers.DetailsRequest{ - CoinQuery: "0", - Token: "2", - Currency: "RUB", + Asset: controllers.Asset{ + CoinId: 0, + TokenId: "2", + }, + Currency: "RUB", }) assert.Nil(t, err) assert.Equal(t, controllers.InfoResponse{ @@ -60,15 +62,13 @@ func setupController(t *testing.T, db dbMock, ch cache.Provider, cm chartsMock) c, _ := config.Init("../../../config.yml") assert.NotNil(t, c) - chartsPriority := []string{"coinmarketcap"} ratesPriority := []string{"coinmarketcap"} - tickerPriority := []string{"coinmarketcap"} coinInfoPriority := []string{"coinmarketcap"} chartsAPIs := make(markets.ChartsAPIs, 1) chartsAPIs[cm.GetProvider()] = cm - controller := NewController(db, ch, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, chartsAPIs, c) + controller := NewController(db, ch, coinInfoPriority, ratesPriority, chartsAPIs) assert.NotNil(t, controller) return controller @@ -120,11 +120,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/info/models.go b/services/controllers/info/models.go deleted file mode 100644 index b92573b1..00000000 --- a/services/controllers/info/models.go +++ /dev/null @@ -1,8 +0,0 @@ -package infocontroller - -type tickerData struct { - Vol24 float64 - MarketCap float64 - CirculatingSupply float64 - TotalSupply float64 -} diff --git a/services/controllers/info/normalization.go b/services/controllers/info/normalization.go deleted file mode 100644 index b577c68b..00000000 --- a/services/controllers/info/normalization.go +++ /dev/null @@ -1,127 +0,0 @@ -package infocontroller - -import ( - "errors" - "strconv" - "strings" - - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -type ( - detailsNormalizedRequest struct { - Coin uint - Token, Currency string - } -) - -const info = "info" - -func toDetailsRequestData(dr controllers.DetailsRequest) (detailsNormalizedRequest, error) { - if len(dr.CoinQuery) == 0 { - return detailsNormalizedRequest{}, errors.New("invalid arguments length") - } - - coinId, err := strconv.Atoi(dr.CoinQuery) - if err != nil { - return detailsNormalizedRequest{}, err - } - - if _, ok := coin.Coins[uint(coinId)]; !ok { - return detailsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) - } - - currency := watchmarket.DefaultCurrency - if dr.Currency != "" { - currency = dr.Currency - } - - return detailsNormalizedRequest{ - Coin: uint(coinId), - Token: dr.Token, - Currency: currency, - }, nil -} - -func (c Controller) getDetailsByPriority(data detailsNormalizedRequest) (controllers.InfoResponse, error) { - availableTickerProviders := c.coinInfoPriority - availableRateProviders := c.configuration.Markets.Priority.Rates - - var ( - result controllers.InfoResponse - details watchmarket.CoinDetails - ) - for _, p := range availableTickerProviders { - data, err := c.api[p].GetCoinData(data.Coin, data.Token, data.Currency) - if err == nil { - details = data - break - } - } - result.Info = details.Info - result.Provider = details.Provider - result.ProviderURL = details.ProviderURL - - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: data.Coin, TokenId: strings.ToLower(data.Token)}}) - if err != nil { - return controllers.InfoResponse{}, err - } - if len(dbTickers) == 0 { - return controllers.InfoResponse{}, errors.New("empty db ticker") - } - tickerData, err := getTickerDataAccordingToPriority(availableTickerProviders, dbTickers) - if err != nil { - return controllers.InfoResponse{}, err - } - result.CirculatingSupply = tickerData.CirculatingSupply - result.MarketCap = tickerData.MarketCap - result.Vol24 = tickerData.Vol24 - result.TotalSupply = tickerData.TotalSupply - - if data.Currency != watchmarket.DefaultCurrency { - rates, err := c.database.GetRates(data.Currency) - if err != nil { - return controllers.InfoResponse{}, err - } - if len(rates) == 0 { - return controllers.InfoResponse{}, errors.New("empty db rate") - } - rate, err := getRateDataAccordingToPriority(availableRateProviders, rates) - if err != nil { - return controllers.InfoResponse{}, err - } - result.MarketCap *= 1 / rate - result.Vol24 *= 1 / rate - } - return result, nil -} - -func getTickerDataAccordingToPriority(availableProviders []string, tickers []models.Ticker) (tickerData, error) { - for _, p := range availableProviders { - for _, t := range tickers { - if t.Provider == p && t.ShowOption != models.NeverShow { - return tickerData{ - Vol24: t.Volume, - MarketCap: t.MarketCap, - CirculatingSupply: t.CirculatingSupply, - TotalSupply: t.TotalSupply, - }, nil - } - } - } - return tickerData{}, errors.New("bad ticker or providers") -} - -func getRateDataAccordingToPriority(availableProviders []string, rates []models.Rate) (float64, error) { - for _, p := range availableProviders { - for _, r := range rates { - if r.Provider == p && r.ShowOption != models.NeverShow { - return r.Rate, nil - } - } - } - return 0, errors.New("bad ticker or providers") -} diff --git a/services/controllers/models.go b/services/controllers/models.go index 6a827d88..ba54034b 100644 --- a/services/controllers/models.go +++ b/services/controllers/models.go @@ -1,11 +1,18 @@ package controllers -import "github.com/trustwallet/watchmarket/pkg/watchmarket" +import ( + "fmt" + "github.com/pkg/errors" + "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "strconv" + "time" +) type ( TickerRequest struct { - Currency string `json:"Currency"` - Assets []Coin `json:"assets"` + Currency string `json:"Currency"` + Assets []Asset `json:"assets"` } TickerRequestV2 struct { @@ -13,8 +20,8 @@ type ( Ids []string `json:"assets"` } - Coin struct { - Coin uint `json:"Coin"` + Asset struct { + CoinId uint `json:"Coin"` CoinType watchmarket.CoinType `json:"type"` TokenId string `json:"token_id,omitempty"` } @@ -47,11 +54,15 @@ type ( } ChartRequest struct { - CoinQuery, Token, Currency, TimeStartRaw, MaxItems string + Asset Asset + Currency string + TimeStart int64 + MaxItems int } DetailsRequest struct { - CoinQuery, Token, Currency string + Asset Asset + Currency string } InfoResponse struct { @@ -64,3 +75,38 @@ type ( Info *watchmarket.Info `json:"info,omitempty"` } ) + +func GetCoinId(rawCoinId string) (uint, error) { + coinId, err := strconv.Atoi(rawCoinId) + if err != nil { + return 0, err + } + if _, ok := coin.Coins[uint(coinId)]; !ok { + return 0, errors.New(fmt.Sprintf("invalid coin Id: %d", coinId)) + } + return uint(coinId), nil +} + +func GetCurrency(rawCurrency string) string { + currency := rawCurrency + if currency == "" { + currency = watchmarket.DefaultCurrency + } + return currency +} + +func GetTimeStart(rawTime string) int64 { + timeStart, err := strconv.ParseInt(rawTime, 10, 64) + if err != nil { + timeStart = time.Now().Unix() - int64(time.Hour)*24 + } + return timeStart +} + +func GetMaxItems(rawMax string) int { + maxItems, err := strconv.Atoi(rawMax) + if err != nil || maxItems <= 0 { + maxItems = watchmarket.DefaultMaxChartItems + } + return maxItems +} diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index 6368700c..afe7ed33 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -93,7 +93,7 @@ func TestController_HandleTickersRequest(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) + response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) wantedTicker1 := watchmarket.Ticker{ @@ -158,7 +158,7 @@ func TestController_HandleTickersRequest(t *testing.T) { err = controllerWithCache.cache.Set("USD", rateRaw) assert.Nil(t, err) - response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) + response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) sort.Slice(response2.Tickers, func(i, j int) bool { diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go index cf20a744..9b9b11f6 100644 --- a/services/controllers/tickers/normalization.go +++ b/services/controllers/tickers/normalization.go @@ -46,11 +46,11 @@ func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Ticker return result } -func makeTickerQueries(coins []controllers.Coin) []models.TickerQuery { +func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { tickerQueries := make([]models.TickerQuery, 0, len(coins)) for _, c := range coins { tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: c.Coin, + Coin: c.CoinId, TokenId: strings.ToLower(c.TokenId), }) } @@ -105,9 +105,9 @@ func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bo return id, false } -func findTickerInAssets(assets []controllers.Coin, t watchmarket.Ticker) (watchmarket.Ticker, bool) { +func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { for _, c := range assets { - if c.Coin == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { + if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { t.TokenId = c.TokenId return t, true } diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go index 010bcaec..8c579226 100644 --- a/services/controllers/tickers/normalization_test.go +++ b/services/controllers/tickers/normalization_test.go @@ -32,7 +32,7 @@ func TestController_createResponse(t *testing.T) { tr := controllers.TickerRequest{ Currency: "EUR", - Assets: []controllers.Coin{{Coin: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, + Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, } response := createResponse(tr, watchmarket.Tickers{ticker}) @@ -273,7 +273,7 @@ func TestController_normalizeTickers_advanced(t *testing.T) { } func Test_findBestProviderForQuery(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -311,7 +311,7 @@ func Test_findBestProviderForQuery(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -320,7 +320,7 @@ func Test_findBestProviderForQuery(t *testing.T) { } func Test_findBestProviderForQuery_advanced(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -359,7 +359,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -368,7 +368,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { } func Test_findBestProviderForQuery_showOption(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -407,7 +407,7 @@ func Test_findBestProviderForQuery_showOption(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index 71d8fe8f..e50b4a13 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -58,7 +58,7 @@ func TestController_getTickersByPriority(t *testing.T) { assert.NotNil(t, c) tickers, err := c.getTickersByPriority(makeTickerQueries( - []controllers.Coin{{Coin: 60, TokenId: "A"}, {Coin: 714, TokenId: "A"}}, + []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, )) assert.Nil(t, err) assert.NotNil(t, tickers) @@ -98,7 +98,7 @@ func TestController_getTickersByPriority(t *testing.T) { db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Coin{{Coin: 60, TokenId: "A"}})) + tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/markets/coingecko/charts.go b/services/markets/coingecko/charts.go index 3c2e14ce..1d2414b2 100755 --- a/services/markets/coingecko/charts.go +++ b/services/markets/coingecko/charts.go @@ -2,6 +2,7 @@ package coingecko import ( "errors" + "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -13,7 +14,7 @@ import ( "github.com/trustwallet/watchmarket/pkg/watchmarket" ) -func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coins, err := p.client.fetchCoins() @@ -23,7 +24,7 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, coinID, token) + coinResult, err := getCoinByID(symbolsMap, asset) if err != nil { return chartsData, err } @@ -38,7 +39,7 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in return normalizeCharts(c), nil } -func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { coins, err := p.client.fetchCoins() if err != nil { return watchmarket.CoinDetails{}, err @@ -46,7 +47,7 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, coinID, token) + coinResult, err := getCoinByID(symbolsMap, asset) if err != nil { return watchmarket.CoinDetails{}, err } @@ -56,9 +57,9 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. return watchmarket.CoinDetails{}, errors.New("no rates found") } - infoData, err := p.info.GetCoinInfo(coinID, token) + infoData, err := p.info.GetCoinInfo(asset) if err != nil { - log.WithFields(log.Fields{"coin": coinID, "token": token}).Warn("No assets assets about that coin") + log.WithFields(log.Fields{"coin": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coin") } return watchmarket.CoinDetails{ Info: &infoData, @@ -107,14 +108,14 @@ func createID(symbol, token string) string { return strings.ToLower(symbol) } -func getCoinByID(coinMap map[string]Coin, coinId uint, token string) (Coin, error) { +func getCoinByID(coinMap map[string]Coin, asset controllers.Asset) (Coin, error) { c := Coin{} - coinObj, ok := coin.Coins[coinId] + coinObj, ok := coin.Coins[asset.CoinId] if !ok { return c, errors.New("coin not found") } - c, ok = coinMap[createID(coinObj.Symbol, token)] + c, ok = coinMap[createID(coinObj.Symbol, asset.TokenId)] if !ok { return c, errors.New("no coin found by symbol") } diff --git a/services/markets/coingecko/charts_test.go b/services/markets/coingecko/charts_test.go index cea70471..f6adcdf9 100755 --- a/services/markets/coingecko/charts_test.go +++ b/services/markets/coingecko/charts_test.go @@ -2,6 +2,7 @@ package coingecko import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "sort" "testing" @@ -14,7 +15,7 @@ func TestProvider_GetCoinData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init(server.URL)) - data, _ := provider.GetCoinData(60, "", "USD") + data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedInfo, string(rawData)) @@ -24,7 +25,7 @@ func TestProvider_GetChartData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) - data, _ := provider.GetChartData(60, "", "USD", 1577871126) + data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/coinmarketcap/charts.go b/services/markets/coinmarketcap/charts.go index 10144c19..6022354f 100755 --- a/services/markets/coinmarketcap/charts.go +++ b/services/markets/coinmarketcap/charts.go @@ -3,6 +3,7 @@ package coinmarketcap import ( "errors" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -15,10 +16,10 @@ const ( chartDataSize = 3 ) -func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) + coinObj, err := coinsFromCmcMap.getCoinByContract(asset) if err != nil { return chartsData, err } @@ -35,10 +36,10 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in return normalizeCharts(currency, c), nil } -func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { details := watchmarket.CoinDetails{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) + coinObj, err := coinsFromCmcMap.getCoinByContract(asset) if err != nil { return details, err } @@ -46,9 +47,9 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. if err != nil { return details, err } - assetsData, err := p.info.GetCoinInfo(coinID, token) + assetsData, err := p.info.GetCoinInfo(asset) if err != nil { - log.WithFields(log.Fields{"coinID": coinID, "token": token}).Warn("No assets assets about that coinID") + log.WithFields(log.Fields{"coinID": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coinID") } return normalizeInfo(priceData, &assetsData) @@ -102,8 +103,8 @@ func (c CmcSlice) coinToCmcMap() (m CoinMapping) { return } -func (cm CoinMapping) getCoinByContract(coinId uint, contract string) (c CoinMap, err error) { - c, ok := cm[createID(coinId, contract)] +func (cm CoinMapping) getCoinByContract(asset controllers.Asset) (c CoinMap, err error) { + c, ok := cm[createID(asset.CoinId, asset.TokenId)] if !ok { err = errors.New("No coin found") } diff --git a/services/markets/coinmarketcap/charts_test.go b/services/markets/coinmarketcap/charts_test.go index 9e7ccd3f..b08ed802 100755 --- a/services/markets/coinmarketcap/charts_test.go +++ b/services/markets/coinmarketcap/charts_test.go @@ -2,6 +2,7 @@ package coinmarketcap import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "reflect" "sort" @@ -20,7 +21,7 @@ func TestProvider_GetCoinData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetCoinData(60, "", "USD") + data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedCoinInfo, string(rawData)) @@ -33,7 +34,7 @@ func TestProvider_GetChartData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetChartData(60, "", "USD", 1577871126) + data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/markets.go b/services/markets/markets.go index 9382ef21..6283d3fd 100755 --- a/services/markets/markets.go +++ b/services/markets/markets.go @@ -4,6 +4,7 @@ import ( "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" + "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/services/markets/binancedex" "github.com/trustwallet/watchmarket/services/markets/coingecko" "github.com/trustwallet/watchmarket/services/markets/coinmarketcap" @@ -27,8 +28,8 @@ type ( ChartsAPI interface { Provider - GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) - GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) + GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) + GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) } Providers map[string]Provider From 61fec65ff0c2861d10c44a239337b0009d5a8a64 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 4 Feb 2021 11:17:11 +0700 Subject: [PATCH 18/96] Revert "Optimize codebase (#358)" (#365) This reverts commit 4ab82d63e0767377efb5a9fe62ebfe9722a4eafb. --- api/api_test.go | 2 +- api/endpoint/charts.go | 44 +++--- api/endpoint/info.go | 35 ++--- api/endpoint/tickers.go | 2 +- cmd/api/main.go | 2 +- go.sum | 1 - services/assets/client.go | 9 +- services/assets/client_test.go | 3 +- services/controllers/charts/base.go | 69 ++++----- services/controllers/charts/base_test.go | 16 +-- services/controllers/charts/models.go | 10 ++ services/controllers/charts/normalization.go | 75 ++++++++++ services/controllers/info/base.go | 134 ++++-------------- services/controllers/info/base_test.go | 18 +-- services/controllers/info/models.go | 8 ++ services/controllers/info/normalization.go | 127 +++++++++++++++++ services/controllers/models.go | 60 +------- services/controllers/tickers/base_test.go | 4 +- services/controllers/tickers/normalization.go | 8 +- .../controllers/tickers/normalization_test.go | 14 +- services/controllers/tickers/tickers_test.go | 4 +- services/markets/coingecko/charts.go | 19 ++- services/markets/coingecko/charts_test.go | 5 +- services/markets/coinmarketcap/charts.go | 17 ++- services/markets/coinmarketcap/charts_test.go | 5 +- services/markets/markets.go | 5 +- 26 files changed, 370 insertions(+), 326 deletions(-) create mode 100644 services/controllers/charts/models.go create mode 100755 services/controllers/charts/normalization.go create mode 100644 services/controllers/info/models.go create mode 100644 services/controllers/info/normalization.go diff --git a/api/api_test.go b/api/api_test.go index a38b18b4..60026246 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -72,7 +72,7 @@ func TestSetupTickersAPI(t *testing.T) { cr1 := controllers.TickerRequest{ Currency: "USD", - Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}}, + Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}}, } rawcr1, err := json.Marshal(&cr1) diff --git a/api/endpoint/charts.go b/api/endpoint/charts.go index faf86ef6..85214a74 100644 --- a/api/endpoint/charts.go +++ b/api/endpoint/charts.go @@ -1,11 +1,13 @@ package endpoint import ( + "net/http" + "strconv" + "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/controllers" - "net/http" ) // @Summary Get charts data for a specific coin @@ -23,20 +25,12 @@ import ( // @Router /v1/market/charts [get] func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { - coinId, err := controllers.GetCoinId(c.Query("coin")) - if err != nil { - code, response := createErrorResponseAndStatusCode(err) - c.AbortWithStatusJSON(code, response) - return - } request := controllers.ChartRequest{ - Asset: controllers.Asset{ - CoinId: coinId, - TokenId: c.Query("token"), - }, - Currency: controllers.GetCurrency(c.Query("currency")), - TimeStart: controllers.GetTimeStart(c.Query("time_start")), - MaxItems: controllers.GetMaxItems(c.Query("max_items")), + CoinQuery: c.Query("coin"), + Token: c.Query("token"), + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + TimeStartRaw: c.Query("time_start"), + MaxItems: c.Query("max_items"), } response, err := controller.HandleChartsRequest(request) @@ -64,25 +58,19 @@ func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Conte // @Router /v2/market/charts/{id} [get] func GetChartsHandlerV2(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { - coinId, tokenId, err := asset.ParseID(c.Param("id")) + coin, token, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - if _, ok := coin.Coins[coinId]; !ok { - code, response := createErrorResponseAndStatusCode(err) - c.AbortWithStatusJSON(code, response) - return - } + request := controllers.ChartRequest{ - Asset: controllers.Asset{ - CoinId: coinId, - TokenId: tokenId, - }, - Currency: controllers.GetCurrency(c.Query("currency")), - TimeStart: controllers.GetTimeStart(c.Query("time_start")), - MaxItems: controllers.GetMaxItems(c.Query("max_items")), + CoinQuery: strconv.Itoa(int(coin)), + Token: token, + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + TimeStartRaw: c.Query("time_start"), + MaxItems: c.Query("max_items"), } response, err := controller.HandleChartsRequest(request) diff --git a/api/endpoint/info.go b/api/endpoint/info.go index db0522d1..498d390a 100644 --- a/api/endpoint/info.go +++ b/api/endpoint/info.go @@ -1,12 +1,13 @@ package endpoint import ( + "net/http" + "strconv" + "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/controllers" - "net/http" ) // @Summary Get charts coin assets data for a specific coin @@ -22,18 +23,10 @@ import ( // @Router /v1/market/info [get] func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { - coinId, err := controllers.GetCoinId(c.Query("coin")) - if err != nil { - code, response := createErrorResponseAndStatusCode(err) - c.AbortWithStatusJSON(code, response) - return - } request := controllers.DetailsRequest{ - Asset: controllers.Asset{ - CoinId: coinId, - TokenId: c.Query("token"), - }, - Currency: controllers.GetCurrency(c.Query("currency")), + CoinQuery: c.Query("coin"), + Token: c.Query("token"), + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), } response, err := controller.HandleInfoRequest(request) if err != nil { @@ -58,23 +51,17 @@ func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Conte // @Router /v2/market/info/{id} [get] func GetCoinInfoHandlerV2(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { - coinId, token, err := asset.ParseID(c.Param("id")) + coin, token, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - if _, ok := coin.Coins[coinId]; !ok { - code, response := createErrorResponseAndStatusCode(err) - c.AbortWithStatusJSON(code, response) - return - } + request := controllers.DetailsRequest{ - Asset: controllers.Asset{ - CoinId: coinId, - TokenId: token, - }, - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + CoinQuery: strconv.Itoa(int(coin)), + Token: token, + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), } response, err := controller.HandleInfoRequest(request) if err != nil { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index b499fcbf..4991cb3b 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -135,7 +135,7 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { tickers := make(watchmarket.Tickers, 0, len(req.Assets)) for _, t := range req.Assets { tickers = append(tickers, watchmarket.Ticker{ - Coin: t.CoinId, + Coin: t.Coin, TokenId: t.TokenId, CoinType: t.CoinType, }) diff --git a/cmd/api/main.go b/cmd/api/main.go index 3f9a0f5c..a84fe3bd 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -90,7 +90,7 @@ func init() { } charts = chartscontroller.NewController(redisCache, memoryCache, database, chartsPriority, m.ChartsAPIs, configuration) - info = infocontroller.NewController(database, memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) + info = infocontroller.NewController(database, memoryCache, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, m.ChartsAPIs, configuration) tickers = tickerscontroller.NewController(database, memoryCache, ratesPriority, tickerPriority, configuration) rates = ratescontroller.NewController(database, memoryCache, ratesPriority, configuration) } diff --git a/go.sum b/go.sum index de43b79a..fd79b428 100644 --- a/go.sum +++ b/go.sum @@ -560,7 +560,6 @@ github.com/trustwallet/golibs v0.0.35 h1:VqWInO5s4Zg6XyCmqro8/xrEViOedZ3oYtBq/kn github.com/trustwallet/golibs v0.0.35/go.mod h1:VI0APImKAYxvJ8MnMD6aHSKvnArXUd3NgNEghX5P+K8= github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgtQ6Y= github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= -github.com/trustwallet/golibs v0.1.1 h1:ZV5zbPbGD/dHcX3jnIcmdq24Llou230xYGHhK2WVvWQ= github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= diff --git a/services/assets/client.go b/services/assets/client.go index d4d8e11a..26133176 100755 --- a/services/assets/client.go +++ b/services/assets/client.go @@ -3,7 +3,6 @@ package assets import ( "errors" "fmt" - "github.com/trustwallet/watchmarket/services/controllers" "time" "github.com/trustwallet/golibs/client" @@ -20,14 +19,14 @@ func Init(api string) Client { return Client{client.InitClient(api, middleware.SentryErrorHandler)} } -func (c Client) GetCoinInfo(asset controllers.Asset) (info watchmarket.Info, err error) { - coinObject, ok := coin.Coins[asset.CoinId] +func (c Client) GetCoinInfo(coinId uint, token string) (info watchmarket.Info, err error) { + coinObject, ok := coin.Coins[coinId] if !ok { - err = errors.New(fmt.Sprint("coin not found ", asset.CoinId, "; token ", asset.TokenId)) + err = errors.New("coin not found " + "token " + token) return } - path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, asset.TokenId)) + path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) err = c.GetWithCache(&info, path, nil, time.Hour*12) //asset info file now only contains description field. info.ShortDescription = info.Description diff --git a/services/assets/client_test.go b/services/assets/client_test.go index 2f7920da..7fb0e0c8 100755 --- a/services/assets/client_test.go +++ b/services/assets/client_test.go @@ -4,7 +4,6 @@ package assets import ( "encoding/json" "fmt" - "github.com/trustwallet/watchmarket/services/controllers" "net/http" "net/http/httptest" "testing" @@ -25,7 +24,7 @@ func TestClient_GetCoinInfo(t *testing.T) { c := Init(server.URL) assert.NotNil(t, c) - data, err := c.GetCoinInfo(controllers.Asset{CoinId: 60}) + data, err := c.GetCoinInfo(60, "") assert.Nil(t, err) rawData, err := json.Marshal(data) diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index b60f30b9..cd6e932e 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -17,8 +17,6 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) -const charts = "charts" - type Controller struct { redisCache cache.Provider memoryCache cache.Provider @@ -47,18 +45,22 @@ func NewController( } // ChartsController interface implementation -func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart watchmarket.Chart, err error) { +func (c Controller) HandleChartsRequest(cr controllers.ChartRequest) (ch watchmarket.Chart, err error) { + chartRequest, err := normalizeRequest(cr) + if err != nil { + return ch, errors.New(watchmarket.ErrBadRequest) + } - if !c.hasTickers(request.Asset) { - return chart, nil + if !c.hasTickers(chartRequest.Coin, chartRequest.Token) { + return ch, nil } - chart, err = c.getChartFromRedis(request) - if err == nil && len(chart.Prices) > 0 { - return chart, nil + ch, err = c.getChartFromRedis(chartRequest) + if err == nil && len(ch.Prices) > 0 { + return ch, nil } - rawChart, err := c.getChartsFromApi(request) + rawChart, err := c.getChartsFromApi(chartRequest) if err != nil { return watchmarket.Chart{}, errors.New(watchmarket.ErrInternal) } @@ -67,21 +69,21 @@ func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart return watchmarket.Chart{}, errors.New(watchmarket.ErrNotFound) } - chart = calculateChartByMaxItems(rawChart, request.MaxItems) - c.putChartsToRedis(chart, request) + chart := normalizeChart(rawChart, chartRequest.MaxItems) + c.putChartsToRedis(chart, chartRequest) return chart, nil } -func (c Controller) hasTickers(assetData controllers.Asset) bool { +func (c Controller) hasTickers(coin uint, token string) bool { var tickers []models.Ticker var err error if c.useMemoryCache { - if tickers, err = c.getChartsFromMemory(assetData); err != nil { + if tickers, err = c.getChartsFromMemory(coin, token); err != nil { return false } } else { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: coin, TokenId: strings.ToLower(token)}}) if err != nil { return false } @@ -94,21 +96,21 @@ func (c Controller) hasTickers(assetData controllers.Asset) bool { return len(tickers) > 0 } -func (c Controller) getChartsFromApi(data controllers.ChartRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartsFromApi(data chartsNormalizedRequest) (ch watchmarket.Chart, err error) { for _, p := range c.availableProviders { - price, err := c.api[p].GetChartData(data.Asset, data.Currency, data.TimeStart) - if err == nil && len(price.Prices) > 0 { + price, err := c.api[p].GetChartData(data.Coin, data.Token, data.Currency, data.TimeStart) + if len(price.Prices) > 0 && err == nil { return price, nil } } return watchmarket.Chart{}, nil } -func (c Controller) getRedisKey(request controllers.ChartRequest) string { - return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Asset.CoinId, request.Asset.TokenId, request.Currency, request.MaxItems)) +func (c Controller) getRedisKey(request chartsNormalizedRequest) string { + return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Coin, request.Token, request.Currency, request.MaxItems)) } -func (c Controller) getChartFromRedis(request controllers.ChartRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartFromRedis(request chartsNormalizedRequest) (ch watchmarket.Chart, err error) { key := c.getRedisKey(request) cachedChartRaw, err := c.redisCache.GetWithTime(key, request.TimeStart) if err != nil || len(cachedChartRaw) <= 0 { @@ -118,7 +120,7 @@ func (c Controller) getChartFromRedis(request controllers.ChartRequest) (ch watc return ch, err } -func (c Controller) putChartsToRedis(chart watchmarket.Chart, request controllers.ChartRequest) { +func (c Controller) putChartsToRedis(chart watchmarket.Chart, request chartsNormalizedRequest) { key := c.getRedisKey(request) chartRaw, err := json.Marshal(&chart) if err != nil { @@ -133,8 +135,8 @@ func (c Controller) putChartsToRedis(chart watchmarket.Chart, request controller } } -func (c Controller) getChartsFromMemory(assetData controllers.Asset) ([]models.Ticker, error) { - key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) +func (c Controller) getChartsFromMemory(coin uint, token string) ([]models.Ticker, error) { + key := strings.ToLower(asset.BuildID(coin, token)) rawResult, err := c.memoryCache.Get(key) if err != nil { return nil, err @@ -156,24 +158,3 @@ func (c Controller) getChartsFromMemory(assetData controllers.Asset) ([]models.T } return []models.Ticker{result}, nil } - -func calculateChartByMaxItems(chart watchmarket.Chart, maxItems int) watchmarket.Chart { - var newPrices []watchmarket.ChartPrice - if len(chart.Prices) > maxItems && maxItems > 0 { - skip := int(float64(len(chart.Prices) / maxItems)) - i := 0 - for i < len(chart.Prices) { - newPrices = append(newPrices, chart.Prices[i]) - i += skip + 1 - } - lastPrice := chart.Prices[len(chart.Prices)-1] - if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { - newPrices = append(newPrices, lastPrice) - } - } else { - newPrices = chart.Prices - } - - chart.Prices = newPrices - return chart -} diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index a368ef77..d98f67bf 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -91,13 +91,11 @@ func TestController_HandleChartsRequest(t *testing.T) { assert.NotNil(t, c) chart, err := c.HandleChartsRequest(controllers.ChartRequest{ - Asset: controllers.Asset{ - CoinId: 60, - TokenId: "a", - }, - Currency: "USD", - TimeStart: 1577871126, - MaxItems: 64, + CoinQuery: "60", + Token: "a", + Currency: "USD", + TimeStartRaw: "1577871126", + MaxItems: "64", }) assert.Nil(t, err) @@ -214,11 +212,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/charts/models.go b/services/controllers/charts/models.go new file mode 100644 index 00000000..c412571c --- /dev/null +++ b/services/controllers/charts/models.go @@ -0,0 +1,10 @@ +package chartscontroller + +type ( + chartsNormalizedRequest struct { + Coin uint + Token, Currency string + TimeStart int64 + MaxItems int + } +) diff --git a/services/controllers/charts/normalization.go b/services/controllers/charts/normalization.go new file mode 100755 index 00000000..027a81dc --- /dev/null +++ b/services/controllers/charts/normalization.go @@ -0,0 +1,75 @@ +package chartscontroller + +import ( + "errors" + "strconv" + "time" + + "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/controllers" +) + +const charts = "charts" + +func normalizeRequest(cr controllers.ChartRequest) (chartsNormalizedRequest, error) { + if len(cr.CoinQuery) == 0 { + return chartsNormalizedRequest{}, errors.New("invalid arguments length") + } + + coinId, err := strconv.Atoi(cr.CoinQuery) + if err != nil { + return chartsNormalizedRequest{}, err + } + + if _, ok := coin.Coins[uint(coinId)]; !ok { + return chartsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) + } + var timeStart int64 + if cr.TimeStartRaw == "" { + timeStart = time.Now().Unix() - 60*60*24 + } else { + timeStart, err = strconv.ParseInt(cr.TimeStartRaw, 10, 64) + if err != nil { + return chartsNormalizedRequest{}, err + } + } + maxItems, err := strconv.Atoi(cr.MaxItems) + if err != nil || maxItems <= 0 { + maxItems = watchmarket.DefaultMaxChartItems + } + + currency := watchmarket.DefaultCurrency + if cr.Currency != "" { + currency = cr.Currency + } + + return chartsNormalizedRequest{ + Coin: uint(coinId), + Token: cr.Token, + Currency: currency, + TimeStart: timeStart, + MaxItems: maxItems, + }, nil +} + +func normalizeChart(chart watchmarket.Chart, maxItems int) watchmarket.Chart { + var newPrices []watchmarket.ChartPrice + if len(chart.Prices) > maxItems && maxItems > 0 { + skip := int(float64(len(chart.Prices) / maxItems)) + i := 0 + for i < len(chart.Prices) { + newPrices = append(newPrices, chart.Prices[i]) + i += skip + 1 + } + lastPrice := chart.Prices[len(chart.Prices)-1] + if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { + newPrices = append(newPrices, lastPrice) + } + } else { + newPrices = chart.Prices + } + + chart.Prices = newPrices + return chart +} diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 5dc201c3..abadfb61 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -3,10 +3,9 @@ package infocontroller import ( "encoding/json" "errors" - "fmt" - "github.com/trustwallet/watchmarket/db/models" log "github.com/sirupsen/logrus" + "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" @@ -14,148 +13,73 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) -const info = "info" - type Controller struct { database db.Instance cache cache.Provider + chartsPriority []string coinInfoPriority []string ratesPriority []string + tickersPriority []string api markets.ChartsAPIs + configuration config.Configuration } func NewController( database db.Instance, cache cache.Provider, - coinInfoPriority []string, - ratesPriority []string, + chartsPriority, coinInfoPriority, ratesPriority, tickersPriority []string, api markets.ChartsAPIs, + configuration config.Configuration, ) Controller { return Controller{ database, cache, + chartsPriority, coinInfoPriority, ratesPriority, + tickersPriority, api, + configuration, } } -func (c Controller) HandleInfoRequest(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - result, err := c.getFromCache(request) - if err == nil { - return result, nil - } +func (c Controller) HandleInfoRequest(dr controllers.DetailsRequest) (controllers.InfoResponse, error) { + var cd controllers.InfoResponse - result, err = c.getDetailsByPriority(request) + req, err := toDetailsRequestData(dr) if err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) + return cd, errors.New(watchmarket.ErrBadRequest) } - if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { - result.Info = nil - } + key := c.cache.GenerateKey(info + dr.CoinQuery + dr.Token + dr.Currency) - c.putToCache(request, result) - - return result, nil -} - -func (c Controller) putToCache(request controllers.DetailsRequest, result controllers.InfoResponse) { - if result.Info == nil { - return - } - key := c.getCacheKey(request) - newCache, err := json.Marshal(result) - if err != nil { - return + cachedDetails, err := c.cache.Get(key) + if err == nil && len(cachedDetails) > 0 { + if json.Unmarshal(cachedDetails, &cd) == nil { + return cd, nil + } } - err = c.cache.Set(key, newCache) + result, err := c.getDetailsByPriority(req) if err != nil { - log.Error("failed to save cache") - } -} - -func (c Controller) getCacheKey(request controllers.DetailsRequest) string { - return c.cache.GenerateKey(fmt.Sprintf("%s%d%s%s", info, request.Asset.CoinId, request.Asset.TokenId, request.Currency)) -} - -func (c Controller) getFromCache(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - key := c.getCacheKey(request) - - cachedDetails, err := c.cache.Get(key) - if err != nil || len(cachedDetails) <= 0 { - return controllers.InfoResponse{}, errors.New("cache is empty") + return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) } - var infoResponse controllers.InfoResponse - err = json.Unmarshal(cachedDetails, &infoResponse) - return infoResponse, err -} - -func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: request.Asset.TokenId}}) - if err != nil || len(dbTickers) == 0 { - return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) + if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { + result.Info = nil } - ticker, err := c.getTickerDataAccordingToPriority(dbTickers) + newCache, err := json.Marshal(result) if err != nil { - return controllers.InfoResponse{}, err + log.Error(err) } - result := c.getCoinDataFromApi(request.Asset, request.Currency) - result.CirculatingSupply = ticker.CirculatingSupply - result.MarketCap = ticker.MarketCap - result.Vol24 = ticker.Volume - result.TotalSupply = ticker.TotalSupply - if request.Currency != watchmarket.DefaultCurrency { - rates, err := c.database.GetRates(request.Currency) - if err != nil || len(rates) == 0 { - return controllers.InfoResponse{}, fmt.Errorf("empty db rate or db error: %w", err) - } - rate, err := c.getRateDataAccordingToPriority(rates) + if result.Info != nil { + err = c.cache.Set(key, newCache) if err != nil { - return controllers.InfoResponse{}, err + log.WithFields(log.Fields{"err": err}).Error("failed to save cache") } - result.MarketCap *= 1 / rate - result.Vol24 *= 1 / rate } - return result, nil -} -func (c Controller) getCoinDataFromApi(assetData controllers.Asset, currency string) controllers.InfoResponse { - var result controllers.InfoResponse - - for _, p := range c.coinInfoPriority { - if data, err := c.api[p].GetCoinData(assetData, currency); err == nil { - result.Info = data.Info - result.Provider = data.Provider - result.ProviderURL = data.ProviderURL - break - } - } - return result -} - -func (c Controller) getTickerDataAccordingToPriority(tickers []models.Ticker) (models.Ticker, error) { - for _, p := range c.coinInfoPriority { - for _, t := range tickers { - if t.Provider == p && t.ShowOption != models.NeverShow { - return t, nil - } - } - } - return models.Ticker{}, errors.New("bad ticker or providers") -} - -func (c Controller) getRateDataAccordingToPriority(rates []models.Rate) (float64, error) { - for _, p := range c.ratesPriority { - for _, r := range rates { - if r.Provider == p && r.ShowOption != models.NeverShow { - return r.Rate, nil - } - } - } - return 0, errors.New("bad ticker or providers") + return result, nil } diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 44ee07c2..9823aa3a 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -32,15 +32,13 @@ func TestController_HandleDetailsRequest(t *testing.T) { db := getDbMock() db.WantedTickers = []models.Ticker{{CirculatingSupply: 1, TotalSupply: 1, MarketCap: 1, Volume: 1, Provider: "coinmarketcap"}} - db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "coinmarketcap"}} + db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "fixer"}} c := setupController(t, db, getCacheMock(), cm) assert.NotNil(t, c) details, err := c.HandleInfoRequest(controllers.DetailsRequest{ - Asset: controllers.Asset{ - CoinId: 0, - TokenId: "2", - }, - Currency: "RUB", + CoinQuery: "0", + Token: "2", + Currency: "RUB", }) assert.Nil(t, err) assert.Equal(t, controllers.InfoResponse{ @@ -62,13 +60,15 @@ func setupController(t *testing.T, db dbMock, ch cache.Provider, cm chartsMock) c, _ := config.Init("../../../config.yml") assert.NotNil(t, c) + chartsPriority := []string{"coinmarketcap"} ratesPriority := []string{"coinmarketcap"} + tickerPriority := []string{"coinmarketcap"} coinInfoPriority := []string{"coinmarketcap"} chartsAPIs := make(markets.ChartsAPIs, 1) chartsAPIs[cm.GetProvider()] = cm - controller := NewController(db, ch, coinInfoPriority, ratesPriority, chartsAPIs) + controller := NewController(db, ch, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, chartsAPIs, c) assert.NotNil(t, controller) return controller @@ -120,11 +120,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/info/models.go b/services/controllers/info/models.go new file mode 100644 index 00000000..b92573b1 --- /dev/null +++ b/services/controllers/info/models.go @@ -0,0 +1,8 @@ +package infocontroller + +type tickerData struct { + Vol24 float64 + MarketCap float64 + CirculatingSupply float64 + TotalSupply float64 +} diff --git a/services/controllers/info/normalization.go b/services/controllers/info/normalization.go new file mode 100644 index 00000000..b577c68b --- /dev/null +++ b/services/controllers/info/normalization.go @@ -0,0 +1,127 @@ +package infocontroller + +import ( + "errors" + "strconv" + "strings" + + "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/controllers" +) + +type ( + detailsNormalizedRequest struct { + Coin uint + Token, Currency string + } +) + +const info = "info" + +func toDetailsRequestData(dr controllers.DetailsRequest) (detailsNormalizedRequest, error) { + if len(dr.CoinQuery) == 0 { + return detailsNormalizedRequest{}, errors.New("invalid arguments length") + } + + coinId, err := strconv.Atoi(dr.CoinQuery) + if err != nil { + return detailsNormalizedRequest{}, err + } + + if _, ok := coin.Coins[uint(coinId)]; !ok { + return detailsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) + } + + currency := watchmarket.DefaultCurrency + if dr.Currency != "" { + currency = dr.Currency + } + + return detailsNormalizedRequest{ + Coin: uint(coinId), + Token: dr.Token, + Currency: currency, + }, nil +} + +func (c Controller) getDetailsByPriority(data detailsNormalizedRequest) (controllers.InfoResponse, error) { + availableTickerProviders := c.coinInfoPriority + availableRateProviders := c.configuration.Markets.Priority.Rates + + var ( + result controllers.InfoResponse + details watchmarket.CoinDetails + ) + for _, p := range availableTickerProviders { + data, err := c.api[p].GetCoinData(data.Coin, data.Token, data.Currency) + if err == nil { + details = data + break + } + } + result.Info = details.Info + result.Provider = details.Provider + result.ProviderURL = details.ProviderURL + + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: data.Coin, TokenId: strings.ToLower(data.Token)}}) + if err != nil { + return controllers.InfoResponse{}, err + } + if len(dbTickers) == 0 { + return controllers.InfoResponse{}, errors.New("empty db ticker") + } + tickerData, err := getTickerDataAccordingToPriority(availableTickerProviders, dbTickers) + if err != nil { + return controllers.InfoResponse{}, err + } + result.CirculatingSupply = tickerData.CirculatingSupply + result.MarketCap = tickerData.MarketCap + result.Vol24 = tickerData.Vol24 + result.TotalSupply = tickerData.TotalSupply + + if data.Currency != watchmarket.DefaultCurrency { + rates, err := c.database.GetRates(data.Currency) + if err != nil { + return controllers.InfoResponse{}, err + } + if len(rates) == 0 { + return controllers.InfoResponse{}, errors.New("empty db rate") + } + rate, err := getRateDataAccordingToPriority(availableRateProviders, rates) + if err != nil { + return controllers.InfoResponse{}, err + } + result.MarketCap *= 1 / rate + result.Vol24 *= 1 / rate + } + return result, nil +} + +func getTickerDataAccordingToPriority(availableProviders []string, tickers []models.Ticker) (tickerData, error) { + for _, p := range availableProviders { + for _, t := range tickers { + if t.Provider == p && t.ShowOption != models.NeverShow { + return tickerData{ + Vol24: t.Volume, + MarketCap: t.MarketCap, + CirculatingSupply: t.CirculatingSupply, + TotalSupply: t.TotalSupply, + }, nil + } + } + } + return tickerData{}, errors.New("bad ticker or providers") +} + +func getRateDataAccordingToPriority(availableProviders []string, rates []models.Rate) (float64, error) { + for _, p := range availableProviders { + for _, r := range rates { + if r.Provider == p && r.ShowOption != models.NeverShow { + return r.Rate, nil + } + } + } + return 0, errors.New("bad ticker or providers") +} diff --git a/services/controllers/models.go b/services/controllers/models.go index ba54034b..6a827d88 100644 --- a/services/controllers/models.go +++ b/services/controllers/models.go @@ -1,18 +1,11 @@ package controllers -import ( - "fmt" - "github.com/pkg/errors" - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "strconv" - "time" -) +import "github.com/trustwallet/watchmarket/pkg/watchmarket" type ( TickerRequest struct { - Currency string `json:"Currency"` - Assets []Asset `json:"assets"` + Currency string `json:"Currency"` + Assets []Coin `json:"assets"` } TickerRequestV2 struct { @@ -20,8 +13,8 @@ type ( Ids []string `json:"assets"` } - Asset struct { - CoinId uint `json:"Coin"` + Coin struct { + Coin uint `json:"Coin"` CoinType watchmarket.CoinType `json:"type"` TokenId string `json:"token_id,omitempty"` } @@ -54,15 +47,11 @@ type ( } ChartRequest struct { - Asset Asset - Currency string - TimeStart int64 - MaxItems int + CoinQuery, Token, Currency, TimeStartRaw, MaxItems string } DetailsRequest struct { - Asset Asset - Currency string + CoinQuery, Token, Currency string } InfoResponse struct { @@ -75,38 +64,3 @@ type ( Info *watchmarket.Info `json:"info,omitempty"` } ) - -func GetCoinId(rawCoinId string) (uint, error) { - coinId, err := strconv.Atoi(rawCoinId) - if err != nil { - return 0, err - } - if _, ok := coin.Coins[uint(coinId)]; !ok { - return 0, errors.New(fmt.Sprintf("invalid coin Id: %d", coinId)) - } - return uint(coinId), nil -} - -func GetCurrency(rawCurrency string) string { - currency := rawCurrency - if currency == "" { - currency = watchmarket.DefaultCurrency - } - return currency -} - -func GetTimeStart(rawTime string) int64 { - timeStart, err := strconv.ParseInt(rawTime, 10, 64) - if err != nil { - timeStart = time.Now().Unix() - int64(time.Hour)*24 - } - return timeStart -} - -func GetMaxItems(rawMax string) int { - maxItems, err := strconv.Atoi(rawMax) - if err != nil || maxItems <= 0 { - maxItems = watchmarket.DefaultMaxChartItems - } - return maxItems -} diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index afe7ed33..6368700c 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -93,7 +93,7 @@ func TestController_HandleTickersRequest(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) + response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) assert.Nil(t, err) wantedTicker1 := watchmarket.Ticker{ @@ -158,7 +158,7 @@ func TestController_HandleTickersRequest(t *testing.T) { err = controllerWithCache.cache.Set("USD", rateRaw) assert.Nil(t, err) - response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) + response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) assert.Nil(t, err) sort.Slice(response2.Tickers, func(i, j int) bool { diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go index 9b9b11f6..cf20a744 100644 --- a/services/controllers/tickers/normalization.go +++ b/services/controllers/tickers/normalization.go @@ -46,11 +46,11 @@ func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Ticker return result } -func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { +func makeTickerQueries(coins []controllers.Coin) []models.TickerQuery { tickerQueries := make([]models.TickerQuery, 0, len(coins)) for _, c := range coins { tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: c.CoinId, + Coin: c.Coin, TokenId: strings.ToLower(c.TokenId), }) } @@ -105,9 +105,9 @@ func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bo return id, false } -func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { +func findTickerInAssets(assets []controllers.Coin, t watchmarket.Ticker) (watchmarket.Ticker, bool) { for _, c := range assets { - if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { + if c.Coin == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { t.TokenId = c.TokenId return t, true } diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go index 8c579226..010bcaec 100644 --- a/services/controllers/tickers/normalization_test.go +++ b/services/controllers/tickers/normalization_test.go @@ -32,7 +32,7 @@ func TestController_createResponse(t *testing.T) { tr := controllers.TickerRequest{ Currency: "EUR", - Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, + Assets: []controllers.Coin{{Coin: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, } response := createResponse(tr, watchmarket.Tickers{ticker}) @@ -273,7 +273,7 @@ func TestController_normalizeTickers_advanced(t *testing.T) { } func Test_findBestProviderForQuery(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -311,7 +311,7 @@ func Test_findBestProviderForQuery(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -320,7 +320,7 @@ func Test_findBestProviderForQuery(t *testing.T) { } func Test_findBestProviderForQuery_advanced(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -359,7 +359,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -368,7 +368,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { } func Test_findBestProviderForQuery_showOption(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -407,7 +407,7 @@ func Test_findBestProviderForQuery_showOption(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index e50b4a13..71d8fe8f 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -58,7 +58,7 @@ func TestController_getTickersByPriority(t *testing.T) { assert.NotNil(t, c) tickers, err := c.getTickersByPriority(makeTickerQueries( - []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, + []controllers.Coin{{Coin: 60, TokenId: "A"}, {Coin: 714, TokenId: "A"}}, )) assert.Nil(t, err) assert.NotNil(t, tickers) @@ -98,7 +98,7 @@ func TestController_getTickersByPriority(t *testing.T) { db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) + tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Coin{{Coin: 60, TokenId: "A"}})) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/markets/coingecko/charts.go b/services/markets/coingecko/charts.go index 1d2414b2..3c2e14ce 100755 --- a/services/markets/coingecko/charts.go +++ b/services/markets/coingecko/charts.go @@ -2,7 +2,6 @@ package coingecko import ( "errors" - "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -14,7 +13,7 @@ import ( "github.com/trustwallet/watchmarket/pkg/watchmarket" ) -func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coins, err := p.client.fetchCoins() @@ -24,7 +23,7 @@ func (p Provider) GetChartData(asset controllers.Asset, currency string, timeSta symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, asset) + coinResult, err := getCoinByID(symbolsMap, coinID, token) if err != nil { return chartsData, err } @@ -39,7 +38,7 @@ func (p Provider) GetChartData(asset controllers.Asset, currency string, timeSta return normalizeCharts(c), nil } -func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { coins, err := p.client.fetchCoins() if err != nil { return watchmarket.CoinDetails{}, err @@ -47,7 +46,7 @@ func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchma symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, asset) + coinResult, err := getCoinByID(symbolsMap, coinID, token) if err != nil { return watchmarket.CoinDetails{}, err } @@ -57,9 +56,9 @@ func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchma return watchmarket.CoinDetails{}, errors.New("no rates found") } - infoData, err := p.info.GetCoinInfo(asset) + infoData, err := p.info.GetCoinInfo(coinID, token) if err != nil { - log.WithFields(log.Fields{"coin": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coin") + log.WithFields(log.Fields{"coin": coinID, "token": token}).Warn("No assets assets about that coin") } return watchmarket.CoinDetails{ Info: &infoData, @@ -108,14 +107,14 @@ func createID(symbol, token string) string { return strings.ToLower(symbol) } -func getCoinByID(coinMap map[string]Coin, asset controllers.Asset) (Coin, error) { +func getCoinByID(coinMap map[string]Coin, coinId uint, token string) (Coin, error) { c := Coin{} - coinObj, ok := coin.Coins[asset.CoinId] + coinObj, ok := coin.Coins[coinId] if !ok { return c, errors.New("coin not found") } - c, ok = coinMap[createID(coinObj.Symbol, asset.TokenId)] + c, ok = coinMap[createID(coinObj.Symbol, token)] if !ok { return c, errors.New("no coin found by symbol") } diff --git a/services/markets/coingecko/charts_test.go b/services/markets/coingecko/charts_test.go index f6adcdf9..cea70471 100755 --- a/services/markets/coingecko/charts_test.go +++ b/services/markets/coingecko/charts_test.go @@ -2,7 +2,6 @@ package coingecko import ( "encoding/json" - "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "sort" "testing" @@ -15,7 +14,7 @@ func TestProvider_GetCoinData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init(server.URL)) - data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") + data, _ := provider.GetCoinData(60, "", "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedInfo, string(rawData)) @@ -25,7 +24,7 @@ func TestProvider_GetChartData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) - data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) + data, _ := provider.GetChartData(60, "", "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/coinmarketcap/charts.go b/services/markets/coinmarketcap/charts.go index 6022354f..10144c19 100755 --- a/services/markets/coinmarketcap/charts.go +++ b/services/markets/coinmarketcap/charts.go @@ -3,7 +3,6 @@ package coinmarketcap import ( "errors" "fmt" - "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -16,10 +15,10 @@ const ( chartDataSize = 3 ) -func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(asset) + coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) if err != nil { return chartsData, err } @@ -36,10 +35,10 @@ func (p Provider) GetChartData(asset controllers.Asset, currency string, timeSta return normalizeCharts(currency, c), nil } -func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { details := watchmarket.CoinDetails{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(asset) + coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) if err != nil { return details, err } @@ -47,9 +46,9 @@ func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchma if err != nil { return details, err } - assetsData, err := p.info.GetCoinInfo(asset) + assetsData, err := p.info.GetCoinInfo(coinID, token) if err != nil { - log.WithFields(log.Fields{"coinID": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coinID") + log.WithFields(log.Fields{"coinID": coinID, "token": token}).Warn("No assets assets about that coinID") } return normalizeInfo(priceData, &assetsData) @@ -103,8 +102,8 @@ func (c CmcSlice) coinToCmcMap() (m CoinMapping) { return } -func (cm CoinMapping) getCoinByContract(asset controllers.Asset) (c CoinMap, err error) { - c, ok := cm[createID(asset.CoinId, asset.TokenId)] +func (cm CoinMapping) getCoinByContract(coinId uint, contract string) (c CoinMap, err error) { + c, ok := cm[createID(coinId, contract)] if !ok { err = errors.New("No coin found") } diff --git a/services/markets/coinmarketcap/charts_test.go b/services/markets/coinmarketcap/charts_test.go index b08ed802..9e7ccd3f 100755 --- a/services/markets/coinmarketcap/charts_test.go +++ b/services/markets/coinmarketcap/charts_test.go @@ -2,7 +2,6 @@ package coinmarketcap import ( "encoding/json" - "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "reflect" "sort" @@ -21,7 +20,7 @@ func TestProvider_GetCoinData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") + data, _ := provider.GetCoinData(60, "", "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedCoinInfo, string(rawData)) @@ -34,7 +33,7 @@ func TestProvider_GetChartData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) + data, _ := provider.GetChartData(60, "", "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/markets.go b/services/markets/markets.go index 6283d3fd..9382ef21 100755 --- a/services/markets/markets.go +++ b/services/markets/markets.go @@ -4,7 +4,6 @@ import ( "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" - "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/services/markets/binancedex" "github.com/trustwallet/watchmarket/services/markets/coingecko" "github.com/trustwallet/watchmarket/services/markets/coinmarketcap" @@ -28,8 +27,8 @@ type ( ChartsAPI interface { Provider - GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) - GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) + GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) + GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) } Providers map[string]Provider From d4ebd631cd7e237c8c526207c793cb23026b7339 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Mon, 8 Feb 2021 02:45:11 +0800 Subject: [PATCH 19/96] Add Dogecoin BEP20 pricing (#368) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 72e5af56..6786e823 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -115,6 +115,12 @@ const Mapping = `[ "type": "coin", "id": 74 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", + "id": 74 + }, { "coin": 152, "type": "coin", From dfd081bf93bc70554f39931ade98d968dbd3915c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 7 Feb 2021 10:45:24 -0800 Subject: [PATCH 20/96] Bump github.com/alicebob/miniredis/v2 from 2.13.3 to 2.14.2 (#367) Bumps [github.com/alicebob/miniredis/v2](https://github.com/alicebob/miniredis) from 2.13.3 to 2.14.2. - [Release notes](https://github.com/alicebob/miniredis/releases) - [Changelog](https://github.com/alicebob/miniredis/blob/master/CHANGELOG.md) - [Commits](https://github.com/alicebob/miniredis/compare/v2.13.3...v2.14.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7890b69b..af9acea9 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ go 1.15 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 - github.com/alicebob/miniredis/v2 v2.13.3 + github.com/alicebob/miniredis/v2 v2.14.2 github.com/chenjiandongx/ginprom v0.0.0-20200410120253-7cfb22707fa6 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.6.3 diff --git a/go.sum b/go.sum index fd79b428..5826a48e 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,7 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZp github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.13.3 h1:kohgdtN58KW/r9ZDVmMJE3MrfbumwsDQStd0LPAGmmw= github.com/alicebob/miniredis/v2 v2.13.3/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg= +github.com/alicebob/miniredis/v2 v2.14.2/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -578,6 +579,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= From c737ca6ba804474b31c0186a220b93833a43b40b Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 8 Feb 2021 18:01:43 +0800 Subject: [PATCH 21/96] add_BEP20_SFP (#370) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 6786e823..a7fd2d32 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14104,6 +14104,12 @@ const Mapping = `[ "token_id": "0x06A01a4d579479Dd5D884EBf61A31727A3d8D442", "id": 8133 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb", + "id": 8119 + }, { "coin": 20000714, "type": "token", From 6eb3b9ea2ee67b3ac33c2af19637969364c7e63b Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Tue, 9 Feb 2021 11:27:27 +0800 Subject: [PATCH 22/96] Add Elrond (ERC20) pricing (#371) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index a7fd2d32..6413519b 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13750,6 +13750,12 @@ const Mapping = `[ "type": "coin", "id": 6892 }, + { + "coin": 60, + "type": "token", + "token_id": "0xF9986D445ceD31882377b5D6a5F58EaEa72288c3", + "id": 6892 + }, { "coin": 20000714, "type": "token", From 97f110aea1a0252b3bb6b510b5c4827f489ac870 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 9 Feb 2021 21:14:59 +0800 Subject: [PATCH 23/96] add_BEP20_YVS (#372) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 6413519b..6b93ff90 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14098,6 +14098,12 @@ const Mapping = `[ "token_id": "0xEC681F28f4561c2a9534799AA38E0d36A83Cf478", "id": 8036 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x47c1C7B9D7941A7265D123DCfb100D8FB5348213", + "id": 8036 + }, { "coin": 60, "type": "token", From 32bf3376209322235e1754c484403239f753c28b Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Thu, 11 Feb 2021 12:27:54 +0800 Subject: [PATCH 24/96] Removed Elrond [ERD] (ERC20) (#373) --- services/markets/coinmarketcap/mapping.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 6b93ff90..9ba6da91 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13750,12 +13750,6 @@ const Mapping = `[ "type": "coin", "id": 6892 }, - { - "coin": 60, - "type": "token", - "token_id": "0xF9986D445ceD31882377b5D6a5F58EaEa72288c3", - "id": 6892 - }, { "coin": 20000714, "type": "token", From 2e611f83eff1eb5bc8bf8de133953124c0d0b8c4 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Fri, 12 Feb 2021 10:33:25 +0800 Subject: [PATCH 25/96] Add AAVE (BEP2 and BEP20) pricing (#374) --- services/markets/coinmarketcap/mapping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 9ba6da91..80791f1f 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13900,6 +13900,18 @@ const Mapping = `[ "token_id": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", "id": 7278 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xfb6115445Bff7b52FeB98650C87f44907E58f802", + "id": 7278 + }, + { + "coin": 714, + "type": "token", + "token_id": "AAVE-8FA", + "id": 7278 + }, { "coin": 20000714, "type": "token", From f252daf414a8fbf3d0a372df58431c99218d0c47 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Sat, 13 Feb 2021 16:37:42 +0700 Subject: [PATCH 26/96] Optimize codebase (#366) * Optimize codebase * Update tests * Update services/controllers/models.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Update services/controllers/models.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Update services/controllers/charts/base.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> * Apply Asset instead coinId, token * Update codebase * Clean codebase: remove controllers/charts/models.go * Merge * Fixed market info call Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> --- api/api_test.go | 2 +- api/endpoint/charts.go | 44 +++--- api/endpoint/info.go | 35 +++-- api/endpoint/tickers.go | 2 +- cmd/api/main.go | 2 +- go.sum | 1 + services/assets/client.go | 9 +- services/assets/client_test.go | 3 +- services/controllers/charts/base.go | 69 +++++---- services/controllers/charts/base_test.go | 16 ++- services/controllers/charts/models.go | 10 -- services/controllers/charts/normalization.go | 75 ---------- services/controllers/info/base.go | 135 ++++++++++++++---- services/controllers/info/base_test.go | 18 +-- services/controllers/info/models.go | 8 -- services/controllers/info/normalization.go | 127 ---------------- services/controllers/models.go | 60 +++++++- services/controllers/tickers/base_test.go | 4 +- services/controllers/tickers/normalization.go | 8 +- .../controllers/tickers/normalization_test.go | 14 +- services/controllers/tickers/tickers_test.go | 4 +- services/markets/coingecko/charts.go | 19 +-- services/markets/coingecko/charts_test.go | 5 +- services/markets/coinmarketcap/charts.go | 17 +-- services/markets/coinmarketcap/charts_test.go | 5 +- services/markets/markets.go | 5 +- 26 files changed, 327 insertions(+), 370 deletions(-) delete mode 100644 services/controllers/charts/models.go delete mode 100755 services/controllers/charts/normalization.go delete mode 100644 services/controllers/info/models.go delete mode 100644 services/controllers/info/normalization.go diff --git a/api/api_test.go b/api/api_test.go index 60026246..a38b18b4 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -72,7 +72,7 @@ func TestSetupTickersAPI(t *testing.T) { cr1 := controllers.TickerRequest{ Currency: "USD", - Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}}, + Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}}, } rawcr1, err := json.Marshal(&cr1) diff --git a/api/endpoint/charts.go b/api/endpoint/charts.go index 85214a74..faf86ef6 100644 --- a/api/endpoint/charts.go +++ b/api/endpoint/charts.go @@ -1,13 +1,11 @@ package endpoint import ( - "net/http" - "strconv" - "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/services/controllers" + "net/http" ) // @Summary Get charts data for a specific coin @@ -25,12 +23,20 @@ import ( // @Router /v1/market/charts [get] func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { + coinId, err := controllers.GetCoinId(c.Query("coin")) + if err != nil { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.ChartRequest{ - CoinQuery: c.Query("coin"), - Token: c.Query("token"), - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - TimeStartRaw: c.Query("time_start"), - MaxItems: c.Query("max_items"), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: c.Query("token"), + }, + Currency: controllers.GetCurrency(c.Query("currency")), + TimeStart: controllers.GetTimeStart(c.Query("time_start")), + MaxItems: controllers.GetMaxItems(c.Query("max_items")), } response, err := controller.HandleChartsRequest(request) @@ -58,19 +64,25 @@ func GetChartsHandler(controller controllers.ChartsController) func(c *gin.Conte // @Router /v2/market/charts/{id} [get] func GetChartsHandlerV2(controller controllers.ChartsController) func(c *gin.Context) { return func(c *gin.Context) { - coin, token, err := asset.ParseID(c.Param("id")) + coinId, tokenId, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - + if _, ok := coin.Coins[coinId]; !ok { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.ChartRequest{ - CoinQuery: strconv.Itoa(int(coin)), - Token: token, - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - TimeStartRaw: c.Query("time_start"), - MaxItems: c.Query("max_items"), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: tokenId, + }, + Currency: controllers.GetCurrency(c.Query("currency")), + TimeStart: controllers.GetTimeStart(c.Query("time_start")), + MaxItems: controllers.GetMaxItems(c.Query("max_items")), } response, err := controller.HandleChartsRequest(request) diff --git a/api/endpoint/info.go b/api/endpoint/info.go index 498d390a..db0522d1 100644 --- a/api/endpoint/info.go +++ b/api/endpoint/info.go @@ -1,13 +1,12 @@ package endpoint import ( - "net/http" - "strconv" - "github.com/gin-gonic/gin" "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/golibs/coin" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/controllers" + "net/http" ) // @Summary Get charts coin assets data for a specific coin @@ -23,10 +22,18 @@ import ( // @Router /v1/market/info [get] func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { + coinId, err := controllers.GetCoinId(c.Query("coin")) + if err != nil { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.DetailsRequest{ - CoinQuery: c.Query("coin"), - Token: c.Query("token"), - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: c.Query("token"), + }, + Currency: controllers.GetCurrency(c.Query("currency")), } response, err := controller.HandleInfoRequest(request) if err != nil { @@ -51,17 +58,23 @@ func GetCoinInfoHandler(controller controllers.InfoController) func(c *gin.Conte // @Router /v2/market/info/{id} [get] func GetCoinInfoHandlerV2(controller controllers.InfoController) func(c *gin.Context) { return func(c *gin.Context) { - coin, token, err := asset.ParseID(c.Param("id")) + coinId, token, err := asset.ParseID(c.Param("id")) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - + if _, ok := coin.Coins[coinId]; !ok { + code, response := createErrorResponseAndStatusCode(err) + c.AbortWithStatusJSON(code, response) + return + } request := controllers.DetailsRequest{ - CoinQuery: strconv.Itoa(int(coin)), - Token: token, - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Asset: controllers.Asset{ + CoinId: coinId, + TokenId: token, + }, + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), } response, err := controller.HandleInfoRequest(request) if err != nil { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index 4991cb3b..b499fcbf 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -135,7 +135,7 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { tickers := make(watchmarket.Tickers, 0, len(req.Assets)) for _, t := range req.Assets { tickers = append(tickers, watchmarket.Ticker{ - Coin: t.Coin, + Coin: t.CoinId, TokenId: t.TokenId, CoinType: t.CoinType, }) diff --git a/cmd/api/main.go b/cmd/api/main.go index a84fe3bd..3f9a0f5c 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -90,7 +90,7 @@ func init() { } charts = chartscontroller.NewController(redisCache, memoryCache, database, chartsPriority, m.ChartsAPIs, configuration) - info = infocontroller.NewController(database, memoryCache, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, m.ChartsAPIs, configuration) + info = infocontroller.NewController(database, memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) tickers = tickerscontroller.NewController(database, memoryCache, ratesPriority, tickerPriority, configuration) rates = ratescontroller.NewController(database, memoryCache, ratesPriority, configuration) } diff --git a/go.sum b/go.sum index 5826a48e..bbd583d3 100644 --- a/go.sum +++ b/go.sum @@ -561,6 +561,7 @@ github.com/trustwallet/golibs v0.0.35 h1:VqWInO5s4Zg6XyCmqro8/xrEViOedZ3oYtBq/kn github.com/trustwallet/golibs v0.0.35/go.mod h1:VI0APImKAYxvJ8MnMD6aHSKvnArXUd3NgNEghX5P+K8= github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgtQ6Y= github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs v0.1.1 h1:ZV5zbPbGD/dHcX3jnIcmdq24Llou230xYGHhK2WVvWQ= github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= diff --git a/services/assets/client.go b/services/assets/client.go index 26133176..d4d8e11a 100755 --- a/services/assets/client.go +++ b/services/assets/client.go @@ -3,6 +3,7 @@ package assets import ( "errors" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "time" "github.com/trustwallet/golibs/client" @@ -19,14 +20,14 @@ func Init(api string) Client { return Client{client.InitClient(api, middleware.SentryErrorHandler)} } -func (c Client) GetCoinInfo(coinId uint, token string) (info watchmarket.Info, err error) { - coinObject, ok := coin.Coins[coinId] +func (c Client) GetCoinInfo(asset controllers.Asset) (info watchmarket.Info, err error) { + coinObject, ok := coin.Coins[asset.CoinId] if !ok { - err = errors.New("coin not found " + "token " + token) + err = errors.New(fmt.Sprint("coin not found ", asset.CoinId, "; token ", asset.TokenId)) return } - path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, token)) + path := fmt.Sprintf("/%s/info.json", getPathForCoin(coinObject, asset.TokenId)) err = c.GetWithCache(&info, path, nil, time.Hour*12) //asset info file now only contains description field. info.ShortDescription = info.Description diff --git a/services/assets/client_test.go b/services/assets/client_test.go index 7fb0e0c8..2f7920da 100755 --- a/services/assets/client_test.go +++ b/services/assets/client_test.go @@ -4,6 +4,7 @@ package assets import ( "encoding/json" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "net/http" "net/http/httptest" "testing" @@ -24,7 +25,7 @@ func TestClient_GetCoinInfo(t *testing.T) { c := Init(server.URL) assert.NotNil(t, c) - data, err := c.GetCoinInfo(60, "") + data, err := c.GetCoinInfo(controllers.Asset{CoinId: 60}) assert.Nil(t, err) rawData, err := json.Marshal(data) diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index cd6e932e..b60f30b9 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -17,6 +17,8 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) +const charts = "charts" + type Controller struct { redisCache cache.Provider memoryCache cache.Provider @@ -45,22 +47,18 @@ func NewController( } // ChartsController interface implementation -func (c Controller) HandleChartsRequest(cr controllers.ChartRequest) (ch watchmarket.Chart, err error) { - chartRequest, err := normalizeRequest(cr) - if err != nil { - return ch, errors.New(watchmarket.ErrBadRequest) - } +func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart watchmarket.Chart, err error) { - if !c.hasTickers(chartRequest.Coin, chartRequest.Token) { - return ch, nil + if !c.hasTickers(request.Asset) { + return chart, nil } - ch, err = c.getChartFromRedis(chartRequest) - if err == nil && len(ch.Prices) > 0 { - return ch, nil + chart, err = c.getChartFromRedis(request) + if err == nil && len(chart.Prices) > 0 { + return chart, nil } - rawChart, err := c.getChartsFromApi(chartRequest) + rawChart, err := c.getChartsFromApi(request) if err != nil { return watchmarket.Chart{}, errors.New(watchmarket.ErrInternal) } @@ -69,21 +67,21 @@ func (c Controller) HandleChartsRequest(cr controllers.ChartRequest) (ch watchma return watchmarket.Chart{}, errors.New(watchmarket.ErrNotFound) } - chart := normalizeChart(rawChart, chartRequest.MaxItems) - c.putChartsToRedis(chart, chartRequest) + chart = calculateChartByMaxItems(rawChart, request.MaxItems) + c.putChartsToRedis(chart, request) return chart, nil } -func (c Controller) hasTickers(coin uint, token string) bool { +func (c Controller) hasTickers(assetData controllers.Asset) bool { var tickers []models.Ticker var err error if c.useMemoryCache { - if tickers, err = c.getChartsFromMemory(coin, token); err != nil { + if tickers, err = c.getChartsFromMemory(assetData); err != nil { return false } } else { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: coin, TokenId: strings.ToLower(token)}}) + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) if err != nil { return false } @@ -96,21 +94,21 @@ func (c Controller) hasTickers(coin uint, token string) bool { return len(tickers) > 0 } -func (c Controller) getChartsFromApi(data chartsNormalizedRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartsFromApi(data controllers.ChartRequest) (ch watchmarket.Chart, err error) { for _, p := range c.availableProviders { - price, err := c.api[p].GetChartData(data.Coin, data.Token, data.Currency, data.TimeStart) - if len(price.Prices) > 0 && err == nil { + price, err := c.api[p].GetChartData(data.Asset, data.Currency, data.TimeStart) + if err == nil && len(price.Prices) > 0 { return price, nil } } return watchmarket.Chart{}, nil } -func (c Controller) getRedisKey(request chartsNormalizedRequest) string { - return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Coin, request.Token, request.Currency, request.MaxItems)) +func (c Controller) getRedisKey(request controllers.ChartRequest) string { + return c.redisCache.GenerateKey(fmt.Sprintf("%s%d%s%s%d", charts, request.Asset.CoinId, request.Asset.TokenId, request.Currency, request.MaxItems)) } -func (c Controller) getChartFromRedis(request chartsNormalizedRequest) (ch watchmarket.Chart, err error) { +func (c Controller) getChartFromRedis(request controllers.ChartRequest) (ch watchmarket.Chart, err error) { key := c.getRedisKey(request) cachedChartRaw, err := c.redisCache.GetWithTime(key, request.TimeStart) if err != nil || len(cachedChartRaw) <= 0 { @@ -120,7 +118,7 @@ func (c Controller) getChartFromRedis(request chartsNormalizedRequest) (ch watch return ch, err } -func (c Controller) putChartsToRedis(chart watchmarket.Chart, request chartsNormalizedRequest) { +func (c Controller) putChartsToRedis(chart watchmarket.Chart, request controllers.ChartRequest) { key := c.getRedisKey(request) chartRaw, err := json.Marshal(&chart) if err != nil { @@ -135,8 +133,8 @@ func (c Controller) putChartsToRedis(chart watchmarket.Chart, request chartsNorm } } -func (c Controller) getChartsFromMemory(coin uint, token string) ([]models.Ticker, error) { - key := strings.ToLower(asset.BuildID(coin, token)) +func (c Controller) getChartsFromMemory(assetData controllers.Asset) ([]models.Ticker, error) { + key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) rawResult, err := c.memoryCache.Get(key) if err != nil { return nil, err @@ -158,3 +156,24 @@ func (c Controller) getChartsFromMemory(coin uint, token string) ([]models.Ticke } return []models.Ticker{result}, nil } + +func calculateChartByMaxItems(chart watchmarket.Chart, maxItems int) watchmarket.Chart { + var newPrices []watchmarket.ChartPrice + if len(chart.Prices) > maxItems && maxItems > 0 { + skip := int(float64(len(chart.Prices) / maxItems)) + i := 0 + for i < len(chart.Prices) { + newPrices = append(newPrices, chart.Prices[i]) + i += skip + 1 + } + lastPrice := chart.Prices[len(chart.Prices)-1] + if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { + newPrices = append(newPrices, lastPrice) + } + } else { + newPrices = chart.Prices + } + + chart.Prices = newPrices + return chart +} diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index d98f67bf..a368ef77 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -91,11 +91,13 @@ func TestController_HandleChartsRequest(t *testing.T) { assert.NotNil(t, c) chart, err := c.HandleChartsRequest(controllers.ChartRequest{ - CoinQuery: "60", - Token: "a", - Currency: "USD", - TimeStartRaw: "1577871126", - MaxItems: "64", + Asset: controllers.Asset{ + CoinId: 60, + TokenId: "a", + }, + Currency: "USD", + TimeStart: 1577871126, + MaxItems: 64, }) assert.Nil(t, err) @@ -212,11 +214,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/charts/models.go b/services/controllers/charts/models.go deleted file mode 100644 index c412571c..00000000 --- a/services/controllers/charts/models.go +++ /dev/null @@ -1,10 +0,0 @@ -package chartscontroller - -type ( - chartsNormalizedRequest struct { - Coin uint - Token, Currency string - TimeStart int64 - MaxItems int - } -) diff --git a/services/controllers/charts/normalization.go b/services/controllers/charts/normalization.go deleted file mode 100755 index 027a81dc..00000000 --- a/services/controllers/charts/normalization.go +++ /dev/null @@ -1,75 +0,0 @@ -package chartscontroller - -import ( - "errors" - "strconv" - "time" - - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -const charts = "charts" - -func normalizeRequest(cr controllers.ChartRequest) (chartsNormalizedRequest, error) { - if len(cr.CoinQuery) == 0 { - return chartsNormalizedRequest{}, errors.New("invalid arguments length") - } - - coinId, err := strconv.Atoi(cr.CoinQuery) - if err != nil { - return chartsNormalizedRequest{}, err - } - - if _, ok := coin.Coins[uint(coinId)]; !ok { - return chartsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) - } - var timeStart int64 - if cr.TimeStartRaw == "" { - timeStart = time.Now().Unix() - 60*60*24 - } else { - timeStart, err = strconv.ParseInt(cr.TimeStartRaw, 10, 64) - if err != nil { - return chartsNormalizedRequest{}, err - } - } - maxItems, err := strconv.Atoi(cr.MaxItems) - if err != nil || maxItems <= 0 { - maxItems = watchmarket.DefaultMaxChartItems - } - - currency := watchmarket.DefaultCurrency - if cr.Currency != "" { - currency = cr.Currency - } - - return chartsNormalizedRequest{ - Coin: uint(coinId), - Token: cr.Token, - Currency: currency, - TimeStart: timeStart, - MaxItems: maxItems, - }, nil -} - -func normalizeChart(chart watchmarket.Chart, maxItems int) watchmarket.Chart { - var newPrices []watchmarket.ChartPrice - if len(chart.Prices) > maxItems && maxItems > 0 { - skip := int(float64(len(chart.Prices) / maxItems)) - i := 0 - for i < len(chart.Prices) { - newPrices = append(newPrices, chart.Prices[i]) - i += skip + 1 - } - lastPrice := chart.Prices[len(chart.Prices)-1] - if len(newPrices) > 0 && lastPrice.Date != newPrices[len(newPrices)-1].Date { - newPrices = append(newPrices, lastPrice) - } - } else { - newPrices = chart.Prices - } - - chart.Prices = newPrices - return chart -} diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index abadfb61..58161253 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -3,9 +3,11 @@ package infocontroller import ( "encoding/json" "errors" + "fmt" + "github.com/trustwallet/watchmarket/db/models" + "strings" log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" @@ -13,73 +15,148 @@ import ( "github.com/trustwallet/watchmarket/services/markets" ) +const info = "info" + type Controller struct { database db.Instance cache cache.Provider - chartsPriority []string coinInfoPriority []string ratesPriority []string - tickersPriority []string api markets.ChartsAPIs - configuration config.Configuration } func NewController( database db.Instance, cache cache.Provider, - chartsPriority, coinInfoPriority, ratesPriority, tickersPriority []string, + coinInfoPriority []string, + ratesPriority []string, api markets.ChartsAPIs, - configuration config.Configuration, ) Controller { return Controller{ database, cache, - chartsPriority, coinInfoPriority, ratesPriority, - tickersPriority, api, - configuration, } } -func (c Controller) HandleInfoRequest(dr controllers.DetailsRequest) (controllers.InfoResponse, error) { - var cd controllers.InfoResponse +func (c Controller) HandleInfoRequest(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + result, err := c.getFromCache(request) + if err == nil { + return result, nil + } - req, err := toDetailsRequestData(dr) + result, err = c.getDetailsByPriority(request) if err != nil { - return cd, errors.New(watchmarket.ErrBadRequest) + return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) } - key := c.cache.GenerateKey(info + dr.CoinQuery + dr.Token + dr.Currency) + if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { + result.Info = nil + } - cachedDetails, err := c.cache.Get(key) - if err == nil && len(cachedDetails) > 0 { - if json.Unmarshal(cachedDetails, &cd) == nil { - return cd, nil - } + c.putToCache(request, result) + + return result, nil +} + +func (c Controller) putToCache(request controllers.DetailsRequest, result controllers.InfoResponse) { + if result.Info == nil { + return + } + key := c.getCacheKey(request) + newCache, err := json.Marshal(result) + if err != nil { + return } - result, err := c.getDetailsByPriority(req) + err = c.cache.Set(key, newCache) if err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrInternal) + log.Error("failed to save cache") } +} - if result.Info != nil && result.Vol24 == 0 && result.TotalSupply == 0 && result.CirculatingSupply == 0 { - result.Info = nil +func (c Controller) getCacheKey(request controllers.DetailsRequest) string { + return c.cache.GenerateKey(fmt.Sprintf("%s%d%s%s", info, request.Asset.CoinId, request.Asset.TokenId, request.Currency)) +} + +func (c Controller) getFromCache(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + key := c.getCacheKey(request) + + cachedDetails, err := c.cache.Get(key) + if err != nil || len(cachedDetails) <= 0 { + return controllers.InfoResponse{}, errors.New("cache is empty") } + var infoResponse controllers.InfoResponse + err = json.Unmarshal(cachedDetails, &infoResponse) + return infoResponse, err +} - newCache, err := json.Marshal(result) +func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: strings.ToLower(request.Asset.TokenId)}}) + + if err != nil || len(dbTickers) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) + } + + ticker, err := c.getTickerDataAccordingToPriority(dbTickers) if err != nil { - log.Error(err) + return controllers.InfoResponse{}, err } + result := c.getCoinDataFromApi(request.Asset, request.Currency) + result.CirculatingSupply = ticker.CirculatingSupply + result.MarketCap = ticker.MarketCap + result.Vol24 = ticker.Volume + result.TotalSupply = ticker.TotalSupply - if result.Info != nil { - err = c.cache.Set(key, newCache) + if request.Currency != watchmarket.DefaultCurrency { + rates, err := c.database.GetRates(request.Currency) + if err != nil || len(rates) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("empty db rate or db error: %w", err) + } + rate, err := c.getRateDataAccordingToPriority(rates) if err != nil { - log.WithFields(log.Fields{"err": err}).Error("failed to save cache") + return controllers.InfoResponse{}, err } + result.MarketCap *= 1 / rate + result.Vol24 *= 1 / rate } - return result, nil } + +func (c Controller) getCoinDataFromApi(assetData controllers.Asset, currency string) controllers.InfoResponse { + var result controllers.InfoResponse + + for _, p := range c.coinInfoPriority { + if data, err := c.api[p].GetCoinData(assetData, currency); err == nil { + result.Info = data.Info + result.Provider = data.Provider + result.ProviderURL = data.ProviderURL + break + } + } + return result +} + +func (c Controller) getTickerDataAccordingToPriority(tickers []models.Ticker) (models.Ticker, error) { + for _, p := range c.coinInfoPriority { + for _, t := range tickers { + if t.Provider == p && t.ShowOption != models.NeverShow { + return t, nil + } + } + } + return models.Ticker{}, errors.New("bad ticker or providers") +} + +func (c Controller) getRateDataAccordingToPriority(rates []models.Rate) (float64, error) { + for _, p := range c.ratesPriority { + for _, r := range rates { + if r.Provider == p && r.ShowOption != models.NeverShow { + return r.Rate, nil + } + } + } + return 0, errors.New("bad ticker or providers") +} diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 9823aa3a..44ee07c2 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -32,13 +32,15 @@ func TestController_HandleDetailsRequest(t *testing.T) { db := getDbMock() db.WantedTickers = []models.Ticker{{CirculatingSupply: 1, TotalSupply: 1, MarketCap: 1, Volume: 1, Provider: "coinmarketcap"}} - db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "fixer"}} + db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "coinmarketcap"}} c := setupController(t, db, getCacheMock(), cm) assert.NotNil(t, c) details, err := c.HandleInfoRequest(controllers.DetailsRequest{ - CoinQuery: "0", - Token: "2", - Currency: "RUB", + Asset: controllers.Asset{ + CoinId: 0, + TokenId: "2", + }, + Currency: "RUB", }) assert.Nil(t, err) assert.Equal(t, controllers.InfoResponse{ @@ -60,15 +62,13 @@ func setupController(t *testing.T, db dbMock, ch cache.Provider, cm chartsMock) c, _ := config.Init("../../../config.yml") assert.NotNil(t, c) - chartsPriority := []string{"coinmarketcap"} ratesPriority := []string{"coinmarketcap"} - tickerPriority := []string{"coinmarketcap"} coinInfoPriority := []string{"coinmarketcap"} chartsAPIs := make(markets.ChartsAPIs, 1) chartsAPIs[cm.GetProvider()] = cm - controller := NewController(db, ch, chartsPriority, coinInfoPriority, ratesPriority, tickerPriority, chartsAPIs, c) + controller := NewController(db, ch, coinInfoPriority, ratesPriority, chartsAPIs) assert.NotNil(t, controller) return controller @@ -120,11 +120,11 @@ type chartsMock struct { wantedDetails watchmarket.CoinDetails } -func (cm chartsMock) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { return cm.wantedCharts, nil } -func (cm chartsMock) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { return cm.wantedDetails, nil } diff --git a/services/controllers/info/models.go b/services/controllers/info/models.go deleted file mode 100644 index b92573b1..00000000 --- a/services/controllers/info/models.go +++ /dev/null @@ -1,8 +0,0 @@ -package infocontroller - -type tickerData struct { - Vol24 float64 - MarketCap float64 - CirculatingSupply float64 - TotalSupply float64 -} diff --git a/services/controllers/info/normalization.go b/services/controllers/info/normalization.go deleted file mode 100644 index b577c68b..00000000 --- a/services/controllers/info/normalization.go +++ /dev/null @@ -1,127 +0,0 @@ -package infocontroller - -import ( - "errors" - "strconv" - "strings" - - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -type ( - detailsNormalizedRequest struct { - Coin uint - Token, Currency string - } -) - -const info = "info" - -func toDetailsRequestData(dr controllers.DetailsRequest) (detailsNormalizedRequest, error) { - if len(dr.CoinQuery) == 0 { - return detailsNormalizedRequest{}, errors.New("invalid arguments length") - } - - coinId, err := strconv.Atoi(dr.CoinQuery) - if err != nil { - return detailsNormalizedRequest{}, err - } - - if _, ok := coin.Coins[uint(coinId)]; !ok { - return detailsNormalizedRequest{}, errors.New(watchmarket.ErrBadRequest) - } - - currency := watchmarket.DefaultCurrency - if dr.Currency != "" { - currency = dr.Currency - } - - return detailsNormalizedRequest{ - Coin: uint(coinId), - Token: dr.Token, - Currency: currency, - }, nil -} - -func (c Controller) getDetailsByPriority(data detailsNormalizedRequest) (controllers.InfoResponse, error) { - availableTickerProviders := c.coinInfoPriority - availableRateProviders := c.configuration.Markets.Priority.Rates - - var ( - result controllers.InfoResponse - details watchmarket.CoinDetails - ) - for _, p := range availableTickerProviders { - data, err := c.api[p].GetCoinData(data.Coin, data.Token, data.Currency) - if err == nil { - details = data - break - } - } - result.Info = details.Info - result.Provider = details.Provider - result.ProviderURL = details.ProviderURL - - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: data.Coin, TokenId: strings.ToLower(data.Token)}}) - if err != nil { - return controllers.InfoResponse{}, err - } - if len(dbTickers) == 0 { - return controllers.InfoResponse{}, errors.New("empty db ticker") - } - tickerData, err := getTickerDataAccordingToPriority(availableTickerProviders, dbTickers) - if err != nil { - return controllers.InfoResponse{}, err - } - result.CirculatingSupply = tickerData.CirculatingSupply - result.MarketCap = tickerData.MarketCap - result.Vol24 = tickerData.Vol24 - result.TotalSupply = tickerData.TotalSupply - - if data.Currency != watchmarket.DefaultCurrency { - rates, err := c.database.GetRates(data.Currency) - if err != nil { - return controllers.InfoResponse{}, err - } - if len(rates) == 0 { - return controllers.InfoResponse{}, errors.New("empty db rate") - } - rate, err := getRateDataAccordingToPriority(availableRateProviders, rates) - if err != nil { - return controllers.InfoResponse{}, err - } - result.MarketCap *= 1 / rate - result.Vol24 *= 1 / rate - } - return result, nil -} - -func getTickerDataAccordingToPriority(availableProviders []string, tickers []models.Ticker) (tickerData, error) { - for _, p := range availableProviders { - for _, t := range tickers { - if t.Provider == p && t.ShowOption != models.NeverShow { - return tickerData{ - Vol24: t.Volume, - MarketCap: t.MarketCap, - CirculatingSupply: t.CirculatingSupply, - TotalSupply: t.TotalSupply, - }, nil - } - } - } - return tickerData{}, errors.New("bad ticker or providers") -} - -func getRateDataAccordingToPriority(availableProviders []string, rates []models.Rate) (float64, error) { - for _, p := range availableProviders { - for _, r := range rates { - if r.Provider == p && r.ShowOption != models.NeverShow { - return r.Rate, nil - } - } - } - return 0, errors.New("bad ticker or providers") -} diff --git a/services/controllers/models.go b/services/controllers/models.go index 6a827d88..ba54034b 100644 --- a/services/controllers/models.go +++ b/services/controllers/models.go @@ -1,11 +1,18 @@ package controllers -import "github.com/trustwallet/watchmarket/pkg/watchmarket" +import ( + "fmt" + "github.com/pkg/errors" + "github.com/trustwallet/golibs/coin" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "strconv" + "time" +) type ( TickerRequest struct { - Currency string `json:"Currency"` - Assets []Coin `json:"assets"` + Currency string `json:"Currency"` + Assets []Asset `json:"assets"` } TickerRequestV2 struct { @@ -13,8 +20,8 @@ type ( Ids []string `json:"assets"` } - Coin struct { - Coin uint `json:"Coin"` + Asset struct { + CoinId uint `json:"Coin"` CoinType watchmarket.CoinType `json:"type"` TokenId string `json:"token_id,omitempty"` } @@ -47,11 +54,15 @@ type ( } ChartRequest struct { - CoinQuery, Token, Currency, TimeStartRaw, MaxItems string + Asset Asset + Currency string + TimeStart int64 + MaxItems int } DetailsRequest struct { - CoinQuery, Token, Currency string + Asset Asset + Currency string } InfoResponse struct { @@ -64,3 +75,38 @@ type ( Info *watchmarket.Info `json:"info,omitempty"` } ) + +func GetCoinId(rawCoinId string) (uint, error) { + coinId, err := strconv.Atoi(rawCoinId) + if err != nil { + return 0, err + } + if _, ok := coin.Coins[uint(coinId)]; !ok { + return 0, errors.New(fmt.Sprintf("invalid coin Id: %d", coinId)) + } + return uint(coinId), nil +} + +func GetCurrency(rawCurrency string) string { + currency := rawCurrency + if currency == "" { + currency = watchmarket.DefaultCurrency + } + return currency +} + +func GetTimeStart(rawTime string) int64 { + timeStart, err := strconv.ParseInt(rawTime, 10, 64) + if err != nil { + timeStart = time.Now().Unix() - int64(time.Hour)*24 + } + return timeStart +} + +func GetMaxItems(rawMax string) int { + maxItems, err := strconv.Atoi(rawMax) + if err != nil || maxItems <= 0 { + maxItems = watchmarket.DefaultMaxChartItems + } + return maxItems +} diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index 6368700c..afe7ed33 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -93,7 +93,7 @@ func TestController_HandleTickersRequest(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) + response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) wantedTicker1 := watchmarket.Ticker{ @@ -158,7 +158,7 @@ func TestController_HandleTickersRequest(t *testing.T) { err = controllerWithCache.cache.Set("USD", rateRaw) assert.Nil(t, err) - response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Coin{{Coin: 60, TokenId: "a"}, {Coin: 714, TokenId: "a"}}}) + response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) sort.Slice(response2.Tickers, func(i, j int) bool { diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go index cf20a744..9b9b11f6 100644 --- a/services/controllers/tickers/normalization.go +++ b/services/controllers/tickers/normalization.go @@ -46,11 +46,11 @@ func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Ticker return result } -func makeTickerQueries(coins []controllers.Coin) []models.TickerQuery { +func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { tickerQueries := make([]models.TickerQuery, 0, len(coins)) for _, c := range coins { tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: c.Coin, + Coin: c.CoinId, TokenId: strings.ToLower(c.TokenId), }) } @@ -105,9 +105,9 @@ func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bo return id, false } -func findTickerInAssets(assets []controllers.Coin, t watchmarket.Ticker) (watchmarket.Ticker, bool) { +func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { for _, c := range assets { - if c.Coin == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { + if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { t.TokenId = c.TokenId return t, true } diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go index 010bcaec..8c579226 100644 --- a/services/controllers/tickers/normalization_test.go +++ b/services/controllers/tickers/normalization_test.go @@ -32,7 +32,7 @@ func TestController_createResponse(t *testing.T) { tr := controllers.TickerRequest{ Currency: "EUR", - Assets: []controllers.Coin{{Coin: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, + Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, } response := createResponse(tr, watchmarket.Tickers{ticker}) @@ -273,7 +273,7 @@ func TestController_normalizeTickers_advanced(t *testing.T) { } func Test_findBestProviderForQuery(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -311,7 +311,7 @@ func Test_findBestProviderForQuery(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -320,7 +320,7 @@ func Test_findBestProviderForQuery(t *testing.T) { } func Test_findBestProviderForQuery_advanced(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -359,7 +359,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() @@ -368,7 +368,7 @@ func Test_findBestProviderForQuery_advanced(t *testing.T) { } func Test_findBestProviderForQuery_showOption(t *testing.T) { - tickerQueries := []controllers.Coin{{Coin: 60, TokenId: "A"}} + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} ticker60ACMC := models.Ticker{ Coin: 60, @@ -407,7 +407,7 @@ func Test_findBestProviderForQuery_showOption(t *testing.T) { wg := new(sync.WaitGroup) for _, q := range tickerQueries { wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) } wg.Wait() diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index 71d8fe8f..e50b4a13 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -58,7 +58,7 @@ func TestController_getTickersByPriority(t *testing.T) { assert.NotNil(t, c) tickers, err := c.getTickersByPriority(makeTickerQueries( - []controllers.Coin{{Coin: 60, TokenId: "A"}, {Coin: 714, TokenId: "A"}}, + []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, )) assert.Nil(t, err) assert.NotNil(t, tickers) @@ -98,7 +98,7 @@ func TestController_getTickersByPriority(t *testing.T) { db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Coin{{Coin: 60, TokenId: "A"}})) + tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/markets/coingecko/charts.go b/services/markets/coingecko/charts.go index 3c2e14ce..1d2414b2 100755 --- a/services/markets/coingecko/charts.go +++ b/services/markets/coingecko/charts.go @@ -2,6 +2,7 @@ package coingecko import ( "errors" + "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -13,7 +14,7 @@ import ( "github.com/trustwallet/watchmarket/pkg/watchmarket" ) -func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coins, err := p.client.fetchCoins() @@ -23,7 +24,7 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, coinID, token) + coinResult, err := getCoinByID(symbolsMap, asset) if err != nil { return chartsData, err } @@ -38,7 +39,7 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in return normalizeCharts(c), nil } -func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { coins, err := p.client.fetchCoins() if err != nil { return watchmarket.CoinDetails{}, err @@ -46,7 +47,7 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. symbolsMap := createSymbolsMap(coins) - coinResult, err := getCoinByID(symbolsMap, coinID, token) + coinResult, err := getCoinByID(symbolsMap, asset) if err != nil { return watchmarket.CoinDetails{}, err } @@ -56,9 +57,9 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. return watchmarket.CoinDetails{}, errors.New("no rates found") } - infoData, err := p.info.GetCoinInfo(coinID, token) + infoData, err := p.info.GetCoinInfo(asset) if err != nil { - log.WithFields(log.Fields{"coin": coinID, "token": token}).Warn("No assets assets about that coin") + log.WithFields(log.Fields{"coin": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coin") } return watchmarket.CoinDetails{ Info: &infoData, @@ -107,14 +108,14 @@ func createID(symbol, token string) string { return strings.ToLower(symbol) } -func getCoinByID(coinMap map[string]Coin, coinId uint, token string) (Coin, error) { +func getCoinByID(coinMap map[string]Coin, asset controllers.Asset) (Coin, error) { c := Coin{} - coinObj, ok := coin.Coins[coinId] + coinObj, ok := coin.Coins[asset.CoinId] if !ok { return c, errors.New("coin not found") } - c, ok = coinMap[createID(coinObj.Symbol, token)] + c, ok = coinMap[createID(coinObj.Symbol, asset.TokenId)] if !ok { return c, errors.New("no coin found by symbol") } diff --git a/services/markets/coingecko/charts_test.go b/services/markets/coingecko/charts_test.go index cea70471..f6adcdf9 100755 --- a/services/markets/coingecko/charts_test.go +++ b/services/markets/coingecko/charts_test.go @@ -2,6 +2,7 @@ package coingecko import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "sort" "testing" @@ -14,7 +15,7 @@ func TestProvider_GetCoinData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init(server.URL)) - data, _ := provider.GetCoinData(60, "", "USD") + data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedInfo, string(rawData)) @@ -24,7 +25,7 @@ func TestProvider_GetChartData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) - data, _ := provider.GetChartData(60, "", "USD", 1577871126) + data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/coinmarketcap/charts.go b/services/markets/coinmarketcap/charts.go index 10144c19..6022354f 100755 --- a/services/markets/coinmarketcap/charts.go +++ b/services/markets/coinmarketcap/charts.go @@ -3,6 +3,7 @@ package coinmarketcap import ( "errors" "fmt" + "github.com/trustwallet/watchmarket/services/controllers" "sort" "strings" "time" @@ -15,10 +16,10 @@ const ( chartDataSize = 3 ) -func (p Provider) GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) { +func (p Provider) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { chartsData := watchmarket.Chart{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) + coinObj, err := coinsFromCmcMap.getCoinByContract(asset) if err != nil { return chartsData, err } @@ -35,10 +36,10 @@ func (p Provider) GetChartData(coinID uint, token, currency string, timeStart in return normalizeCharts(currency, c), nil } -func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) { +func (p Provider) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { details := watchmarket.CoinDetails{} coinsFromCmcMap := CmcSlice(p.Cm).coinToCmcMap() - coinObj, err := coinsFromCmcMap.getCoinByContract(coinID, token) + coinObj, err := coinsFromCmcMap.getCoinByContract(asset) if err != nil { return details, err } @@ -46,9 +47,9 @@ func (p Provider) GetCoinData(coinID uint, token, currency string) (watchmarket. if err != nil { return details, err } - assetsData, err := p.info.GetCoinInfo(coinID, token) + assetsData, err := p.info.GetCoinInfo(asset) if err != nil { - log.WithFields(log.Fields{"coinID": coinID, "token": token}).Warn("No assets assets about that coinID") + log.WithFields(log.Fields{"coinID": asset.CoinId, "token": asset.TokenId}).Warn("No assets assets about that coinID") } return normalizeInfo(priceData, &assetsData) @@ -102,8 +103,8 @@ func (c CmcSlice) coinToCmcMap() (m CoinMapping) { return } -func (cm CoinMapping) getCoinByContract(coinId uint, contract string) (c CoinMap, err error) { - c, ok := cm[createID(coinId, contract)] +func (cm CoinMapping) getCoinByContract(asset controllers.Asset) (c CoinMap, err error) { + c, ok := cm[createID(asset.CoinId, asset.TokenId)] if !ok { err = errors.New("No coin found") } diff --git a/services/markets/coinmarketcap/charts_test.go b/services/markets/coinmarketcap/charts_test.go index 9e7ccd3f..b08ed802 100755 --- a/services/markets/coinmarketcap/charts_test.go +++ b/services/markets/coinmarketcap/charts_test.go @@ -2,6 +2,7 @@ package coinmarketcap import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "reflect" "sort" @@ -20,7 +21,7 @@ func TestProvider_GetCoinData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetCoinData(60, "", "USD") + data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) assert.JSONEq(t, wantedCoinInfo, string(rawData)) @@ -33,7 +34,7 @@ func TestProvider_GetChartData(t *testing.T) { cm, err := setupCoinMap(testMapping) assert.Nil(t, err) provider.Cm = cm - data, _ := provider.GetChartData(60, "", "USD", 1577871126) + data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) isSorted := sort.SliceIsSorted(data.Prices, func(i, j int) bool { diff --git a/services/markets/markets.go b/services/markets/markets.go index 9382ef21..6283d3fd 100755 --- a/services/markets/markets.go +++ b/services/markets/markets.go @@ -4,6 +4,7 @@ import ( "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" + "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/services/markets/binancedex" "github.com/trustwallet/watchmarket/services/markets/coingecko" "github.com/trustwallet/watchmarket/services/markets/coinmarketcap" @@ -27,8 +28,8 @@ type ( ChartsAPI interface { Provider - GetChartData(coinID uint, token, currency string, timeStart int64) (watchmarket.Chart, error) - GetCoinData(coinID uint, token, currency string) (watchmarket.CoinDetails, error) + GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) + GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) } Providers map[string]Provider From 9fe9a885c78f3c899cb69c213dedab91989862c4 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 15 Feb 2021 02:38:25 +0800 Subject: [PATCH 27/96] add_BEP20_AUTO (#377) https://coinmarketcap.com/currencies/auto/ https://bscscan.com/token/0xa184088a740c695e156f91f5cc086a06bb78b827 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 80791f1f..0863f190 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14163,5 +14163,11 @@ const Mapping = `[ "type": "token", "token_id": "0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2", "id": 8334 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xa184088a740c695E156F91f5cC086a06bb78b827", + "id": 8387 } ]` From 124adff4b90797907eaff1d6b20f716522f4e20d Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Wed, 17 Feb 2021 11:56:06 +0800 Subject: [PATCH 28/96] add_BEP20_Binance-Pegged (#379) --- services/markets/coinmarketcap/mapping.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 0863f190..f8e8afa2 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -531,6 +531,12 @@ const Mapping = `[ "token_id": "0xc5137E8e017799e71A65e0cFe3F340d719AF17D3", "id": 1027 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x250632378E573c6Be1AC2f97Fcdf00515d0Aa91B", + "id": 1027 + }, { "coin": 524, "type": "coin", @@ -3437,6 +3443,12 @@ const Mapping = `[ "type": "coin", "id": 2566 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xFd7B3A77848f1C2D67E05E54d78d174a0C850335", + "id": 2566 + }, { "coin": 60, "type": "token", @@ -6131,6 +6143,12 @@ const Mapping = `[ "token_id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "id": 3408 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + "id": 3408 + }, { "coin": 60, "type": "token", From ccac837334ea6b518f563759fe0bb60d5ca0a01a Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Wed, 17 Feb 2021 12:52:02 +0800 Subject: [PATCH 29/96] add_ERC20_CWS (#380) https://etherscan.io/token/0xac0104cca91d167873b8601d2e71eb3d4d8c33e0 https://coinmarketcap.com/currencies/crowns/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f8e8afa2..cea48210 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14182,6 +14182,12 @@ const Mapping = `[ "token_id": "0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2", "id": 8334 }, + { + "coin": 60, + "type": "token", + "token_id": "0xaC0104Cca91D167873B8601d2e71EB3D4D8c33e0", + "id": 8365 + }, { "coin": 20000714, "type": "token", From aa4b501b4c8ee8c3a30bc4f91450a9910f7469b7 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Wed, 17 Feb 2021 21:02:25 +0700 Subject: [PATCH 30/96] Remove binance dex (#375) --- config.yml | 5 +- config/config.go | 3 - config/config_test.go | 3 - seed/watchmarket_public_tickers.sql | 121 ------------------ services/controllers/charts/base_test.go | 2 +- .../controllers/tickers/normalization_test.go | 8 +- services/controllers/tickers/tickers_test.go | 12 +- services/markets/binancedex/base.go | 18 --- services/markets/binancedex/base_test.go | 38 ------ services/markets/binancedex/client.go | 21 --- services/markets/binancedex/models.go | 9 -- services/markets/binancedex/tickers.go | 82 ------------ services/markets/binancedex/tickers_test.go | 102 --------------- services/markets/markets.go | 19 ++- services/markets/markets_test.go | 3 +- services/worker/memory_test.go | 35 ++--- 16 files changed, 28 insertions(+), 453 deletions(-) delete mode 100755 services/markets/binancedex/base.go delete mode 100755 services/markets/binancedex/base_test.go delete mode 100755 services/markets/binancedex/client.go delete mode 100755 services/markets/binancedex/models.go delete mode 100755 services/markets/binancedex/tickers.go delete mode 100755 services/markets/binancedex/tickers_test.go diff --git a/config.yml b/config.yml index 8380d5ef..9fa69459 100644 --- a/config.yml +++ b/config.yml @@ -2,12 +2,9 @@ markets: priority: # for each data type: [first in queue, next, ...] charts: [coinmarketcap, coingecko] coin_info: [coinmarketcap, coingecko] - tickers: [coinmarketcap, coingecko, binancedex] + tickers: [coinmarketcap, coingecko] rates: [fixer, coinmarketcap, coingecko] - binancedex: - api: https://dex.binance.org/api - coinmarketcap: api: https://pro-api.coinmarketcap.com key: #key diff --git a/config/config.go b/config/config.go index 3cceceb5..ba34d039 100644 --- a/config/config.go +++ b/config/config.go @@ -20,9 +20,6 @@ type Configuration struct { Tickers []string `mapstructure:"tickers"` Rates []string `mapstructure:"rates"` } `mapstructure:"priority"` - BinanceDex struct { - API string `mapstructure:"api"` - } `mapstructure:"binancedex"` Coinmarketcap struct { API string `mapstructure:"api"` Key string `mapstructure:"key"` diff --git a/config/config_test.go b/config/config_test.go index 62185f39..fb8e8f87 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -11,7 +11,6 @@ func TestInit(t *testing.T) { c, _ := Init("../config.yml") assert.Equal(t, []string{"coinmarketcap", "coingecko"}, c.Markets.Priority.Charts) - assert.Equal(t, []string{"coinmarketcap", "coingecko", "binancedex"}, c.Markets.Priority.Tickers) assert.Equal(t, []string{"fixer", "coinmarketcap", "coingecko"}, c.Markets.Priority.Rates) assert.Equal(t, []string{"coinmarketcap", "coingecko"}, c.Markets.Priority.CoinInfo) @@ -24,8 +23,6 @@ func TestInit(t *testing.T) { assert.Equal(t, "https://api.coingecko.com/api", c.Markets.Coingecko.API) assert.Equal(t, "USD", c.Markets.Coingecko.Currency) - assert.Equal(t, "https://dex.binance.org/api", c.Markets.BinanceDex.API) - assert.Equal(t, "https://data.fixer.io/api", c.Markets.Fixer.API) assert.Equal(t, "", c.Markets.Fixer.Key) assert.Equal(t, "USD", c.Markets.Fixer.Currency) diff --git a/seed/watchmarket_public_tickers.sql b/seed/watchmarket_public_tickers.sql index ca00f8d3..57139d1f 100644 --- a/seed/watchmarket_public_tickers.sql +++ b/seed/watchmarket_public_tickers.sql @@ -106,7 +106,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573210', '2020-08-02 13:19:41.573210', 'c60_t0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009', 60, 'ETH', 'token', '0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009', 'USD', 'coinmarketcap', -2.9088, 0.00900137739925, 0, 0, 0, '2020-08-02 13:18:09.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573211', '2020-08-02 13:19:41.573211', 'c60_t0xeabacd844a196d7faf3ce596edebf9900341b420', 60, 'ETH', 'token', '0xeabacd844a196d7faf3ce596edebf9900341b420', 'USD', 'coingecko', -2.78296, 878.69, 438.03, 24621, 0, '2020-08-02 13:17:58.217000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573211', '2020-08-02 13:19:41.573211', 'c60_t0x7528e3040376edd5db8263db2f5bd1bed91467fb', 60, 'ETH', 'token', '0x7528e3040376edd5db8263db2f5bd1bed91467fb', 'USD', 'coingecko', 0, 0.00007693, 1.4, 0, 0, '2020-07-30 13:24:02.861000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573212', '2020-08-02 13:19:41.573212', 'c714_tbst2-2f2', 714, 'BNB', 'token', 'bst2-2f2', 'BNB', 'binancedex', -0.13, 0.0000074, 0.2667500078678131, 0, 0, '2020-08-02 13:19:35.487666'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573212', '2020-08-02 13:19:41.573212', 'c60_t0xc5e017450346e4f9a2e477519d65affcfc90586a', 60, 'ETH', 'token', '0xc5e017450346e4f9a2e477519d65affcfc90586a', 'USD', 'coingecko', 0, 0.00007155, 0.00114256, 0, 0, '2020-04-07 22:33:39.128000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573213', '2020-08-02 13:19:41.573213', 'c60_t0xda2c424fc98c741c2d4ef2f42897cefed897ca75', 60, 'ETH', 'token', '0xda2c424fc98c741c2d4ef2f42897cefed897ca75', 'USD', 'coingecko', 0, 0.00721442, 0, 0, 0, '2019-12-26 04:00:22.817000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573213', '2020-08-02 13:19:41.573213', 'c111111', 111111, 'ARC', 'coin', '', 'USD', 'coinmarketcap', 0, 0.00209743173421, 0, 60076.791590586574, 0, '2020-08-02 13:18:09.000000'); @@ -137,7 +136,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573234', '2020-08-02 13:19:41.573234', 'c60_t0x1c79ab32c66acaa1e9e81952b8aaa581b43e54e7', 60, 'ETH', 'token', '0x1c79ab32c66acaa1e9e81952b8aaa581b43e54e7', 'USD', 'coinmarketcap', -16.0933, 0.022304431302, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573234', '2020-08-02 13:19:41.573234', 'c60_t0xb5b8f5616fe42d5ceca3e87f3fddbdd8f496d760', 60, 'ETH', 'token', '0xb5b8f5616fe42d5ceca3e87f3fddbdd8f496d760', 'USD', 'coingecko', -1.40013, 0.00048379, 509.63, 0, 0, '2020-08-02 03:03:55.432000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573235', '2020-08-02 13:19:41.573235', 'c60_t0x974c98bc2e82fa18de92b7e697a1d9bd25682e80', 60, 'ETH', 'token', '0x974c98bc2e82fa18de92b7e697a1d9bd25682e80', 'USD', 'coingecko', -30.88214, 108.1, 353800, 0, 0, '2020-08-02 13:09:03.143000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573235', '2020-08-02 13:19:41.573235', 'c714_tzebi-84f', 714, 'BNB', 'token', 'zebi-84f', 'BNB', 'binancedex', 13.52, 0.00011003, 1.9145634174346924, 0, 0, '2020-08-02 13:19:35.487585'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573236', '2020-08-02 13:19:41.573236', 'c111111', 111111, 'SOVE', 'coin', '', 'USD', 'coinmarketcap', 15.4676, 0.000856122727428, 90.1392425911055, 7061.3848587402845, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573236', '2020-08-02 13:19:41.573236', 'c111111', 111111, 'OTO', 'coin', '', 'USD', 'coinmarketcap', -7.01691, 0.264821129697, 10397.4283579621, 5644891.0771389315, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573236', '2020-08-02 13:19:41.573237', 'c60_t0x3b3ac5386837dc563660fb6a0937dfaa5924333b', 60, 'ETH', 'token', '0x3b3ac5386837dc563660fb6a0937dfaa5924333b', 'USD', 'coingecko', 0.03371, 1.04, 0, 0, 0, '2020-08-02 13:01:11.264000'); @@ -280,7 +278,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573349', '2020-08-02 13:19:41.573349', 'c60_t0x2e98a6804e4b6c832ed0ca876a943abd3400b224', 60, 'ETH', 'token', '0x2e98a6804e4b6c832ed0ca876a943abd3400b224', 'USD', 'coinmarketcap', -14.049, 0.000996100537008, 0, 0, 0, '2020-08-02 13:18:08.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573349', '2020-08-02 13:19:41.573349', 'c60_t0x94501b6a153c8973fd1f321fcc8188d40dc5d72d', 60, 'ETH', 'token', '0x94501b6a153c8973fd1f321fcc8188d40dc5d72d', 'USD', 'coinmarketcap', -4.37904, 22.0547190031, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573349', '2020-08-02 13:19:41.573350', 'c60_t0x36b60a425b82483004487abc7adcb0002918fc56', 60, 'ETH', 'token', '0x36b60a425b82483004487abc7adcb0002918fc56', 'USD', 'coingecko', 0.22006, 0.00326616, 0.625335, 0, 0, '2020-08-01 23:19:16.421000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359428', '2020-08-02 13:19:42.359428', 'c714_tarpa-575', 714, 'BNB', 'token', 'arpa-575', 'BNB', 'binancedex', -60.88, 0.0015, 1.4972003698349, 0, 0, '2020-08-02 13:19:35.487677'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573350', '2020-08-02 13:19:41.573350', 'c60_t0xce53a179047ebed80261689367c093c90a94cc08', 60, 'ETH', 'token', '0xce53a179047ebed80261689367c093c90a94cc08', 'USD', 'coingecko', 0, 0.00007888, 0.473286, 0, 0, '2020-01-23 12:55:10.877000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573350', '2020-08-02 13:19:41.573351', 'c60_t0x786001c9c5ca6e502deb8a8a72480d2147891f32', 60, 'ETH', 'token', '0x786001c9c5ca6e502deb8a8a72480d2147891f32', 'USD', 'coingecko', -1.93672, 0.00079254, 481541, 1444632, 0, '2020-08-02 13:15:20.397000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573351', '2020-08-02 13:19:41.573351', 'c714_tebst-783', 714, 'BNB', 'token', 'ebst-783', 'USD', 'coinmarketcap', -47.7208, 0.000938613047899, 0, 0, 0, '2020-08-02 13:18:10.000000'); @@ -445,7 +442,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573603', '2020-08-02 13:19:41.573603', 'c195', 195, 'TRX', 'coin', '', 'USD', 'coingecko', -4.16555, 0.01894837, 791525632, 1245726384, 0, '2020-08-02 13:16:39.914000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573604', '2020-08-02 13:19:41.573604', 'c60_t0x5362c0d267d2d5946a9291d4739c05faec636c2c', 60, 'ETH', 'token', '0x5362c0d267d2d5946a9291d4739c05faec636c2c', 'USD', 'coingecko', 0, 0.00000402, 0.302151, 0, 0, '2020-07-31 11:04:36.035000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573604', '2020-08-02 13:19:41.573604', 'c60_t0xd2299b3098cf5e13144caebfdad61ebe505233dc', 60, 'ETH', 'token', '0xd2299b3098cf5e13144caebfdad61ebe505233dc', 'USD', 'coingecko', 0, 0.0000498, 49.75, 0, 0, '2020-05-28 21:44:35.920000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573605', '2020-08-02 13:19:41.573605', 'c714_taergo-46b', 714, 'BNB', 'token', 'aergo-46b', 'BNB', 'binancedex', -2.5, 0.00195, 31.920961380004883, 0, 0, '2020-08-02 13:19:35.487561'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573605', '2020-08-02 13:19:41.573605', 'c111111_tgdstrshxhgj7zivrbxeye5q74xuvcusekebr7ucheuuek72n7i7kj6jh', 111111, 'XLM', 'token', 'gdstrshxhgj7zivrbxeye5q74xuvcusekebr7ucheuuek72n7i7kj6jh', 'USD', 'coinmarketcap', -0.0000000000000426326, 0.000357429564237, 0, 1166520.8818639247, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573606', '2020-08-02 13:19:41.573606', 'c60_t0xe884cc2795b9c45beeac0607da9539fd571ccf85', 60, 'ETH', 'token', '0xe884cc2795b9c45beeac0607da9539fd571ccf85', 'USD', 'coingecko', -0.96396, 0.01544727, 798653, 21174051, 0, '2020-08-02 13:16:44.737000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573606', '2020-08-02 13:19:41.573606', 'c60_t0x7ef55a013d0632c24955553367c8d5cc082ddbff', 60, 'ETH', 'token', '0x7ef55a013d0632c24955553367c8d5cc082ddbff', 'USD', 'coingecko', -1.63631, 0.402076, 60.26, 0, 0, '2020-08-02 10:28:39.642000'); @@ -454,7 +450,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573608', '2020-08-02 13:19:41.573608', 'c60_t0x29257908879c5792f1bb25449a7209205434dc3f', 60, 'ETH', 'token', '0x29257908879c5792f1bb25449a7209205434dc3f', 'USD', 'coingecko', -4.57395, 0.00254302, 295.76, 0, 0, '2020-08-02 13:15:00.557000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573609', '2020-08-02 13:19:41.573609', 'c60_t0xa38920c00d1a5303db538a3ea08da7a779e1f751', 60, 'ETH', 'token', '0xa38920c00d1a5303db538a3ea08da7a779e1f751', 'USD', 'coingecko', -7.12739, 17.18, 125922, 0, 0, '2020-08-02 13:09:47.775000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573609', '2020-08-02 13:19:41.573609', 'c60_t0x2aec18c5500f21359ce1bea5dc1777344df4c0dc', 60, 'ETH', 'token', '0x2aec18c5500f21359ce1bea5dc1777344df4c0dc', 'USD', 'coingecko', -33.01234, 0.00912816, 4178.1, 8643222, 0, '2020-08-02 13:18:38.866000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573610', '2020-08-02 13:19:41.573610', 'c714_tphb-2df', 714, 'BNB', 'token', 'phb-2df', 'BNB', 'binancedex', 0, 0.00018, 0, 0, 0, '2020-08-02 13:19:35.487545'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573610', '2020-08-02 13:19:41.573610', 'c60_t0x4760e7a401558aa59639161454bb2a41a3c5a90b', 60, 'ETH', 'token', '0x4760e7a401558aa59639161454bb2a41a3c5a90b', 'USD', 'coingecko', -0.33892, 1.12, 1751734, 0, 0, '2020-08-02 13:01:02.638000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573611', '2020-08-02 13:19:41.573611', 'c60_t0x229a569b673d908cee8920658ae7bcad68e7d01d', 60, 'ETH', 'token', '0x229a569b673d908cee8920658ae7bcad68e7d01d', 'USD', 'coingecko', 0, 0.00004249, 4508.73, 0, 0, '2020-01-08 08:32:26.815000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573611', '2020-08-02 13:19:41.573611', 'c60_t0x0074d43246adc737101eca26bc8681c481d10ae8', 60, 'ETH', 'token', '0x0074d43246adc737101eca26bc8681c481d10ae8', 'USD', 'coingecko', 0, 0.407367, 259.64, 0, 0, '2020-02-28 11:34:20.175000'); @@ -469,7 +464,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573616', '2020-08-02 13:19:41.573616', 'c60_t0x0b7b59cf63fc99130a77aa17cf9a4811a90a23a0', 60, 'ETH', 'token', '0x0b7b59cf63fc99130a77aa17cf9a4811a90a23a0', 'USD', 'coingecko', 0, 0.00001055, 0, 0, 0, '2020-02-06 16:45:27.161000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573616', '2020-08-02 13:19:41.573616', 'c60_t0x512630dc263fd4c71dbe81fec68cf61156d79e80', 60, 'ETH', 'token', '0x512630dc263fd4c71dbe81fec68cf61156d79e80', 'USD', 'coingecko', 0, 0.00027475, 0.00005495, 0, 0, '2020-07-13 16:41:55.082000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573617', '2020-08-02 13:19:41.573617', 'c60_t0x69b148395ce0015c13e36bffbad63f49ef874e03', 60, 'ETH', 'token', '0x69b148395ce0015c13e36bffbad63f49ef874e03', 'USD', 'coingecko', -7.68603, 0.00030014, 281700, 3370405, 0, '2020-08-02 13:18:33.701000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573617', '2020-08-02 13:19:41.573618', 'c714_tthkdb-888', 714, 'BNB', 'token', 'thkdb-888', 'BNB', 'binancedex', 0, 0.010526315789473684, 0, 0, 0, '2020-08-02 13:19:35.487670'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573618', '2020-08-02 13:19:41.573618', 'c60_t0xd6940a1ffd9f3b025d1f1055abcfd9f7cda81ef9', 60, 'ETH', 'token', '0xd6940a1ffd9f3b025d1f1055abcfd9f7cda81ef9', 'USD', 'coingecko', -30.92637, 0.00787281, 1071.71, 0, 0, '2020-08-02 13:12:12.028000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573618', '2020-08-02 13:19:41.573619', 'c60_t0x75b5f145002ba88cdfdb7897e0550781e3909a08', 60, 'ETH', 'token', '0x75b5f145002ba88cdfdb7897e0550781e3909a08', 'USD', 'coingecko', 0, 0.00498967, 0, 0, 0, '2019-12-26 04:00:28.441000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573619', '2020-08-02 13:19:41.573619', 'c60_t0xb647a1d7633c6c4d434e22ee9756b36f2b219525', 60, 'ETH', 'token', '0xb647a1d7633c6c4d434e22ee9756b36f2b219525', 'USD', 'coingecko', 2.24061, 553.01, 7784.68, 0, 0, '2020-08-02 13:09:53.518000'); @@ -548,7 +542,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573701', '2020-08-02 13:19:41.573778', 'c111111', 111111, 'MRL', 'coin', '', 'USD', 'coinmarketcap', -31.5571, 0.00106591922573, 547.740480265405, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573779', '2020-08-02 13:19:41.573779', 'c60_t0x931a9350333c79d9da373ee857ca97273c5a595f', 60, 'ETH', 'token', '0x931a9350333c79d9da373ee857ca97273c5a595f', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573779', '2020-08-02 13:19:41.573780', 'c60_t0x49c67ae22c334d0123dd6dbdc44f5302e130a88b', 60, 'ETH', 'token', '0x49c67ae22c334d0123dd6dbdc44f5302e130a88b', 'USD', 'coingecko', 0, 0.0004811, 0.481096, 0, 0, '2019-12-26 04:00:40.475000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573780', '2020-08-02 13:19:41.573780', 'c714_tethbear-b2b', 714, 'BNB', 'token', 'ethbear-b2b', 'BNB', 'binancedex', -17.9, 0.0078921, 98.183837890625, 0, 0, '2020-08-02 13:19:35.487601'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573781', '2020-08-02 13:19:41.573781', 'c60_t0xc3e2de0b661cf58f66bde8e896905399ded58af5', 60, 'ETH', 'token', '0xc3e2de0b661cf58f66bde8e896905399ded58af5', 'USD', 'coinmarketcap', -7.1757, 0.00753064641626, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573782', '2020-08-02 13:19:41.573782', 'c60_t0x42f1d3380cc1526eb182343dc3bdd970ce664322', 60, 'ETH', 'token', '0x42f1d3380cc1526eb182343dc3bdd970ce664322', 'USD', 'coingecko', 0, 0.00000127, 0.0000726, 0, 0, '2020-07-01 17:32:43.847000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573782', '2020-08-02 13:19:41.573782', 'c60_t0x467bccd9d29f223bce8043b84e8c8b282827790f', 60, 'ETH', 'token', '0x467bccd9d29f223bce8043b84e8c8b282827790f', 'USD', 'coinmarketcap', -11.3831, 0.000172588940254, 0, 0, 0, '2020-08-02 13:18:12.000000'); @@ -578,7 +571,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573795', '2020-08-02 13:19:41.573796', 'c60_t0x1062fdf250b44697216d07e41df93824519f47aa', 60, 'ETH', 'token', '0x1062fdf250b44697216d07e41df93824519f47aa', 'USD', 'coingecko', 0, 2.15, 0.0214947, 0, 0, '2020-07-21 20:19:48.535000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573796', '2020-08-02 13:19:41.573796', 'c60_t0x16c4672c614fa107972427db6f5fb165583b8fbc', 60, 'ETH', 'token', '0x16c4672c614fa107972427db6f5fb165583b8fbc', 'USD', 'coingecko', 0, 0.00014009, 0, 0, 0, '2020-05-05 11:19:16.214000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573796', '2020-08-02 13:19:41.573797', 'c60_t0xecc3a47f5d0ac33db287d8f9debf03830853cbb9', 60, 'ETH', 'token', '0xecc3a47f5d0ac33db287d8f9debf03830853cbb9', 'USD', 'coingecko', 0, 0.00275994, 4.64, 0, 0, '2019-12-26 04:00:32.815000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573797', '2020-08-02 13:19:41.573797', 'c714_tmith-c76', 714, 'BNB', 'token', 'mith-c76', 'BNB', 'binancedex', -2.08, 0.0004205, 60.941158294677734, 0, 0, '2020-08-02 13:19:35.487605'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573797', '2020-08-02 13:19:41.573797', 'c60_t0xdc5864ede28bd4405aa04d93e05a0531797d9d59', 60, 'ETH', 'token', '0xdc5864ede28bd4405aa04d93e05a0531797d9d59', 'USD', 'coinmarketcap', -11.8842, 0.00013221498278, 0, 0, 0, '2020-08-02 13:18:26.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573798', '2020-08-02 13:19:41.573798', 'c111111', 111111, 'NBTC', 'coin', '', 'USD', 'coinmarketcap', 4.66258, 5.53348042354, 23134.7499986235, 0, 0, '2020-08-02 13:18:26.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573798', '2020-08-02 13:19:41.573798', 'c60_t0xf3db7560e820834658b590c96234c333cd3d5e5e', 60, 'ETH', 'token', '0xf3db7560e820834658b590c96234c333cd3d5e5e', 'USD', 'coingecko', -5.37599, 0.00379829, 11308.78, 1164857, 0, '2020-08-02 13:17:41.539000'); @@ -650,7 +642,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573848', '2020-08-02 13:19:41.573849', 'c60_t0x0c2c5e2b677dea43025b5da5061fece445f0295b', 60, 'ETH', 'token', '0x0c2c5e2b677dea43025b5da5061fece445f0295b', 'USD', 'coingecko', 0, 0.0000148, 2.77, 0, 0, '2020-05-28 06:24:33.576000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573849', '2020-08-02 13:19:41.573849', 'c60_t0x5d21ef5f25a985380b65c8e943a0082feda0db84', 60, 'ETH', 'token', '0x5d21ef5f25a985380b65c8e943a0082feda0db84', 'USD', 'coingecko', -5.69792, 0.00519887, 87.1, 71553, 0, '2020-08-02 13:17:45.111000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573849', '2020-08-02 13:19:41.573849', 'c60_t0xfab25d4469444f28023075db5932497d70094601', 60, 'ETH', 'token', '0xfab25d4469444f28023075db5932497d70094601', 'USD', 'coingecko', 3.81838, 0.01180756, 132.19, 0, 0, '2020-08-01 21:28:28.674000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573850', '2020-08-02 13:19:41.573850', 'c714_tbcpt-95a', 714, 'BNB', 'token', 'bcpt-95a', 'BNB', 'binancedex', 0, 0.00120001, 0.5112212300300598, 0, 0, '2020-08-02 13:19:35.487547'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573851', '2020-08-02 13:19:41.573851', 'c60_t0xcbcc0f036ed4788f63fc0fee32873d6a7487b908', 60, 'ETH', 'token', '0xcbcc0f036ed4788f63fc0fee32873d6a7487b908', 'USD', 'coinmarketcap', -4.16256, 0.00566896293593, 0, 0, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573851', '2020-08-02 13:19:41.573851', 'c60_t0xa974c709cfb4566686553a20790685a47aceaa33', 60, 'ETH', 'token', '0xa974c709cfb4566686553a20790685a47aceaa33', 'USD', 'coinmarketcap', -6.0318, 173.985411225, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573852', '2020-08-02 13:19:41.573852', 'c60_t0x016396044709eb3edc69c44f4d5fa6996917e4e8', 60, 'ETH', 'token', '0x016396044709eb3edc69c44f4d5fa6996917e4e8', 'USD', 'coingecko', -44.56056, 0.00000147, 33.64, 0, 0, '2020-08-02 13:08:52.935000'); @@ -692,7 +683,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573912', '2020-08-02 13:19:41.573912', 'c111111', 111111, 'BTB', 'coin', '', 'USD', 'coinmarketcap', 0.304732, 2.27066651303, 352.655007529121, 106270.93428238553, 0, '2020-08-02 13:18:06.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573913', '2020-08-02 13:19:41.573913', 'c60_t0x7ba19b7f7d106a9a1e0985397b94f38eee0b555e', 60, 'ETH', 'token', '0x7ba19b7f7d106a9a1e0985397b94f38eee0b555e', 'USD', 'coingecko', -4.78716, 0.00351958, 3.96, 0, 0, '2020-08-02 07:34:17.077000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573913', '2020-08-02 13:19:41.573913', 'c60_t0xdfc3e857c8ccea7657e0ed98ab92e048e38dee0f', 60, 'ETH', 'token', '0xdfc3e857c8ccea7657e0ed98ab92e048e38dee0f', 'USD', 'coingecko', 0, 0.00238896, 7.39, 0, 0, '2020-07-22 12:15:55.140000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573913', '2020-08-02 13:19:41.573914', 'c714_tgmat-fc8', 714, 'BNB', 'token', 'gmat-fc8', 'BNB', 'binancedex', 118.58, 0.00008999, 0.7962369918823242, 0, 0, '2020-08-02 13:19:35.487586'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573914', '2020-08-02 13:19:41.573914', 'c60_t0x8db54ca569d3019a2ba126d03c37c44b5ef81ef6', 60, 'ETH', 'token', '0x8db54ca569d3019a2ba126d03c37c44b5ef81ef6', 'USD', 'coinmarketcap', 61.1227, 0.00180339822489, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573914', '2020-08-02 13:19:41.573915', 'c60_t0x98e0438d3ee1404fea48e38e92853bb08cfa68bd', 60, 'ETH', 'token', '0x98e0438d3ee1404fea48e38e92853bb08cfa68bd', 'USD', 'coingecko', 1.89318, 0.00000005, 20.55, 0, 0, '2020-08-02 13:14:28.640000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573915', '2020-08-02 13:19:41.573915', 'c60_t0x2adba23cf1252de095aced801e758b369ec10426', 60, 'ETH', 'token', '0x2adba23cf1252de095aced801e758b369ec10426', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2019-12-26 04:00:36.026000'); @@ -752,7 +742,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573941', '2020-08-02 13:19:41.573941', 'c60_t0xa31f7a32db329f270a0e6b59558823e64d8ef0a6', 60, 'ETH', 'token', '0xa31f7a32db329f270a0e6b59558823e64d8ef0a6', 'USD', 'coingecko', 0, 29.25, 0, 0, 0, '2020-07-29 19:34:18.996000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573941', '2020-08-02 13:19:41.573942', 'c60_t0x7105ec15995a97496ec25de36cf7eec47b703375', 60, 'ETH', 'token', '0x7105ec15995a97496ec25de36cf7eec47b703375', 'USD', 'coingecko', 9.38368, 0.13906, 240.16, 0, 0, '2020-08-02 06:54:01.954000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573942', '2020-08-02 13:19:41.573942', 'c60_t0x284da39fec424ad0e1dc5a004b881de309c24a32', 60, 'ETH', 'token', '0x284da39fec424ad0e1dc5a004b881de309c24a32', 'USD', 'coingecko', 0, 0.0041473, 0.553411, 0, 0, '2020-07-14 06:01:53.148000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573942', '2020-08-02 13:19:41.573942', 'c714_ttroy-9b8', 714, 'BNB', 'token', 'troy-9b8', 'BNB', 'binancedex', -19.66, 0.000241, 23.789812088012695, 0, 0, '2020-08-02 13:19:35.487566'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573943', '2020-08-02 13:19:41.573943', 'c60_t0xebbdf302c940c6bfd49c6b165f457fdb324649bc', 60, 'ETH', 'token', '0xebbdf302c940c6bfd49c6b165f457fdb324649bc', 'USD', 'coinmarketcap', -7.76578, 0.000305631769161, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573943', '2020-08-02 13:19:41.573943', 'c60_t0x7b2df125567815ac9b57da04b620f50bc93b320c', 60, 'ETH', 'token', '0x7b2df125567815ac9b57da04b620f50bc93b320c', 'USD', 'coingecko', 0, 0.0000022, 10.98, 15464, 0, '2020-07-29 03:48:38.157000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.573944', '2020-08-02 13:19:41.573944', 'c60_t0x491604c0fdf08347dd1fa4ee062a822a5dd06b5d', 60, 'ETH', 'token', '0x491604c0fdf08347dd1fa4ee062a822a5dd06b5d', 'USD', 'coinmarketcap', 1.74222, 0.055640902973, 0, 0, 0, '2020-08-02 13:18:21.000000'); @@ -906,7 +895,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574061', '2020-08-02 13:19:41.574061', 'c714_tlyfe-6ab', 714, 'BNB', 'token', 'lyfe-6ab', 'USD', 'coinmarketcap', -1.06645, 0.0136734228795, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574061', '2020-08-02 13:19:41.574062', 'c60_t0xc175e77b04f2341517334ea3ed0b198a01a97383', 60, 'ETH', 'token', '0xc175e77b04f2341517334ea3ed0b198a01a97383', 'USD', 'coingecko', -14.04493, 2.82, 851706, 0, 0, '2020-08-02 13:19:18.491000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574062', '2020-08-02 13:19:41.574062', 'c60_t0x621d78f2ef2fd937bfca696cabaf9a779f59b3ed', 60, 'ETH', 'token', '0x621d78f2ef2fd937bfca696cabaf9a779f59b3ed', 'USD', 'coingecko', 0, 0.00003482, 0, 0, 0, '2020-07-03 04:04:12.368000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574062', '2020-08-02 13:19:41.574063', 'c714_tgtex-71b', 714, 'BNB', 'token', 'gtex-71b', 'BNB', 'binancedex', 38.19, 0.00000767, 2.0687499046325684, 0, 0, '2020-08-02 13:19:35.487668'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574063', '2020-08-02 13:19:41.574063', 'c60_t0xba50933c268f567bdc86e1ac131be072c6b0b71a', 60, 'ETH', 'token', '0xba50933c268f567bdc86e1ac131be072c6b0b71a', 'USD', 'coinmarketcap', -3.80697, 0.021690212676, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574063', '2020-08-02 13:19:41.574064', 'c111111', 111111, 'GCC', 'coin', '', 'USD', 'coinmarketcap', -8.03604, 0.00287762377358, 929.996206392354, 3647338.7176869283, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574064', '2020-08-02 13:19:41.574064', 'c60_t0x2fc246aa66f0da5bb1368f688548ecbbe9bdee5d', 60, 'ETH', 'token', '0x2fc246aa66f0da5bb1368f688548ecbbe9bdee5d', 'USD', 'coinmarketcap', 10.8689, 0.000333558448036, 0, 0, 0, '2020-08-02 13:18:15.000000'); @@ -924,10 +912,8 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574070', '2020-08-02 13:19:41.574070', 'c60_t0xd2e46fcde7ad104c86266f3bd5f50f8a852c8415', 60, 'ETH', 'token', '0xd2e46fcde7ad104c86266f3bd5f50f8a852c8415', 'USD', 'coingecko', 0, 0.00015916, 246386, 0, 0, '2019-12-26 04:00:44.730000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574070', '2020-08-02 13:19:41.574070', 'c60_t0x827d53c8170af52625f414bde00326fc8a085e86', 60, 'ETH', 'token', '0x827d53c8170af52625f414bde00326fc8a085e86', 'USD', 'coingecko', -2.77322, 0.00621116, 10877.12, 2132627, 0, '2020-08-02 13:11:19.473000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574071', '2020-08-02 13:19:41.574071', 'c60_t0x347a29ea126a746c70e1ead570fddf438e66231a', 60, 'ETH', 'token', '0x347a29ea126a746c70e1ead570fddf438e66231a', 'USD', 'coingecko', 0, 0.00136761, 32418, 0, 0, '2019-12-24 21:29:09.057000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574071', '2020-08-02 13:19:41.574071', 'c714_tcos-2e4', 714, 'BNB', 'token', 'cos-2e4', 'BNB', 'binancedex', -3.13, 0.00038799, 29.177539825439453, 0, 0, '2020-08-02 13:19:35.487557'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574072', '2020-08-02 13:19:41.574072', 'c111111', 111111, 'RSTR', 'coin', '', 'USD', 'coinmarketcap', -4.50054, 0.000110677837445, 3.56322988966906, 4179953.040548832, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574072', '2020-08-02 13:19:41.574072', 'c60_t0xb38018c51987dc57a815ab21f5dd94004c259686', 60, 'ETH', 'token', '0xb38018c51987dc57a815ab21f5dd94004c259686', 'USD', 'coingecko', 0, 1.57, 0, 0, 0, '2020-04-23 10:48:30.012000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574072', '2020-08-02 13:19:41.574073', 'c714_tgto-908', 714, 'BNB', 'token', 'gto-908', 'BNB', 'binancedex', -11.11, 0.0004, 77.07099914550781, 0, 0, '2020-08-02 13:19:35.487647'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574073', '2020-08-02 13:19:41.574073', 'c60_t0xeaf61fc150cd5c3bea75744e830d916e60ea5a9f', 60, 'ETH', 'token', '0xeaf61fc150cd5c3bea75744e830d916e60ea5a9f', 'USD', 'coingecko', -60.05846, 0.00023862, 0.03400315, 166603, 0, '2020-08-02 03:01:03.395000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574073', '2020-08-02 13:19:41.574074', 'c111111', 111111, 'NANOX', 'coin', '', 'USD', 'coinmarketcap', 2.60093, 20727.7453968, 2.09324993960281, 1622.2362657351553, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574074', '2020-08-02 13:19:41.574074', 'c60_t0x13c2b7f851e756415cf7d51d04dcf4f94a5b382e', 60, 'ETH', 'token', '0x13c2b7f851e756415cf7d51d04dcf4f94a5b382e', 'USD', 'coingecko', -1.58874, 0.00795211, 71337, 0, 0, '2020-08-02 13:14:27.711000'); @@ -1006,7 +992,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574109', '2020-08-02 13:19:41.574109', 'c60_t0xd67b1db49801b6f4c96a01a4f7964233150dc58b', 60, 'ETH', 'token', '0xd67b1db49801b6f4c96a01a4f7964233150dc58b', 'USD', 'coingecko', -10.46934, 0.00480995, 2133642, 0, 0, '2020-08-02 13:18:26.180000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574110', '2020-08-02 13:19:41.574110', 'c60_t0xf29e46887ffae92f1ff87dfe39713875da541373', 60, 'ETH', 'token', '0xf29e46887ffae92f1ff87dfe39713875da541373', 'USD', 'coingecko', 27.18149, 0.050654, 1311163, 6512621, 0, '2020-08-02 13:17:30.363000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574110', '2020-08-02 13:19:41.574110', 'c60_t0x379e2768e0631493dfcc9a560171e66f93cbcc69', 60, 'ETH', 'token', '0x379e2768e0631493dfcc9a560171e66f93cbcc69', 'USD', 'coingecko', 0, 0.115446, 1.15, 0, 0, '2019-12-26 04:00:53.107000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574111', '2020-08-02 13:19:41.574111', 'c714_tcas-167', 714, 'BNB', 'token', 'cas-167', 'BNB', 'binancedex', 3.05, 0.0001989, 154.5921630859375, 0, 0, '2020-08-02 13:19:35.487677'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574111', '2020-08-02 13:19:41.574111', 'c111111_t0x7458fd786b2fe8cd801c0381f88b61c5071a006f', 111111, 'ETH', 'token', '0x7458fd786b2fe8cd801c0381f88b61c5071a006f', 'USD', 'coinmarketcap', -12.1016, 0.0341934917716, 94216.929568367, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574112', '2020-08-02 13:19:41.574112', 'c60_t0x0cc9fccff81252f4bd8c5c6b359b14ae2ed851cf', 60, 'ETH', 'token', '0x0cc9fccff81252f4bd8c5c6b359b14ae2ed851cf', 'USD', 'coingecko', -35.55074, 0.00004882, 44.56, 0, 0, '2020-08-02 13:11:21.906000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574112', '2020-08-02 13:19:41.574112', 'c60_t0x61d71973a6ffd07d5f1095aed53b06e5673e64bc', 60, 'ETH', 'token', '0x61d71973a6ffd07d5f1095aed53b06e5673e64bc', 'USD', 'coingecko', -30.93063, 0.00576755, 263.92, 0, 0, '2020-08-02 10:07:53.875000'); @@ -1196,7 +1181,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574266', '2020-08-02 13:19:41.574266', 'c60_t0x86807da5b92d31f67e128771cacb85f3579646ea', 60, 'ETH', 'token', '0x86807da5b92d31f67e128771cacb85f3579646ea', 'USD', 'coinmarketcap', 9.47677, 2.54141479439, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574266', '2020-08-02 13:19:41.574266', 'c60_t0x8633e144f2d9b9b8bdd12ddb58e4bef1e163a0ce', 60, 'ETH', 'token', '0x8633e144f2d9b9b8bdd12ddb58e4bef1e163a0ce', 'USD', 'coingecko', 0, 0.00045428, 0.00000045, 5042.02, 0, '2020-07-03 14:14:32.580000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574266', '2020-08-02 13:19:41.574267', 'c60_t0xde4c5a791913838027a2185709e98c5c6027ea63', 60, 'ETH', 'token', '0xde4c5a791913838027a2185709e98c5c6027ea63', 'USD', 'coingecko', 1.02484, 1.1, 0.005472, 0, 0, '2020-08-01 17:54:17.762000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574267', '2020-08-02 13:19:41.574267', 'c714_tvidt-f53', 714, 'BNB', 'token', 'vidt-f53', 'BNB', 'binancedex', -15.69, 0.019348, 183.66757202148438, 0, 0, '2020-08-02 13:19:35.487557'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574267', '2020-08-02 13:19:41.574268', 'c111111', 111111, 'CHESS', 'coin', '', 'USD', 'coinmarketcap', -0.0000000000000284217, 0.000677313580083, 0, 36597.127977656615, 0, '2020-08-02 13:18:09.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574268', '2020-08-02 13:19:41.574268', 'c60_t0xed0849bf46cfb9845a2d900a0a4e593f2dd3673c', 60, 'ETH', 'token', '0xed0849bf46cfb9845a2d900a0a4e593f2dd3673c', 'USD', 'coinmarketcap', 0.403433, 1.40246373495, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574268', '2020-08-02 13:19:41.574268', 'c60_t0x9746953f5b1324a78132895cfd263f417b0faae3', 60, 'ETH', 'token', '0x9746953f5b1324a78132895cfd263f417b0faae3', 'USD', 'coingecko', -0.77421, 0.00336904, 120.38, 0, 0, '2020-08-02 10:29:56.407000'); @@ -1254,7 +1238,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574293', '2020-08-02 13:19:41.574293', 'c60_t0x2f8472dd7ecf7ca760c8f6b45db20ca7cf52f8d7', 60, 'ETH', 'token', '0x2f8472dd7ecf7ca760c8f6b45db20ca7cf52f8d7', 'USD', 'coinmarketcap', 15.4492, 0.0000140727444162, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574294', '2020-08-02 13:19:41.574294', 'c60_t0x8a1e3930fde1f151471c368fdbb39f3f63a65b55', 60, 'ETH', 'token', '0x8a1e3930fde1f151471c368fdbb39f3f63a65b55', 'USD', 'coinmarketcap', -4.50126, 0.0024349124238, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574294', '2020-08-02 13:19:41.574294', 'c60_t0xab6257fab118222751b339cc199145b29661ed7c', 60, 'ETH', 'token', '0xab6257fab118222751b339cc199145b29661ed7c', 'USD', 'coingecko', 4.03846, 0.185936, 100794, 0, 0, '2020-08-02 13:14:29.785000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574295', '2020-08-02 13:19:41.574295', 'c714_tcrpt-8c9', 714, 'BNB', 'token', 'crpt-8c9', 'BNB', 'binancedex', -22.82, 0.012, 35.91252136230469, 0, 0, '2020-08-02 13:19:35.487626'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574295', '2020-08-02 13:19:41.574295', 'c60_t0x6ba460ab75cd2c56343b3517ffeba60748654d26', 60, 'ETH', 'token', '0x6ba460ab75cd2c56343b3517ffeba60748654d26', 'USD', 'coinmarketcap', 0.0000000000000852651, 0.00159819678581, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574296', '2020-08-02 13:19:41.574296', 'c60_t0xd31695a1d35e489252ce57b129fd4b1b05e6acac', 60, 'ETH', 'token', '0xd31695a1d35e489252ce57b129fd4b1b05e6acac', 'USD', 'coingecko', 1.56372, 0.01557216, 417.74, 387542, 0, '2020-08-02 13:19:14.533000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574296', '2020-08-02 13:19:41.574296', 'c60_t0x46b9ad944d1059450da1163511069c718f699d31', 60, 'ETH', 'token', '0x46b9ad944d1059450da1163511069c718f699d31', 'USD', 'coingecko', -3.20873, 0.02639184, 47365, 4437223, 0, '2020-08-02 13:15:06.898000'); @@ -1274,7 +1257,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574303', '2020-08-02 13:19:41.574303', 'c60_t0xecb79a9b7559168174c41b153997bc462b6dfe4e', 60, 'ETH', 'token', '0xecb79a9b7559168174c41b153997bc462b6dfe4e', 'USD', 'coingecko', -1.61441, 0.159562, 69515, 0, 0, '2020-08-02 13:11:21.241000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574303', '2020-08-02 13:19:41.574303', 'c60_t0x3366adfcd676463e2f5387d07649f227fcc5c15e', 60, 'ETH', 'token', '0x3366adfcd676463e2f5387d07649f227fcc5c15e', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2019-12-26 04:00:13.424000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574304', '2020-08-02 13:19:41.574304', 'c111111', 111111, 'DCY', 'coin', '', 'USD', 'coinmarketcap', -24.2867, 0.000524749736794, 179.18847442974, 1036956.139970667, 0, '2020-08-02 13:18:10.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574507', '2020-08-02 13:19:41.574507', 'c714_tdefi-fa5', 714, 'BNB', 'token', 'defi-fa5', 'BNB', 'binancedex', 16.31, 0.0272199, 4.388152122497559, 0, 0, '2020-08-02 13:19:35.487569'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574304', '2020-08-02 13:19:41.574304', 'c60_t0xfe4455fd433ed3ca025ec7c43cb8686ed89826cd', 60, 'ETH', 'token', '0xfe4455fd433ed3ca025ec7c43cb8686ed89826cd', 'USD', 'coinmarketcap', -9.49243, 0.0000993913089679, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574305', '2020-08-02 13:19:41.574305', 'c60_t0x13c2fab6354d3790d8ece4f0f1a3280b4a25ad96', 60, 'ETH', 'token', '0x13c2fab6354d3790d8ece4f0f1a3280b4a25ad96', 'USD', 'coingecko', -4.13462, 0.04370483, 233.87, 0, 0, '2020-08-02 13:15:25.411000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574305', '2020-08-02 13:19:41.574305', 'c60_t0xd2d6158683aee4cc838067727209a0aaf4359de3', 60, 'ETH', 'token', '0xd2d6158683aee4cc838067727209a0aaf4359de3', 'USD', 'coingecko', -6.26431, 0.00091078, 2896.31, 149477, 0, '2020-08-02 13:17:34.671000'); @@ -1307,7 +1289,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574318', '2020-08-02 13:19:41.574318', 'c111111', 111111, 'D4RK', 'coin', '', 'USD', 'coinmarketcap', 0.569998, 0.0335353847459, 13690.2485074258, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574318', '2020-08-02 13:19:41.574318', 'c60_t0xacaca5b8805636608e14c64b0bfffc2deb2c6cec', 60, 'ETH', 'token', '0xacaca5b8805636608e14c64b0bfffc2deb2c6cec', 'USD', 'coinmarketcap', -0.0000000000000568434, 0.00000837247465233, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574319', '2020-08-02 13:19:41.574319', 'c60_t0x9cb085053fae27adda04c09e2ba1af61489bf741', 60, 'ETH', 'token', '0x9cb085053fae27adda04c09e2ba1af61489bf741', 'USD', 'coingecko', 0, 0.107771, 39.55, 0, 0, '2019-12-26 04:00:30.283000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574319', '2020-08-02 13:19:41.574319', 'c714_tcova-218', 714, 'BNB', 'token', 'cova-218', 'BNB', 'binancedex', 7.66, 0.00003499, 1.1336519718170166, 0, 0, '2020-08-02 13:19:35.487658'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574320', '2020-08-02 13:19:41.574320', 'c60_t0x1c83501478f1320977047008496dacbd60bb15ef', 60, 'ETH', 'token', '0x1c83501478f1320977047008496dacbd60bb15ef', 'USD', 'coinmarketcap', -6.24043, 0.0716778338138, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574320', '2020-08-02 13:19:41.574320', 'c60_t0x23352036e911a22cfc692b5e2e196692658aded9', 60, 'ETH', 'token', '0x23352036e911a22cfc692b5e2e196692658aded9', 'USD', 'coinmarketcap', -24.3725, 0.000460944386162, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574321', '2020-08-02 13:19:41.574321', 'c60_t0x638155f4bd8f85d401da32498d8866ee39a150b8', 60, 'ETH', 'token', '0x638155f4bd8f85d401da32498d8866ee39a150b8', 'USD', 'coingecko', 12.97424, 0.00033947, 70.47, 0, 0, '2020-08-02 08:32:34.192000'); @@ -1704,7 +1685,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574700', '2020-08-02 13:19:41.574700', 'c60_t0xce1a728c0a2dfc8e3e01d769ed5efccdd5230f10', 60, 'ETH', 'token', '0xce1a728c0a2dfc8e3e01d769ed5efccdd5230f10', 'USD', 'coingecko', 0, 0.00001994, 20.15, 0, 0, '2020-06-04 04:14:26.149000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574701', '2020-08-02 13:19:41.574701', 'c60_t0xc6363c1a05f840be2d185d7084b28af84c543d40', 60, 'ETH', 'token', '0xc6363c1a05f840be2d185d7084b28af84c543d40', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574701', '2020-08-02 13:19:41.574701', 'c60_t0x6888a16ea9792c15a4dcf2f6c623d055c8ede792', 60, 'ETH', 'token', '0x6888a16ea9792c15a4dcf2f6c623d055c8ede792', 'USD', 'coingecko', -1.30311, 0.00003654, 137.29, 0, 0, '2020-08-02 13:17:43.706000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574702', '2020-08-02 13:19:41.574702', 'c714_txbase-cd2', 714, 'BNB', 'token', 'xbase-cd2', 'BNB', 'binancedex', -36.93, 0.00011857, 4.355145454406738, 0, 0, '2020-08-02 13:19:35.487596'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574702', '2020-08-02 13:19:41.574702', 'c60_t0x8f8221afbb33998d8584a2b05749ba73c37a938a', 60, 'ETH', 'token', '0x8f8221afbb33998d8584a2b05749ba73c37a938a', 'USD', 'coinmarketcap', -0.498102, 0.0347589350347, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574703', '2020-08-02 13:19:41.574703', 'c60_t0x9947a675cb4d4a19e020e1dd035955c0150b1e5e', 60, 'ETH', 'token', '0x9947a675cb4d4a19e020e1dd035955c0150b1e5e', 'USD', 'coingecko', 0, 0.00001418, 6.42, 0, 0, '2020-06-18 09:34:43.461000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574703', '2020-08-02 13:19:41.574703', 'c60_t0x5dcfa62f81b43ce7a3632454d327dee1f1d93b28', 60, 'ETH', 'token', '0x5dcfa62f81b43ce7a3632454d327dee1f1d93b28', 'USD', 'coingecko', 0, 0.0001909, 0, 0, 0, '2020-05-19 05:24:19.061000'); @@ -1765,7 +1745,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574737', '2020-08-02 13:19:41.574737', 'c61_t0xf03a967b0f6eede6f73fd747a93006e9130525d4', 61, 'ETC', 'token', '0xf03a967b0f6eede6f73fd747a93006e9130525d4', 'USD', 'coingecko', 0, 0.02225578, 14, 0, 0, '2020-04-29 00:14:56.376000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574738', '2020-08-02 13:19:41.574738', 'c60_t0xe120c1ecbfdfea7f0a8f0ee30063491e8c26fedf', 60, 'ETH', 'token', '0xe120c1ecbfdfea7f0a8f0ee30063491e8c26fedf', 'USD', 'coingecko', -9.8311, 0.286128, 1941.5, 62036, 0, '2020-08-02 13:18:28.332000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574738', '2020-08-02 13:19:41.574738', 'c60_t0x0fe156436f203b114c6c562cb1a2a81aa2801090', 60, 'ETH', 'token', '0x0fe156436f203b114c6c562cb1a2a81aa2801090', 'USD', 'coingecko', -47.88216, 0.00001743, 825.43, 0, 0, '2020-08-02 12:28:16.341000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574739', '2020-08-02 13:19:41.574739', 'c714_tfsn-e14', 714, 'BNB', 'token', 'fsn-e14', 'BNB', 'binancedex', -0.3, 0.0425003, 3.624713182449341, 0, 0, '2020-08-02 13:19:35.487575'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574739', '2020-08-02 13:19:41.574739', 'c60_t0x4983f767b1bc44328e434729ddabea0a064ca1ac', 60, 'ETH', 'token', '0x4983f767b1bc44328e434729ddabea0a064ca1ac', 'USD', 'coingecko', 0, 0.220645, 0, 0, 0, '2020-01-22 05:47:30.560000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574740', '2020-08-02 13:19:41.574740', 'c60_t0x3c4a46f0c075a7f191a7459bb51eb1f81ac36f8a', 60, 'ETH', 'token', '0x3c4a46f0c075a7f191a7459bb51eb1f81ac36f8a', 'USD', 'coingecko', 0, 4134, 0.78546, 0, 0, '2020-07-10 16:59:27.543000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574740', '2020-08-02 13:19:41.574740', 'c60_t0x1453dbb8a29551ade11d89825ca812e05317eaeb', 60, 'ETH', 'token', '0x1453dbb8a29551ade11d89825ca812e05317eaeb', 'USD', 'coingecko', 13.53081, 0.833392, 2737532, 6683091, 0, '2020-08-02 13:18:55.717000'); @@ -1828,7 +1807,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574767', '2020-08-02 13:19:41.574767', 'c5741564_t51lxatwbxapvvtfsbbh4nlywfxh6x8ocfnvrxxbtchze', 5741564, 'WAVES', 'token', '51lxatwbxapvvtfsbbh4nlywfxh6x8ocfnvrxxbtchze', 'USD', 'coingecko', 383.12178, 0.00013702, 4.16, 0, 0, '2020-08-02 01:59:30.067000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574768', '2020-08-02 13:19:41.574768', 'c60_t0x393fac0773c765c80dc887451377d553c46f83b1', 60, 'ETH', 'token', '0x393fac0773c765c80dc887451377d553c46f83b1', 'USD', 'coingecko', 0, 0.00086405, 1224.41, 0, 0, '2020-07-23 18:55:30.646000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574768', '2020-08-02 13:19:41.574768', 'c60_t0x94855082f3d6b76e35c1110f8a0d720127c146e9', 60, 'ETH', 'token', '0x94855082f3d6b76e35c1110f8a0d720127c146e9', 'USD', 'coingecko', 0, 0.00009177, 2.93, 0, 0, '2020-07-20 04:50:56.496000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574769', '2020-08-02 13:19:41.574769', 'c714_txrp-bf2', 714, 'BNB', 'token', 'xrp-bf2', 'BNB', 'binancedex', 8.84, 0.0139804, 354.73077392578125, 0, 0, '2020-08-02 13:19:35.487567'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574769', '2020-08-02 13:19:41.574769', 'c111111', 111111, 'BLN', 'coin', '', 'USD', 'coinmarketcap', 0, 0.0012350985531, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574770', '2020-08-02 13:19:41.574770', 'c60_t0x949bed886c739f1a3273629b3320db0c5024c719', 60, 'ETH', 'token', '0x949bed886c739f1a3273629b3320db0c5024c719', 'USD', 'coingecko', 14.81272, 0.0082373, 0.807338, 0, 0, '2020-08-02 13:11:59.875000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574770', '2020-08-02 13:19:41.574770', 'c60_t0x2e0c40beb655a988e087ad71ca191a2806ac55ef', 60, 'ETH', 'token', '0x2e0c40beb655a988e087ad71ca191a2806ac55ef', 'USD', 'coingecko', 0, 0.00001348, 11.1, 0, 0, '2020-06-19 14:34:51.704000'); @@ -1841,8 +1819,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574773', '2020-08-02 13:19:41.574773', 'c111111', 111111, 'ZANO', 'coin', '', 'USD', 'coinmarketcap', -4.25182, 0.680863891322, 66570.453426655, 6965219.905762886, 0, '2020-08-02 13:18:18.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574774', '2020-08-02 13:19:41.574774', 'c60_t0xba5f11b16b155792cf3b2e6880e8706859a8aeb6', 60, 'ETH', 'token', '0xba5f11b16b155792cf3b2e6880e8706859a8aeb6', 'USD', 'coingecko', -4.59232, 0.01670598, 9948.71, 334989, 0, '2020-08-02 13:18:23.806000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574774', '2020-08-02 13:19:41.574774', 'c60_t0xaec98a708810414878c3bcdf46aad31ded4a4557', 60, 'ETH', 'token', '0xaec98a708810414878c3bcdf46aad31ded4a4557', 'USD', 'coingecko', 0, 183.43, 0, 55030, 0, '2019-12-26 04:00:04.540000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574775', '2020-08-02 13:19:41.574775', 'c714_tbkbt-3a6', 714, 'BNB', 'token', 'bkbt-3a6', 'BNB', 'binancedex', 0, 0.0000075, 0, 0, 0, '2020-08-02 13:19:35.487600'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574775', '2020-08-02 13:19:41.574775', 'c714_tnpxb-1e8', 714, 'BNB', 'token', 'npxb-1e8', 'BNB', 'binancedex', 0, 0.00439097, 0, 0, 0, '2020-08-02 13:19:35.487641'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574776', '2020-08-02 13:19:41.574776', 'c111111_tgaj7v3emd3frwapbejap7ec4223xi5eacdz46rfmy5dyomcimwefr5ii', 111111, 'XLM', 'token', 'gaj7v3emd3frwapbejap7ec4223xi5eacdz46rfmy5dyomcimwefr5ii', 'USD', 'coinmarketcap', -0.0000000000000426326, 0.000172919156717, 0, 5360.493858227, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574776', '2020-08-02 13:19:41.574776', 'c60_t0xd9af2d11d788da0097076f4eb21bd1c5533743d9', 60, 'ETH', 'token', '0xd9af2d11d788da0097076f4eb21bd1c5533743d9', 'USD', 'coinmarketcap', -3.97854, 0.00041236715104, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574777', '2020-08-02 13:19:41.574777', 'c60_t0x931ad0628aa11791c26ff4d41ce23e40c31c5e4e', 60, 'ETH', 'token', '0x931ad0628aa11791c26ff4d41ce23e40c31c5e4e', 'USD', 'coingecko', -18.96701, 0.00055164, 116692, 0, 0, '2020-08-02 13:18:14.039000'); @@ -2040,7 +2016,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574869', '2020-08-02 13:19:41.574869', 'c60_t0x3e8a6ba8dbed0d1463e50f6df7359931481a89e8', 60, 'ETH', 'token', '0x3e8a6ba8dbed0d1463e50f6df7359931481a89e8', 'USD', 'coingecko', 0, 0.00040004, 11.96, 0, 0, '2020-04-22 04:58:35.213000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574869', '2020-08-02 13:19:41.574869', 'c60_t0x028ce5ea3298a50c0d8a27b937b1f48cf0d68b56', 60, 'ETH', 'token', '0x028ce5ea3298a50c0d8a27b937b1f48cf0d68b56', 'USD', 'coingecko', 0.83738, 17.78, 15980.83, 0, 0, '2020-08-02 13:12:08.264000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574870', '2020-08-02 13:19:41.574870', 'c60_t0xea097a2b1db00627b2fa17460ad260c016016977', 60, 'ETH', 'token', '0xea097a2b1db00627b2fa17460ad260c016016977', 'USD', 'coingecko', -2.99745, 0.04747145, 1393.4, 0, 0, '2020-08-02 13:17:42.162000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574870', '2020-08-02 13:19:41.574870', 'c714_tbusd-bd1', 714, 'BNB', 'token', 'busd-bd1', 'BNB', 'binancedex', -2.65, 0.049313555310083634, 93692.8515625, 0, 0, '2020-08-02 13:19:35.487637'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574870', '2020-08-02 13:19:41.574871', 'c60_t0xfdbc1adc26f0f8f8606a5d63b7d3a3cd21c22b23', 60, 'ETH', 'token', '0xfdbc1adc26f0f8f8606a5d63b7d3a3cd21c22b23', 'USD', 'coinmarketcap', -4.23204, 0.0765890635121, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574871', '2020-08-02 13:19:41.574871', 'c60_t0x13119e34e140097a507b07a5564bde1bc375d9e6', 60, 'ETH', 'token', '0x13119e34e140097a507b07a5564bde1bc375d9e6', 'USD', 'coingecko', 19.7376, 0.00005908, 40131, 462187, 0, '2020-08-02 13:15:36.236000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574871', '2020-08-02 13:19:41.574872', 'c60_t0x4ab30b965a8ef0f512da064b5e574d9ad73c0e79', 60, 'ETH', 'token', '0x4ab30b965a8ef0f512da064b5e574d9ad73c0e79', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); @@ -2054,7 +2029,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574875', '2020-08-02 13:19:41.574876', 'c60_t0xac956c72c262e5405a84dac655d5f3bea7ae9534', 60, 'ETH', 'token', '0xac956c72c262e5405a84dac655d5f3bea7ae9534', 'USD', 'coingecko', 0, 0.01176237, 0, 0, 0, '2019-12-26 04:00:54.394000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574876', '2020-08-02 13:19:41.574876', 'c60_t0xd536bbd5414a8c2beed82a63737b9327d2fa35a6', 60, 'ETH', 'token', '0xd536bbd5414a8c2beed82a63737b9327d2fa35a6', 'USD', 'coingecko', 13.37789, 0.00366163, 4765.12, 0, 0, '2020-08-02 13:17:33.015000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574876', '2020-08-02 13:19:41.574877', 'c60_t0xcef46305d096fa876dd23048bf80f9345282e3fc', 60, 'ETH', 'token', '0xcef46305d096fa876dd23048bf80f9345282e3fc', 'USD', 'coingecko', 6.22818, 0.652561, 145.52, 0, 0, '2020-08-01 19:49:20.875000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574877', '2020-08-02 13:19:41.574877', 'c714_tloki-6a9', 714, 'BNB', 'token', 'loki-6a9', 'BNB', 'binancedex', 0.01, 0.0256002, 0.9010314345359802, 0, 0, '2020-08-02 13:19:35.487595'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574877', '2020-08-02 13:19:41.574877', 'c111111', 111111, 'PAI', 'coin', '', 'USD', 'coinmarketcap', 4.65145, 0.0185999947726, 988926.586024977, 27474452.513294976, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574878', '2020-08-02 13:19:41.574878', 'c60_t0x5f2ec9cf1ec1c0e2c880b6584921e812a4225395', 60, 'ETH', 'token', '0x5f2ec9cf1ec1c0e2c880b6584921e812a4225395', 'USD', 'coingecko', 31.17448, 0.00023717, 447.92, 2977.28, 0, '2020-08-02 13:13:16.063000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.574878', '2020-08-02 13:19:41.574878', 'c60_t0xf013e0ea26cb386b3021783a3201bf2652778f93', 60, 'ETH', 'token', '0xf013e0ea26cb386b3021783a3201bf2652778f93', 'USD', 'coingecko', 0, 0.00003349, 2.39, 0, 0, '2020-08-01 11:58:10.522000'); @@ -2181,7 +2155,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575069', '2020-08-02 13:19:41.575069', 'c60_t0x4fd414c5ac6f8a17834d704ab431921ee93a4f2d', 60, 'ETH', 'token', '0x4fd414c5ac6f8a17834d704ab431921ee93a4f2d', 'USD', 'coingecko', 6.22818, 26.49, 1085.94, 0, 0, '2020-08-01 19:49:20.157000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575069', '2020-08-02 13:19:41.575070', 'c60_t0xb444208cb0516c150178fcf9a52604bc04a1acea', 60, 'ETH', 'token', '0xb444208cb0516c150178fcf9a52604bc04a1acea', 'USD', 'coingecko', 0, 0.00310393, 0, 46249, 0, '2019-12-26 00:02:51.887000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575070', '2020-08-02 13:19:41.575070', 'c60_t0x16ea01acb4b0bca2000ee5473348b6937ee6f72f', 60, 'ETH', 'token', '0x16ea01acb4b0bca2000ee5473348b6937ee6f72f', 'USD', 'coingecko', 2.95752, 0.0230391, 251638, 2158184, 0, '2020-08-02 13:19:06.272000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575070', '2020-08-02 13:19:41.575071', 'c714_twinb-41f', 714, 'BNB', 'token', 'winb-41f', 'BNB', 'binancedex', -0.25, 0.00000384, 3.981290102005005, 0, 0, '2020-08-02 13:19:35.487570'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575071', '2020-08-02 13:19:41.575071', 'c60_t0x1a66e09f7dccc10eae46e27cfa6b8d44a50df1e7', 60, 'ETH', 'token', '0x1a66e09f7dccc10eae46e27cfa6b8d44a50df1e7', 'USD', 'coinmarketcap', -0.0000000000000142109, 0.0000212825726626, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575071', '2020-08-02 13:19:41.575071', 'c60_t0x8f179114235842978d8917e08721541072c46584', 60, 'ETH', 'token', '0x8f179114235842978d8917e08721541072c46584', 'USD', 'coinmarketcap', -6.94673, 0.0164909977793, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575072', '2020-08-02 13:19:41.575072', 'c60_t0xb73e314501ec4dc2c7c7351514458b1c139df98a', 60, 'ETH', 'token', '0xb73e314501ec4dc2c7c7351514458b1c139df98a', 'USD', 'coingecko', 0, 0.00016004, 741.14, 0, 0, '2020-04-20 04:28:32.436000'); @@ -2193,14 +2166,11 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575075', '2020-08-02 13:19:41.575075', 'c60_t0x998b3b82bc9dba173990be7afb772788b5acb8bd', 60, 'ETH', 'token', '0x998b3b82bc9dba173990be7afb772788b5acb8bd', 'USD', 'coinmarketcap', -4.13895, 0.0000808535731905, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575075', '2020-08-02 13:19:41.575075', 'c60_t0xb351da6ffebd5dddd1da037929fcf334d6b4a8d5', 60, 'ETH', 'token', '0xb351da6ffebd5dddd1da037929fcf334d6b4a8d5', 'USD', 'coinmarketcap', -1.33489, 0.000000430267697475, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575076', '2020-08-02 13:19:41.575076', 'c111111', 111111, 'BDX', 'coin', '', 'USD', 'coinmarketcap', -3.46181, 0.05514184755, 146578.614790149, 54051284.89855539, 0, '2020-08-02 13:18:16.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575218', '2020-08-02 13:19:41.575218', 'c714_tnpxsxem-89c', 714, 'BNB', 'token', 'npxsxem-89c', 'BNB', 'binancedex', 0.2, 0.00000485, 12.601119995117188, 0, 0, '2020-08-02 13:19:35.487566'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575076', '2020-08-02 13:19:41.575076', 'c60_t0xccbf21ba6ef00802ab06637896b799f7101f54a2', 60, 'ETH', 'token', '0xccbf21ba6ef00802ab06637896b799f7101f54a2', 'USD', 'coinmarketcap', -51.3526, 0.00973964969519, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575077', '2020-08-02 13:19:41.575077', 'c60_t0x82125afe01819dff1535d0d6276d57045291b6c0', 60, 'ETH', 'token', '0x82125afe01819dff1535d0d6276d57045291b6c0', 'USD', 'coingecko', 0, 0.00002925, 0.292519, 2195.37, 0, '2019-12-26 04:00:53.928000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575077', '2020-08-02 13:19:41.575077', 'c60_t0xbe68b4645ab798ed4db88192a444898ff4fda5ae', 60, 'ETH', 'token', '0xbe68b4645ab798ed4db88192a444898ff4fda5ae', 'USD', 'coingecko', 0, 0.00030634, 19.92, 0, 0, '2020-05-12 06:04:20.100000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575078', '2020-08-02 13:19:41.575078', 'c60_t0xdf195c2101959f6f39f583ffa5a2aeae71c0f503', 60, 'ETH', 'token', '0xdf195c2101959f6f39f583ffa5a2aeae71c0f503', 'USD', 'coingecko', 0, 0.00002216, 0, 0, 0, '2020-05-19 10:30:13.864000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575078', '2020-08-02 13:19:41.575078', 'c60_t0x0a76aad21948ea1ef447d26dee91a54370e151e0', 60, 'ETH', 'token', '0x0a76aad21948ea1ef447d26dee91a54370e151e0', 'USD', 'coingecko', 0.11492, 0.00216326, 0.0036505, 0, 0, '2020-08-01 13:31:57.985000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575078', '2020-08-02 13:19:41.575079', 'c714_traven-f66', 714, 'BNB', 'token', 'raven-f66', 'BNB', 'binancedex', 1.92, 0.00002703, 76.20285034179688, 0, 0, '2020-08-02 13:19:35.487539'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575079', '2020-08-02 13:19:41.575079', 'c714_tarn-71b', 714, 'BNB', 'token', 'arn-71b', 'BNB', 'binancedex', 1.78, 0.0009, 9.953174591064453, 0, 0, '2020-08-02 13:19:35.487558'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575079', '2020-08-02 13:19:41.575080', 'c60_t0x86225c165b61472c83599270b4c916566a784861', 60, 'ETH', 'token', '0x86225c165b61472c83599270b4c916566a784861', 'USD', 'coingecko', 0, 0.00000958, 0, 0, 0, '2020-05-19 05:23:58.408000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575080', '2020-08-02 13:19:41.575080', 'c60_t0x5556d6a283fd18d71fd0c8b50d1211c5f842dbbc', 60, 'ETH', 'token', '0x5556d6a283fd18d71fd0c8b50d1211c5f842dbbc', 'USD', 'coingecko', 0, 0.00000656, 9.19, 0, 0, '2020-03-14 06:29:59.482000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575080', '2020-08-02 13:19:41.575081', 'c60_t0x5c743a35e903f6c584514ec617acee0611cf44f3', 60, 'ETH', 'token', '0x5c743a35e903f6c584514ec617acee0611cf44f3', 'USD', 'coingecko', -6.73563, 0.03230771, 8305.47, 929833, 0, '2020-08-02 13:17:14.669000'); @@ -2244,7 +2214,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575099', '2020-08-02 13:19:41.575099', 'c60_t0xac8ea871e2d5f4be618905f36f73c760f8cfdc8e', 60, 'ETH', 'token', '0xac8ea871e2d5f4be618905f36f73c760f8cfdc8e', 'USD', 'coingecko', -4.72471, 180.01, 22450, 0, 0, '2020-08-02 13:09:52.378000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575100', '2020-08-02 13:19:41.575100', 'c60_t0xa8b9cd2577d20224af856c19af20040290705932', 60, 'ETH', 'token', '0xa8b9cd2577d20224af856c19af20040290705932', 'USD', 'coingecko', 0, 0.01997359, 101.51, 0, 0, '2020-05-20 13:33:38.556000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575100', '2020-08-02 13:19:41.575100', 'c60_t0xb83d46598d61a98eddaddc33ed4adaa0ed496907', 60, 'ETH', 'token', '0xb83d46598d61a98eddaddc33ed4adaa0ed496907', 'USD', 'coingecko', 0, 0.00000002, 2.05, 0, 0, '2019-12-10 21:32:13.503000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575101', '2020-08-02 13:19:41.575101', 'c714_tmdab-d42', 714, 'BNB', 'token', 'mdab-d42', 'BNB', 'binancedex', 0, 0.00011109, 0, 0, 0, '2020-08-02 13:19:35.487598'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575101', '2020-08-02 13:19:41.575101', 'c60_t0xaf8a215e81faea7c180ce22b72483525121813bd', 60, 'ETH', 'token', '0xaf8a215e81faea7c180ce22b72483525121813bd', 'USD', 'coinmarketcap', -9.87893, 0.000103415209009, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575102', '2020-08-02 13:19:41.575102', 'c60_t0xf5c0e24aca5217bcbae662871cae1a86873f02db', 60, 'ETH', 'token', '0xf5c0e24aca5217bcbae662871cae1a86873f02db', 'USD', 'coingecko', 1.76474, 138.58, 1132.52, 0, 0, '2020-08-02 13:13:27.223000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575102', '2020-08-02 13:19:41.575102', 'c60_t0x70d2b7c19352bb76e4409858ff5746e500f2b67c', 60, 'ETH', 'token', '0x70d2b7c19352bb76e4409858ff5746e500f2b67c', 'USD', 'coinmarketcap', -10.3142, 0.000531581948663, 0, 0, 0, '2020-08-02 13:18:20.000000'); @@ -2255,13 +2224,11 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575104', '2020-08-02 13:19:41.575105', 'c60_t0x4bffc9b4d4dcf730820a2edcad48ff5d7e0ae807', 60, 'ETH', 'token', '0x4bffc9b4d4dcf730820a2edcad48ff5d7e0ae807', 'USD', 'coingecko', 0, 0.00003407, 0.00718992, 15673.11, 0, '2020-07-03 09:32:10.397000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575105', '2020-08-02 13:19:41.575105', 'c60_t0xc6d603a9df53d1542552058c382bf115aace70c7', 60, 'ETH', 'token', '0xc6d603a9df53d1542552058c382bf115aace70c7', 'USD', 'coingecko', 0, 0.00009165, 1.2, 410689, 0, '2020-06-30 17:21:40.372000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575106', '2020-08-02 13:19:41.575106', 'c60_t0xae73e05847461dce0d113cd2f09c7069b85b6e3e', 60, 'ETH', 'token', '0xae73e05847461dce0d113cd2f09c7069b85b6e3e', 'USD', 'coingecko', 0, 96.58, 1062.39, 0, 0, '2020-06-05 01:32:24.034000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575106', '2020-08-02 13:19:41.575106', 'c714_tevt-49b', 714, 'BNB', 'token', 'evt-49b', 'BNB', 'binancedex', 0, 0.0001, 0.019999999552965164, 0, 0, '2020-08-02 13:19:35.487640'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575106', '2020-08-02 13:19:41.575107', 'c111111', 111111, 'DMB', 'coin', '', 'USD', 'coinmarketcap', -20.0212, 0.000110677837445, 1.10578443213374, 11751.104064416257, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575107', '2020-08-02 13:19:41.575107', 'c60_t0x8f7b0b40e27e357540f90f187d90ce06366ac5a5', 60, 'ETH', 'token', '0x8f7b0b40e27e357540f90f187d90ce06366ac5a5', 'USD', 'coinmarketcap', 1.91212, 0.00253465372126, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575107', '2020-08-02 13:19:41.575108', 'c60_t0x595832f8fc6bf59c85c527fec3740a1b7a361269', 60, 'ETH', 'token', '0x595832f8fc6bf59c85c527fec3740a1b7a361269', 'USD', 'coingecko', -2.7081, 0.09082, 3823989, 38741240, 0, '2020-08-02 13:16:29.467000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575108', '2020-08-02 13:19:41.575108', 'c60_t0xc48b1ac1417db27c4e2c2ed3dae5a3d2fbb07dc5', 60, 'ETH', 'token', '0xc48b1ac1417db27c4e2c2ed3dae5a3d2fbb07dc5', 'USD', 'coingecko', -5.12331, 0.00045139, 0.061834, 0, 0, '2020-08-02 06:07:39.820000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575108', '2020-08-02 13:19:41.575109', 'c60_t0x3684b581db1f94b721ee0022624329feb16ab653', 60, 'ETH', 'token', '0x3684b581db1f94b721ee0022624329feb16ab653', 'USD', 'coingecko', 0, 0.071833, 5.75, 0, 0, '2020-08-01 04:31:35.029000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575109', '2020-08-02 13:19:41.575109', 'c714_tcan-677', 714, 'BNB', 'token', 'can-677', 'BNB', 'binancedex', 3.02, 0.00169999, 0.169949010014534, 0, 0, '2020-08-02 13:19:35.487641'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575110', '2020-08-02 13:19:41.575110', 'c60_t0xb2c19ba4d5246d4c587a62f0dfe9f78083568455', 60, 'ETH', 'token', '0xb2c19ba4d5246d4c587a62f0dfe9f78083568455', 'USD', 'coingecko', 0, 0.00011076, 0, 0, 0, '2020-08-02 12:55:15.320000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575110', '2020-08-02 13:19:41.575110', 'c60_t0x89fb927240750c1b15d4743cd58440fc5f14a11c', 60, 'ETH', 'token', '0x89fb927240750c1b15d4743cd58440fc5f14a11c', 'USD', 'coingecko', -12.67565, 0.282082, 2397789, 0, 0, '2020-08-02 13:19:11.992000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575110', '2020-08-02 13:19:41.575111', 'c60_t0xe25b0bba01dc5630312b6a21927e578061a13f55', 60, 'ETH', 'token', '0xe25b0bba01dc5630312b6a21927e578061a13f55', 'USD', 'coinmarketcap', -15.6439, 0.0181260709417, 0, 0, 0, '2020-08-02 13:18:12.000000'); @@ -2320,14 +2287,12 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575136', '2020-08-02 13:19:41.575136', 'c60_t0xb422e605fbd765b80d2c4b5d8196c2f94144438b', 60, 'ETH', 'token', '0xb422e605fbd765b80d2c4b5d8196c2f94144438b', 'USD', 'coingecko', 10.71763, 408.6, 685243, 0, 0, '2020-08-02 13:15:19.058000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575136', '2020-08-02 13:19:41.575137', 'c60_t0xae73b38d1c9a8b274127ec30160a4927c4d71824', 60, 'ETH', 'token', '0xae73b38d1c9a8b274127ec30160a4927c4d71824', 'USD', 'coingecko', -2.77454, 0.00224656, 120634, 776700, 0, '2020-08-02 13:18:26.667000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575137', '2020-08-02 13:19:41.575137', 'c60_t0x386cabc0b14a507a4e024dea15554342865b20de', 60, 'ETH', 'token', '0x386cabc0b14a507a4e024dea15554342865b20de', 'USD', 'coingecko', -6.67846, 0.00126524, 201967, 1782718, 0, '2020-08-02 13:17:12.300000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575137', '2020-08-02 13:19:41.575137', 'c714_tpyn-c37', 714, 'BNB', 'token', 'pyn-c37', 'BNB', 'binancedex', 24.24, 0.000236, 42.17344284057617, 0, 0, '2020-08-02 13:19:35.487587'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575139', '2020-08-02 13:19:41.575139', 'c111111_t0xbb97e381f1d1e94ffa2a5844f6875e6146981009', 111111, 'ETH', 'token', '0xbb97e381f1d1e94ffa2a5844f6875e6146981009', 'USD', 'coinmarketcap', -7.18927, 0.0128215843958, 280683.117265796, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575139', '2020-08-02 13:19:41.575139', 'c60_t0x6aeb95f06cda84ca345c2de0f3b7f96923a44f4c', 60, 'ETH', 'token', '0x6aeb95f06cda84ca345c2de0f3b7f96923a44f4c', 'USD', 'coinmarketcap', -5.36191, 0.000341665703583, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575140', '2020-08-02 13:19:41.575140', 'c111111', 111111, 'SPK', 'coin', '', 'USD', 'coinmarketcap', 50.1122, 0.00120433823056, 5.52253608681938, 10117.150653771274, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575140', '2020-08-02 13:19:41.575140', 'c60_t0xcc7dbc32c67246d03de824ca06bccbc6c02fe8b7', 60, 'ETH', 'token', '0xcc7dbc32c67246d03de824ca06bccbc6c02fe8b7', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-01-31 03:30:54.969000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575141', '2020-08-02 13:19:41.575141', 'c60_t0xac3da587eac229c9896d919abc235ca4fd7f72c1', 60, 'ETH', 'token', '0xac3da587eac229c9896d919abc235ca4fd7f72c1', 'USD', 'coingecko', 0, 0.00182455, 0.799151, 0, 0, '2020-05-05 00:45:33.828000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575141', '2020-08-02 13:19:41.575141', 'c60_t0x3cdc8d06dbbd72dc11c2fa9896e5bd90cfac0570', 60, 'ETH', 'token', '0x3cdc8d06dbbd72dc11c2fa9896e5bd90cfac0570', 'USD', 'coingecko', 0, 0.00058937, 122.69, 0, 0, '2020-08-02 07:44:01.995000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575142', '2020-08-02 13:19:41.575142', 'c714_tlit-099', 714, 'BNB', 'token', 'lit-099', 'BNB', 'binancedex', 31.56, 0.0046, 95.39171600341797, 0, 0, '2020-08-02 13:19:35.487560'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575142', '2020-08-02 13:19:41.575142', 'c60_t0x170b275ced089fffaebfe927f445a350ed9160dc', 60, 'ETH', 'token', '0x170b275ced089fffaebfe927f445a350ed9160dc', 'USD', 'coinmarketcap', 5.30279, 0.000039142295324, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575143', '2020-08-02 13:19:41.575143', 'c60_t0xe79e177d2a5c7085027d7c64c8f271c81430fc9b', 60, 'ETH', 'token', '0xe79e177d2a5c7085027d7c64c8f271c81430fc9b', 'USD', 'coingecko', 0.00891, 1.01, 0, 0, 0, '2020-08-02 13:01:55.919000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575143', '2020-08-02 13:19:41.575143', 'c60_t0x814f67fa286f7572b041d041b1d99b432c9155ee', 60, 'ETH', 'token', '0x814f67fa286f7572b041d041b1d99b432c9155ee', 'USD', 'coingecko', -5.35154, 0.03192722, 1213.32, 0, 0, '2020-08-02 13:17:14.266000'); @@ -2388,7 +2353,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575169', '2020-08-02 13:19:41.575169', 'c111111_t0x6e13a9e4ae3d0678e511fb6d2ad531fcf0e247bf', 111111, 'ETH', 'token', '0x6e13a9e4ae3d0678e511fb6d2ad531fcf0e247bf', 'USD', 'coinmarketcap', -31.2899, 1.23029169546, 669188.564468486, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575170', '2020-08-02 13:19:41.575170', 'c111111_tlevelg-gc3l2flr2qmusoj6qmqhkiwukexgoxsin2ky72sduhpc2ko6hosqixif', 111111, 'XLM', 'token', 'levelg-gc3l2flr2qmusoj6qmqhkiwukexgoxsin2ky72sduhpc2ko6hosqixif', 'USD', 'coinmarketcap', 0.222488, 0.090117294181, 8580.59964552362, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575170', '2020-08-02 13:19:41.575170', 'c60_t0xea4931bfcf3260da6dbf0550e27f5c214e3c268b', 60, 'ETH', 'token', '0xea4931bfcf3260da6dbf0550e27f5c214e3c268b', 'USD', 'coingecko', -4.91179, 0.00001105, 88.81, 0, 0, '2020-08-02 12:54:57.833000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575171', '2020-08-02 13:19:41.575171', 'c714_tbear-14c', 714, 'BNB', 'token', 'bear-14c', 'BNB', 'binancedex', 12.33, 0.0435681, 54.68320846557617, 0, 0, '2020-08-02 13:19:35.487588'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575171', '2020-08-02 13:19:41.575171', 'c60_t0xe477292f1b3268687a29376116b0ed27a9c76170', 60, 'ETH', 'token', '0xe477292f1b3268687a29376116b0ed27a9c76170', 'USD', 'coinmarketcap', -4.53995, 0.00177507427875, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575172', '2020-08-02 13:19:41.575172', 'c60_t0x5abaff0b83f81dc061c590aadcba013c69237fd7', 60, 'ETH', 'token', '0x5abaff0b83f81dc061c590aadcba013c69237fd7', 'USD', 'coinmarketcap', -1.18498, 0.000442711349781, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575172', '2020-08-02 13:19:41.575172', 'c60_t0x4a73e60adbb8575500ffc6aaea6128954011c8af', 60, 'ETH', 'token', '0x4a73e60adbb8575500ffc6aaea6128954011c8af', 'USD', 'coingecko', 0, 0.00180505, 1389.62, 0, 0, '2020-07-23 07:32:48.600000'); @@ -2458,7 +2422,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575202', '2020-08-02 13:19:41.575202', 'c60_t0x08d967bb0134f2d07f7cfb6e246680c53927dd30', 60, 'ETH', 'token', '0x08d967bb0134f2d07f7cfb6e246680c53927dd30', 'USD', 'coinmarketcap', 2.84968, 0.216487567131, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575202', '2020-08-02 13:19:41.575203', 'c60_t0x41e5560054824ea6b0732e656e3ad64e20e94e45', 60, 'ETH', 'token', '0x41e5560054824ea6b0732e656e3ad64e20e94e45', 'USD', 'coingecko', -5.09391, 0.02833984, 6379506, 18934784, 0, '2020-08-02 13:18:02.644000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575203', '2020-08-02 13:19:41.575203', 'c60_t0xd559f20296ff4895da39b5bd9add54b442596a61', 60, 'ETH', 'token', '0xd559f20296ff4895da39b5bd9add54b442596a61', 'USD', 'coingecko', 6.46127, 0.01018597, 475.96, 839744, 0, '2020-08-02 13:19:23.541000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575203', '2020-08-02 13:19:41.575204', 'c714_tvote-fd4', 714, 'BNB', 'token', 'vote-fd4', 'BNB', 'binancedex', 12.4, 0.00004496, 0.008496000431478024, 0, 0, '2020-08-02 13:19:35.487594'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575204', '2020-08-02 13:19:41.575204', 'c60_t0xd91a6162f146ef85922d9a15ee6eb14a00344586', 60, 'ETH', 'token', '0xd91a6162f146ef85922d9a15ee6eb14a00344586', 'USD', 'coinmarketcap', -4.10852, 0.133664280693, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575204', '2020-08-02 13:19:41.575205', 'c60_t0x2d3e7d4870a51b918919e7b851fe19983e4c38d5', 60, 'ETH', 'token', '0x2d3e7d4870a51b918919e7b851fe19983e4c38d5', 'USD', 'coingecko', 8.91667, 0.00057976, 3.55, 198435, 0, '2020-08-01 23:39:19.199000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575205', '2020-08-02 13:19:41.575205', 'c60_t0x1245ef80f4d9e02ed9425375e8f649b9221b31d8', 60, 'ETH', 'token', '0x1245ef80f4d9e02ed9425375e8f649b9221b31d8', 'USD', 'coinmarketcap', 14.6264, 0.000110677837445, 0, 0, 0, '2020-08-02 13:18:12.000000'); @@ -2532,7 +2495,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575238', '2020-08-02 13:19:41.575238', 'c1023', 1023, 'ONE', 'coin', '', 'USD', 'coinmarketcap', -3.78547, 0.00815735853713, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054241', '2020-08-02 13:19:42.054241', 'c111111', 111111, 'CSPN', 'coin', '', 'USD', 'coinmarketcap', -4.62846, 0.188263001494, 484.623968819563, 515374.8933064379, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575239', '2020-08-02 13:19:41.575239', 'c60_t0x9a0587eae7ef64b2b38a10442a44cfa43edd7d2a', 60, 'ETH', 'token', '0x9a0587eae7ef64b2b38a10442a44cfa43edd7d2a', 'USD', 'coingecko', -55.91976, 0.00010074, 2.31, 4673.25, 0, '2020-08-02 01:19:39.923000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575239', '2020-08-02 13:19:41.575239', 'c714_tone-5f9', 714, 'BNB', 'token', 'one-5f9', 'BNB', 'binancedex', -15.34, 0.00110052, 41.87958908081055, 0, 0, '2020-08-02 13:19:35.487642'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575240', '2020-08-02 13:19:41.575240', 'c60_t0x408e41876cccdc0f92210600ef50372656052a38', 60, 'ETH', 'token', '0x408e41876cccdc0f92210600ef50372656052a38', 'USD', 'coinmarketcap', 2.67904, 0.163937988504, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575240', '2020-08-02 13:19:41.575240', 'c60_t0x22f39b18d17665177f1ac88d6da4861b13be07df', 60, 'ETH', 'token', '0x22f39b18d17665177f1ac88d6da4861b13be07df', 'USD', 'coingecko', 0, 1095.07, 45.61, 0, 0, '2020-02-11 15:48:52.809000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575241', '2020-08-02 13:19:41.575241', 'c60_t0xe6877ea9c28fbdec631ffbc087956d0023a76bf2', 60, 'ETH', 'token', '0xe6877ea9c28fbdec631ffbc087956d0023a76bf2', 'USD', 'coingecko', 0, 0.470134, 1916.72, 0, 0, '2020-07-21 10:04:06.673000'); @@ -2566,7 +2528,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575254', '2020-08-02 13:19:41.575254', 'c60_t0x0e8e874bb30a5f254f5144eaae4564c7f73fabed', 60, 'ETH', 'token', '0x0e8e874bb30a5f254f5144eaae4564c7f73fabed', 'USD', 'coinmarketcap', 0.0000000000000284217, 0.0000259507774134, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575255', '2020-08-02 13:19:41.575255', 'c60_t0xd3e41fd8bbcd3d512119608cf4a687a1fda9807d', 60, 'ETH', 'token', '0xd3e41fd8bbcd3d512119608cf4a687a1fda9807d', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575255', '2020-08-02 13:19:41.575255', 'c60_t0x245ef47d4d0505ecf3ac463f4d81f41ade8f1fd1', 60, 'ETH', 'token', '0x245ef47d4d0505ecf3ac463f4d81f41ade8f1fd1', 'USD', 'coingecko', 0.17677, 0.00073342, 69.68, 0, 0, '2020-08-01 15:51:08.983000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575256', '2020-08-02 13:19:41.575256', 'c714_tltc-f07', 714, 'BNB', 'token', 'ltc-f07', 'BNB', 'binancedex', -1.26, 2.83368, 66.46746063232422, 0, 0, '2020-08-02 13:19:35.487601'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575256', '2020-08-02 13:19:41.575256', 'c111111', 111111, 'RINGX', 'coin', '', 'USD', 'coinmarketcap', 12.5102, 0.171673111988, 557178.757005002, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575257', '2020-08-02 13:19:41.575257', 'c60_t0xd0ea200c8f37d61ff77290c89b5cf171016db365', 60, 'ETH', 'token', '0xd0ea200c8f37d61ff77290c89b5cf171016db365', 'USD', 'coingecko', 0, 0.199491, 292585, 0, 0, '2019-12-26 04:00:07.200000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575257', '2020-08-02 13:19:41.575257', 'c60_t0x72dc3d52b7ef107a7cffb6953eaa8a2ad6a204cd', 60, 'ETH', 'token', '0x72dc3d52b7ef107a7cffb6953eaa8a2ad6a204cd', 'USD', 'coinmarketcap', -0.482295, 0.611383816745, 0, 0, 0, '2020-08-02 13:18:25.000000'); @@ -2583,7 +2544,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575262', '2020-08-02 13:19:41.575263', 'c111111', 111111, 'LTCU', 'coin', '', 'USD', 'coinmarketcap', 39.8593, 0.00154948972423, 3.43588278565165, 1597.9887526908724, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575263', '2020-08-02 13:19:41.575263', 'c111111_tcx429731644462ebcfd22185df38727273f16f9b87', 111111, 'ICX', 'token', 'cx429731644462ebcfd22185df38727273f16f9b87', 'USD', 'coinmarketcap', -5.73285, 0.00543130931902, 161799.759682459, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575263', '2020-08-02 13:19:41.575263', 'c60_t0x1a2277c83930b7a64c3e3d5544eaa8c4f946b1b7', 60, 'ETH', 'token', '0x1a2277c83930b7a64c3e3d5544eaa8c4f946b1b7', 'USD', 'coinmarketcap', -0.586038, 0.000221355674891, 0, 0, 0, '2020-08-02 13:18:15.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575264', '2020-08-02 13:19:41.575264', 'c714_tplg-d8d', 714, 'BNB', 'token', 'plg-d8d', 'BNB', 'binancedex', -7.19, 0.00006617, 8.143903732299805, 0, 0, '2020-08-02 13:19:35.487596'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575264', '2020-08-02 13:19:41.575264', 'c60_t0x8f0921f30555624143d427b340b1156914882c10', 60, 'ETH', 'token', '0x8f0921f30555624143d427b340b1156914882c10', 'USD', 'coinmarketcap', -4.36786, 0.0119735027164, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575265', '2020-08-02 13:19:41.575265', 'c60_t0x67a9099f0008c35c61c00042cd9fb03684451097', 60, 'ETH', 'token', '0x67a9099f0008c35c61c00042cd9fb03684451097', 'USD', 'coinmarketcap', -32.2914, 0.0000108628016625, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575265', '2020-08-02 13:19:41.575265', 'c60_t0x6c94f6a21ef54b99c5985642814877210531d99b', 60, 'ETH', 'token', '0x6c94f6a21ef54b99c5985642814877210531d99b', 'USD', 'coingecko', 0, 0.00037397, 0.093493, 0, 0, '2020-07-22 06:20:31.397000'); @@ -2697,7 +2657,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575668', '2020-08-02 13:19:41.575668', 'c60_t0xabc1280a0187a2020cc675437aed400185f86db6', 60, 'ETH', 'token', '0xabc1280a0187a2020cc675437aed400185f86db6', 'USD', 'coingecko', 8.54661, 0.00574501, 45.88, 0, 0, '2020-08-02 04:49:27.201000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575668', '2020-08-02 13:19:41.575668', 'c60_t0x0568025c55c21bda4bc488f3107ebfc8b3d3ef2d', 60, 'ETH', 'token', '0x0568025c55c21bda4bc488f3107ebfc8b3d3ef2d', 'USD', 'coingecko', 0, 0.0000352, 0, 38642, 0, '2019-12-26 04:01:27.786000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575668', '2020-08-02 13:19:41.575669', 'c60_t0xe29c5b523590165795bbd7d52369c2895b18841f', 60, 'ETH', 'token', '0xe29c5b523590165795bbd7d52369c2895b18841f', 'USD', 'coingecko', -2.98483, 0.00101666, 11.15, 0, 0, '2020-08-02 09:40:23.643000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575669', '2020-08-02 13:19:41.575669', 'c714_tatp-38c', 714, 'BNB', 'token', 'atp-38c', 'BNB', 'binancedex', 0, 0.00394998, 0, 0, 0, '2020-08-02 13:19:35.487606'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575669', '2020-08-02 13:19:41.575669', 'c60_t0x9214ec02cb71cba0ada6896b8da260736a67ab10', 60, 'ETH', 'token', '0x9214ec02cb71cba0ada6896b8da260736a67ab10', 'USD', 'coinmarketcap', 0.0000000000000284217, 0.123008270922, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575670', '2020-08-02 13:19:41.575670', 'c60_t0x5299d6f7472dcc137d7f3c4bcfbbb514babf341a', 60, 'ETH', 'token', '0x5299d6f7472dcc137d7f3c4bcfbbb514babf341a', 'USD', 'coingecko', -5.76648, 84.07, 16053.64, 24789, 0, '2020-08-02 13:17:56.648000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575670', '2020-08-02 13:19:41.575670', 'c60_t0xb5ceab8559742713c9e3306e72b69a429ebf166b', 60, 'ETH', 'token', '0xb5ceab8559742713c9e3306e72b69a429ebf166b', 'USD', 'coingecko', 0, 0.341149, 0, 0, 0, '2019-12-26 04:00:19.328000'); @@ -2737,7 +2696,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575687', '2020-08-02 13:19:41.575687', 'c60_t0xf832484f0c9f6b7cd5c945488899035467508a5d', 60, 'ETH', 'token', '0xf832484f0c9f6b7cd5c945488899035467508a5d', 'USD', 'coingecko', 0, 0.00120459, 0, 0, 0, '2019-12-24 20:32:32.500000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575687', '2020-08-02 13:19:41.575687', 'c60_t0x6ce21e5f5383c95691d243879a86a6025e0870c0', 60, 'ETH', 'token', '0x6ce21e5f5383c95691d243879a86a6025e0870c0', 'USD', 'coingecko', -10.81923, 0.00185337, 108306, 0, 0, '2020-08-02 13:14:46.942000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575688', '2020-08-02 13:19:41.575688', 'c60_t0x7a9716685f852ee268feb86dffa562d214cc13db', 60, 'ETH', 'token', '0x7a9716685f852ee268feb86dffa562d214cc13db', 'USD', 'coingecko', 0.45091, 0.00303338, 370658, 0, 0, '2020-08-02 13:14:34.235000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575688', '2020-08-02 13:19:41.575688', 'c714_tlto-bdf', 714, 'BNB', 'token', 'lto-bdf', 'BNB', 'binancedex', 6.15, 0.00344988, 27.39710807800293, 0, 0, '2020-08-02 13:19:35.487667'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575688', '2020-08-02 13:19:41.575689', 'c457', 457, 'AE', 'coin', '', 'USD', 'coinmarketcap', 3.7732, 0.167047380999, 0, 0, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575689', '2020-08-02 13:19:41.575689', 'c60_t0x8711cf7764d23d32092c0dcedfdac63ece1e6cf3', 60, 'ETH', 'token', '0x8711cf7764d23d32092c0dcedfdac63ece1e6cf3', 'USD', 'coingecko', 0, 0.703004, 0, 0, 0, '2020-04-23 10:49:08.463000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054584', '2020-08-02 13:19:42.054584', 'c42', 42, 'DCR', 'coin', '', 'USD', 'coingecko', -2.11121, 15.53, 12436135, 182879504, 0, '2020-08-02 13:16:45.823000'); @@ -2789,7 +2747,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575712', '2020-08-02 13:19:41.575712', 'c60_t0x042f972ac93404f0fcbe4e3a0729f0b395232106', 60, 'ETH', 'token', '0x042f972ac93404f0fcbe4e3a0729f0b395232106', 'USD', 'coingecko', 0.31899, 0.00027288, 2.34, 0, 0, '2020-08-02 13:12:10.959000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575712', '2020-08-02 13:19:41.575712', 'c60_t0xd6014ea05bde904448b743833ddf07c3c7837481', 60, 'ETH', 'token', '0xd6014ea05bde904448b743833ddf07c3c7837481', 'USD', 'coingecko', 8.10411, 8239.81, 154389, 2681826, 0, '2020-08-02 13:16:50.616000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575713', '2020-08-02 13:19:41.575713', 'c60_t0xeeee2a622330e6d2036691e983dee87330588603', 60, 'ETH', 'token', '0xeeee2a622330e6d2036691e983dee87330588603', 'USD', 'coingecko', -4.69614, 0.01279535, 271572, 0, 0, '2020-08-02 13:18:05.346000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575713', '2020-08-02 13:19:41.575713', 'c714_twicc-01d', 714, 'BNB', 'token', 'wicc-01d', 'BNB', 'binancedex', 0, 0.0377925, 0.026454750448465347, 0, 0, '2020-08-02 13:19:35.487603'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575714', '2020-08-02 13:19:41.575714', 'c60_t0xd6e1401a079922469e9b965cb090ea6ff64c6839', 60, 'ETH', 'token', '0xd6e1401a079922469e9b965cb090ea6ff64c6839', 'USD', 'coinmarketcap', 1.91446, 0.0000724186777502, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575714', '2020-08-02 13:19:41.575714', 'c60_t0xb0a66227b50810df87ce4b152920d22a716b9b1d', 60, 'ETH', 'token', '0xb0a66227b50810df87ce4b152920d22a716b9b1d', 'USD', 'coingecko', 0, 0.00000008, 0, 0, 0, '2019-12-26 04:00:51.144000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575714', '2020-08-02 13:19:41.575715', 'c60_t0x8971f9fd7196e5cee2c1032b50f656855af7dd26', 60, 'ETH', 'token', '0x8971f9fd7196e5cee2c1032b50f656855af7dd26', 'USD', 'coingecko', -5.12358, 0.01724528, 5540955, 32067496, 0, '2020-08-02 13:17:33.660000'); @@ -2805,7 +2762,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575719', '2020-08-02 13:19:41.575719', 'c60_t0x84f710bae3316a74fb0fcb01904d2578a4cc6a26', 60, 'ETH', 'token', '0x84f710bae3316a74fb0fcb01904d2578a4cc6a26', 'USD', 'coingecko', -7.43034, 0.00192614, 92071, 0, 0, '2020-08-02 13:12:15.861000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575720', '2020-08-02 13:19:41.575720', 'c60_t0x4289c043a12392f1027307fb58272d8ebd853912', 60, 'ETH', 'token', '0x4289c043a12392f1027307fb58272d8ebd853912', 'USD', 'coingecko', 2.27686, 0.00003092, 5230.46, 162950, 0, '2020-08-02 13:17:59.957000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575720', '2020-08-02 13:19:41.575720', 'c60_t0x27c743954bce1bfaef8bcbd685527531001d88d7', 60, 'ETH', 'token', '0x27c743954bce1bfaef8bcbd685527531001d88d7', 'USD', 'coingecko', 0, 0.00459848, 0, 0, 0, '2019-12-23 02:03:04.314000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575720', '2020-08-02 13:19:41.575721', 'c714_tart-3c9', 714, 'BNB', 'token', 'art-3c9', 'BNB', 'binancedex', -21.88, 0.00035153, 0.08048029989004135, 0, 0, '2020-08-02 13:19:35.487578'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575721', '2020-08-02 13:19:41.575721', 'c60_t0xb70835d7822ebb9426b56543e391846c107bd32c', 60, 'ETH', 'token', '0xb70835d7822ebb9426b56543e391846c107bd32c', 'USD', 'coinmarketcap', -0.261666, 0.0131371233189, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575721', '2020-08-02 13:19:41.575722', 'c60_t0x0488401c3f535193fa8df029d9ffe615a06e74e6', 60, 'ETH', 'token', '0x0488401c3f535193fa8df029d9ffe615a06e74e6', 'USD', 'coingecko', -6.0181, 0.00092891, 359609, 0, 0, '2020-08-02 13:18:05.303000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575722', '2020-08-02 13:19:41.575722', 'c60_t0x72b2b8e42a10d785abf85f3044223db8c9167bd6', 60, 'ETH', 'token', '0x72b2b8e42a10d785abf85f3044223db8c9167bd6', 'USD', 'coingecko', 9.56935, 0.00000103, 115.93, 0, 0, '2020-08-02 11:14:25.964000'); @@ -2866,7 +2822,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575748', '2020-08-02 13:19:41.575748', 'c60_t0x11dd5dddd1bd9b2df6ff908fbcf8db09cefed29b', 60, 'ETH', 'token', '0x11dd5dddd1bd9b2df6ff908fbcf8db09cefed29b', 'USD', 'coingecko', 0, 0.00000819, 0, 0, 0, '2019-12-26 04:00:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575749', '2020-08-02 13:19:41.575749', 'c60_t0x86b300ef935284a99fa5d148a9a6ccc5103b21a8', 60, 'ETH', 'token', '0x86b300ef935284a99fa5d148a9a6ccc5103b21a8', 'USD', 'coingecko', 0, 0.0000237, 1.51, 0, 0, '2020-07-23 13:28:10.035000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575749', '2020-08-02 13:19:41.575749', 'c60_t0xd0cb75298d5c1e3b277e3cd95c56b3caa81a99d3', 60, 'ETH', 'token', '0xd0cb75298d5c1e3b277e3cd95c56b3caa81a99d3', 'USD', 'coingecko', -11.49887, 0.00152131, 36435, 0, 0, '2020-08-02 12:24:49.089000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054586', '2020-08-02 13:19:42.054586', 'c714_tebst-783', 714, 'BNB', 'token', 'ebst-783', 'BNB', 'binancedex', -48.38, 0.00004643, 1.1923719644546509, 0, 0, '2020-08-02 13:19:35.487637'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575750', '2020-08-02 13:19:41.575750', 'c60_t0x00c4b398500645eb5da00a1a379a88b11683ba01', 60, 'ETH', 'token', '0x00c4b398500645eb5da00a1a379a88b11683ba01', 'USD', 'coingecko', 0, 0.00650353, 0.058532, 0, 0, '2019-12-26 04:00:43.347000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575750', '2020-08-02 13:19:41.575750', 'c60_t0x21839a7f7e88c19a6089adbfb3fb52606ac6f0dd', 60, 'ETH', 'token', '0x21839a7f7e88c19a6089adbfb3fb52606ac6f0dd', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575751', '2020-08-02 13:19:41.575751', 'c60_t0xa4112be97aca5b0cabf5e1efb35c99a0459b30c2', 60, 'ETH', 'token', '0xa4112be97aca5b0cabf5e1efb35c99a0459b30c2', 'USD', 'coingecko', 0, 0.02355539, 36006, 0, 0, '2019-12-26 04:00:53.023000'); @@ -2882,7 +2837,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575755', '2020-08-02 13:19:41.575755', 'c60_t0x7728dfef5abd468669eb7f9b48a7f70a501ed29d', 60, 'ETH', 'token', '0x7728dfef5abd468669eb7f9b48a7f70a501ed29d', 'USD', 'coinmarketcap', -0.0000000000000426326, 0.00284844323647, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575756', '2020-08-02 13:19:41.575756', 'c60_t0x1e66008a24a486456a796e0c771fdc0cdf43cad9', 60, 'ETH', 'token', '0x1e66008a24a486456a796e0c771fdc0cdf43cad9', 'USD', 'coinmarketcap', 0.809666, 0.0000652466776566, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575756', '2020-08-02 13:19:41.575756', 'c60_t0x62d75a2a10f755104bd1024d997141ce793cf585', 60, 'ETH', 'token', '0x62d75a2a10f755104bd1024d997141ce793cf585', 'USD', 'coingecko', 0.6602, 0.00400649, 0.00480779, 0, 0, '2020-08-02 13:08:56.434000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575757', '2020-08-02 13:19:41.575757', 'c714_tvrab-b56', 714, 'BNB', 'token', 'vrab-b56', 'BNB', 'binancedex', -11.62, 0.0000019, 114.33885192871094, 0, 0, '2020-08-02 13:19:35.487556'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575757', '2020-08-02 13:19:41.575757', 'c242', 242, 'NIM', 'coin', '', 'USD', 'coinmarketcap', 5.36249, 0.00676766965506, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575758', '2020-08-02 13:19:41.575758', 'c60_t0xa8892bfc33fa44053a9e402b1839966f4fec74a4', 60, 'ETH', 'token', '0xa8892bfc33fa44053a9e402b1839966f4fec74a4', 'USD', 'coinmarketcap', -24.359, 0.363385709583, 0, 0, 0, '2020-08-02 13:18:26.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575758', '2020-08-02 13:19:41.575758', 'c60_t0x3cc5eb07e0e1227613f1df58f38b549823d11cb9', 60, 'ETH', 'token', '0x3cc5eb07e0e1227613f1df58f38b549823d11cb9', 'USD', 'coinmarketcap', 11.8429, 0.173007983735, 0, 0, 0, '2020-08-02 13:18:21.000000'); @@ -2983,7 +2937,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575804', '2020-08-02 13:19:41.575804', 'c60_t0x0c51e4f4a0532879eac0029d6a302b23ebf60bb3', 60, 'ETH', 'token', '0x0c51e4f4a0532879eac0029d6a302b23ebf60bb3', 'USD', 'coingecko', 0, 0.00020767, 29384, 0, 0, '2020-04-10 10:02:10.797000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575804', '2020-08-02 13:19:41.575804', 'c60_t0xe6b75a1960f91bfa7010dec8543685ead67f8cff', 60, 'ETH', 'token', '0xe6b75a1960f91bfa7010dec8543685ead67f8cff', 'USD', 'coingecko', -11.30675, 0.00028145, 11031.68, 0, 0, '2020-08-02 13:18:29.375000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575805', '2020-08-02 13:19:41.575805', 'c60_t0x881ef48211982d01e2cb7092c915e647cd40d85c', 60, 'ETH', 'token', '0x881ef48211982d01e2cb7092c915e647cd40d85c', 'USD', 'coingecko', 0, 0.01195411, 212.26, 22092, 0, '2020-05-05 12:02:42.703000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575805', '2020-08-02 13:19:41.575805', 'c714_tmzk-2c7', 714, 'BNB', 'token', 'mzk-2c7', 'BNB', 'binancedex', -41.96, 0.00029018, 1.947057843208313, 0, 0, '2020-08-02 13:19:35.487609'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575806', '2020-08-02 13:19:41.575806', 'c60_t0x9f0f1be08591ab7d990faf910b38ed5d60e4d5bf', 60, 'ETH', 'token', '0x9f0f1be08591ab7d990faf910b38ed5d60e4d5bf', 'USD', 'coinmarketcap', -0.512945, 0.00855060804922, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575806', '2020-08-02 13:19:41.575806', 'c60_t0x47d1a59cbdd19aee060c859c0009277e245328ae', 60, 'ETH', 'token', '0x47d1a59cbdd19aee060c859c0009277e245328ae', 'USD', 'coinmarketcap', 0, 0.000250979684051, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:41.575806', '2020-08-02 13:19:41.575807', 'c60_t0x839078ada638af8306c039221e408ee7bc4e3f7f', 60, 'ETH', 'token', '0x839078ada638af8306c039221e408ee7bc4e3f7f', 'USD', 'coingecko', 0, 0.0000113, 0, 0, 0, '2020-04-23 10:49:07.078000'); @@ -3224,11 +3177,9 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054097', '2020-08-02 13:19:42.054097', 'c111111_ta87cc2a513f5d8b4a42432343687c2127c60bc3f', 111111, 'NEO', 'token', 'a87cc2a513f5d8b4a42432343687c2127c60bc3f', 'USD', 'coinmarketcap', -4.12519, 0.000769675883449, 10479.8826518204, 436791.05616054864, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054098', '2020-08-02 13:19:42.054098', 'c60_t0x06a6fc23e6ec8a2b2aeeefd70d772dc3d6b45010', 60, 'ETH', 'token', '0x06a6fc23e6ec8a2b2aeeefd70d772dc3d6b45010', 'USD', 'coingecko', 0, 0.0005195, 1.05, 0, 0, '2020-08-02 06:10:03.373000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054098', '2020-08-02 13:19:42.054098', 'c60_t0x4212fea9fec90236ecc51e41e2096b16ceb84555', 60, 'ETH', 'token', '0x4212fea9fec90236ecc51e41e2096b16ceb84555', 'USD', 'coingecko', 0, 0.00112818, 950.23, 150798, 0, '2020-07-01 10:30:14.828000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054099', '2020-08-02 13:19:42.054099', 'c714_tpibnb-43c', 714, 'BNB', 'token', 'pibnb-43c', 'BNB', 'binancedex', 0, 0.00043999, 0, 0, 0, '2020-08-02 13:19:35.487640'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054099', '2020-08-02 13:19:42.054099', 'c60_t0xe5b826ca2ca02f09c1725e9bd98d9a8874c30532', 60, 'ETH', 'token', '0xe5b826ca2ca02f09c1725e9bd98d9a8874c30532', 'USD', 'coingecko', -4.3876, 0.00031227, 38946, 0, 0, '2020-08-02 13:16:28.464000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054099', '2020-08-02 13:19:42.054100', 'c60_t0x194524355f26af663468d4996f207a918c73e013', 60, 'ETH', 'token', '0x194524355f26af663468d4996f207a918c73e013', 'USD', 'coinmarketcap', 0.454391, 0.269480870953, 0, 0, 0, '2020-08-02 13:18:26.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054100', '2020-08-02 13:19:42.054100', 'c60_t0x6cb9c5abf310b42893adff0b1f38322eea109c98', 60, 'ETH', 'token', '0x6cb9c5abf310b42893adff0b1f38322eea109c98', 'USD', 'coingecko', 0, 0.00009211, 0.460575, 0, 0, '2020-07-09 18:51:21.201000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054100', '2020-08-02 13:19:42.054101', 'c714_twish-2d5', 714, 'BNB', 'token', 'wish-2d5', 'BNB', 'binancedex', 23.69, 0.00213996, 16.572355270385742, 0, 0, '2020-08-02 13:19:35.487592'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054101', '2020-08-02 13:19:42.054101', 'c111111_tetlzrcpbqtrpyumgdivlbpznuokwte88ovdjjofi5r2h', 111111, 'WAVES', 'token', 'etlzrcpbqtrpyumgdivlbpznuokwte88ovdjjofi5r2h', 'USD', 'coinmarketcap', -11.3905, 0.0498050268504, 13.4797858559745, 348635.1879528, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054101', '2020-08-02 13:19:42.054101', 'c60_t0xd8446236fa95b9b5f9fd0f8e7df1a944823c683d', 60, 'ETH', 'token', '0xd8446236fa95b9b5f9fd0f8e7df1a944823c683d', 'USD', 'coingecko', 0, 0.0011241, 0.590152, 0, 0, '2020-04-01 10:08:26.691000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054102', '2020-08-02 13:19:42.054102', 'c60_t0xf29226914595052a04f5afbe6410d0c3ed707548', 60, 'ETH', 'token', '0xf29226914595052a04f5afbe6410d0c3ed707548', 'USD', 'coingecko', -3.3811, 0.22921, 316.92, 0, 0, '2020-08-02 13:15:12.225000'); @@ -3294,12 +3245,10 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054148', '2020-08-02 13:19:42.054148', 'c60_t0x1367d4a67c1719b58c7e05df8768226fa768279a', 60, 'ETH', 'token', '0x1367d4a67c1719b58c7e05df8768226fa768279a', 'USD', 'coinmarketcap', 0.0000000000000710543, 0.00169639062326, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054148', '2020-08-02 13:19:42.054148', 'c60_t0x70508920986c120bc534f40450390bb1578b2637', 60, 'ETH', 'token', '0x70508920986c120bc534f40450390bb1578b2637', 'USD', 'coingecko', 0, 0.00102046, 96.31, 0, 0, '2020-07-10 14:02:19.918000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054150', '2020-08-02 13:19:42.054150', 'c60_t0x8694ee05b45c9fe1058ce532de8dbcf1d84a4154', 60, 'ETH', 'token', '0x8694ee05b45c9fe1058ce532de8dbcf1d84a4154', 'USD', 'coingecko', -40.52289, 0.00055267, 0.428494, 0, 0, '2020-08-02 13:13:21.449000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054151', '2020-08-02 13:19:42.054151', 'c714_tphv-4a1', 714, 'BNB', 'token', 'phv-4a1', 'BNB', 'binancedex', 0, 0.0000896, 0, 0, 0, '2020-08-02 13:19:35.487639'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054151', '2020-08-02 13:19:42.054151', 'c818', 818, 'VET', 'coin', '', 'USD', 'coinmarketcap', -6.18263, 0.0159882878272, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054151', '2020-08-02 13:19:42.054152', 'c111111', 111111, 'TAG', 'coin', '', 'USD', 'coinmarketcap', 0.0000000000000426326, 0.0102287994312, 0, 65810.72056255653, 0, '2020-08-02 13:18:06.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054152', '2020-08-02 13:19:42.054152', 'c60_t0xc27c95350ecd634c80df89db0f10cd5c24b7b11f', 60, 'ETH', 'token', '0xc27c95350ecd634c80df89db0f10cd5c24b7b11f', 'USD', 'coingecko', 7.99476, 0.00112067, 8772.74, 0, 0, '2020-08-02 09:23:32.912000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054152', '2020-08-02 13:19:42.054153', 'c60_t0x7dbdd9dafdc4c1c03d67925a4f85daa398af32b0', 60, 'ETH', 'token', '0x7dbdd9dafdc4c1c03d67925a4f85daa398af32b0', 'USD', 'coingecko', 7.92875, 0.099973, 132498, 0, 0, '2020-08-02 13:16:25.801000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054153', '2020-08-02 13:19:42.054153', 'c714_trune-b1a', 714, 'BNB', 'token', 'rune-b1a', 'BNB', 'binancedex', 1.49, 0.0224509, 6709.98779296875, 0, 0, '2020-08-02 13:19:35.487665'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054153', '2020-08-02 13:19:42.054154', 'c111111', 111111, 'GIC', 'coin', '', 'USD', 'coinmarketcap', -5.74856, 0.0303008778369, 8510.12605138282, 244812.72739186732, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054154', '2020-08-02 13:19:42.054154', 'c195_ttwcddx1q6qeobrji9qehtznd4vcxxuvler', 195, 'TRX', 'token', 'twcddx1q6qeobrji9qehtznd4vcxxuvler', 'USD', 'coingecko', -0.78484, 0.02105193, 151891, 0, 0, '2020-08-02 13:12:18.184000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054154', '2020-08-02 13:19:42.054154', 'c60_t0x8f0921f30555624143d427b340b1156914882c10', 60, 'ETH', 'token', '0x8f0921f30555624143d427b340b1156914882c10', 'USD', 'coingecko', -4.46659, 0.01196148, 6630.41, 203211, 0, '2020-08-02 13:15:49.089000'); @@ -3346,15 +3295,12 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054175', '2020-08-02 13:19:42.054175', 'c60_t0x22e3c3a3bda39c897a48257bc822e7466f171729', 60, 'ETH', 'token', '0x22e3c3a3bda39c897a48257bc822e7466f171729', 'USD', 'coingecko', 5.82061, 0.116343, 1838276, 0, 0, '2020-08-02 13:19:22.907000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054176', '2020-08-02 13:19:42.054176', 'c60_t0x3154da898943fc7151bc77f16e43c0c47b5e452d', 60, 'ETH', 'token', '0x3154da898943fc7151bc77f16e43c0c47b5e452d', 'USD', 'coingecko', 0, 0.0009915, 2.52, 0, 0, '2020-07-29 20:42:43.755000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054194', '2020-08-02 13:19:42.054194', 'c60_t0x9ec251401eafb7e98f37a1d911c0aea02cb63a80', 60, 'ETH', 'token', '0x9ec251401eafb7e98f37a1d911c0aea02cb63a80', 'USD', 'coingecko', 6.16142, 0.03030582, 3623.99, 0, 0, '2020-08-01 19:52:26.926000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054194', '2020-08-02 13:19:42.054194', 'c714_tstyl-65b', 714, 'BNB', 'token', 'styl-65b', 'BNB', 'binancedex', 0, 0.196, 0.9094399809837341, 0, 0, '2020-08-02 13:19:35.487665'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054194', '2020-08-02 13:19:42.054195', 'c714_tbolt-4c6', 714, 'BNB', 'token', 'bolt-4c6', 'BNB', 'binancedex', -23.88, 0.0001001, 27.196422576904297, 0, 0, '2020-08-02 13:19:35.487672'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054195', '2020-08-02 13:19:42.054195', 'c60_t0x6a404a3386655bd8b63e584f2efd2e3fb60e70f8', 60, 'ETH', 'token', '0x6a404a3386655bd8b63e584f2efd2e3fb60e70f8', 'USD', 'coingecko', -2.73861, 0.00211969, 65249, 0, 0, '2020-08-02 13:08:54.559000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054195', '2020-08-02 13:19:42.054195', 'c60_t0x87f56ee356b434187105b40f96b230f5283c0ab4', 60, 'ETH', 'token', '0x87f56ee356b434187105b40f96b230f5283c0ab4', 'USD', 'coingecko', 0, 0.00042925, 4.38, 0, 0, '2020-08-01 09:42:05.891000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054196', '2020-08-02 13:19:42.054196', 'c60_t0xb9ef770b6a5e12e45983c5d80545258aa38f3b78', 60, 'ETH', 'token', '0xb9ef770b6a5e12e45983c5d80545258aa38f3b78', 'USD', 'coinmarketcap', -20.2035, 0.189076335042, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054196', '2020-08-02 13:19:42.054196', 'c60_t0xef51c9377feb29856e61625caf9390bd0b67ea18', 60, 'ETH', 'token', '0xef51c9377feb29856e61625caf9390bd0b67ea18', 'USD', 'coinmarketcap', 46.3231, 0.0000353403147421, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054197', '2020-08-02 13:19:42.054197', 'c60_t0x79650799e7899a802cb96c0bc33a6a8d4ce4936c', 60, 'ETH', 'token', '0x79650799e7899a802cb96c0bc33a6a8d4ce4936c', 'USD', 'coinmarketcap', -3.51941, 0.00111366108582, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054197', '2020-08-02 13:19:42.054197', 'c60_t0x56ba2ee7890461f463f7be02aac3099f6d5811a8', 60, 'ETH', 'token', '0x56ba2ee7890461f463f7be02aac3099f6d5811a8', 'USD', 'coinmarketcap', -0.0000000000000710543, 0.00799611307295, 0, 0, 0, '2020-08-02 13:18:10.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054198', '2020-08-02 13:19:42.054198', 'c714_terd-d06', 714, 'BNB', 'token', 'erd-d06', 'BNB', 'binancedex', 9.9, 0.00110999, 1297.862060546875, 0, 0, '2020-08-02 13:19:35.487575'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054198', '2020-08-02 13:19:42.054198', 'c111111', 111111, 'MB8', 'coin', '', 'USD', 'coinmarketcap', -1.84727, 0.00686202592161, 209.885493091785, 1107048.1927844072, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054199', '2020-08-02 13:19:42.054199', 'c60_t0x3917e933bd430c08304cae2aa6d9746b806406c2', 60, 'ETH', 'token', '0x3917e933bd430c08304cae2aa6d9746b806406c2', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-06-06 10:19:22.731000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054199', '2020-08-02 13:19:42.054199', 'c60_t0x1ed7ae1f0e2fa4276dd7ddc786334a3df81d50c0', 60, 'ETH', 'token', '0x1ed7ae1f0e2fa4276dd7ddc786334a3df81d50c0', 'USD', 'coinmarketcap', -23.051, 0.0388502128537, 0, 0, 0, '2020-08-02 13:18:14.000000'); @@ -3457,7 +3403,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054280', '2020-08-02 13:19:42.054280', 'c60_t0x1aa0dd2faada457d467a1c426b63c6bf8c176663', 60, 'ETH', 'token', '0x1aa0dd2faada457d467a1c426b63c6bf8c176663', 'USD', 'coingecko', 0, 0.00783239, 30.59, 0, 0, '2020-07-31 17:58:12.857000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054281', '2020-08-02 13:19:42.054281', 'c60_t0x190fb342aa6a15eb82903323ae78066ff8616746', 60, 'ETH', 'token', '0x190fb342aa6a15eb82903323ae78066ff8616746', 'USD', 'coingecko', 0, 0.00026404, 0.236428, 0, 0, '2020-07-24 13:48:07.166000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054281', '2020-08-02 13:19:42.054281', 'c60_t0xc80c5e40220172b36adee2c951f26f2a577810c5', 60, 'ETH', 'token', '0xc80c5e40220172b36adee2c951f26f2a577810c5', 'USD', 'coingecko', -4.01889, 0.00169734, 15890.57, 0, 0, '2020-08-02 13:11:25.959000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054281', '2020-08-02 13:19:42.054282', 'c714_tnow-e68', 714, 'BNB', 'token', 'now-e68', 'BNB', 'binancedex', 10.96, 0.00045497, 20.19409942626953, 0, 0, '2020-08-02 13:19:35.487574'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054282', '2020-08-02 13:19:42.054282', 'c60_t0xc2992b2c22238f296c2f429ee2f7afb462ed1750', 60, 'ETH', 'token', '0xc2992b2c22238f296c2f429ee2f7afb462ed1750', 'USD', 'coingecko', -7.9725, 1.51, 880.79, 109.1, 0, '2020-08-02 01:14:39.254000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054282', '2020-08-02 13:19:42.054282', 'c60_t0xf29226914595052a04f5afbe6410d0c3ed707548', 60, 'ETH', 'token', '0xf29226914595052a04f5afbe6410d0c3ed707548', 'USD', 'coinmarketcap', 0.911441, 0.501742605549, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054283', '2020-08-02 13:19:42.054283', 'c60_t0xb48b7e5bf6563b3e0a85055821a83deb8cfc12f6', 60, 'ETH', 'token', '0xb48b7e5bf6563b3e0a85055821a83deb8cfc12f6', 'USD', 'coingecko', 3.94483, 0.00001772, 0.00021266, 0, 0, '2020-08-02 13:18:05.585000'); @@ -3488,7 +3433,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054294', '2020-08-02 13:19:42.054295', 'c60_t0x1418e621e5be75f2f79b7add3322ce8481f073b4', 60, 'ETH', 'token', '0x1418e621e5be75f2f79b7add3322ce8481f073b4', 'USD', 'coingecko', 0, 0.00192122, 0, 0, 0, '2019-12-26 04:00:39.657000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054295', '2020-08-02 13:19:42.054295', 'c60_t0x8e870d67f660d95d5be530380d0ec0bd388289e1', 60, 'ETH', 'token', '0x8e870d67f660d95d5be530380d0ec0bd388289e1', 'USD', 'coingecko', 0.0199, 1, 226130175, 254462921, 0, '2020-08-02 13:18:26.231000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054295', '2020-08-02 13:19:42.054296', 'c60_t0xba9ecaa4d6f22d3a69c41daa0584ac0e2418925e', 60, 'ETH', 'token', '0xba9ecaa4d6f22d3a69c41daa0584ac0e2418925e', 'USD', 'coingecko', -10.17113, 0.00023433, 22.73, 0, 0, '2020-08-02 13:13:30.236000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054296', '2020-08-02 13:19:42.054296', 'c714_tlba-340', 714, 'BNB', 'token', 'lba-340', 'BNB', 'binancedex', 58.81, 0.00135, 2.3823821544647217, 0, 0, '2020-08-02 13:19:35.487661'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054296', '2020-08-02 13:19:42.054297', 'c60_t0xb88657d3f48e8804f2f54cd98270304120c58fb8', 60, 'ETH', 'token', '0xb88657d3f48e8804f2f54cd98270304120c58fb8', 'USD', 'coingecko', 0, 0.00247319, 1338.68, 0, 0, '2020-07-11 12:31:37.845000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054297', '2020-08-02 13:19:42.054297', 'c60_t0x7f288ff5a8055f5f6103a80dd806cf8415e035c7', 60, 'ETH', 'token', '0x7f288ff5a8055f5f6103a80dd806cf8415e035c7', 'USD', 'coingecko', 0, 0.00191122, 2.74, 0, 0, '2020-07-30 15:34:59.611000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054297', '2020-08-02 13:19:42.054297', 'c60_t0xcbeaec699431857fdb4d37addbbdc20e132d4903', 60, 'ETH', 'token', '0xcbeaec699431857fdb4d37addbbdc20e132d4903', 'USD', 'coingecko', -5.04591, 0.01025051, 792063, 1790728, 0, '2020-08-02 13:18:37.492000'); @@ -3536,12 +3480,10 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054318', '2020-08-02 13:19:42.054319', 'c60_t0x59a2eb1675f31406e3bc00262a6dc0d98e0376b1', 60, 'ETH', 'token', '0x59a2eb1675f31406e3bc00262a6dc0d98e0376b1', 'USD', 'coingecko', 0, 0.110246, 13.08, 0, 0, '2020-08-01 00:08:45.305000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054319', '2020-08-02 13:19:42.054319', 'c60_t0xff98a08c143311719ca492e4b8c950c940f26872', 60, 'ETH', 'token', '0xff98a08c143311719ca492e4b8c950c940f26872', 'USD', 'coingecko', 0, 0.01100595, 2899.88, 13207145, 0, '2020-07-29 10:32:40.915000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054319', '2020-08-02 13:19:42.054320', 'c60_t0x63e634330a20150dbb61b15648bc73855d6ccf07', 60, 'ETH', 'token', '0x63e634330a20150dbb61b15648bc73855d6ccf07', 'USD', 'coingecko', -2.57271, 0.00034001, 20.58, 36545, 0, '2020-08-02 08:01:04.175000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054320', '2020-08-02 13:19:42.054320', 'c714_tethbull-d33', 714, 'BNB', 'token', 'ethbull-d33', 'BNB', 'binancedex', -3.47, 35.6094, 864.3153076171875, 0, 0, '2020-08-02 13:19:35.487645'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054320', '2020-08-02 13:19:42.054321', 'c60_t0x3f06b5d78406cd97bdf10f5c420b241d32759c80', 60, 'ETH', 'token', '0x3f06b5d78406cd97bdf10f5c420b241d32759c80', 'USD', 'coinmarketcap', 2.00464, 0.00000108628016625, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054321', '2020-08-02 13:19:42.054321', 'c111111', 111111, 'CUT', 'coin', '', 'USD', 'coinmarketcap', -5.75372, 0.0333140517639, 7894.75864728228, 3608328.040421448, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054321', '2020-08-02 13:19:42.054321', 'c60_t0x791425156956e39f2ab8ab06b79de189c18e95e5', 60, 'ETH', 'token', '0x791425156956e39f2ab8ab06b79de189c18e95e5', 'USD', 'coingecko', 0, 0.00000238, 0.00074453, 1974.32, 0, '2020-07-21 06:42:45.176000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054322', '2020-08-02 13:19:42.054322', 'c60_t0x29c9e65e9e976bbd18721f942e90c2089a931221', 60, 'ETH', 'token', '0x29c9e65e9e976bbd18721f942e90c2089a931221', 'USD', 'coingecko', 0, 0.00000152, 0.106143, 0, 0, '2019-12-16 02:00:35.328000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054322', '2020-08-02 13:19:42.054322', 'c714_tiris-d88', 714, 'BNB', 'token', 'iris-d88', 'BNB', 'binancedex', 4.38, 0.0032358, 56.74612045288086, 0, 0, '2020-08-02 13:19:35.487661'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054323', '2020-08-02 13:19:42.054323', 'c111111_t0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', 111111, 'RBTC', 'token', '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', 'USD', 'coinmarketcap', -3.36153, 0.0910168827045, 886471.397158298, 56757522.395950586, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054323', '2020-08-02 13:19:42.054323', 'c60_t0xffe02ee4c69edf1b340fcad64fbd6b37a7b9e265', 60, 'ETH', 'token', '0xffe02ee4c69edf1b340fcad64fbd6b37a7b9e265', 'USD', 'coingecko', 0, 0.00002417, 0.108771, 483425, 0, '2020-08-01 03:00:08.448000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054324', '2020-08-02 13:19:42.054324', 'c60_t0x633ee3fbe5ffc05bd44ecd8240732ff9ef9dee1d', 60, 'ETH', 'token', '0x633ee3fbe5ffc05bd44ecd8240732ff9ef9dee1d', 'USD', 'coinmarketcap', -1.93795, 0.132136850514, 0, 0, 0, '2020-08-02 13:18:21.000000'); @@ -3556,7 +3498,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054356', '2020-08-02 13:19:42.054356', 'c60_t0x8cd024cc8f73f5cd132005d1584403877b318c9d', 60, 'ETH', 'token', '0x8cd024cc8f73f5cd132005d1584403877b318c9d', 'USD', 'coingecko', 5.6637, 0.00013747, 401.07, 0, 0, '2020-08-02 13:16:43.438000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054357', '2020-08-02 13:19:42.054357', 'c60_t0xbcc7026cde024c6a97d2df6e40613217d946279c', 60, 'ETH', 'token', '0xbcc7026cde024c6a97d2df6e40613217d946279c', 'USD', 'coingecko', 0, 0.00000003, 9.82, 0, 0, '2020-07-23 19:30:46.338000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054357', '2020-08-02 13:19:42.054357', 'c60_t0x5732046a883704404f284ce41ffadd5b007fd668', 60, 'ETH', 'token', '0x5732046a883704404f284ce41ffadd5b007fd668', 'USD', 'coingecko', 28.38669, 0.120434, 15883348, 28654862, 0, '2020-08-02 13:18:35.233000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054358', '2020-08-02 13:19:42.054358', 'c714_tgiv-94e', 714, 'BNB', 'token', 'giv-94e', 'BNB', 'binancedex', 30.35, 0.00073, 3.5482726097106934, 0, 0, '2020-08-02 13:19:35.487643'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054358', '2020-08-02 13:19:42.054358', 'c60_t0xe48972fcd82a274411c01834e2f031d4377fa2c0', 60, 'ETH', 'token', '0xe48972fcd82a274411c01834e2f031d4377fa2c0', 'USD', 'coingecko', -5.36871, 0.03846101, 1032256, 780979, 0, '2020-08-02 13:17:58.950000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054359', '2020-08-02 13:19:42.054359', 'c111111_t0x4c133e081dfb5858e39cca74e69bf603d409e57a', 111111, 'ETH', 'token', '0x4c133e081dfb5858e39cca74e69bf603d409e57a', 'USD', 'coinmarketcap', -27.4087, 9.76865635246, 1561655.59031869, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054359', '2020-08-02 13:19:42.054359', 'c60_t0x307d45afbb7e84f82ef3d251a6bb0f00edf632e4', 60, 'ETH', 'token', '0x307d45afbb7e84f82ef3d251a6bb0f00edf632e4', 'USD', 'coingecko', -11.43003, 0.03306522, 716733, 0, 0, '2020-08-02 13:18:24.925000'); @@ -3649,7 +3590,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054402', '2020-08-02 13:19:42.054402', 'c60_t0xb67718b98d52318240c52e71a898335da4a28c42', 60, 'ETH', 'token', '0xb67718b98d52318240c52e71a898335da4a28c42', 'USD', 'coingecko', -20.25107, 0.056801, 45122, 0, 0, '2020-08-02 13:15:48.162000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054403', '2020-08-02 13:19:42.054403', 'c60_t0xe9ed705842bd7219a963e452c41be85ce5cff884', 60, 'ETH', 'token', '0xe9ed705842bd7219a963e452c41be85ce5cff884', 'USD', 'coingecko', 0.22917, 0.0015344, 31009, 0, 0, '2020-08-02 13:14:01.984000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054403', '2020-08-02 13:19:42.054403', 'c60_t0x2c5a9980b41861d91d30d0e0271d1c093452dca5', 60, 'ETH', 'token', '0x2c5a9980b41861d91d30d0e0271d1c093452dca5', 'USD', 'coingecko', -5.84475, 353.61, 94447, 0, 0, '2020-08-02 13:09:07.259000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054404', '2020-08-02 13:19:42.054404', 'c714_tqbx-38c', 714, 'BNB', 'token', 'qbx-38c', 'BNB', 'binancedex', 0, 0.00020104, 3.518199920654297, 0, 0, '2020-08-02 13:19:35.487602'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054404', '2020-08-02 13:19:42.054404', 'c60_t0xd29f0b5b3f50b07fe9a9511f7d86f4f4bac3f8c4', 60, 'ETH', 'token', '0xd29f0b5b3f50b07fe9a9511f7d86f4f4bac3f8c4', 'USD', 'coingecko', -2.83833, 0.03343013, 166110, 1753219, 0, '2020-08-02 13:17:40.285000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054405', '2020-08-02 13:19:42.054405', 'c60_t0x03282f2d7834a97369cad58f888ada19eec46ab6', 60, 'ETH', 'token', '0x03282f2d7834a97369cad58f888ada19eec46ab6', 'USD', 'coingecko', -49.39268, 0.00000358, 25.95, 134050, 0, '2020-08-02 13:16:08.390000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054405', '2020-08-02 13:19:42.054405', 'c60_t0xa4bdb11dc0a2bec88d24a3aa1e6bb17201112ebe', 60, 'ETH', 'token', '0xa4bdb11dc0a2bec88d24a3aa1e6bb17201112ebe', 'USD', 'coinmarketcap', -9.08231, 0.997299344441, 0, 0, 0, '2020-08-02 13:18:15.000000'); @@ -3680,7 +3620,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054417', '2020-08-02 13:19:42.054417', 'c111111', 111111, 'ASAFE', 'coin', '', 'USD', 'coinmarketcap', -8.8645, 0.0208805410999, 447.211662895867, 190960.27456391632, 0, '2020-08-02 13:18:09.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054417', '2020-08-02 13:19:42.054418', 'c195_t1001308', 195, 'TRX', 'token', '1001308', 'USD', 'coingecko', -7.88211, 0.01202909, 257.19, 0, 0, '2020-08-02 12:59:48.330000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054418', '2020-08-02 13:19:42.054418', 'c60_t0x421291c62344278642a1ea917cdca23effd01416', 60, 'ETH', 'token', '0x421291c62344278642a1ea917cdca23effd01416', 'USD', 'coingecko', 0, 0.01787172, 89152, 0, 0, '2020-02-28 04:33:48.569000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054418', '2020-08-02 13:19:42.054418', 'c714_tspndb-916', 714, 'BNB', 'token', 'spndb-916', 'BNB', 'binancedex', -29.67, 0.00014101, 35.23866653442383, 0, 0, '2020-08-02 13:19:35.487639'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054419', '2020-08-02 13:19:42.054419', 'c60_t0x6944d3e38973c4831da24e954fbd790c7e688bdd', 60, 'ETH', 'token', '0x6944d3e38973c4831da24e954fbd790c7e688bdd', 'USD', 'coingecko', 18.33111, 0.00896346, 16611.41, 0, 0, '2020-08-02 13:17:18.344000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054420', '2020-08-02 13:19:42.054420', 'c60_t0x9214ec02cb71cba0ada6896b8da260736a67ab10', 60, 'ETH', 'token', '0x9214ec02cb71cba0ada6896b8da260736a67ab10', 'USD', 'coingecko', 0, 0.247993, 0.221732, 3112931, 0, '2020-07-30 06:53:26.910000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054421', '2020-08-02 13:19:42.054421', 'c60_t0x5e3845a1d78db544613edbe43dc1ea497266d3b8', 60, 'ETH', 'token', '0x5e3845a1d78db544613edbe43dc1ea497266d3b8', 'USD', 'coinmarketcap', 0.0000000000000426326, 0.00778212359744, 0, 0, 0, '2020-08-02 13:18:17.000000'); @@ -3744,7 +3683,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054481', '2020-08-02 13:19:42.054481', 'c60_t0x5d285f735998f36631f678ff41fb56a10a4d0429', 60, 'ETH', 'token', '0x5d285f735998f36631f678ff41fb56a10a4d0429', 'USD', 'coingecko', -8.15224, 0.00347986, 1019201, 0, 0, '2020-08-02 13:18:02.613000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054481', '2020-08-02 13:19:42.054481', 'c60_t0x38968746147bbaeb882f356ad9a57594bb158235', 60, 'ETH', 'token', '0x38968746147bbaeb882f356ad9a57594bb158235', 'USD', 'coingecko', 0, 0.00020606, 12.94, 0, 0, '2020-05-11 09:15:12.677000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054482', '2020-08-02 13:19:42.054482', 'c60_t0x3b8d5facff748c4525cdc1796990c8170a6206f1', 60, 'ETH', 'token', '0x3b8d5facff748c4525cdc1796990c8170a6206f1', 'USD', 'coingecko', 0, 0.00102477, 1069.6, 0, 0, '2019-12-26 04:00:48.449000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054482', '2020-08-02 13:19:42.054482', 'c714_tbet-844', 714, 'BNB', 'token', 'bet-844', 'BNB', 'binancedex', 5.3, 0.0029999, 27.279991149902344, 0, 0, '2020-08-02 13:19:35.487678'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054483', '2020-08-02 13:19:42.054483', 'c60_t0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d', 60, 'ETH', 'token', '0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d', 'USD', 'coingecko', 5.33707, 0.450341, 1701952, 160656484, 0, '2020-08-02 13:18:40.143000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054483', '2020-08-02 13:19:42.054483', 'c60_t0xba90351ac53860eca66fb57ae43640fbb066418c', 60, 'ETH', 'token', '0xba90351ac53860eca66fb57ae43640fbb066418c', 'USD', 'coingecko', 0, 1.17, 2.34, 0, 0, '2020-08-01 12:29:24.168000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054484', '2020-08-02 13:19:42.054484', 'c60_t0x639cff3936ba73fced75f9ace328b7e72d85d933', 60, 'ETH', 'token', '0x639cff3936ba73fced75f9ace328b7e72d85d933', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-05-19 05:24:09.625000'); @@ -3756,7 +3694,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054487', '2020-08-02 13:19:42.054487', 'c60_t0x22314b3d1375548c969eaae65e43203b51f9e9e9', 60, 'ETH', 'token', '0x22314b3d1375548c969eaae65e43203b51f9e9e9', 'USD', 'coingecko', -1.99385, 0.00020672, 1412.01, 0, 0, '2020-08-02 13:12:26.307000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054487', '2020-08-02 13:19:42.054487', 'c60_t0xd9dc38f1c0f551f949a81cf7269a017e48b1d5a4', 60, 'ETH', 'token', '0xd9dc38f1c0f551f949a81cf7269a017e48b1d5a4', 'USD', 'coingecko', 0, 0.079153, 0, 0, 0, '2019-12-26 04:00:36.387000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054487', '2020-08-02 13:19:42.054488', 'c60_t0xeed736b2b809550d89a941c2005de93588c628e2', 60, 'ETH', 'token', '0xeed736b2b809550d89a941c2005de93588c628e2', 'USD', 'coingecko', 7.45025, 0.739448, 46015, 0, 0, '2020-08-02 13:13:45.638000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054488', '2020-08-02 13:19:42.054488', 'c714_tupx-f3e', 714, 'BNB', 'token', 'upx-f3e', 'BNB', 'binancedex', 19.8, 0.00002995, 10.814499855041504, 0, 0, '2020-08-02 13:19:35.487654'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054488', '2020-08-02 13:19:42.054488', 'c60_t0xe7e4279b80d319ede2889855135a22021baf0907', 60, 'ETH', 'token', '0xe7e4279b80d319ede2889855135a22021baf0907', 'USD', 'coinmarketcap', -4.50054, 0.000000664067024672, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054489', '2020-08-02 13:19:42.054489', 'c60_t0xc5bbae50781be1669306b9e001eff57a2957b09d', 60, 'ETH', 'token', '0xc5bbae50781be1669306b9e001eff57a2957b09d', 'USD', 'coingecko', -6.36903, 0.01222803, 9177831, 8161379, 0, '2020-08-02 13:17:51.803000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054489', '2020-08-02 13:19:42.054489', 'c60_t0xd664fe5b3277f04349c709745cca7eb549a9df0f', 60, 'ETH', 'token', '0xd664fe5b3277f04349c709745cca7eb549a9df0f', 'USD', 'coingecko', 0, 0.00000605, 0, 0, 0, '2019-12-26 04:00:14.352000'); @@ -3919,7 +3856,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054613', '2020-08-02 13:19:42.054613', 'c60_t0x3335f16af9008bfd32f1ee6c2be5d4f84fa0b9da', 60, 'ETH', 'token', '0x3335f16af9008bfd32f1ee6c2be5d4f84fa0b9da', 'USD', 'coingecko', -12.00001, 912.53, 1333.5, 0, 0, '2020-08-02 09:58:53.959000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054613', '2020-08-02 13:19:42.054613', 'c60_t0xd5e38d2ef4ad5e38942e6234e2cec0dac38e124a', 60, 'ETH', 'token', '0xd5e38d2ef4ad5e38942e6234e2cec0dac38e124a', 'USD', 'coingecko', 0, 0.907351, 1.81, 0, 0, '2020-02-29 00:05:48.010000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054614', '2020-08-02 13:19:42.054614', 'c60_t0x8b6c0dbc499eaf97f54b54fe0019a4c676db534a', 60, 'ETH', 'token', '0x8b6c0dbc499eaf97f54b54fe0019a4c676db534a', 'USD', 'coingecko', 0, 0.00011995, 104.09, 0, 0, '2019-12-26 04:00:25.555000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054614', '2020-08-02 13:19:42.054614', 'c714_tnoizb-878', 714, 'BNB', 'token', 'noizb-878', 'BNB', 'binancedex', -26.64, 0.00154045, 0.04558990150690079, 0, 0, '2020-08-02 13:19:35.487559'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054615', '2020-08-02 13:19:42.054615', 'c60_t0x973e52691176d36453868d9d86572788d27041a9', 60, 'ETH', 'token', '0x973e52691176d36453868d9d86572788d27041a9', 'USD', 'coinmarketcap', -2.70587, 0.00255302175999, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054615', '2020-08-02 13:19:42.054615', 'c60_t0x464ebe77c293e473b48cfe96ddcf88fcf7bfdac0', 60, 'ETH', 'token', '0x464ebe77c293e473b48cfe96ddcf88fcf7bfdac0', 'USD', 'coinmarketcap', 7.72008, 0.134606828726, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054616', '2020-08-02 13:19:42.054616', 'c60_t0x9a9bb9b4b11bf8eccff84b58a6ccccd4058a7f0d', 60, 'ETH', 'token', '0x9a9bb9b4b11bf8eccff84b58a6ccccd4058a7f0d', 'USD', 'coingecko', 0, 0.00000864, 0.401786, 0, 0, '2019-11-19 05:30:05.496000'); @@ -3960,8 +3896,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054634', '2020-08-02 13:19:42.054634', 'c165', 165, 'NANO', 'coin', '', 'USD', 'coinmarketcap', -2.27093, 0.940047273473, 0, 0, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054634', '2020-08-02 13:19:42.054634', 'c60_t0xcf42de80d80edc4a8d56e4e840b5ff0dc84aaa17', 60, 'ETH', 'token', '0xcf42de80d80edc4a8d56e4e840b5ff0dc84aaa17', 'USD', 'coingecko', 0, 0.00004672, 0.02214993, 0, 0, '2020-08-01 12:25:20.364000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054635', '2020-08-02 13:19:42.054635', 'c60_t0xf6b2a425c03a1ee90427270343187b1f637709d9', 60, 'ETH', 'token', '0xf6b2a425c03a1ee90427270343187b1f637709d9', 'USD', 'coingecko', -59.8007, 0.00046816, 2.38, 0, 0, '2020-08-02 11:31:40.079000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054635', '2020-08-02 13:19:42.054635', 'c714_tslv-986', 714, 'BNB', 'token', 'slv-986', 'BNB', 'binancedex', 2.04, 0.0000005, 7.0808000564575195, 0, 0, '2020-08-02 13:19:35.487541'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054636', '2020-08-02 13:19:42.054636', 'c714_tankr-e97', 714, 'BNB', 'token', 'ankr-e97', 'BNB', 'binancedex', -3.98, 0.00026248, 36.35841751098633, 0, 0, '2020-08-02 13:19:35.487638'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054636', '2020-08-02 13:19:42.054636', 'c60_t0x29f20242051accda50d52a7e272a5f23237e4696', 60, 'ETH', 'token', '0x29f20242051accda50d52a7e272a5f23237e4696', 'USD', 'coingecko', 0, 0.00301841, 0.754603, 0, 0, '2020-08-02 09:59:34.564000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054637', '2020-08-02 13:19:42.054637', 'c111111', 111111, 'XRC', 'coin', '', 'USD', 'coinmarketcap', -8.46515, 4.56966709778, 23287.4901337355, 4614479.927161991, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054637', '2020-08-02 13:19:42.054637', 'c111111', 111111, 'ARCO', 'coin', '', 'USD', 'coinmarketcap', 70.7777, 0.0246811577503, 1.25209837501859, 73658.02336310688, 0, '2020-08-02 13:18:09.000000'); @@ -3982,7 +3916,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054644', '2020-08-02 13:19:42.054644', 'c60_t0x9f96f3076a7ba20f328e16891ffe565e50584a10', 60, 'ETH', 'token', '0x9f96f3076a7ba20f328e16891ffe565e50584a10', 'USD', 'coingecko', 0, 0.0007089, 0.418106, 0, 0, '2020-07-31 21:55:42.218000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054645', '2020-08-02 13:19:42.054645', 'c60_t0x646cec6ee42d258336165cbbd5deb4af14f0f476', 60, 'ETH', 'token', '0x646cec6ee42d258336165cbbd5deb4af14f0f476', 'USD', 'coingecko', 0, 0.00808851, 0.144243, 0, 0, '2020-07-24 16:39:21.949000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054645', '2020-08-02 13:19:42.054645', 'c60_t0x19037b591ce06e7cd1b990146697466a23b165bf', 60, 'ETH', 'token', '0x19037b591ce06e7cd1b990146697466a23b165bf', 'USD', 'coingecko', 0, 0.00011815, 0.084515, 0, 0, '2019-12-26 04:00:17.527000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054646', '2020-08-02 13:19:42.054646', 'c714_tnew-09e', 714, 'BNB', 'token', 'new-09e', 'BNB', 'binancedex', 26.94, 0.00004443, 0.034157998859882355, 0, 0, '2020-08-02 13:19:35.487600'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054646', '2020-08-02 13:19:42.054646', 'c714_tgmat-fc8', 714, 'BNB', 'token', 'gmat-fc8', 'USD', 'coinmarketcap', -0.799374, 0.000471735131534, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054646', '2020-08-02 13:19:42.054647', 'c60_t0x3c6a7ab47b5f058be0e7c7fe1a4b7925b8aca40e', 60, 'ETH', 'token', '0x3c6a7ab47b5f058be0e7c7fe1a4b7925b8aca40e', 'USD', 'coinmarketcap', -4.44835, 1.53820058481, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054647', '2020-08-02 13:19:42.054647', 'c60_t0xb0a0a070640b450eb136dc377208469ee4f49fbc', 60, 'ETH', 'token', '0xb0a0a070640b450eb136dc377208469ee4f49fbc', 'USD', 'coinmarketcap', -24.2899, 0.0000941442810752, 0, 0, 0, '2020-08-02 13:18:15.000000'); @@ -4074,7 +4007,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054740', '2020-08-02 13:19:42.054740', 'c60_t0x0f4315934eb9ebe33c602e2726ffe0cda9e6dc83', 60, 'ETH', 'token', '0x0f4315934eb9ebe33c602e2726ffe0cda9e6dc83', 'USD', 'coingecko', -6.64072, 0.22084, 242.92, 0, 0, '2020-08-02 05:58:03.945000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054741', '2020-08-02 13:19:42.054741', 'c60_t0x96b52b5bf8d902252d0714a1bd2651a785fd2660', 60, 'ETH', 'token', '0x96b52b5bf8d902252d0714a1bd2651a785fd2660', 'USD', 'coingecko', 0.00159, 0.00009897, 46077, 0, 0, '2020-08-02 13:12:53.556000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054741', '2020-08-02 13:19:42.054741', 'c60_t0x82f4ded9cec9b5750fbff5c2185aee35afc16587', 60, 'ETH', 'token', '0x82f4ded9cec9b5750fbff5c2185aee35afc16587', 'USD', 'coingecko', 0, 0.02752113, 4.6, 0, 0, '2020-07-30 21:29:45.563000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054741', '2020-08-02 13:19:42.054742', 'c714_tcbm-4b2', 714, 'BNB', 'token', 'cbm-4b2', 'BNB', 'binancedex', -2.98, 0.00000065, 5.6290998458862305, 0, 0, '2020-08-02 13:19:35.487579'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054742', '2020-08-02 13:19:42.054742', 'c111111', 111111, 'CURE', 'coin', '', 'USD', 'coinmarketcap', -14.5315, 0.0690050632809, 8208.39866127836, 1698551.8642156203, 0, '2020-08-02 13:18:08.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054742', '2020-08-02 13:19:42.054743', 'c60_t0xf77f4810e7521298a6e2a04f82a6c3492706d74f', 60, 'ETH', 'token', '0xf77f4810e7521298a6e2a04f82a6c3492706d74f', 'USD', 'coingecko', -2.6474, 0.00704828, 152303, 0, 0, '2020-08-02 13:18:33.837000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054743', '2020-08-02 13:19:42.054743', 'c60_t0xe477292f1b3268687a29376116b0ed27a9c76170', 60, 'ETH', 'token', '0xe477292f1b3268687a29376116b0ed27a9c76170', 'USD', 'coingecko', -3.55441, 0.00177423, 3513.96, 263044, 0, '2020-08-02 13:13:53.253000'); @@ -4138,10 +4070,8 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054773', '2020-08-02 13:19:42.054773', 'c60_t0x4f3afec4e5a3f2a6a1a411def7d7dfe50ee057bf', 60, 'ETH', 'token', '0x4f3afec4e5a3f2a6a1a411def7d7dfe50ee057bf', 'USD', 'coinmarketcap', -4.0092, 60.8360485137, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054773', '2020-08-02 13:19:42.054773', 'c111111', 111111, 'FUZZ', 'coin', '', 'USD', 'coinmarketcap', 0.0000000000000284217, 0.00337695710489, 0, 16310.517083977931, 0, '2020-08-02 13:18:09.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054774', '2020-08-02 13:19:42.054774', 'c111111_t0x2494a68c1484376fef880b4c24d91f049d29b02a', 111111, 'ETH', 'token', '0x2494a68c1484376fef880b4c24d91f049d29b02a', 'USD', 'coinmarketcap', -4.76171, 4.08390152389, 106418.049849, 0, 0, '2020-08-02 13:18:25.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054774', '2020-08-02 13:19:42.054774', 'c714_txrpbull-e7c', 714, 'BNB', 'token', 'xrpbull-e7c', 'BNB', 'binancedex', 9.44, 1.133706, 421.7105712890625, 0, 0, '2020-08-02 13:19:35.487627'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054775', '2020-08-02 13:19:42.054775', 'c60_t0xd7efb00d12c2c13131fd319336fdf952525da2af', 60, 'ETH', 'token', '0xd7efb00d12c2c13131fd319336fdf952525da2af', 'USD', 'coinmarketcap', -4.77913, 0.0167219528288, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054775', '2020-08-02 13:19:42.054775', 'c60_t0xcda4377806cb09f226aa4840a9df8b5c2b7744ec', 60, 'ETH', 'token', '0xcda4377806cb09f226aa4840a9df8b5c2b7744ec', 'USD', 'coingecko', 0, 0.00323387, 0.02597519, 0, 0, '2020-08-01 02:04:15.461000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054776', '2020-08-02 13:19:42.054776', 'c714_teth-1c9', 714, 'BNB', 'token', 'eth-1c9', 'BNB', 'binancedex', -4.74, 17.929661936224193, 71.59510803222656, 0, 0, '2020-08-02 13:19:35.487658'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054776', '2020-08-02 13:19:42.054776', 'c60_t0x24810d836f6d60a7ee499622b7103ec769e81e3b', 60, 'ETH', 'token', '0x24810d836f6d60a7ee499622b7103ec769e81e3b', 'USD', 'coingecko', -0.94654, 0.148102, 749286, 0, 0, '2020-08-02 13:12:29.916000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054776', '2020-08-02 13:19:42.054777', 'c60_t0xe968ad47b1c071ea3905ef982833552a495d6213', 60, 'ETH', 'token', '0xe968ad47b1c071ea3905ef982833552a495d6213', 'USD', 'coingecko', 0, 0.00007092, 35.24, 0, 0, '2019-12-26 04:00:06.299000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054777', '2020-08-02 13:19:42.054777', 'c60_t0xa00425d3e2d3e9ff74f3e112b4d3a7978d7d88c2', 60, 'ETH', 'token', '0xa00425d3e2d3e9ff74f3e112b4d3a7978d7d88c2', 'USD', 'coingecko', 495.17039, 0.00027312, 5.56, 0, 0, '2020-08-02 10:25:00.024000'); @@ -4325,7 +4255,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054868', '2020-08-02 13:19:42.054868', 'c60_t0xdf859c9878ef5e742d7bbe3c22a496c088c89fa9', 60, 'ETH', 'token', '0xdf859c9878ef5e742d7bbe3c22a496c088c89fa9', 'USD', 'coingecko', 6.6564, 0.00014415, 18428.81, 0, 0, '2020-08-02 13:10:35.398000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054868', '2020-08-02 13:19:42.054868', 'c60_t0xaf4dce16da2877f8c9e00544c93b62ac40631f16', 60, 'ETH', 'token', '0xaf4dce16da2877f8c9e00544c93b62ac40631f16', 'USD', 'coingecko', -9.23711, 0.00864239, 256609, 3031568, 0, '2020-08-02 13:15:52.042000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054869', '2020-08-02 13:19:42.054869', 'c60_t0xa870879e2872f9f2dc3a33933a9af3345b00fd14', 60, 'ETH', 'token', '0xa870879e2872f9f2dc3a33933a9af3345b00fd14', 'USD', 'coingecko', -0.24259, 0.00078677, 353936, 0, 0, '2020-08-02 13:13:48.775000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054869', '2020-08-02 13:19:42.054869', 'c714_tbull-be4', 714, 'BNB', 'token', 'bull-be4', 'BNB', 'binancedex', -17.8, 193.336, 891.1900024414062, 0, 0, '2020-08-02 13:19:35.487588'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054870', '2020-08-02 13:19:42.054870', 'c60_t0x7deb5e830be29f91e298ba5ff1356bb7f8146998', 60, 'ETH', 'token', '0x7deb5e830be29f91e298ba5ff1356bb7f8146998', 'USD', 'coingecko', -2.7122, 557.59, 167721, 2455308, 0, '2020-08-02 12:23:11.534000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054870', '2020-08-02 13:19:42.054870', 'c60_t0x29536b7ca7029b5cddeb03c0451715615aca35ba', 60, 'ETH', 'token', '0x29536b7ca7029b5cddeb03c0451715615aca35ba', 'USD', 'coinmarketcap', -4.42775, 0.000695219306402, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.054870', '2020-08-02 13:19:42.054871', 'c60_t0x6b74dd5d01f8320081247f5cf1f7a48324700db6', 60, 'ETH', 'token', '0x6b74dd5d01f8320081247f5cf1f7a48324700db6', 'USD', 'coingecko', -5.36007, 0.053408, 618047, 0, 0, '2020-08-02 13:12:42.809000'); @@ -4527,7 +4456,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056054', '2020-08-02 13:19:42.056055', 'c60_t0xf4bbd1f932bda87c24fe13a50912a13b06ed2601', 60, 'ETH', 'token', '0xf4bbd1f932bda87c24fe13a50912a13b06ed2601', 'USD', 'coingecko', 0, 0.103242, 0, 0, 0, '2019-12-26 04:00:38.226000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056059', '2020-08-02 13:19:42.056059', 'c60_t0xf87271ff78a3de23bb7a6fbd3c7080199f6ae82b', 60, 'ETH', 'token', '0xf87271ff78a3de23bb7a6fbd3c7080199f6ae82b', 'USD', 'coingecko', 0, 0.07454, 0, 0, 0, '2019-12-19 07:02:25.944000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056060', '2020-08-02 13:19:42.056060', 'c60_t0x17052d51e954592c1046320c2371abab6c73ef10', 60, 'ETH', 'token', '0x17052d51e954592c1046320c2371abab6c73ef10', 'USD', 'coingecko', 0, 65.41, 0, 0, 0, '2019-12-26 04:00:17.090000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056061', '2020-08-02 13:19:42.056061', 'c714_tentrp-c8d', 714, 'BNB', 'token', 'entrp-c8d', 'BNB', 'binancedex', 0, 0.00317291, 0, 0, 0, '2020-08-02 13:19:35.487673'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056061', '2020-08-02 13:19:42.056062', 'c60_t0x7c0a3f749ed88a10015d553dfdadd8bdcdb784fa', 60, 'ETH', 'token', '0x7c0a3f749ed88a10015d553dfdadd8bdcdb784fa', 'USD', 'coingecko', 0, 0.00003992, 0, 0, 0, '2019-12-26 04:00:32.958000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056062', '2020-08-02 13:19:42.056063', 'c304', 304, 'IOTX', 'coin', '', 'USD', 'coingecko', -5.82377, 0.0066349, 4322572, 33825911, 0, '2020-08-02 13:17:26.853000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056063', '2020-08-02 13:19:42.056064', 'c283', 283, 'ALGO', 'coin', '', 'USD', 'coingecko', -9.89434, 0.295502, 92693574, 236076896, 0, '2020-08-02 13:16:10.509000'); @@ -4586,7 +4514,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056124', '2020-08-02 13:19:42.056124', 'c60_t0x174bfa6600bf90c885c7c01c7031389ed1461ab9', 60, 'ETH', 'token', '0x174bfa6600bf90c885c7c01c7031389ed1461ab9', 'USD', 'coingecko', 0, 0.00198169, 11.12, 0, 0, '2020-08-01 08:34:10.602000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056125', '2020-08-02 13:19:42.056125', 'c60_t0x0f1ed66c251bcb52ecf7e67ac64bb72482048adb', 60, 'ETH', 'token', '0x0f1ed66c251bcb52ecf7e67ac64bb72482048adb', 'USD', 'coingecko', 1.24931, 0.00024112, 331651, 0, 0, '2020-08-02 13:11:30.416000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056125', '2020-08-02 13:19:42.056125', 'c60_t0x19131a8ae42e32c747c1ead318fadb98b0be45b7', 60, 'ETH', 'token', '0x19131a8ae42e32c747c1ead318fadb98b0be45b7', 'USD', 'coingecko', 2.71856, 0.00428872, 25704, 0, 0, '2020-08-02 13:12:53.638000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056126', '2020-08-02 13:19:42.056126', 'c714_tund-ebc', 714, 'BNB', 'token', 'und-ebc', 'BNB', 'binancedex', 114.04, 0.00971062, 38.898197174072266, 0, 0, '2020-08-02 13:19:35.487592'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056129', '2020-08-02 13:19:42.056129', 'c60_t0x5e3346444010135322268a4630d2ed5f8d09446c', 60, 'ETH', 'token', '0x5e3346444010135322268a4630d2ed5f8d09446c', 'USD', 'coinmarketcap', -0.779919, 0.390508136008, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056130', '2020-08-02 13:19:42.056130', 'c60_t0x9501bfc48897dceeadf73113ef635d2ff7ee4b97', 60, 'ETH', 'token', '0x9501bfc48897dceeadf73113ef635d2ff7ee4b97', 'USD', 'coingecko', 0, 0.00020377, 0.00224147, 0, 0, '2020-07-31 13:29:52.611000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056130', '2020-08-02 13:19:42.056130', 'c60_t0xc8650a5381b62e2e75f5db74c1e0425f745fc960', 60, 'ETH', 'token', '0xc8650a5381b62e2e75f5db74c1e0425f745fc960', 'USD', 'coingecko', 0, 0.00000005, 0, 0, 0, '2019-12-26 04:00:54.779000'); @@ -4631,7 +4558,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056176', '2020-08-02 13:19:42.056176', 'c111111', 111111, 'FTO', 'coin', '', 'USD', 'coinmarketcap', -46.7216, 0.175182615296, 48.0160141790224, 0, 0, '2020-07-31 07:37:07.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056177', '2020-08-02 13:19:42.056177', 'c60_t0x80e82dd8707a68d9f26a3035c1bbf2b704549801', 60, 'ETH', 'token', '0x80e82dd8707a68d9f26a3035c1bbf2b704549801', 'USD', 'coingecko', 0, 0.00009219, 0.184374, 0, 0, '2020-07-14 12:11:49.692000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056177', '2020-08-02 13:19:42.056177', 'c60_t0x0f71b8de197a1c84d31de0f1fa7926c365f052b3', 60, 'ETH', 'token', '0x0f71b8de197a1c84d31de0f1fa7926c365f052b3', 'USD', 'coingecko', -10.83575, 0.01195079, 5527.67, 0, 0, '2020-08-02 13:18:27.188000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056178', '2020-08-02 13:19:42.056178', 'c714_tmvl-7b0', 714, 'BNB', 'token', 'mvl-7b0', 'BNB', 'binancedex', 0.26, 0.00000755, 16.14896011352539, 0, 0, '2020-08-02 13:19:35.487608'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056179', '2020-08-02 13:19:42.056179', 'c111111_t0x555d051538c7a13712f1f590fa6b4c176ca4529f', 111111, 'ETH', 'token', '0x555d051538c7a13712f1f590fa6b4c176ca4529f', 'USD', 'coinmarketcap', 3.71267, 0.0153587989464, 38094.3199691445, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056179', '2020-08-02 13:19:42.056180', 'c60_t0x80bd0cc689c206e3f642919244c4251c7ef19852', 60, 'ETH', 'token', '0x80bd0cc689c206e3f642919244c4251c7ef19852', 'USD', 'coinmarketcap', 16.6291, 0.0651902795524, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056180', '2020-08-02 13:19:42.056180', 'c60_t0x52494fbffe10f8c29411521040ae8618c334981e', 60, 'ETH', 'token', '0x52494fbffe10f8c29411521040ae8618c334981e', 'USD', 'coingecko', 0, 0.00009193, 0.00919316, 0, 0, '2020-06-15 04:25:39.341000'); @@ -4649,7 +4575,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056190', '2020-08-02 13:19:42.056190', 'c60_t0x4575f41308ec1483f3d399aa9a2826d74da13deb', 60, 'ETH', 'token', '0x4575f41308ec1483f3d399aa9a2826d74da13deb', 'USD', 'coingecko', -0.90182, 0.174907, 5656952, 0, 0, '2020-08-02 13:16:39.249000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056191', '2020-08-02 13:19:42.056191', 'c60_t0xb38f206615325306dddeb0794a6482486b6b78b8', 60, 'ETH', 'token', '0xb38f206615325306dddeb0794a6482486b6b78b8', 'USD', 'coingecko', 9.44852, 1780.33, 8920.83, 0, 0, '2020-08-02 13:09:02.552000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056192', '2020-08-02 13:19:42.056192', 'c60_t0x75c5ee419331b6150879530d06f9ba054755f1da', 60, 'ETH', 'token', '0x75c5ee419331b6150879530d06f9ba054755f1da', 'USD', 'coingecko', 0, 0.00050677, 88.28, 0, 0, '2020-06-21 00:10:03.425000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056194', '2020-08-02 13:19:42.056194', 'c714_tblink-9c6', 714, 'BNB', 'token', 'blink-9c6', 'BNB', 'binancedex', 61.75, 0.00000647, 3.63713002204895, 0, 0, '2020-08-02 13:19:35.487544'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056195', '2020-08-02 13:19:42.056195', 'c60_t0xb6ee9668771a79be7967ee29a63d4184f8097143', 60, 'ETH', 'token', '0xb6ee9668771a79be7967ee29a63d4184f8097143', 'USD', 'coinmarketcap', -3.57948, 0.0143323231501, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056196', '2020-08-02 13:19:42.056196', 'c60_t0x48ac44f4e29e602f851b84c271c22b85b9447251', 60, 'ETH', 'token', '0x48ac44f4e29e602f851b84c271c22b85b9447251', 'USD', 'coingecko', 0, 105.6, 1068.17, 0, 0, '2020-08-01 22:54:42.274000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056196', '2020-08-02 13:19:42.056196', 'c60_t0x2c974b2d0ba1716e644c1fc59982a89ddd2ff724', 60, 'ETH', 'token', '0x2c974b2d0ba1716e644c1fc59982a89ddd2ff724', 'USD', 'coinmarketcap', -2.77043, 0.0212097265944, 0, 0, 0, '2020-08-02 13:18:11.000000'); @@ -4659,7 +4584,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056200', '2020-08-02 13:19:42.056200', 'c111111', 111111, 'BTAD', 'coin', '', 'USD', 'coinmarketcap', 4.49821, 0.000441440067151, 0.302943580405429, 19026.5582291601, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056201', '2020-08-02 13:19:42.056201', 'c60_t0x9363e6eadf5e307b96f26dfd94f355b95a0e2498', 60, 'ETH', 'token', '0x9363e6eadf5e307b96f26dfd94f355b95a0e2498', 'USD', 'coingecko', 0, 0.0000923, 0.184595, 0, 0, '2020-07-10 19:29:00.805000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056201', '2020-08-02 13:19:42.056201', 'c60_t0x3d3560279b7a4e57af202c285305d8f761ccb60a', 60, 'ETH', 'token', '0x3d3560279b7a4e57af202c285305d8f761ccb60a', 'USD', 'coingecko', -0.09604, 0.068791, 468.16, 0, 0, '2020-08-02 08:15:09.837000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056204', '2020-08-02 13:19:42.056204', 'c714_twrx-ed1', 714, 'BNB', 'token', 'wrx-ed1', 'BNB', 'binancedex', 0.88, 0.00601496, 18.959003448486328, 0, 0, '2020-08-02 13:19:35.487594'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056205', '2020-08-02 13:19:42.056205', 'c60_t0x4922a015c4407f87432b179bb209e125432e4a2a', 60, 'ETH', 'token', '0x4922a015c4407f87432b179bb209e125432e4a2a', 'USD', 'coinmarketcap', -0.399722, 1949.55930215, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056205', '2020-08-02 13:19:42.056205', 'c111111', 111111, 'XGOX', 'coin', '', 'USD', 'coinmarketcap', -0.390295, 0.0000215760936338, 36.8654110968252, 51340.97126221829, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056206', '2020-08-02 13:19:42.056206', 'c60_t0x5eb87caa0105a63aa87a36c7bd2573bd13e84fae', 60, 'ETH', 'token', '0x5eb87caa0105a63aa87a36c7bd2573bd13e84fae', 'USD', 'coingecko', -9.47083, 0.01010055, 58269, 0, 0, '2020-08-02 13:16:29.769000'); @@ -4671,7 +4595,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056210', '2020-08-02 13:19:42.056210', 'c60_t0xd9b6f884771857a2afb9171ea53303ff041c2af9', 60, 'ETH', 'token', '0xd9b6f884771857a2afb9171ea53303ff041c2af9', 'USD', 'coingecko', 0, 0.00135337, 13.53, 0, 0, '2019-10-07 01:29:29.855000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056213', '2020-08-02 13:19:42.056213', 'c60_t0x6368e1e18c4c419ddfc608a0bed1ccb87b9250fc', 60, 'ETH', 'token', '0x6368e1e18c4c419ddfc608a0bed1ccb87b9250fc', 'USD', 'coingecko', -8.84044, 0.04800187, 183222, 0, 0, '2020-08-02 13:18:27.354000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056213', '2020-08-02 13:19:42.056214', 'c60_t0x0854dcbdcd026c0b534b09608adb3f2bf6baacd0', 60, 'ETH', 'token', '0x0854dcbdcd026c0b534b09608adb3f2bf6baacd0', 'USD', 'coingecko', 0, 0.00043681, 0, 0, 0, '2020-04-23 10:49:07.761000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056214', '2020-08-02 13:19:42.056214', 'c714_tbttb-d31', 714, 'BNB', 'token', 'bttb-d31', 'BNB', 'binancedex', 1.71, 0.00001902, 4.005205154418945, 0, 0, '2020-08-02 13:19:35.487674'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056593', '2020-08-02 13:19:42.056593', 'c60_t0x9d9223436ddd466fc247e9dbbd20207e640fef58', 60, 'ETH', 'token', '0x9d9223436ddd466fc247e9dbbd20207e640fef58', 'USD', 'coinmarketcap', 0, 0.00174352756157, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056594', '2020-08-02 13:19:42.056594', 'c60_t0x136723300aef2aab4b7cf52c3eaac6f997e12a68', 60, 'ETH', 'token', '0x136723300aef2aab4b7cf52c3eaac6f997e12a68', 'USD', 'coingecko', 0.06076, 0.00090389, 22.67, 0, 0, '2020-08-02 02:15:58.130000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056594', '2020-08-02 13:19:42.056595', 'c60_t0xff8998b32a2b3da59de78518086ea4431b30a2c6', 60, 'ETH', 'token', '0xff8998b32a2b3da59de78518086ea4431b30a2c6', 'USD', 'coingecko', 0, 0.00000999, 348.82, 0, 0, '2020-01-31 07:39:13.915000'); @@ -4705,14 +4628,12 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056621', '2020-08-02 13:19:42.056622', 'c60_t0xaa19961b6b858d9f18a115f25aa1d98abc1fdba8', 60, 'ETH', 'token', '0xaa19961b6b858d9f18a115f25aa1d98abc1fdba8', 'USD', 'coingecko', -6.11861, 0.00697788, 10864.17, 269928, 0, '2020-08-02 13:18:58.290000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056623', '2020-08-02 13:19:42.056623', 'c60_t0xf18af466f8885f9ea93d2b85c47a427cb01bad52', 60, 'ETH', 'token', '0xf18af466f8885f9ea93d2b85c47a427cb01bad52', 'USD', 'coingecko', -14.00199, 0.00546301, 38.24, 0, 0, '2020-08-02 12:22:38.018000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056624', '2020-08-02 13:19:42.056624', 'c60_t0x5808fb823d720e91f1564cd9c9081af7136f73db', 60, 'ETH', 'token', '0x5808fb823d720e91f1564cd9c9081af7136f73db', 'USD', 'coingecko', 0, 0.00000183, 0, 0, 0, '2019-12-26 04:00:09.993000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056625', '2020-08-02 13:19:42.056625', 'c714_tcnns-e16', 714, 'BNB', 'token', 'cnns-e16', 'BNB', 'binancedex', 0, 0.00017195, 0, 0, 0, '2020-08-02 13:19:35.487634'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056625', '2020-08-02 13:19:42.056625', 'c60_t0x7a5e6ca9d335e343d1ed12239f67248e056afe2f', 60, 'ETH', 'token', '0x7a5e6ca9d335e343d1ed12239f67248e056afe2f', 'USD', 'coinmarketcap', 0.0000000000000284217, 0.0212882656986, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056627', '2020-08-02 13:19:42.056627', 'c60_t0x05ac103f68e05da35e78f6165b9082432fe64b58', 60, 'ETH', 'token', '0x05ac103f68e05da35e78f6165b9082432fe64b58', 'USD', 'coingecko', -0.70761, 1.16, 793296, 0, 0, '2020-08-01 23:25:27.773000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056627', '2020-08-02 13:19:42.056627', 'c60_t0xffc7a65176b532db7e1ac26c522ca07123f952e1', 60, 'ETH', 'token', '0xffc7a65176b532db7e1ac26c522ca07123f952e1', 'USD', 'coingecko', 0, 30.49, 111021310, 0, 0, '2019-12-26 04:00:08.496000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056628', '2020-08-02 13:19:42.056628', 'c60_t0x009e864923b49263c7f10d19b7f8ab7a9a5aad33', 60, 'ETH', 'token', '0x009e864923b49263c7f10d19b7f8ab7a9a5aad33', 'USD', 'coingecko', -24.70936, 0.00287112, 23103, 0, 0, '2020-08-02 13:18:35.174000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056631', '2020-08-02 13:19:42.056631', 'c60_t0x223fb5c14c00cfb70cf56bb63c2eef2d74fe1a78', 60, 'ETH', 'token', '0x223fb5c14c00cfb70cf56bb63c2eef2d74fe1a78', 'USD', 'coingecko', 9.36047, 35.01, 1450.47, 0, 0, '2020-08-02 07:11:46.799000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056632', '2020-08-02 13:19:42.056632', 'c60_t0xcb529ae44941500ded968baf9617ddecacc6fb87', 60, 'ETH', 'token', '0xcb529ae44941500ded968baf9617ddecacc6fb87', 'USD', 'coingecko', 0, 0.00004437, 0, 0, 0, '2020-04-23 10:48:33.324000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056632', '2020-08-02 13:19:42.056632', 'c714_teosbull-f0d', 714, 'BNB', 'token', 'eosbull-f0d', 'BNB', 'binancedex', -22.69, 0.203996, 132.91070556640625, 0, 0, '2020-08-02 13:19:35.487542'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056633', '2020-08-02 13:19:42.056633', 'c60_t0x9972a0f24194447e73a7e8b6cd26a52e02ddfad5', 60, 'ETH', 'token', '0x9972a0f24194447e73a7e8b6cd26a52e02ddfad5', 'USD', 'coinmarketcap', 28.9534, 0.00210739505218, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056634', '2020-08-02 13:19:42.056634', 'c60_t0x88a3e4f35d64aad41a6d4030ac9afe4356cb84fa', 60, 'ETH', 'token', '0x88a3e4f35d64aad41a6d4030ac9afe4356cb84fa', 'USD', 'coinmarketcap', -20.3403, 0.0146455286714, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056634', '2020-08-02 13:19:42.056634', 'c60_t0x43044f861ec040db59a7e324c40507addb673142', 60, 'ETH', 'token', '0x43044f861ec040db59a7e324c40507addb673142', 'USD', 'coingecko', -13.8396, 52.71, 265757, 5255825, 0, '2020-08-02 13:17:35.217000'); @@ -4732,7 +4653,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056646', '2020-08-02 13:19:42.056646', 'c60_t0x6425c6be902d692ae2db752b3c268afadb099d3b', 60, 'ETH', 'token', '0x6425c6be902d692ae2db752b3c268afadb099d3b', 'USD', 'coinmarketcap', -14.9351, 0.00232228991825, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056647', '2020-08-02 13:19:42.056647', 'c60_t0xd9dac7b72472376b60b6aee9cfa2498cccdcb2a7', 60, 'ETH', 'token', '0xd9dac7b72472376b60b6aee9cfa2498cccdcb2a7', 'USD', 'coingecko', 2.92052, 0.00029625, 734.97, 0, 0, '2020-08-02 12:19:09.503000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056650', '2020-08-02 13:19:42.056650', 'c60_t0x218f1de2ea9ae3e9fdea347b6e707ebfda2d6233', 60, 'ETH', 'token', '0x218f1de2ea9ae3e9fdea347b6e707ebfda2d6233', 'USD', 'coingecko', 0, 0.00029241, 0, 0, 0, '2020-06-19 07:48:55.961000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056650', '2020-08-02 13:19:42.056650', 'c714_tmeetone-031', 714, 'BNB', 'token', 'meetone-031', 'BNB', 'binancedex', -38.14, 0.00004, 0.010467000305652618, 0, 0, '2020-08-02 13:19:35.487599'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056651', '2020-08-02 13:19:42.056651', 'c60_t0x3c4a3ffd813a107febd57b2f01bc344264d90fde', 60, 'ETH', 'token', '0x3c4a3ffd813a107febd57b2f01bc344264d90fde', 'USD', 'coinmarketcap', 0.0000000000000284217, 0.000167148658487, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056652', '2020-08-02 13:19:42.056652', 'c60_t0xf970b8e36e23f7fc3fd752eea86f8be8d83375a6', 60, 'ETH', 'token', '0xf970b8e36e23f7fc3fd752eea86f8be8d83375a6', 'USD', 'coingecko', -3.80424, 0.051212, 391069, 26051007, 0, '2020-08-02 13:18:21.575000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056652', '2020-08-02 13:19:42.056652', 'c60_t0xc19216eea17b2f4dd677f1024cda59c7d142f189', 60, 'ETH', 'token', '0xc19216eea17b2f4dd677f1024cda59c7d142f189', 'USD', 'coingecko', 0.06961, 149.48, 1311.92, 0, 0, '2020-08-02 13:09:52.026000'); @@ -4754,7 +4674,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056691', '2020-08-02 13:19:42.056692', 'c235', 235, 'FIO', 'coin', '', 'USD', 'coinmarketcap', -1.09377, 0.287629443121, 0, 0, 0, '2020-08-02 13:18:26.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056692', '2020-08-02 13:19:42.056692', 'c60_t0xad29d26b081204ba2d1da9e86101dda69ec835d5', 60, 'ETH', 'token', '0xad29d26b081204ba2d1da9e86101dda69ec835d5', 'USD', 'coingecko', 0, 0.00007937, 0, 0, 0, '2019-12-26 04:00:33.990000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056693', '2020-08-02 13:19:42.056693', 'c195_ttnq5pbsssk5xfmsyu4aox4xkgtdpdoediy', 195, 'TRX', 'token', 'tnq5pbsssk5xfmsyu4aox4xkgtdpdoediy', 'USD', 'coingecko', 8.40514, 0.00008605, 83.44, 0, 0, '2020-08-02 12:59:00.488000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056693', '2020-08-02 13:19:42.056694', 'c714_tugas-b0c', 714, 'BNB', 'token', 'ugas-b0c', 'BNB', 'binancedex', 5.6, 0.0011109, 0.18044137954711914, 0, 0, '2020-08-02 13:19:35.487598'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056698', '2020-08-02 13:19:42.056699', 'c60_t0xd4a293ae8bb9e0be12e99eb19d48239e8c83a136', 60, 'ETH', 'token', '0xd4a293ae8bb9e0be12e99eb19d48239e8c83a136', 'USD', 'coinmarketcap', -6.9745, 0.00239685491202, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056699', '2020-08-02 13:19:42.056700', 'c60_t0xa8262eb913fccea4c3f77fc95b8b4043b384cfbb', 60, 'ETH', 'token', '0xa8262eb913fccea4c3f77fc95b8b4043b384cfbb', 'USD', 'coingecko', -2.99604, 0.00030559, 6521.09, 272634, 0, '2020-08-02 13:11:10.648000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056701', '2020-08-02 13:19:42.056701', 'c60_t0x9e5a64943f9f48463f07cc0578bbf9e2e67f0f61', 60, 'ETH', 'token', '0x9e5a64943f9f48463f07cc0578bbf9e2e67f0f61', 'USD', 'coingecko', 2.68602, 1.38, 127871, 0, 0, '2020-08-02 13:14:01.755000'); @@ -4771,7 +4690,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056712', '2020-08-02 13:19:42.056712', 'c111111', 111111, 'TREX', 'coin', '', 'USD', 'coinmarketcap', -4.50102, 0.0000110677837445, 0.0153424717246112, 11143.593111644734, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056713', '2020-08-02 13:19:42.056713', 'c60_t0xdf2237d32ab6945657a6e56f6e4568d19dace492', 60, 'ETH', 'token', '0xdf2237d32ab6945657a6e56f6e4568d19dace492', 'USD', 'coingecko', 0, 0.0004915, 0.234713, 0, 0, '2020-02-22 06:50:50.167000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056713', '2020-08-02 13:19:42.056713', 'c60_t0x823ac2e3177e81ce1ad3afdae4fb41870b221495', 60, 'ETH', 'token', '0x823ac2e3177e81ce1ad3afdae4fb41870b221495', 'USD', 'coingecko', 0, 0.088541, 92.49, 0, 0, '2020-06-07 07:13:51.243000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056714', '2020-08-02 13:19:42.056714', 'c714_tbch-1fd', 714, 'BNB', 'token', 'bch-1fd', 'BNB', 'binancedex', -4.53, 13.9931, 82.0638427734375, 0, 0, '2020-08-02 13:19:35.487563'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056715', '2020-08-02 13:19:42.056715', 'c60_t0x1bc7c1de0ac6ef4fdec35c053030d90cf54c7e9a', 60, 'ETH', 'token', '0x1bc7c1de0ac6ef4fdec35c053030d90cf54c7e9a', 'USD', 'coingecko', 0, 0.00003816, 0.968307, 4085.55, 0, '2020-07-20 07:49:21.451000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056716', '2020-08-02 13:19:42.056716', 'c60_t0xe50365f5d679cb98a1dd62d6f6e58e59321bcddf', 60, 'ETH', 'token', '0xe50365f5d679cb98a1dd62d6f6e58e59321bcddf', 'USD', 'coinmarketcap', -0.419698, 0.0335679272423, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056716', '2020-08-02 13:19:42.056716', 'c60_t0xfe76be9cec465ed3219a9972c21655d57d21aec6', 60, 'ETH', 'token', '0xfe76be9cec465ed3219a9972c21655d57d21aec6', 'USD', 'coinmarketcap', -3.22051, 0.00305747273498, 0, 0, 0, '2020-08-02 13:18:15.000000'); @@ -4791,7 +4709,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056732', '2020-08-02 13:19:42.056732', 'c60_t0xb2f7eb1f2c37645be61d73953035360e768d81e6', 60, 'ETH', 'token', '0xb2f7eb1f2c37645be61d73953035360e768d81e6', 'USD', 'coinmarketcap', -20.4155, 0.000553389187226, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056733', '2020-08-02 13:19:42.056733', 'c60_t0xebf4ca5319f406602eeff68da16261f1216011b5', 60, 'ETH', 'token', '0xebf4ca5319f406602eeff68da16261f1216011b5', 'USD', 'coinmarketcap', -4.81087, 709.029745733, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056733', '2020-08-02 13:19:42.056734', 'c60_t0x8430acfd193271d004ac0f0825b95e6a382eeb22', 60, 'ETH', 'token', '0x8430acfd193271d004ac0f0825b95e6a382eeb22', 'USD', 'coingecko', 6.68747, 0.0003644, 134.3, 0, 0, '2020-08-02 08:04:49.193000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056734', '2020-08-02 13:19:42.056734', 'c714_tcbix-3c9', 714, 'BNB', 'token', 'cbix-3c9', 'BNB', 'binancedex', 1.39, 0.000145, 44.37766647338867, 0, 0, '2020-08-02 13:19:35.487540'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056750', '2020-08-02 13:19:42.056750', 'c60_t0xa8892bfc33fa44053a9e402b1839966f4fec74a4', 60, 'ETH', 'token', '0xa8892bfc33fa44053a9e402b1839966f4fec74a4', 'USD', 'coingecko', 4.96582, 0.374841, 60955, 0, 0, '2020-08-02 13:16:22.780000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056751', '2020-08-02 13:19:42.056752', 'c111111', 111111, 'XTA', 'coin', '', 'USD', 'coinmarketcap', 1.1439, 0.00644725566373, 16.2903385833656, 29263.964512557195, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056752', '2020-08-02 13:19:42.056752', 'c60_t0x174bea2cb8b20646681e855196cf34fcecec2489', 60, 'ETH', 'token', '0x174bea2cb8b20646681e855196cf34fcecec2489', 'USD', 'coingecko', -87.7752, 0.00048217, 25.79, 0, 0, '2020-08-02 13:09:47.476000'); @@ -4844,7 +4761,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056794', '2020-08-02 13:19:42.056794', 'c111111', 111111, 'SXC', 'coin', '', 'USD', 'coinmarketcap', -4.50259, 0.00166016756168, 336.745722047219, 0, 0, '2020-08-02 13:18:06.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056794', '2020-08-02 13:19:42.056795', 'c60_t0x71d01db8d6a2fbea7f8d434599c237980c234e4c', 60, 'ETH', 'token', '0x71d01db8d6a2fbea7f8d434599c237980c234e4c', 'USD', 'coingecko', 0, 0.00003501, 3.4, 506.33, 0, '2020-06-17 13:43:19.432000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056795', '2020-08-02 13:19:42.056795', 'c60_t0x543ff227f64aa17ea132bf9886cab5db55dcaddf', 60, 'ETH', 'token', '0x543ff227f64aa17ea132bf9886cab5db55dcaddf', 'USD', 'coingecko', -11.54881, 0.180099, 449667, 8659824, 0, '2020-08-02 13:18:02.313000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056796', '2020-08-02 13:19:42.056796', 'c714_tkat-7bb', 714, 'BNB', 'token', 'kat-7bb', 'BNB', 'binancedex', -16.57, 0.00003754, 10.078742027282715, 0, 0, '2020-08-02 13:19:35.487577'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056796', '2020-08-02 13:19:42.056797', 'c111111', 111111, 'SOCC', 'coin', '', 'USD', 'coinmarketcap', -0.0000000000000284217, 0.000173972596426, 0, 1829.917707562149, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056797', '2020-08-02 13:19:42.056797', 'c60_t0xf237f9cb687857b41fa88a141793115f1af9ac80', 60, 'ETH', 'token', '0xf237f9cb687857b41fa88a141793115f1af9ac80', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056798', '2020-08-02 13:19:42.056800', 'c60_t0x2dae7da77d3ea6f83e1ea81ca2604c30d0b1cb00', 60, 'ETH', 'token', '0x2dae7da77d3ea6f83e1ea81ca2604c30d0b1cb00', 'USD', 'coingecko', 0, 0.00028961, 0.00057921, 0, 0, '2020-01-31 04:05:35.235000'); @@ -4908,7 +4824,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056850', '2020-08-02 13:19:42.056850', 'c60_t0x94236591125e935f5ac128bb3d5062944c24958c', 60, 'ETH', 'token', '0x94236591125e935f5ac128bb3d5062944c24958c', 'USD', 'coingecko', 0, 0.03849569, 4.73, 961212, 0, '2020-08-02 05:14:17.966000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056850', '2020-08-02 13:19:42.056850', 'c111111_tbac0d143a547dc66a1d6a2b7d66b06de42614971', 111111, 'NEO', 'token', 'bac0d143a547dc66a1d6a2b7d66b06de42614971', 'USD', 'coingecko', 15.5585, 0.00190463, 13290.03, 434246, 0, '2020-08-02 13:11:22.037000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056851', '2020-08-02 13:19:42.056851', 'c60_t0x25380dbee64f2a7afcd8e9f46375d1dcba28630f', 60, 'ETH', 'token', '0x25380dbee64f2a7afcd8e9f46375d1dcba28630f', 'USD', 'coingecko', 0, 0.00315457, 22725, 0, 0, '2020-06-09 06:03:46.697000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056852', '2020-08-02 13:19:42.056852', 'c714_tidrtb-178', 714, 'BNB', 'token', 'idrtb-178', 'BNB', 'binancedex', -2.55, 0.0000033892905198154872, 44880968, 0, 0, '2020-08-02 13:19:35.487604'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056854', '2020-08-02 13:19:42.056854', 'c111111', 111111, 'DTEP', 'coin', '', 'USD', 'coinmarketcap', 10.6174, 0.0575524754716, 10117.4519243182, 3070563.935656665, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056855', '2020-08-02 13:19:42.056855', 'c60_t0xc275865a6cce78398e94cb2af29fa0d787b7f7eb', 60, 'ETH', 'token', '0xc275865a6cce78398e94cb2af29fa0d787b7f7eb', 'USD', 'coingecko', 0, 0.00003715, 0.01029702, 0, 0, '2020-08-02 05:24:21.902000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056855', '2020-08-02 13:19:42.056856', 'c60_t0xe6bc60a00b81c7f3cbc8f4ef3b0a6805b6851753', 60, 'ETH', 'token', '0xe6bc60a00b81c7f3cbc8f4ef3b0a6805b6851753', 'USD', 'coingecko', 0, 0.00000157, 0, 0, 0, '2019-12-26 04:00:21.887000'); @@ -4928,7 +4843,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056867', '2020-08-02 13:19:42.056867', 'c60_t0x84f7c44b6fed1080f647e354d552595be2cc602f', 60, 'ETH', 'token', '0x84f7c44b6fed1080f647e354d552595be2cc602f', 'USD', 'coinmarketcap', 8.61793, 0.000565534852504, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056867', '2020-08-02 13:19:42.056867', 'c60_t0xf53e6deda250bc5fa12793ac49c257edf4efdbc2', 60, 'ETH', 'token', '0xf53e6deda250bc5fa12793ac49c257edf4efdbc2', 'USD', 'coingecko', 6.46112, 0.00084402, 486.39, 0, 0, '2020-07-17 15:01:10.250000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056868', '2020-08-02 13:19:42.056868', 'c60_t0x20910e5b5f087f6439dfcb0dda4e27d1014ac2b8', 60, 'ETH', 'token', '0x20910e5b5f087f6439dfcb0dda4e27d1014ac2b8', 'USD', 'coingecko', -3.57283, 0.01505436, 301956, 0, 0, '2020-08-02 13:14:22.435000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056869', '2020-08-02 13:19:42.056869', 'c714_thyn-f21', 714, 'BNB', 'token', 'hyn-f21', 'BNB', 'binancedex', 0, 0.034, 1.4573158025741577, 0, 0, '2020-08-02 13:19:35.487629'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056869', '2020-08-02 13:19:42.056869', 'c60_t0x84cd9d75af2786d20504fb50bde9f2c2339390b3', 60, 'ETH', 'token', '0x84cd9d75af2786d20504fb50bde9f2c2339390b3', 'USD', 'coingecko', 0, 0.00014707, 8.38, 0, 0, '2020-03-21 03:14:52.169000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056872', '2020-08-02 13:19:42.056872', 'c60_t0xb052f8a33d8bb068414eade06af6955199f9f010', 60, 'ETH', 'token', '0xb052f8a33d8bb068414eade06af6955199f9f010', 'USD', 'coingecko', -6.53368, 0.052848, 249.15, 0, 0, '2020-08-02 13:14:49.987000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056873', '2020-08-02 13:19:42.056873', 'c111111', 111111, 'BLAZR', 'coin', '', 'USD', 'coinmarketcap', -1.9316, 0.000221355674891, 46.643846457269, 0, 0, '2020-08-02 13:18:10.000000'); @@ -5000,7 +4914,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056930', '2020-08-02 13:19:42.056930', 'c60_t0xb0866289e870d2efc282406cf4123df6e5bcb652', 60, 'ETH', 'token', '0xb0866289e870d2efc282406cf4123df6e5bcb652', 'USD', 'coingecko', 0.29572, 0.00705975, 5005.83, 0, 0, '2020-08-02 13:18:26.452000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056931', '2020-08-02 13:19:42.056931', 'c60_t0x1b6c5864375b34af3ff5bd2e5f40bc425b4a8d79', 60, 'ETH', 'token', '0x1b6c5864375b34af3ff5bd2e5f40bc425b4a8d79', 'USD', 'coingecko', -1.50413, 0.00659901, 981041, 0, 0, '2020-08-02 13:18:22.569000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056931', '2020-08-02 13:19:42.056931', 'c60_t0x957b28f93b0e01557e21e6c564ab26ddc2d18ec5', 60, 'ETH', 'token', '0x957b28f93b0e01557e21e6c564ab26ddc2d18ec5', 'USD', 'coingecko', -82.3676, 0.00167782, 16.05, 0, 0, '2020-07-31 14:23:51.993000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056932', '2020-08-02 13:19:42.056932', 'c714_thnst-3c9', 714, 'BNB', 'token', 'hnst-3c9', 'BNB', 'binancedex', -10.44, 0.0003, 1.9738613367080688, 0, 0, '2020-08-02 13:19:35.487667'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056933', '2020-08-02 13:19:42.056933', 'c60_t0x9d8be94d0612170ce533ac4d7b43cc3cd91e5a1a', 60, 'ETH', 'token', '0x9d8be94d0612170ce533ac4d7b43cc3cd91e5a1a', 'USD', 'coinmarketcap', -5.11686, 0.00131940857373, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056935', '2020-08-02 13:19:42.056935', 'c60_t0xc00e94cb662c3520282e6f5717214004a7f26888', 60, 'ETH', 'token', '0xc00e94cb662c3520282e6f5717214004a7f26888', 'USD', 'coingecko', -6.92715, 128.39, 58855325, 402896373, 0, '2020-08-02 13:18:35.133000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056936', '2020-08-02 13:19:42.056936', 'c60_t0x48ff53777f747cfb694101222a944de070c15d36', 60, 'ETH', 'token', '0x48ff53777f747cfb694101222a944de070c15d36', 'USD', 'coinmarketcap', -19.0285, 0.00258988181893, 0, 0, 0, '2020-08-02 13:18:14.000000'); @@ -5023,7 +4936,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056949', '2020-08-02 13:19:42.056949', 'c60_t0xedbdafaf3428faeef3cd3d61cda8d14fd0ddec71', 60, 'ETH', 'token', '0xedbdafaf3428faeef3cd3d61cda8d14fd0ddec71', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-04-23 10:48:35.494000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056950', '2020-08-02 13:19:42.056950', 'c60_t0x865d176351f287fe1b0010805b110d08699c200a', 60, 'ETH', 'token', '0x865d176351f287fe1b0010805b110d08699c200a', 'USD', 'coingecko', 0, 0.01429348, 150.45, 97375, 0, '2020-03-23 16:07:45.691000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056951', '2020-08-02 13:19:42.056953', 'c60_t0x0abdace70d3790235af448c88547603b945604ea', 60, 'ETH', 'token', '0x0abdace70d3790235af448c88547603b945604ea', 'USD', 'coingecko', -0.99608, 0.0081928, 253586, 6133071, 0, '2020-08-02 13:17:13.442000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056953', '2020-08-02 13:19:42.056953', 'c714_tswipe.b-dc0', 714, 'BNB', 'token', 'swipe.b-dc0', 'BNB', 'binancedex', -42.26, 0.00004559, 88.63916778564453, 0, 0, '2020-08-02 13:19:35.487636'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056954', '2020-08-02 13:19:42.056954', 'c5', 5, 'DASH', 'coin', '', 'USD', 'coinmarketcap', -0.830172, 84.193465646, 0, 0, 0, '2020-08-02 13:18:07.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056954', '2020-08-02 13:19:42.056955', 'c60_t0x3a92bd396aef82af98ebc0aa9030d25a23b11c6b', 60, 'ETH', 'token', '0x3a92bd396aef82af98ebc0aa9030d25a23b11c6b', 'USD', 'coinmarketcap', 6.95729, 0.0530253147794, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056955', '2020-08-02 13:19:42.056955', 'c111111', 111111, 'XBG', 'coin', '', 'USD', 'coinmarketcap', 14.9451, 0.00412054126038, 37914.9869724463, 0, 0, '2020-08-02 13:18:20.000000'); @@ -5035,7 +4947,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056959', '2020-08-02 13:19:42.056959', 'c111111', 111111, 'FIII', 'coin', '', 'USD', 'coinmarketcap', 8.79614, 0.000117743105743, 501.711184415069, 56799.827485277085, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056962', '2020-08-02 13:19:42.056962', 'c60_t0xd7cddd45629934c2f6ed3b63217bd8085d7c14a8', 60, 'ETH', 'token', '0xd7cddd45629934c2f6ed3b63217bd8085d7c14a8', 'USD', 'coingecko', 0, 0.00028421, 0.0196107, 0, 0, '2020-06-12 09:09:21.890000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056962', '2020-08-02 13:19:42.056962', 'c60_t0x196f4727526ea7fb1e17b2071b3d8eaa38486988', 60, 'ETH', 'token', '0x196f4727526ea7fb1e17b2071b3d8eaa38486988', 'USD', 'coingecko', -0.3796, 0.995437, 2311.11, 1014336, 0, '2020-08-02 11:15:23.932000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056963', '2020-08-02 13:19:42.056963', 'c714_tdrep-7d2', 714, 'BNB', 'token', 'drep-7d2', 'BNB', 'binancedex', 0, 0.00023997, 0.028796400874853134, 0, 0, '2020-08-02 13:19:35.487636'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056964', '2020-08-02 13:19:42.056964', 'c111111', 111111, 'PNX', 'coin', '', 'USD', 'coinmarketcap', -3.52918, 0.000641680625681, 0, 31118.638504187675, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056964', '2020-08-02 13:19:42.056964', 'c111111', 111111, 'MCPC', 'coin', '', 'USD', 'coinmarketcap', 5.55883, 0.00424291495677, 15.1741240002173, 37487.1692089871, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.056965', '2020-08-02 13:19:42.056965', 'c111111', 111111, 'VIDZ', 'coin', '', 'USD', 'coinmarketcap', -0.0000000000000284217, 0.000275223174057, 0, 34479.89718471407, 0, '2020-08-02 13:18:09.000000'); @@ -5135,7 +5046,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057294', '2020-08-02 13:19:42.057294', 'c60_t0xc690f7c7fcffa6a82b79fab7508c466fefdfc8c5', 60, 'ETH', 'token', '0xc690f7c7fcffa6a82b79fab7508c466fefdfc8c5', 'USD', 'coinmarketcap', -2.44416, 0.00245768534878, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057294', '2020-08-02 13:19:42.057294', 'c111111_tLFEC', 111111, 'XLM', 'token', 'LFEC', 'USD', 'coinmarketcap', 0.0000000000000710543, 0.00129949565559, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057295', '2020-08-02 13:19:42.057295', 'c60_t0xce5114d7fa8361f0c088ee26fa3a5446c4a1f50b', 60, 'ETH', 'token', '0xce5114d7fa8361f0c088ee26fa3a5446c4a1f50b', 'USD', 'coingecko', 3.76119, 0.065097, 1746347, 0, 0, '2020-08-02 13:17:53.901000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057295', '2020-08-02 13:19:42.057295', 'c714_tnexo-a84', 714, 'BNB', 'token', 'nexo-a84', 'BNB', 'binancedex', -1.98, 0.0109005, 173.92408752441406, 0, 0, '2020-08-02 13:19:35.487625'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057296', '2020-08-02 13:19:42.057296', 'c60_t0xf4fe95603881d0e07954fd7605e0e9a916e42c44', 60, 'ETH', 'token', '0xf4fe95603881d0e07954fd7605e0e9a916e42c44', 'USD', 'coinmarketcap', -4.36694, 0.0018804164582, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057296', '2020-08-02 13:19:42.057296', 'c60_t0x688ff43c3c19e4714f0beb76df8ee394207ab411', 60, 'ETH', 'token', '0x688ff43c3c19e4714f0beb76df8ee394207ab411', 'USD', 'coingecko', 0.8777, 3.99, 226646, 0, 0, '2020-08-02 13:16:00.353000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057297', '2020-08-02 13:19:42.057297', 'c60_t0xb6957bf56805faed7f1bae30eaebe918b8baff71', 60, 'ETH', 'token', '0xb6957bf56805faed7f1bae30eaebe918b8baff71', 'USD', 'coingecko', 0, 0.0001381, 0, 0, 0, '2020-04-29 12:55:01.293000'); @@ -5267,7 +5177,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057360', '2020-08-02 13:19:42.057360', 'c60_t0xb17df9a3b09583a9bdcf757d6367171476d4d8a3', 60, 'ETH', 'token', '0xb17df9a3b09583a9bdcf757d6367171476d4d8a3', 'USD', 'coingecko', 0.88436, 0.00199019, 2363.93, 158844, 0, '2020-08-02 13:15:57.366000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057361', '2020-08-02 13:19:42.057361', 'c60_t0x1279c15969bb2007ec075c7d19f55de3e3da3807', 60, 'ETH', 'token', '0x1279c15969bb2007ec075c7d19f55de3e3da3807', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-05-20 07:33:41.912000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057361', '2020-08-02 13:19:42.057361', 'c60_t0xcfee207a9a4e2ed5027c5830b2611f1944899130', 60, 'ETH', 'token', '0xcfee207a9a4e2ed5027c5830b2611f1944899130', 'USD', 'coingecko', 0, 0, 0, 0, 0, '0001-01-01 00:00:00.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057362', '2020-08-02 13:19:42.057362', 'c714_tchz-ecd', 714, 'BNB', 'token', 'chz-ecd', 'BNB', 'binancedex', -1.88, 0.00062239, 312.98114013671875, 0, 0, '2020-08-02 13:19:35.487625'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057362', '2020-08-02 13:19:42.057363', 'c60_t0x7b0c06043468469967dba22d1af33d77d44056c8', 60, 'ETH', 'token', '0x7b0c06043468469967dba22d1af33d77d44056c8', 'USD', 'coinmarketcap', -3.20319, 0.187274792047, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057363', '2020-08-02 13:19:42.057363', 'c60_t0x61bfc979ea8160ede9b862798b7833a97bafa02a', 60, 'ETH', 'token', '0x61bfc979ea8160ede9b862798b7833a97bafa02a', 'USD', 'coingecko', -6.20243, 0.000004, 71318, 193690, 0, '2020-08-02 13:16:01.446000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057363', '2020-08-02 13:19:42.057364', 'c60_t0xc06aec5191be16b94ffc97b6fc01393527367365', 60, 'ETH', 'token', '0xc06aec5191be16b94ffc97b6fc01393527367365', 'USD', 'coingecko', 0, 337.42, 127.59, 0, 0, '2020-07-23 04:02:04.496000'); @@ -5291,7 +5200,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057373', '2020-08-02 13:19:42.057373', 'c60_t0xaf146fbd319ca7ae178caa2c9d80a2db6b944350', 60, 'ETH', 'token', '0xaf146fbd319ca7ae178caa2c9d80a2db6b944350', 'USD', 'coingecko', 0, 0.00137425, 2.09, 0, 0, '2020-02-21 02:05:41.195000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057373', '2020-08-02 13:19:42.057374', 'c60_t0x6b785a0322126826d8226d77e173d75dafb84d11', 60, 'ETH', 'token', '0x6b785a0322126826d8226d77e173d75dafb84d11', 'USD', 'coingecko', 1.1542, 0.637525, 53869, 0, 0, '2020-08-02 13:18:34.184000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057374', '2020-08-02 13:19:42.057374', 'c60_t0xeb7c20027172e5d143fb030d50f91cece2d1485d', 60, 'ETH', 'token', '0xeb7c20027172e5d143fb030d50f91cece2d1485d', 'USD', 'coingecko', 0, 0.00000242, 0, 45.39, 0, '2020-07-18 04:52:49.166000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057375', '2020-08-02 13:19:42.057375', 'c714_teosbear-721', 714, 'BNB', 'token', 'eosbear-721', 'BNB', 'binancedex', 17.82, 0.223719, 25.763334274291992, 0, 0, '2020-08-02 13:19:35.487673'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057375', '2020-08-02 13:19:42.057375', 'c60_t0x0e7f79e89ba8c4a13431129fb2db0d4f444b5b9a', 60, 'ETH', 'token', '0x0e7f79e89ba8c4a13431129fb2db0d4f444b5b9a', 'USD', 'coinmarketcap', 0.306136, 0.0838521869947, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057376', '2020-08-02 13:19:42.057376', 'c60_t0x6e5a43db10b04701385a34afb670e404bc7ea597', 60, 'ETH', 'token', '0x6e5a43db10b04701385a34afb670e404bc7ea597', 'USD', 'coinmarketcap', -4.96535, 0.0762299596843, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057376', '2020-08-02 13:19:42.057376', 'c60_t0xa7de087329bfcda5639247f96140f9dabe3deed1', 60, 'ETH', 'token', '0xa7de087329bfcda5639247f96140f9dabe3deed1', 'USD', 'coingecko', -13.27149, 0.053665, 282610, 0, 0, '2020-08-02 13:18:56.451000'); @@ -5305,7 +5213,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057380', '2020-08-02 13:19:42.057381', 'c60_t0x71f7b56f9f8641f73ca71512a93857a7868d1443', 60, 'ETH', 'token', '0x71f7b56f9f8641f73ca71512a93857a7868d1443', 'USD', 'coingecko', 0, 0.00068103, 0, 0, 0, '2019-12-26 04:00:37.414000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057381', '2020-08-02 13:19:42.057381', 'c60_t0x686c650dbcfeaa75d09b883621ad810f5952bd5d', 60, 'ETH', 'token', '0x686c650dbcfeaa75d09b883621ad810f5952bd5d', 'USD', 'coingecko', 12.74155, 0.190663, 2455570, 0, 0, '2020-08-02 13:17:57.041000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057381', '2020-08-02 13:19:42.057382', 'c60_t0x4ac00f287f36a6aad655281fe1ca6798c9cb727b', 60, 'ETH', 'token', '0x4ac00f287f36a6aad655281fe1ca6798c9cb727b', 'USD', 'coingecko', 2.70769, 0.01550057, 0, 0, 0, '2020-08-02 06:08:14.696000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057382', '2020-08-02 13:19:42.057382', 'c714_tmtxlt-286', 714, 'BNB', 'token', 'mtxlt-286', 'BNB', 'binancedex', 14.58, 1.83799, 197.96177673339844, 0, 0, '2020-08-02 13:19:35.487628'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057382', '2020-08-02 13:19:42.057383', 'c60_t0x36232b1328e49a043434e71c02c0dc2be278e975', 60, 'ETH', 'token', '0x36232b1328e49a043434e71c02c0dc2be278e975', 'USD', 'coingecko', 0, 0.0010025, 0.050125, 0, 0, '2020-07-17 19:23:48.796000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057383', '2020-08-02 13:19:42.057383', 'c60_t0x6f6d15e2dabd182c7c0830db1bdff1f920b57ffa', 60, 'ETH', 'token', '0x6f6d15e2dabd182c7c0830db1bdff1f920b57ffa', 'USD', 'coinmarketcap', -0.0000000000000426326, 31.5201775322, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057383', '2020-08-02 13:19:42.057383', 'c60_t0x8727c112c712c4a03371ac87a74dd6ab104af768', 60, 'ETH', 'token', '0x8727c112c712c4a03371ac87a74dd6ab104af768', 'USD', 'coingecko', -2.80769, 0.03444915, 217289, 270811, 0, '2020-08-02 13:17:34.257000'); @@ -5432,7 +5339,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057451', '2020-08-02 13:19:42.057451', 'c111111', 111111, 'SCRIV', 'coin', '', 'USD', 'coinmarketcap', -0.200287, 0.000996100537008, 19.4999969660964, 24647.87196981943, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057452', '2020-08-02 13:19:42.057452', 'c60_t0xb6f43025b29196af2dddd69b0a58afba079cd600', 60, 'ETH', 'token', '0xb6f43025b29196af2dddd69b0a58afba079cd600', 'USD', 'coingecko', -17.4888, 0.00018893, 452881, 2184706, 0, '2020-08-02 13:17:49.645000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057452', '2020-08-02 13:19:42.057452', 'c60_t0xcf2f184b317573103b19e9d0c0204c841d70fe04', 60, 'ETH', 'token', '0xcf2f184b317573103b19e9d0c0204c841d70fe04', 'USD', 'coingecko', 0, 0.00008077, 1.56, 0, 0, '2020-02-04 09:09:51.841000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057453', '2020-08-02 13:19:42.057453', 'c714_tava-645', 714, 'BNB', 'token', 'ava-645', 'BNB', 'binancedex', -5.81, 0.0753064, 20173.794921875, 0, 0, '2020-08-02 13:19:35.487586'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057453', '2020-08-02 13:19:42.057453', 'c111111', 111111, 'SFX', 'coin', '', 'USD', 'coinmarketcap', 10.7418, 0.00839569825438, 919.100905998005, 437867.27427358663, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057454', '2020-08-02 13:19:42.057454', 'c60_t0xba36676acd9709ac84a2864f05c0a3f820aa223e', 60, 'ETH', 'token', '0xba36676acd9709ac84a2864f05c0a3f820aa223e', 'USD', 'coingecko', 0, 0, 0.00457222, 0, 0, '2020-07-01 07:10:45.800000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057454', '2020-08-02 13:19:42.057454', 'c60_t0x7ca936344d234034cf6936472d6bedbe8ae6667f', 60, 'ETH', 'token', '0x7ca936344d234034cf6936472d6bedbe8ae6667f', 'USD', 'coingecko', 0, 0.00380763, 0, 0, 0, '2019-12-26 04:00:30.290000'); @@ -5498,7 +5404,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057485', '2020-08-02 13:19:42.057485', 'c60_t0xa8b919680258d369114910511cc87595aec0be6d', 60, 'ETH', 'token', '0xa8b919680258d369114910511cc87595aec0be6d', 'USD', 'coingecko', -0.46944, 0.247332, 426521, 0, 0, '2020-08-02 13:15:04.294000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057486', '2020-08-02 13:19:42.057486', 'c60_t0xba9d4199fab4f26efe3551d490e3821486f135ba', 60, 'ETH', 'token', '0xba9d4199fab4f26efe3551d490e3821486f135ba', 'USD', 'coingecko', -7.33628, 0.104837, 1025914, 74405138, 0, '2020-08-02 13:17:13.617000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057486', '2020-08-02 13:19:42.057486', 'c60_t0xd3f04e421771e92a5026affdda5aba80952917a0', 60, 'ETH', 'token', '0xd3f04e421771e92a5026affdda5aba80952917a0', 'USD', 'coingecko', 0, 0.156775, 438970637070, 0, 0, '2020-04-14 19:47:12.671000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057487', '2020-08-02 13:19:42.057487', 'c714_tcoti-cbb', 714, 'BNB', 'token', 'coti-cbb', 'BNB', 'binancedex', -12.1, 0.00195314, 41.20762634277344, 0, 0, '2020-08-02 13:19:35.487675'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057487', '2020-08-02 13:19:42.057487', 'c60_t0x9b62513c8a27290cf6a7a9e29386e600245ea819', 60, 'ETH', 'token', '0x9b62513c8a27290cf6a7a9e29386e600245ea819', 'USD', 'coingecko', 0, 0.00174911, 80.73, 0, 0, '2020-04-30 16:08:53.527000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057488', '2020-08-02 13:19:42.057488', 'c60_t0x40c836982788dca47d11024b1fa3e01fd4661766', 60, 'ETH', 'token', '0x40c836982788dca47d11024b1fa3e01fd4661766', 'USD', 'coingecko', -10.21029, 0.375321, 2079.33, 0, 0, '2020-08-02 13:12:31.877000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057488', '2020-08-02 13:19:42.057488', 'c60_t0xe577e0b200d00ebdecbfc1cd3f7e8e04c70476be', 60, 'ETH', 'token', '0xe577e0b200d00ebdecbfc1cd3f7e8e04c70476be', 'USD', 'coingecko', -4.55896, 1.22, 19819.48, 0, 0, '2020-08-02 13:16:40.043000'); @@ -5664,7 +5569,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057712', '2020-08-02 13:19:42.057712', 'c60_t0x56b6431f45d08eed55f34371386326c739eacbcc', 60, 'ETH', 'token', '0x56b6431f45d08eed55f34371386326c739eacbcc', 'USD', 'coingecko', -60.63528, 0.00005446, 468.53, 5240.58, 0, '2020-08-02 13:18:19.815000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057713', '2020-08-02 13:19:42.057713', 'c60_t0xb705268213d593b8fd88d3fdeff93aff5cbdcfae', 60, 'ETH', 'token', '0xb705268213d593b8fd88d3fdeff93aff5cbdcfae', 'USD', 'coingecko', 3.24989, 0.04925583, 280467, 27136952, 0, '2020-08-02 13:17:23.198000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057713', '2020-08-02 13:19:42.057713', 'c60_t0xf4b54874cd8a6c863e3a904c18fda964661ec363', 60, 'ETH', 'token', '0xf4b54874cd8a6c863e3a904c18fda964661ec363', 'USD', 'coingecko', 2.29816, 0.00002472, 6924.8, 7249.95, 0, '2020-08-02 13:18:38.093000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057714', '2020-08-02 13:19:42.057714', 'c714_tftm-a64', 714, 'BNB', 'token', 'ftm-a64', 'BNB', 'binancedex', 9.7, 0.00066973, 56.091064453125, 0, 0, '2020-08-02 13:19:35.487543'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057714', '2020-08-02 13:19:42.057714', 'c714_twgr-d3d', 714, 'BNB', 'token', 'wgr-d3d', 'USD', 'coinmarketcap', -3.2071, 0.0307371475734, 0, 0, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057715', '2020-08-02 13:19:42.057715', 'c60_t0xd84958efa6fe4e6f29457917a9ab1bbc1b542995', 60, 'ETH', 'token', '0xd84958efa6fe4e6f29457917a9ab1bbc1b542995', 'USD', 'coingecko', 0, 1415.96, 566.32, 0, 0, '2020-01-20 15:34:12.196000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057716', '2020-08-02 13:19:42.057716', 'c60_t0xb683d83a532e2cb7dfa5275eed3698436371cc9f', 60, 'ETH', 'token', '0xb683d83a532e2cb7dfa5275eed3698436371cc9f', 'USD', 'coinmarketcap', -3.6273, 0.424392075719, 0, 0, 0, '2020-08-02 13:18:15.000000'); @@ -5865,7 +5769,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057829', '2020-08-02 13:19:42.057829', 'c60_t0x52a912ddf2673bcaff7bc336b05afac519d08211', 60, 'ETH', 'token', '0x52a912ddf2673bcaff7bc336b05afac519d08211', 'USD', 'coingecko', 0, 0.00752171, 0, 0, 0, '2019-12-26 04:00:39.287000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057830', '2020-08-02 13:19:42.057830', 'c111111', 111111, 'BIT', 'coin', '', 'USD', 'coinmarketcap', -21.9719, 0.0000774744862117, 83.5172135790187, 6391.46676281908, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057830', '2020-08-02 13:19:42.057830', 'c60_t0x6e4d93efc2beac20992197278ad41f8d10b3efaa', 60, 'ETH', 'token', '0x6e4d93efc2beac20992197278ad41f8d10b3efaa', 'USD', 'coingecko', 0, 0.00023452, 0, 0, 0, '2020-04-23 10:48:31.883000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057831', '2020-08-02 13:19:42.057831', 'c714_tbznt-464', 714, 'BNB', 'token', 'bznt-464', 'BNB', 'binancedex', -3.46, 0.00052899, 21.518709182739258, 0, 0, '2020-08-02 13:19:35.487597'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057831', '2020-08-02 13:19:42.057831', 'c60_t0xe0c72452740414d861606a44ccd5ea7f96488278', 60, 'ETH', 'token', '0xe0c72452740414d861606a44ccd5ea7f96488278', 'USD', 'coingecko', -7.13732, 0.00398736, 307.79, 0, 0, '2020-08-02 13:18:28.407000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057832', '2020-08-02 13:19:42.057832', 'c60_t0x2604fa406be957e542beb89e6754fcde6815e83f', 60, 'ETH', 'token', '0x2604fa406be957e542beb89e6754fcde6815e83f', 'USD', 'coingecko', 30.61342, 0.03925875, 44993, 0, 0, '2020-08-02 13:18:40.796000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057832', '2020-08-02 13:19:42.057832', 'c60_t0xdf18a53c2eeb81635c306c555d7a844e42bf7134', 60, 'ETH', 'token', '0xdf18a53c2eeb81635c306c555d7a844e42bf7134', 'USD', 'coingecko', 0, 104.12, 0, 0, 0, '2020-07-16 12:02:49.757000'); @@ -6036,7 +5939,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.057916', '2020-08-02 13:19:42.057916', 'c60_t0xac3211a5025414af2866ff09c23fc18bc97e79b1', 60, 'ETH', 'token', '0xac3211a5025414af2866ff09c23fc18bc97e79b1', 'USD', 'coingecko', -9.51523, 0.00122973, 707.94, 383137, 0, '2020-08-02 13:18:39.669000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358943', '2020-08-02 13:19:42.358944', 'c60_t0x7703c35cffdc5cda8d27aa3df2f9ba6964544b6e', 60, 'ETH', 'token', '0x7703c35cffdc5cda8d27aa3df2f9ba6964544b6e', 'USD', 'coinmarketcap', 20.4546, 0.977652149157, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358947', '2020-08-02 13:19:42.358947', 'c111111', 111111, 'SPD', 'coin', '', 'USD', 'coinmarketcap', 42.0418, 0.00143881188679, 1.01724000395968, 16576.807978040302, 0, '2020-08-02 13:18:12.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358949', '2020-08-02 13:19:42.358949', 'c714_tpvt-554', 714, 'BNB', 'token', 'pvt-554', 'BNB', 'binancedex', 0.74, 0.00000951, 1.3609130382537842, 0, 0, '2020-08-02 13:19:35.487664'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358950', '2020-08-02 13:19:42.358950', 'c60_t0x5e365a320779acc2c72f5dcd2ba8a81e4a34569f', 60, 'ETH', 'token', '0x5e365a320779acc2c72f5dcd2ba8a81e4a34569f', 'USD', 'coingecko', 0, 0.00033511, 2.23, 0, 0, '2020-07-29 15:26:06.953000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358951', '2020-08-02 13:19:42.358951', 'c60_t0x1966d718a565566e8e202792658d7b5ff4ece469', 60, 'ETH', 'token', '0x1966d718a565566e8e202792658d7b5ff4ece469', 'USD', 'coingecko', -1.37006, 0.00000109, 16.74, 0, 0, '2020-08-02 13:08:53.008000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358955', '2020-08-02 13:19:42.358955', 'c60_t0x6bec54e4fea5d541fb14de96993b8e11d81159b2', 60, 'ETH', 'token', '0x6bec54e4fea5d541fb14de96993b8e11d81159b2', 'USD', 'coingecko', 0, 0.00004458, 0, 0, 0, '2019-12-26 04:00:43.255000'); @@ -6079,7 +5981,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358986', '2020-08-02 13:19:42.358986', 'c60_t0x72fbc0fc1446f5accc1b083f0852a7ef70a8ec9f', 60, 'ETH', 'token', '0x72fbc0fc1446f5accc1b083f0852a7ef70a8ec9f', 'USD', 'coingecko', 0, 0.00011653, 0.00011653, 0, 0, '2020-08-01 11:53:46.232000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358987', '2020-08-02 13:19:42.358987', 'c60_t0x5f778ec4b31a506c1dfd8b06f131e9b451a61d39', 60, 'ETH', 'token', '0x5f778ec4b31a506c1dfd8b06f131e9b451a61d39', 'USD', 'coingecko', 18.33923, 0.00061842, 254.05, 0, 0, '2020-08-02 11:04:31.443000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358988', '2020-08-02 13:19:42.358988', 'c60_t0x490c95be16384e1f28b9e864e98ffecfcbff386d', 60, 'ETH', 'token', '0x490c95be16384e1f28b9e864e98ffecfcbff386d', 'USD', 'coingecko', 0, 0.00000642, 0.641793, 27341, 0, '2020-04-14 19:05:45.133000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358988', '2020-08-02 13:19:42.358988', 'c714_tbtcb-1de', 714, 'BNB', 'token', 'btcb-1de', 'BNB', 'binancedex', 2.86, 543.3335687778798, 0.2784560024738312, 0, 0, '2020-08-02 13:19:35.487546'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358989', '2020-08-02 13:19:42.358989', 'c60_t0x23935765cdf2f7548f86042ff053d16a22c4e240', 60, 'ETH', 'token', '0x23935765cdf2f7548f86042ff053d16a22c4e240', 'USD', 'coingecko', 0, 0.167734, 72.02, 0, 0, '2020-07-10 19:44:32.901000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358989', '2020-08-02 13:19:42.358989', 'c60_t0xeda8b016efa8b1161208cf041cd86972eee0f31e', 60, 'ETH', 'token', '0xeda8b016efa8b1161208cf041cd86972eee0f31e', 'USD', 'coinmarketcap', -2.63922, 0.00113068850598, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.358990', '2020-08-02 13:19:42.358990', 'c714_teql-586', 714, 'BNB', 'token', 'eql-586', 'USD', 'coinmarketcap', 4.19351, 0.00074535134775, 0, 0, 0, '2020-08-02 13:18:12.000000'); @@ -6109,7 +6010,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359007', '2020-08-02 13:19:42.359007', 'c60_t0x5c872500c00565505f3624ab435c222e558e9ff8', 60, 'ETH', 'token', '0x5c872500c00565505f3624ab435c222e558e9ff8', 'USD', 'coinmarketcap', -11.4951, 0.000184517527477, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359007', '2020-08-02 13:19:42.359007', 'c111111', 111111, 'ENRG', 'coin', '', 'USD', 'coinmarketcap', -2.58963, 0.00112890298962, 0, 138093.56119805996, 0, '2020-08-02 13:18:08.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359008', '2020-08-02 13:19:42.359008', 'c60_t0x304e9847104b14628a56cfb3366cf9e94718b036', 60, 'ETH', 'token', '0x304e9847104b14628a56cfb3366cf9e94718b036', 'USD', 'coingecko', -0.69363, 0.00117834, 0.00117893, 0, 0, '2020-08-02 11:00:43.419000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359008', '2020-08-02 13:19:42.359008', 'c714_tawc-986', 714, 'BNB', 'token', 'awc-986', 'BNB', 'binancedex', 0.57, 0.0748249, 2656.253173828125, 0, 0, '2020-08-02 13:19:35.487578'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359009', '2020-08-02 13:19:42.359009', 'c60_t0xc7596f3fc97ae603e1d7ffa61e6efb7b6a59bed2', 60, 'ETH', 'token', '0xc7596f3fc97ae603e1d7ffa61e6efb7b6a59bed2', 'USD', 'coingecko', 2.01515, 0.00410479, 199497, 0, 0, '2020-08-02 13:17:24.680000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359009', '2020-08-02 13:19:42.359009', 'c60_t0xcc34366e3842ca1bd36c1f324d15257960fcc801', 60, 'ETH', 'token', '0xcc34366e3842ca1bd36c1f324d15257960fcc801', 'USD', 'coingecko', -3.44368, 0.00817948, 3460.68, 77915, 0, '2020-08-02 13:13:17.471000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359010', '2020-08-02 13:19:42.359010', 'c60_t0x3137619705b5fc22a3048989f983905e456b59ab', 60, 'ETH', 'token', '0x3137619705b5fc22a3048989f983905e456b59ab', 'USD', 'coingecko', -5.1578, 0.03178813, 102.07, 0, 0, '2020-08-02 13:18:12.587000'); @@ -6233,7 +6133,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359097', '2020-08-02 13:19:42.359097', 'c60_t0x3db1678170418d1014012f855e2dda492f35c289', 60, 'ETH', 'token', '0x3db1678170418d1014012f855e2dda492f35c289', 'USD', 'coingecko', 0, 0.417459, 2.99, 0, 0, '2020-07-24 16:58:55.319000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359097', '2020-08-02 13:19:42.359097', 'c60_t0xdb7eab9ba6be88b869f738f6deeba96d49fe13fd', 60, 'ETH', 'token', '0xdb7eab9ba6be88b869f738f6deeba96d49fe13fd', 'USD', 'coingecko', -2.91653, 0.00165995, 542097, 1058971, 0, '2020-08-02 13:16:42.997000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359098', '2020-08-02 13:19:42.359098', 'c60_t0xf116f88457609a0bac8f1131170b190f35966487', 60, 'ETH', 'token', '0xf116f88457609a0bac8f1131170b190f35966487', 'USD', 'coingecko', 0, 0.00003004, 0.12177, 0, 0, '2020-03-28 04:34:41.170000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359099', '2020-08-02 13:19:42.359099', 'c714_tdos-120', 714, 'BNB', 'token', 'dos-120', 'BNB', 'binancedex', 67.8, 0.00399366, 1080.6683349609375, 0, 0, '2020-08-02 13:19:35.487632'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359099', '2020-08-02 13:19:42.359099', 'c60_t0x1beef31946fbbb40b877a72e4ae04a8d1a5cee06', 60, 'ETH', 'token', '0x1beef31946fbbb40b877a72e4ae04a8d1a5cee06', 'USD', 'coinmarketcap', -11.7028, 0.000968248228481, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359100', '2020-08-02 13:19:42.359100', 'c60_t0xfb559ce67ff522ec0b9ba7f5dc9dc7ef6c139803', 60, 'ETH', 'token', '0xfb559ce67ff522ec0b9ba7f5dc9dc7ef6c139803', 'USD', 'coingecko', 0.15274, 0.260884, 238334, 0, 0, '2020-08-02 13:13:03.276000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359100', '2020-08-02 13:19:42.359100', 'c60_t0x8317b216d7c3f9a5b8401e4b6814d13a7be390ec', 60, 'ETH', 'token', '0x8317b216d7c3f9a5b8401e4b6814d13a7be390ec', 'USD', 'coingecko', 0.10748, 0.06137, 44.67, 0, 0, '2020-08-02 08:39:54.007000'); @@ -6365,7 +6264,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359191', '2020-08-02 13:19:42.359192', 'c60_t0x229d1ed07310a9aaaf7bda570825b0c4089b88ad', 60, 'ETH', 'token', '0x229d1ed07310a9aaaf7bda570825b0c4089b88ad', 'USD', 'coingecko', 0, 0.00115212, 0.00115212, 0, 0, '2020-07-23 18:27:38.908000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359192', '2020-08-02 13:19:42.359192', 'c60_t0x2c9023bbc572ff8dc1228c7858a280046ea8c9e5', 60, 'ETH', 'token', '0x2c9023bbc572ff8dc1228c7858a280046ea8c9e5', 'USD', 'coinmarketcap', -1.82239, 0.119690202815, 0, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359192', '2020-08-02 13:19:42.359193', 'c111111', 111111, 'ELE', 'coin', '', 'USD', 'coinmarketcap', 0, 0.000657050813334, 0, 17218.370529010055, 0, '2020-08-02 13:18:09.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359193', '2020-08-02 13:19:42.359193', 'c714_tmitx-caa', 714, 'BNB', 'token', 'mitx-caa', 'BNB', 'binancedex', 0, 0.00089999, 0, 0, 0, '2020-08-02 13:19:35.487670'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359193', '2020-08-02 13:19:42.359194', 'c60_t0x956cdac781389d259de92e427ecd86e1cc273f7f', 60, 'ETH', 'token', '0x956cdac781389d259de92e427ecd86e1cc273f7f', 'USD', 'coingecko', 0, 0.00012168, 0.00086393, 0, 0, '2020-07-13 15:33:43.881000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359194', '2020-08-02 13:19:42.359194', 'c60_t0x4321853dedc763416f4b3ffa269ca553f7dd54c7', 60, 'ETH', 'token', '0x4321853dedc763416f4b3ffa269ca553f7dd54c7', 'USD', 'coingecko', 0, 0.00282685, 10.72, 0, 0, '2020-07-10 15:32:37.923000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359194', '2020-08-02 13:19:42.359195', 'c1729', 1729, 'XTZ', 'coin', '', 'USD', 'coingecko', 0.21905, 2.89, 277843516, 2061296325, 0, '2020-08-02 13:18:15.266000'); @@ -6436,7 +6334,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359226', '2020-08-02 13:19:42.359226', 'c60_t0x6e13a9e4ae3d0678e511fb6d2ad531fcf0e247bf', 60, 'ETH', 'token', '0x6e13a9e4ae3d0678e511fb6d2ad531fcf0e247bf', 'USD', 'coingecko', -31.24451, 1.23, 638824, 0, 0, '2020-08-02 13:18:34.727000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359227', '2020-08-02 13:19:42.359227', 'c148_trmt-gcvwttpadc5yb5aydkjctuyscj7rkpge4ht75nizoum4l7vrts5eklfn', 148, 'XLM', 'token', 'rmt-gcvwttpadc5yb5aydkjctuyscj7rkpge4ht75nizoum4l7vrts5eklfn', 'USD', 'coingecko', -4.05617, 0.00155465, 40.32, 773993, 0, '2020-08-02 13:18:22.031000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359227', '2020-08-02 13:19:42.359227', 'c714', 714, 'BNB', 'coin', '', 'USD', 'coingecko', -3.03413, 20.2, 344081664, 2985464384, 0, '2020-08-02 13:15:33.007000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359428', '2020-08-02 13:19:42.359428', 'c714_ttaudb-888', 714, 'BNB', 'token', 'taudb-888', 'BNB', 'binancedex', 0, 0.02564102564102564, 0, 0, 0, '2020-08-02 13:19:35.487628'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359228', '2020-08-02 13:19:42.359228', 'c60_t0xb3104b4b9da82025e8b9f8fb28b3553ce2f67069', 60, 'ETH', 'token', '0xb3104b4b9da82025e8b9f8fb28b3553ce2f67069', 'USD', 'coingecko', -4.93419, 0.088128, 2611006, 10039853, 0, '2020-08-02 13:18:36.392000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359228', '2020-08-02 13:19:42.359229', 'c111111', 111111, 'CLOAK', 'coin', '', 'USD', 'coinmarketcap', -3.23438, 0.171864687081, 18955.0263516366, 942608.9760527181, 0, '2020-08-02 13:18:08.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359229', '2020-08-02 13:19:42.359229', 'c60_t0x4d8bfe7ea0f46486fd40fc4df60cf39f7568bee8', 60, 'ETH', 'token', '0x4d8bfe7ea0f46486fd40fc4df60cf39f7568bee8', 'USD', 'coingecko', 0, 0.00000132, 2.66, 0, 0, '2020-03-31 05:55:07.069000'); @@ -6472,8 +6369,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359263', '2020-08-02 13:19:42.359263', 'c111111', 111111, 'ZCH', 'coin', '', 'USD', 'coinmarketcap', -4.74267, 0.00365236863569, 184.254317636044, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359263', '2020-08-02 13:19:42.359263', 'c60_t0x8a854288a5976036a725879164ca3e91d30c6a1b', 60, 'ETH', 'token', '0x8a854288a5976036a725879164ca3e91d30c6a1b', 'USD', 'coingecko', -0.20966, 0.351617, 155500, 5636248, 0, '2020-08-02 13:18:09.839000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359264', '2020-08-02 13:19:42.359264', 'c60_t0xf6dbe88ba55f1793ff0773c9b1275300f830914f', 60, 'ETH', 'token', '0xf6dbe88ba55f1793ff0773c9b1275300f830914f', 'USD', 'coingecko', 0, 0.00092657, 235.71, 463283, 0, '2020-07-23 21:51:03.813000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359264', '2020-08-02 13:19:42.359264', 'c714_teql-586', 714, 'BNB', 'token', 'eql-586', 'BNB', 'binancedex', 7.21, 0.00003687, 39.174076080322266, 0, 0, '2020-08-02 13:19:35.487584'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359265', '2020-08-02 13:19:42.359265', 'c714_tcsm-734', 714, 'BNB', 'token', 'csm-734', 'BNB', 'binancedex', 0, 0.00121123, 0, 0, 0, '2020-08-02 13:19:35.487643'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359265', '2020-08-02 13:19:42.359265', 'c60_t0x19ea630bcbc1a511a16e65b6ecd447c92e1c087c', 60, 'ETH', 'token', '0x19ea630bcbc1a511a16e65b6ecd447c92e1c087c', 'USD', 'coingecko', -1.06333, 0.997187, 10954.52, 0, 0, '2020-08-02 13:18:51.652000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359266', '2020-08-02 13:19:42.359266', 'c60_t0x0d4b4da5fb1a7d55e85f8e22f728701ceb6e44c9', 60, 'ETH', 'token', '0x0d4b4da5fb1a7d55e85f8e22f728701ceb6e44c9', 'USD', 'coingecko', -5.45678, 0.08647, 1310.66, 0, 0, '2020-08-02 13:11:42.376000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359266', '2020-08-02 13:19:42.359266', 'c60_t0xbcd8756ea481608ea3dd5a555493305cf0a79640', 60, 'ETH', 'token', '0xbcd8756ea481608ea3dd5a555493305cf0a79640', 'USD', 'coinmarketcap', -4.43216, 0.079086624685, 0, 0, 0, '2020-08-02 13:18:25.000000'); @@ -6497,7 +6392,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359275', '2020-08-02 13:19:42.359275', 'c60_t0x21d5678a62dfe63a47062469ebb2fac2817d8832', 60, 'ETH', 'token', '0x21d5678a62dfe63a47062469ebb2fac2817d8832', 'USD', 'coingecko', 7.68668, 0.0009821, 6219.08, 30697, 0, '2020-08-02 12:58:16.329000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359276', '2020-08-02 13:19:42.359276', 'c60_t0xe5f7ef61443fc36ae040650aa585b0395aef77c8', 60, 'ETH', 'token', '0xe5f7ef61443fc36ae040650aa585b0395aef77c8', 'USD', 'coingecko', 0, 78.89, 788.92, 0, 0, '2020-07-27 08:28:03.633000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359276', '2020-08-02 13:19:42.359276', 'c60_t0x15ef5b9447710eab904e63e6233ff540400d603f', 60, 'ETH', 'token', '0x15ef5b9447710eab904e63e6233ff540400d603f', 'USD', 'coingecko', 0, 0.00005142, 0.01076455, 0, 0, '2020-04-23 23:14:49.013000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359277', '2020-08-02 13:19:42.359277', 'c714_tmatic-84a', 714, 'BNB', 'token', 'matic-84a', 'BNB', 'binancedex', 1.6, 0.0010004, 61.02536392211914, 0, 0, '2020-08-02 13:19:35.487589'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359277', '2020-08-02 13:19:42.359277', 'c111111', 111111, 'NZL', 'coin', '', 'USD', 'coinmarketcap', -25.7248, 0.000774744862117, 44.1969707774808, 10852.424724490482, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359278', '2020-08-02 13:19:42.359278', 'c111111', 111111, 'KEMA', 'coin', '', 'USD', 'coinmarketcap', 2.08512, 0.00034310129608, 3.58321853400125, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359278', '2020-08-02 13:19:42.359278', 'c60_t0xc1915a97fd75818d3e10570b7613eda8636720bb', 60, 'ETH', 'token', '0xc1915a97fd75818d3e10570b7613eda8636720bb', 'USD', 'coingecko', 0, 0.00451086, 468.33, 0, 0, '2020-02-12 06:39:47.053000'); @@ -6512,12 +6406,10 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359283', '2020-08-02 13:19:42.359283', 'c60_t0x3cf37518ca5762c76827f1e8e0b5b24fdacf42ac', 60, 'ETH', 'token', '0x3cf37518ca5762c76827f1e8e0b5b24fdacf42ac', 'USD', 'coingecko', 0, 0.15373, 54.42, 0, 0, '2020-04-28 04:33:47.826000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359283', '2020-08-02 13:19:42.359283', 'c60_t0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24', 60, 'ETH', 'token', '0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24', 'USD', 'coinmarketcap', -7.33451, 0.0752677122082, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359284', '2020-08-02 13:19:42.359284', 'c111111_t0x1763ad73694d4d64fb71732b068e32ac72a345b1', 111111, 'ETH', 'token', '0x1763ad73694d4d64fb71732b068e32ac72a345b1', 'USD', 'coinmarketcap', -1.10774, 0.0158343795261, 23638.8024157494, 0, 0, '2020-08-02 13:18:21.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359284', '2020-08-02 13:19:42.359284', 'c714_ttm2-0c4', 714, 'BNB', 'token', 'tm2-0c4', 'BNB', 'binancedex', -30.8, 0.0000031, 4.348700046539307, 0, 0, '2020-08-02 13:19:35.487584'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359285', '2020-08-02 13:19:42.359285', 'c60_t0x6f259637dcd74c767781e37bc6133cd6a68aa161', 60, 'ETH', 'token', '0x6f259637dcd74c767781e37bc6133cd6a68aa161', 'USD', 'coingecko', -5.31295, 4.42, 221357181, 1031707456, 0, '2020-08-02 13:18:15.680000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359285', '2020-08-02 13:19:42.359285', 'c60_t0xe130d59c0d7f84260b776aa5f93de5031c5a0bf6', 60, 'ETH', 'token', '0xe130d59c0d7f84260b776aa5f93de5031c5a0bf6', 'USD', 'coingecko', -7.31501, 0.00000167, 32.99, 0, 0, '2020-08-02 13:11:42.280000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359286', '2020-08-02 13:19:42.359286', 'c60_t0xb272422b7d07b94859ad61e4435c6d5087f308de', 60, 'ETH', 'token', '0xb272422b7d07b94859ad61e4435c6d5087f308de', 'USD', 'coingecko', 0, 125.85, 0, 0, 0, '2020-07-05 09:40:25.492000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359286', '2020-08-02 13:19:42.359286', 'c60_t0x7ab1fc79f319718690e9c883bac910f8e289ce8f', 60, 'ETH', 'token', '0x7ab1fc79f319718690e9c883bac910f8e289ce8f', 'USD', 'coingecko', 0, 0.00021612, 178.26, 0, 0, '2020-07-27 22:03:34.431000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359287', '2020-08-02 13:19:42.359287', 'c714_ttrue-d84', 714, 'BNB', 'token', 'true-d84', 'BNB', 'binancedex', 0, 0.0274997, 5.976539134979248, 0, 0, '2020-08-02 13:19:35.487549'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359287', '2020-08-02 13:19:42.359287', 'c60_t0x10ba8c420e912bf07bedac03aa6908720db04e0c', 60, 'ETH', 'token', '0x10ba8c420e912bf07bedac03aa6908720db04e0c', 'USD', 'coinmarketcap', -23.773, 0.0186683591355, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359289', '2020-08-02 13:19:42.359289', 'c60_t0xe64509f0bf07ce2d29a7ef19a8a9bc065477c1b4', 60, 'ETH', 'token', '0xe64509f0bf07ce2d29a7ef19a8a9bc065477c1b4', 'USD', 'coingecko', -36.55017, 0.00022103, 14.09, 41398, 0, '2020-08-02 13:15:43.223000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359290', '2020-08-02 13:19:42.359290', 'c60_t0x09a7cae366b24485bfdea01436bb264851af7456', 60, 'ETH', 'token', '0x09a7cae366b24485bfdea01436bb264851af7456', 'USD', 'coingecko', 0, 0.009738, 0.072353, 0, 0, '2020-05-09 19:19:04.540000'); @@ -6534,7 +6426,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359295', '2020-08-02 13:19:42.359295', 'c60_t0x97aeb5066e1a590e868b511457beb6fe99d329f5', 60, 'ETH', 'token', '0x97aeb5066e1a590e868b511457beb6fe99d329f5', 'USD', 'coingecko', 1.12131, 0.00023376, 96.26, 0, 0, '2020-08-02 03:28:19.172000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359296', '2020-08-02 13:19:42.359296', 'c60_t0x248c27f814ef2c9c51c26398d09715cd35142fc4', 60, 'ETH', 'token', '0x248c27f814ef2c9c51c26398d09715cd35142fc4', 'USD', 'coingecko', 0, 0.01736586, 52.1, 0, 0, '2020-02-27 13:44:44.784000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359296', '2020-08-02 13:19:42.359296', 'c195_ttzgqjy1qbzuxjmmgdgozveg4md1ef6sdwu', 195, 'TRX', 'token', 'tzgqjy1qbzuxjmmgdgozveg4md1ef6sdwu', 'USD', 'coingecko', 0, 0.00005554, 0.155501, 0, 0, '2020-05-13 23:09:14.505000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359297', '2020-08-02 13:19:42.359297', 'c714_tmtv-4c6', 714, 'BNB', 'token', 'mtv-4c6', 'BNB', 'binancedex', -9.7, 0.00004515, 0.1881999969482422, 0, 0, '2020-08-02 13:19:35.487565'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359297', '2020-08-02 13:19:42.359297', 'c60_t0x09463194e7890d226a5fdb226d19ab600b92ee9f', 60, 'ETH', 'token', '0x09463194e7890d226a5fdb226d19ab600b92ee9f', 'USD', 'coingecko', 0, 0.00178436, 1.01, 0, 0, '2020-04-21 00:41:45.343000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359298', '2020-08-02 13:19:42.359298', 'c60_t0xff56cc6b1e6ded347aa0b7676c85ab0b3d08b0fa', 60, 'ETH', 'token', '0xff56cc6b1e6ded347aa0b7676c85ab0b3d08b0fa', 'USD', 'coinmarketcap', -4.96923, 0.0164167421749, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359298', '2020-08-02 13:19:42.359298', 'c60_t0xf2cee90309418353a57717eca26c4f8754f0d84e', 60, 'ETH', 'token', '0xf2cee90309418353a57717eca26c4f8754f0d84e', 'USD', 'coingecko', -5.72464, 0.00000034, 12.62, 971.08, 0, '2020-08-02 09:11:13.776000'); @@ -6591,7 +6482,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359349', '2020-08-02 13:19:42.359349', 'c111111_tg1emxxrghxdse5sdunmquljdkngrjk3c6d7npw19fk86', 111111, 'WAVES', 'token', 'g1emxxrghxdse5sdunmquljdkngrjk3c6d7npw19fk86', 'USD', 'coinmarketcap', -0.0000000000000284217, 0.000000777877878823, 0, 75.29391485347062, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359349', '2020-08-02 13:19:42.359349', 'c111111_tQPY', 111111, 'ETH', 'token', 'QPY', 'USD', 'coinmarketcap', 2.10328, 0.00000725537113884, 0.00149097876903071, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359350', '2020-08-02 13:19:42.359350', 'c60_t0x0e7f19c634709559a3743d52d78a369b08cb6fef', 60, 'ETH', 'token', '0x0e7f19c634709559a3743d52d78a369b08cb6fef', 'USD', 'coingecko', 0, 0.01178895, 2769.21, 0, 0, '2020-03-11 11:32:28.467000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359350', '2020-08-02 13:19:42.359350', 'c714_tshr-db6', 714, 'BNB', 'token', 'shr-db6', 'BNB', 'binancedex', -5.69, 0.00230071, 4255.337890625, 0, 0, '2020-08-02 13:19:35.487644'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359351', '2020-08-02 13:19:42.359351', 'c60_t0x08d32b0da63e2c3bcf8019c9c5d849d7a9d791e6', 60, 'ETH', 'token', '0x08d32b0da63e2c3bcf8019c9c5d849d7a9d791e6', 'USD', 'coinmarketcap', 8.72632, 0.00000599054040966, 0, 0, 0, '2020-08-02 13:18:10.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359351', '2020-08-02 13:19:42.359351', 'c60_t0x412d397ddca07d753e3e0c61e367fb1b474b3e7d', 60, 'ETH', 'token', '0x412d397ddca07d753e3e0c61e367fb1b474b3e7d', 'USD', 'coinmarketcap', -1.14074, 0.201567592467, 0, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359352', '2020-08-02 13:19:42.359352', 'c60_t0x049399a6b048d52971f7d122ae21a1532722285f', 60, 'ETH', 'token', '0x049399a6b048d52971f7d122ae21a1532722285f', 'USD', 'coinmarketcap', 30.2451, 0.00483032580594, 0, 0, 0, '2020-08-02 13:18:14.000000'); @@ -6751,7 +6641,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359465', '2020-08-02 13:19:42.359465', 'c60_t0xa957045a12d270e2ee0dca9a3340c340e05d4670', 60, 'ETH', 'token', '0xa957045a12d270e2ee0dca9a3340c340e05d4670', 'USD', 'coinmarketcap', -1.18019, 0.0023730596531, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359465', '2020-08-02 13:19:42.359466', 'c60_t0xa5fd1a791c4dfcaacc963d4f73c6ae5824149ea7', 60, 'ETH', 'token', '0xa5fd1a791c4dfcaacc963d4f73c6ae5824149ea7', 'USD', 'coingecko', 7.14746, 0.0297926, 21567, 5026622, 0, '2020-08-02 13:17:57.222000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359466', '2020-08-02 13:19:42.359466', 'c60_t0x294caec1e7c1b674f409514af529af02e67cdb56', 60, 'ETH', 'token', '0x294caec1e7c1b674f409514af529af02e67cdb56', 'USD', 'coingecko', 0, 0.422769, 803.46, 0, 0, '2019-12-26 04:00:31.421000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359466', '2020-08-02 13:19:42.359467', 'c714_ttop-491', 714, 'BNB', 'token', 'top-491', 'BNB', 'binancedex', 0, 0.00011999, 0, 0, 0, '2020-08-02 13:19:35.487674'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359467', '2020-08-02 13:19:42.359467', 'c111111', 111111, 'AMB', 'coin', '', 'USD', 'coinmarketcap', 6.19058, 0.0240068832645, 2702207.19722663, 2140617.56100172, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359467', '2020-08-02 13:19:42.359468', 'c60_t0x7e9e431a0b8c4d532c745b1043c7fa29a48d4fba', 60, 'ETH', 'token', '0x7e9e431a0b8c4d532c745b1043c7fa29a48d4fba', 'USD', 'coingecko', -14.02461, 0.00123271, 27158, 1188174, 0, '2020-08-02 13:18:09.021000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359468', '2020-08-02 13:19:42.359468', 'c60_t0x6710c63432a2de02954fc0f851db07146a6c0312', 60, 'ETH', 'token', '0x6710c63432a2de02954fc0f851db07146a6c0312', 'USD', 'coinmarketcap', 2.70347, 0.00842743069798, 0, 0, 0, '2020-08-02 13:18:13.000000'); @@ -6850,7 +6739,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359516', '2020-08-02 13:19:42.359516', 'c60_t0xf04a8ac553fcedb5ba99a64799155826c136b0be', 60, 'ETH', 'token', '0xf04a8ac553fcedb5ba99a64799155826c136b0be', 'USD', 'coinmarketcap', -1.20224, 0.0151370409976, 0, 0, 0, '2020-08-02 13:18:11.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359516', '2020-08-02 13:19:42.359516', 'c60_t0x519f8d4578d967d7900382a3f40e89ccf4472d32', 60, 'ETH', 'token', '0x519f8d4578d967d7900382a3f40e89ccf4472d32', 'USD', 'coingecko', 0, 0.00066159, 0.856094, 0, 0, '2020-07-29 06:49:50.104000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359517', '2020-08-02 13:19:42.359517', 'c60_t0xf449ef0007c98761bdfced7ab1d0351f71d30468', 60, 'ETH', 'token', '0xf449ef0007c98761bdfced7ab1d0351f71d30468', 'USD', 'coingecko', 0, 0.00000004, 0, 0, 0, '2020-06-21 14:58:43.610000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359517', '2020-08-02 13:19:42.359517', 'c714_ttomob-4bc', 714, 'BNB', 'token', 'tomob-4bc', 'BNB', 'binancedex', -4.38, 0.0511088, 5.334025859832764, 0, 0, '2020-08-02 13:19:35.487662'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359556', '2020-08-02 13:19:42.359556', 'c111111', 111111, 'SONO', 'coin', '', 'USD', 'coinmarketcap', -0.0000000000000284217, 0.174212536903, 0, 4921575.017164223, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359556', '2020-08-02 13:19:42.359556', 'c60_t0x4cee978c126c43522765de9ed02d9373c72ac290', 60, 'ETH', 'token', '0x4cee978c126c43522765de9ed02d9373c72ac290', 'USD', 'coingecko', 0, 0.00182081, 0.837575, 0, 0, '2020-04-15 02:19:09.888000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359557', '2020-08-02 13:19:42.359557', 'c60_t0x5d64d850c8368008afb39224e92ad0dceff3cf38', 60, 'ETH', 'token', '0x5d64d850c8368008afb39224e92ad0dceff3cf38', 'USD', 'coingecko', -4.853, 1.02, 3474.54, 0, 0, '2020-08-02 13:18:40.287000'); @@ -6967,12 +6855,10 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359612', '2020-08-02 13:19:42.359612', 'c111111', 111111, 'AG8', 'coin', '', 'USD', 'coinmarketcap', -13.9834, 0.0247218611979, 90366.1858336791, 313673.2987339078, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359612', '2020-08-02 13:19:42.359612', 'c60_t0x81b4d08645da11374a03749ab170836e4e539767', 60, 'ETH', 'token', '0x81b4d08645da11374a03749ab170836e4e539767', 'USD', 'coingecko', 0, 0.00000207, 17.21, 1411.05, 0, '2020-05-11 10:09:56.396000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359613', '2020-08-02 13:19:42.359613', 'c60_t0x752ff65b884b9c260d212c804e0b7aceea012473', 60, 'ETH', 'token', '0x752ff65b884b9c260d212c804e0b7aceea012473', 'USD', 'coingecko', 0, 0.00038202, 3.47, 0, 0, '2020-07-23 16:33:53.569000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359613', '2020-08-02 13:19:42.359613', 'c714_tvdx-a17', 714, 'BNB', 'token', 'vdx-a17', 'BNB', 'binancedex', 2.12, 0.0000384, 7.165887832641602, 0, 0, '2020-08-02 13:19:35.487577'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359614', '2020-08-02 13:19:42.359614', 'c60_t0x0e22734e078d6e399bcee40a549db591c4ea46cb', 60, 'ETH', 'token', '0x0e22734e078d6e399bcee40a549db591c4ea46cb', 'USD', 'coinmarketcap', -28.6047, 0.0119749900646, 0, 0, 0, '2020-08-02 13:18:20.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359614', '2020-08-02 13:19:42.359614', 'c111111_tidrtb-178', 111111, 'BNB', 'token', 'idrtb-178', 'USD', 'coinmarketcap', -0.36781, 0.0000680991961111, 706928.314180649, 2674537.7825354324, 0, '2020-08-02 13:18:18.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359615', '2020-08-02 13:19:42.359615', 'c60_t0x93065b5c7eb63333b8e57a73012d25f687895785', 60, 'ETH', 'token', '0x93065b5c7eb63333b8e57a73012d25f687895785', 'USD', 'coingecko', 0, 0.00000215, 44.04, 0, 0, '2020-04-08 04:02:35.345000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359615', '2020-08-02 13:19:42.359615', 'c60_t0x3e6941521c85c7233632bf76e3adb05db8e2f1db', 60, 'ETH', 'token', '0x3e6941521c85c7233632bf76e3adb05db8e2f1db', 'USD', 'coingecko', 0, 194.39, 189.58, 0, 0, '2020-07-26 07:18:41.855000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359616', '2020-08-02 13:19:42.359616', 'c714_txrpbear-00b', 714, 'BNB', 'token', 'xrpbear-00b', 'BNB', 'binancedex', -23.82, 2.33236, 150.9877471923828, 0, 0, '2020-08-02 13:19:35.487624'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359616', '2020-08-02 13:19:42.359616', 'c60_t0xe1aee98495365fc179699c1bb3e761fa716bee62', 60, 'ETH', 'token', '0xe1aee98495365fc179699c1bb3e761fa716bee62', 'USD', 'coinmarketcap', -4.82405, 0.00705975585426, 0, 0, 0, '2020-08-02 13:18:13.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359617', '2020-08-02 13:19:42.359617', 'c111111_tLOL', 111111, 'IOST', 'token', 'LOL', 'USD', 'coinmarketcap', -5.9211, 0.000372033654971, 308468.012100844, 0, 0, '2020-08-02 13:18:17.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359617', '2020-08-02 13:19:42.359617', 'c60_t0x36c85687eedae01c50eb7d04d74c0ec74f930c54', 60, 'ETH', 'token', '0x36c85687eedae01c50eb7d04d74c0ec74f930c54', 'USD', 'coinmarketcap', 0.0444625, 0.427810237061, 0, 0, 0, '2020-08-02 13:18:25.000000'); @@ -6998,7 +6884,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359627', '2020-08-02 13:19:42.359627', 'c60_t0x69d2779533a4d2c780639713558b2cc98c46a9b7', 60, 'ETH', 'token', '0x69d2779533a4d2c780639713558b2cc98c46a9b7', 'USD', 'coingecko', -4.44261, 0.00112044, 223916, 0, 0, '2020-08-02 13:15:39.870000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359628', '2020-08-02 13:19:42.359628', 'c60_t0x50987e6be405ebac691f8988304562e5efc3b2ea', 60, 'ETH', 'token', '0x50987e6be405ebac691f8988304562e5efc3b2ea', 'USD', 'coingecko', 1.14281, 0.089315, 7025.96, 0, 0, '2020-08-02 13:16:18.303000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359628', '2020-08-02 13:19:42.359628', 'c60_t0x14094949152eddbfcd073717200da82fed8dc960', 60, 'ETH', 'token', '0x14094949152eddbfcd073717200da82fed8dc960', 'USD', 'coingecko', 12.49852, 2.15, 116.25, 0, 0, '2020-08-01 20:30:27.786000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359629', '2020-08-02 13:19:42.359629', 'c714_ttrxb-2e6', 714, 'BNB', 'token', 'trxb-2e6', 'BNB', 'binancedex', -1.09, 0.00093659, 504.8367614746094, 0, 0, '2020-08-02 13:19:35.487576'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359629', '2020-08-02 13:19:42.359629', 'c60_t0xd50649aab1d39d68bc965e0f6d1cfe0010e4908b', 60, 'ETH', 'token', '0xd50649aab1d39d68bc965e0f6d1cfe0010e4908b', 'USD', 'coinmarketcap', -12.1729, 0.00608728105949, 0, 0, 0, '2020-08-02 13:18:16.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359630', '2020-08-02 13:19:42.359630', 'c61_t0x1ce1b789e291ffa8812d03fa7e67e538f91f132d', 61, 'ETC', 'token', '0x1ce1b789e291ffa8812d03fa7e67e538f91f132d', 'USD', 'coingecko', 0, 0.00037969, 0, 0, 0, '2020-04-23 10:49:09.006000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359630', '2020-08-02 13:19:42.359630', 'c60_t0x69beab403438253f13b6e92db91f7fb849258263', 60, 'ETH', 'token', '0x69beab403438253f13b6e92db91f7fb849258263', 'USD', 'coingecko', -2.31709, 0.01588526, 21.25, 1351095, 0, '2020-08-02 13:18:22.634000'); @@ -7039,7 +6924,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359647', '2020-08-02 13:19:42.359647', 'c60_t0x3fe2ef1dfb1595195768627d16751d552586dce8', 60, 'ETH', 'token', '0x3fe2ef1dfb1595195768627d16751d552586dce8', 'USD', 'coingecko', 0, 0.00001694, 0, 0, 0, '2020-02-09 20:02:32.057000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359648', '2020-08-02 13:19:42.359648', 'c60_t0x9075118e1165e20e9fbe9cd92449fae8bbf46e12', 60, 'ETH', 'token', '0x9075118e1165e20e9fbe9cd92449fae8bbf46e12', 'USD', 'coingecko', 0, 0.00056508, 0.282621, 0, 0, '2020-06-22 00:28:49.391000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359648', '2020-08-02 13:19:42.359648', 'c60_t0x1dea979ae76f26071870f824088da78979eb91c8', 60, 'ETH', 'token', '0x1dea979ae76f26071870f824088da78979eb91c8', 'USD', 'coingecko', 0, 0.00017942, 46.16, 495973, 0, '2020-08-01 09:40:03.863000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359648', '2020-08-02 13:19:42.359649', 'c714_ttusdb-888', 714, 'BNB', 'token', 'tusdb-888', 'BNB', 'binancedex', -6.36, 0.052608597296970275, 1039.9189453125, 0, 0, '2020-08-02 13:19:35.487671'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359649', '2020-08-02 13:19:42.359649', 'c60_t0x59b8d11d50ab6615f9cd430743baf646fb8966c6', 60, 'ETH', 'token', '0x59b8d11d50ab6615f9cd430743baf646fb8966c6', 'USD', 'coingecko', 0, 0, 0, 0, 0, '2020-04-28 07:15:33.753000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359649', '2020-08-02 13:19:42.359650', 'c60_t0x41ad4093349c8a60de591a3c37dcd184558eaae3', 60, 'ETH', 'token', '0x41ad4093349c8a60de591a3c37dcd184558eaae3', 'USD', 'coingecko', 0, 0.00003339, 3.34, 0, 0, '2020-07-31 06:51:46.701000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359650', '2020-08-02 13:19:42.359650', 'c60_t0xeb9951021698b42e4399f9cbb6267aa35f82d59d', 60, 'ETH', 'token', '0xeb9951021698b42e4399f9cbb6267aa35f82d59d', 'USD', 'coinmarketcap', 2.97562, 0.135235999495, 0, 0, 0, '2020-08-02 13:18:13.000000'); @@ -7091,7 +6975,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359723', '2020-08-02 13:19:42.359723', 'c60_t0x6beb418fc6e1958204ac8baddcf109b8e9694966', 60, 'ETH', 'token', '0x6beb418fc6e1958204ac8baddcf109b8e9694966', 'USD', 'coingecko', 0, 0.00688134, 6.88, 0, 0, '2020-08-02 11:05:15.360000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359723', '2020-08-02 13:19:42.359723', 'c60_t0x4257d36df231dc71f7b7a6e1be3ef9c99b9181fd', 60, 'ETH', 'token', '0x4257d36df231dc71f7b7a6e1be3ef9c99b9181fd', 'USD', 'coingecko', 0, 0.00215118, 0, 236630, 0, '2019-12-26 04:02:34.668000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359724', '2020-08-02 13:19:42.359724', 'c60_t0x91e84ec6101547c1fa39dd565dd8b020e3c20cf2', 60, 'ETH', 'token', '0x91e84ec6101547c1fa39dd565dd8b020e3c20cf2', 'USD', 'coingecko', 14.20768, 0.00128757, 0.910314, 0, 0, '2020-08-01 19:10:13.558000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359724', '2020-08-02 13:19:42.359724', 'c714_tdusk-45e', 714, 'BNB', 'token', 'dusk-45e', 'BNB', 'binancedex', 0, 0.00268438, 0, 0, 0, '2020-08-02 13:19:35.487646'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359725', '2020-08-02 13:19:42.359725', 'c111111', 111111, 'HNT', 'coin', '', 'USD', 'coinmarketcap', 2.22277, 0.472590729613, 170631.855522423, 0, 0, '2020-08-02 13:18:25.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359725', '2020-08-02 13:19:42.359725', 'c60_t0x278a83b64c3e3e1139f8e8a52d96360ca3c69a3d', 60, 'ETH', 'token', '0x278a83b64c3e3e1139f8e8a52d96360ca3c69a3d', 'USD', 'coingecko', 0, 0.00233615, 1.73, 0, 0, '2020-08-01 01:58:23.239000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359726', '2020-08-02 13:19:42.359726', 'c60_t0x88a3e4f35d64aad41a6d4030ac9afe4356cb84fa', 60, 'ETH', 'token', '0x88a3e4f35d64aad41a6d4030ac9afe4356cb84fa', 'USD', 'coingecko', -20.56207, 0.01449424, 98194, 5740208, 0, '2020-08-02 13:15:35.998000'); @@ -7217,7 +7100,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359785', '2020-08-02 13:19:42.359785', 'c111111', 111111, 'DIME', 'coin', '', 'USD', 'coinmarketcap', 3.94572, 0.00000187850931072, 582.13898985328, 1012698.2465206103, 0, '2020-08-02 13:18:06.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359785', '2020-08-02 13:19:42.359785', 'c60_t0xd3c00772b24d997a812249ca637a921e81357701', 60, 'ETH', 'token', '0xd3c00772b24d997a812249ca637a921e81357701', 'USD', 'coingecko', -4.60608, 0.00022152, 1.76, 13905.94, 0, '2020-08-02 13:19:08.031000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359786', '2020-08-02 13:19:42.359786', 'c60_t0x7f373d989df0709273e18769300ef1177d333799', 60, 'ETH', 'token', '0x7f373d989df0709273e18769300ef1177d333799', 'USD', 'coingecko', 0, 0.184626, 0, 0, 0, '2019-12-26 04:00:47.887000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359786', '2020-08-02 13:19:42.359786', 'c714_tfrm-de7', 714, 'BNB', 'token', 'frm-de7', 'BNB', 'binancedex', 13.5, 0.00216901, 14.155559539794922, 0, 0, '2020-08-02 13:19:35.487623'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359787', '2020-08-02 13:19:42.359787', 'c60_t0x6226caa1857afbc6dfb6ca66071eb241228031a1', 60, 'ETH', 'token', '0x6226caa1857afbc6dfb6ca66071eb241228031a1', 'USD', 'coinmarketcap', -0.0757352, 0.010909656099, 0, 0, 0, '2020-08-02 13:18:21.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359787', '2020-08-02 13:19:42.359787', 'c5741564_t51zchw4vzwpj4wgviwjjf6buafga8tjousxze2pkdui9', 5741564, 'WAVES', 'token', '51zchw4vzwpj4wgviwjjf6buafga8tjousxze2pkdui9', 'USD', 'coingecko', -3.75261, 2193.35, 49744, 0, 0, '2020-08-02 06:49:43.067000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359788', '2020-08-02 13:19:42.359788', 'c60_t0xe08854b668958657064fa20f309f6ba7a19d5af2', 60, 'ETH', 'token', '0xe08854b668958657064fa20f309f6ba7a19d5af2', 'USD', 'coingecko', 3.15763, 0.002806, 11.79, 1683603, 0, '2020-08-01 09:47:24.449000'); @@ -7287,14 +7169,12 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359819', '2020-08-02 13:19:42.359819', 'c60_t0x865ec58b06bf6305b886793aa20a2da31d034e68', 60, 'ETH', 'token', '0x865ec58b06bf6305b886793aa20a2da31d034e68', 'USD', 'coinmarketcap', -6.60478, 0.0182519947421, 0, 0, 0, '2020-08-02 13:18:14.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359820', '2020-08-02 13:19:42.359820', 'c60_t0x6523203bd28d399068acc14db6b7f31d9bf43f1a', 60, 'ETH', 'token', '0x6523203bd28d399068acc14db6b7f31d9bf43f1a', 'USD', 'coingecko', 0.0025, 0.00142332, 32698, 0, 0, '2020-08-01 20:09:40.425000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359820', '2020-08-02 13:19:42.359820', 'c60_t0xd07d9fe2d2cc067015e2b4917d24933804f42cfa', 60, 'ETH', 'token', '0xd07d9fe2d2cc067015e2b4917d24933804f42cfa', 'USD', 'coinmarketcap', 2.45802, 0.00580606241027, 0, 0, 0, '2020-08-02 13:18:15.000000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359821', '2020-08-02 13:19:42.359821', 'c714_tusdsb-1ac', 714, 'BNB', 'token', 'usdsb-1ac', 'BNB', 'binancedex', 0, 0.05020206330480183, 539.8632202148438, 0, 0, '2020-08-02 13:19:35.487635'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359821', '2020-08-02 13:19:42.359821', 'c60_t0xd45247c07379d94904e0a87b4481f0a1ddfa0c64', 60, 'ETH', 'token', '0xd45247c07379d94904e0a87b4481f0a1ddfa0c64', 'USD', 'coinmarketcap', -4.54601, 0.0158008978452, 0, 0, 0, '2020-08-02 13:18:15.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359821', '2020-08-02 13:19:42.359822', 'c60_t0x79cdfa04e3c4eb58c4f49dae78b322e5b0d38788', 60, 'ETH', 'token', '0x79cdfa04e3c4eb58c4f49dae78b322e5b0d38788', 'USD', 'coingecko', 2.63017, 0.00014942, 15247.23, 0, 0, '2020-08-02 13:17:34.893000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359822', '2020-08-02 13:19:42.359822', 'c5741564', 5741564, 'WAVES', 'coin', '', 'USD', 'coingecko', 1.32496, 1.58, 47219270, 157055420, 0, '2020-08-02 13:19:01.254000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359822', '2020-08-02 13:19:42.359823', 'c60_t0x5b322514ff727253292637d9054301600c2c81e8', 60, 'ETH', 'token', '0x5b322514ff727253292637d9054301600c2c81e8', 'USD', 'coingecko', -2.99705, 0.262409, 11475202, 0, 0, '2020-08-02 13:19:05.311000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359823', '2020-08-02 13:19:42.359823', 'c60_t0x6baf7fcea90b0968dc5ed7b8dcb76c986637ff55', 60, 'ETH', 'token', '0x6baf7fcea90b0968dc5ed7b8dcb76c986637ff55', 'USD', 'coingecko', 0, 0.095803, 0, 362789, 0, '2020-04-23 10:49:08.035000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359824', '2020-08-02 13:19:42.359824', 'c60_t0x6baa91cd8aa07431760ef2eedfedcef662a6b8b3', 60, 'ETH', 'token', '0x6baa91cd8aa07431760ef2eedfedcef662a6b8b3', 'USD', 'coingecko', 0, 249.19, 14.25, 0, 0, '2020-08-01 06:45:25.075000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359824', '2020-08-02 13:19:42.359824', 'c714_tont-33d', 714, 'BNB', 'token', 'ont-33d', 'BNB', 'binancedex', -4.53, 0.0339868, 1.8711992502212524, 0, 0, '2020-08-02 13:19:35.487671'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359825', '2020-08-02 13:19:42.359825', 'c60_t0x28dee01d53fed0edf5f6e310bf8ef9311513ae40', 60, 'ETH', 'token', '0x28dee01d53fed0edf5f6e310bf8ef9311513ae40', 'USD', 'coingecko', 3.97585, 0.00063449, 722.64, 228822, 0, '2020-08-02 13:15:43.055000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359825', '2020-08-02 13:19:42.359825', 'c60_t0x1ce9200c98b6d9999b60bff53860475a993a8b68', 60, 'ETH', 'token', '0x1ce9200c98b6d9999b60bff53860475a993a8b68', 'USD', 'coingecko', 0, 68.01, 69.12, 0, 0, '2020-07-30 23:57:14.203000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359826', '2020-08-02 13:19:42.359826', 'c60_t0x660e71483785f66133548b10f6926dc332b06e61', 60, 'ETH', 'token', '0x660e71483785f66133548b10f6926dc332b06e61', 'USD', 'coingecko', -6.71832, 0.01038847, 309.41, 0, 0, '2020-08-02 13:14:21.990000'); @@ -7326,7 +7206,6 @@ INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_ty INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359841', '2020-08-02 13:19:42.359841', 'c60_t0x5adc961d6ac3f7062d2ea45fefb8d8167d44b190', 60, 'ETH', 'token', '0x5adc961d6ac3f7062d2ea45fefb8d8167d44b190', 'USD', 'coinmarketcap', -20.2867, 0.0284881469548, 0, 0, 0, '2020-08-02 13:18:12.000000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359842', '2020-08-02 13:19:42.359842', 'c60_t0x0469b5be3d08413de884bae18afb886ee4521c25', 60, 'ETH', 'token', '0x0469b5be3d08413de884bae18afb886ee4521c25', 'USD', 'coingecko', 0, 0.00015911, 56.03, 0, 0, '2020-08-02 00:15:43.506000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359843', '2020-08-02 13:19:42.359843', 'c60_t0x7051620d11042c4335069aaa4f10cd3b4290c681', 60, 'ETH', 'token', '0x7051620d11042c4335069aaa4f10cd3b4290c681', 'USD', 'coingecko', -4.26178, 0.00724121, 6187.94, 247299, 0, '2020-08-02 13:18:11.793000'); -INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359843', '2020-08-02 13:19:42.359843', 'c714_taxpr-777', 714, 'BNB', 'token', 'axpr-777', 'BNB', 'binancedex', -0.01, 0.0002, 1.4962493181228638, 0, 0, '2020-08-02 13:19:35.487606'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359843', '2020-08-02 13:19:42.359844', 'c60_t0x1f88cac675a37b649646860746f25f58e21b99f2', 60, 'ETH', 'token', '0x1f88cac675a37b649646860746f25f58e21b99f2', 'USD', 'coingecko', 0, 0.00017001, 0.535531, 0, 0, '2020-02-27 08:07:51.059000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359844', '2020-08-02 13:19:42.359844', 'c60_t0xd54e2e7281de8e7d220f9173e33241fbfa881968', 60, 'ETH', 'token', '0xd54e2e7281de8e7d220f9173e33241fbfa881968', 'USD', 'coingecko', 0, 0.00014004, 10.5, 0, 0, '2020-02-10 22:12:09.746000'); INSERT INTO public.tickers (updated_at, created_at, id, coin, coin_name, coin_type, token_id, currency, provider, change24h, value, volume, market_cap, show_option, last_updated) VALUES ('2020-08-02 13:19:42.359902', '2020-08-02 13:19:42.359902', 'c60_t0x23ccc43365d9dd3882eab88f43d515208f832430', 60, 'ETH', 'token', '0x23ccc43365d9dd3882eab88f43d515208f832430', 'USD', 'coinmarketcap', 4.60457, 0.00206000938197, 0, 0, 0, '2020-08-02 13:18:15.000000'); diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index a368ef77..656b8841 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -72,7 +72,7 @@ func TestController_HandleChartsRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 100, } diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go index 8c579226..f77722ea 100644 --- a/services/controllers/tickers/normalization_test.go +++ b/services/controllers/tickers/normalization_test.go @@ -22,7 +22,7 @@ func TestController_createResponse(t *testing.T) { Price: watchmarket.Price{ Change24h: -10.24, Currency: "EUR", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 14.700428799936965, }, TokenId: "raven-f66", @@ -47,7 +47,7 @@ func TestController_createResponse(t *testing.T) { Price: watchmarket.Price{ Change24h: -10.24, Currency: "EUR", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 14.700428799936965, }, TokenId: "RAVEN-F66", @@ -237,7 +237,7 @@ func TestController_normalizeTickers_advanced(t *testing.T) { Price: watchmarket.Price{ Change24h: -10.24, Currency: "BNB", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 1, }, TokenId: "raven-f66", @@ -261,7 +261,7 @@ func TestController_normalizeTickers_advanced(t *testing.T) { Price: watchmarket.Price{ Change24h: -10.24, Currency: "EUR", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 14.700428799936965, }, TokenId: "raven-f66", diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index e50b4a13..02d7f54f 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -40,20 +40,10 @@ func TestController_getTickersByPriority(t *testing.T) { Value: 100, } - ticker714ABNB := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "binancedex", - Value: 100, - } - db := getDbMock() db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} + db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG} c := setupController(t, db, false) assert.NotNil(t, c) diff --git a/services/markets/binancedex/base.go b/services/markets/binancedex/base.go deleted file mode 100755 index ce82ef88..00000000 --- a/services/markets/binancedex/base.go +++ /dev/null @@ -1,18 +0,0 @@ -package binancedex - -type Provider struct { - id string - client Client -} - -func InitProvider(api string) Provider { - m := Provider{ - id: id, - client: NewClient(api), - } - return m -} - -func (p Provider) GetProvider() string { - return p.id -} diff --git a/services/markets/binancedex/base_test.go b/services/markets/binancedex/base_test.go deleted file mode 100755 index 3e5d1aca..00000000 --- a/services/markets/binancedex/base_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package binancedex - -import ( - "encoding/json" - "net/http" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestInitProvider(t *testing.T) { - provider := InitProvider("demo.api") - assert.NotNil(t, provider) - assert.Equal(t, "demo.api", provider.client.BaseUrl) - assert.Equal(t, "binancedex", provider.id) -} - -func TestProvider_GetProvider(t *testing.T) { - provider := InitProvider("demo.api") - assert.Equal(t, "binancedex", provider.GetProvider()) -} - -func createMockedAPI() http.Handler { - r := http.NewServeMux() - r.HandleFunc("/v1/ticker/24hr", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - p := CoinPrice{BaseAssetName: "BaseName", QuoteAssetName: BNBAsset, PriceChangePercent: "10", LastPrice: "123"} - rawBytes, err := json.Marshal([]CoinPrice{p}) - if err != nil { - panic(err) - } - if _, err := w.Write(rawBytes); err != nil { - panic(err) - } - }) - - return r -} diff --git a/services/markets/binancedex/client.go b/services/markets/binancedex/client.go deleted file mode 100755 index 92896afc..00000000 --- a/services/markets/binancedex/client.go +++ /dev/null @@ -1,21 +0,0 @@ -package binancedex - -import ( - "net/url" - - "github.com/trustwallet/golibs/client" - "github.com/trustwallet/golibs/network/middleware" -) - -type Client struct { - client.Request -} - -func NewClient(api string) Client { - return Client{client.InitClient(api, middleware.SentryErrorHandler)} -} - -func (c Client) fetchPrices() (result []CoinPrice, err error) { - err = c.Get(&result, "/v1/ticker/24hr", url.Values{"limit": {"1000"}}) - return -} diff --git a/services/markets/binancedex/models.go b/services/markets/binancedex/models.go deleted file mode 100755 index 53e4ba6f..00000000 --- a/services/markets/binancedex/models.go +++ /dev/null @@ -1,9 +0,0 @@ -package binancedex - -type CoinPrice struct { - BaseAssetName string `json:"baseAssetName"` - QuoteAssetName string `json:"quoteAssetName"` - PriceChangePercent string `json:"priceChangePercent"` - LastPrice string `json:"lastPrice"` - Volume string `json:"quoteVolume"` -} diff --git a/services/markets/binancedex/tickers.go b/services/markets/binancedex/tickers.go deleted file mode 100755 index fa17753b..00000000 --- a/services/markets/binancedex/tickers.go +++ /dev/null @@ -1,82 +0,0 @@ -package binancedex - -import ( - "strconv" - "strings" - "time" - - "errors" - - "github.com/trustwallet/golibs/coin" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -var ( - id = "binancedex" - BNBAsset = coin.Binance().Symbol -) - -func (p Provider) GetTickers() (watchmarket.Tickers, error) { - prices, err := p.client.fetchPrices() - if err != nil { - return nil, err - } - return normalizeTickers(prices, p.id), nil -} - -func normalizeTickers(prices []CoinPrice, provider string) watchmarket.Tickers { - tickersList := make(watchmarket.Tickers, 0) - for _, price := range prices { - t, err := normalizeTicker(price, provider) - if err != nil { - continue - } - tickersList = append(tickersList, t) - } - return tickersList -} - -func normalizeTicker(price CoinPrice, provider string) (watchmarket.Ticker, error) { - var t watchmarket.Ticker - - if price.QuoteAssetName != BNBAsset && price.BaseAssetName != BNBAsset { - return t, errors.New("invalid quote/base asset") - } - - value, err := strconv.ParseFloat(price.LastPrice, 64) - if err != nil { - return t, errors.New(err.Error() + " normalizeTicker parse value error") - } - - value24h, err := strconv.ParseFloat(price.PriceChangePercent, 64) - if err != nil { - return t, errors.New(err.Error() + " normalizeTicker parse value24h error") - } - - tokenId := price.BaseAssetName - if tokenId == BNBAsset { - tokenId = price.QuoteAssetName - value = 1.0 / value - } - - volume, err := strconv.ParseFloat(price.Volume, 32) - if err != nil { - volume = 0 - } - - t = watchmarket.Ticker{ - Coin: coin.BINANCE, - CoinName: BNBAsset, - CoinType: watchmarket.Token, - TokenId: strings.ToLower(tokenId), - Price: watchmarket.Price{ - Value: value, - Change24h: value24h, - Currency: BNBAsset, - Provider: provider, - }, - LastUpdate: time.Now(), - Volume: volume, - } - return t, nil -} diff --git a/services/markets/binancedex/tickers_test.go b/services/markets/binancedex/tickers_test.go deleted file mode 100755 index 360725f4..00000000 --- a/services/markets/binancedex/tickers_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package binancedex - -import ( - "net/http/httptest" - "sort" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -func TestProvider_GetTickers(t *testing.T) { - server := httptest.NewServer(createMockedAPI()) - defer server.Close() - - provider := InitProvider(server.URL) - data, err := provider.GetTickers() - assert.Nil(t, err) - assert.NotNil(t, data) - assert.Equal(t, "BNB", data[0].CoinName) - assert.Equal(t, uint(714), data[0].Coin) - assert.Equal(t, watchmarket.Price{Value: 123, Change24h: 10, Currency: "BNB", Provider: "binancedex"}, data[0].Price) - assert.Equal(t, watchmarket.CoinType("token"), data[0].CoinType) - assert.Equal(t, "", data[0].Error) - assert.LessOrEqual(t, data[0].LastUpdate.Unix(), time.Now().Unix()) -} - -func Test_normalizeTickers(t *testing.T) { - type args struct { - prices []CoinPrice - provider string - } - tests := []struct { - name string - args args - wantTickers watchmarket.Tickers - }{ - { - "test normalize binancedex quote", - args{prices: []CoinPrice{ - { - BaseAssetName: "rAven-f66", - QuoteAssetName: "BNB", - LastPrice: "0.00001082", - PriceChangePercent: "-2.2500", - Volume: "440.78560000", - }, - { - BaseAssetName: "sLv-986", - QuoteAssetName: "BNB", - LastPrice: "0.04494510", - PriceChangePercent: "-5.3700", - Volume: "440.78560000", - }, - { - BaseAssetName: "CBIX-3C9", - QuoteAssetName: "TAUD-888", - LastPrice: "0.00100235", - PriceChangePercent: "5.2700", - Volume: "440.78560000", - }, - }, - provider: "binancedex"}, - watchmarket.Tickers{ - watchmarket.Ticker{Volume: 440.7856140136719, Coin: uint(714), CoinName: "BNB", TokenId: "raven-f66", CoinType: watchmarket.Token, LastUpdate: time.Now(), - Price: watchmarket.Price{ - Value: 0.00001082, - Change24h: -2.2500, - Currency: "BNB", - Provider: "binancedex", - }, - }, - watchmarket.Ticker{Volume: 440.7856140136719, Coin: uint(714), CoinName: "BNB", TokenId: "slv-986", CoinType: watchmarket.Token, LastUpdate: time.Now(), - Price: watchmarket.Price{ - Value: 0.0449451, - Change24h: -5.3700, - Currency: "BNB", - Provider: "binancedex", - }, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - gotTickers := normalizeTickers(tt.args.prices, tt.args.provider) - now := time.Now() - sort.Slice(gotTickers, func(i, j int) bool { - gotTickers[i].LastUpdate = now - gotTickers[j].LastUpdate = now - return gotTickers[i].Coin < gotTickers[j].Coin - }) - sort.Slice(tt.wantTickers, func(i, j int) bool { - tt.wantTickers[i].LastUpdate = now - tt.wantTickers[j].LastUpdate = now - return tt.wantTickers[i].Coin < tt.wantTickers[j].Coin - }) - assert.Equal(t, tt.wantTickers, gotTickers) - }) - } -} diff --git a/services/markets/markets.go b/services/markets/markets.go index 6283d3fd..124f29fc 100755 --- a/services/markets/markets.go +++ b/services/markets/markets.go @@ -5,7 +5,6 @@ import ( "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" "github.com/trustwallet/watchmarket/services/controllers" - "github.com/trustwallet/watchmarket/services/markets/binancedex" "github.com/trustwallet/watchmarket/services/markets/coingecko" "github.com/trustwallet/watchmarket/services/markets/coinmarketcap" "github.com/trustwallet/watchmarket/services/markets/fixer" @@ -68,23 +67,21 @@ func Init(config config.Configuration, assets assets.Client) (APIs, error) { } func setupProviders(config config.Configuration, assets assets.Client) Providers { - b := binancedex.InitProvider(config.Markets.BinanceDex.API) - cmc := coinmarketcap.InitProvider( + coinmarketcapPriveder := coinmarketcap.InitProvider( config.Markets.Coinmarketcap.API, config.Markets.Coinmarketcap.WebAPI, config.Markets.Coinmarketcap.WidgetAPI, config.Markets.Coinmarketcap.Key, config.Markets.Coinmarketcap.Currency, assets) - cg := coingecko.InitProvider(config.Markets.Coingecko.API, config.Markets.Coingecko.Currency, assets) - f := fixer.InitProvider(config.Markets.Fixer.API, config.Markets.Fixer.Key, config.Markets.Fixer.Currency) + coingeckoProvider := coingecko.InitProvider(config.Markets.Coingecko.API, config.Markets.Coingecko.Currency, assets) + fixerProvider := fixer.InitProvider(config.Markets.Fixer.API, config.Markets.Fixer.Key, config.Markets.Fixer.Currency) - ps := make(Providers, 4) + providers := make(Providers, 4) - ps[b.GetProvider()] = b - ps[cmc.GetProvider()] = cmc - ps[cg.GetProvider()] = cg - ps[f.GetProvider()] = f + providers[coinmarketcapPriveder.GetProvider()] = coinmarketcapPriveder + providers[coingeckoProvider.GetProvider()] = coingeckoProvider + providers[fixerProvider.GetProvider()] = fixerProvider - return ps + return providers } diff --git a/services/markets/markets_test.go b/services/markets/markets_test.go index 8c43feaf..7cfd9f38 100755 --- a/services/markets/markets_test.go +++ b/services/markets/markets_test.go @@ -18,7 +18,7 @@ func TestInit(t *testing.T) { assert.Equal(t, 2, len(apis.ChartsAPIs)) assert.Equal(t, 3, len(apis.RatesAPIs)) - assert.Equal(t, 3, len(apis.TickersAPIs)) + assert.Equal(t, 2, len(apis.TickersAPIs)) assert.Equal(t, "coingecko", apis.ChartsAPIs["coingecko"].GetProvider()) assert.Equal(t, "coinmarketcap", apis.ChartsAPIs["coinmarketcap"].GetProvider()) @@ -27,7 +27,6 @@ func TestInit(t *testing.T) { assert.Equal(t, "coinmarketcap", apis.RatesAPIs["coinmarketcap"].GetProvider()) assert.Equal(t, "coingecko", apis.RatesAPIs["coingecko"].GetProvider()) - assert.Equal(t, "binancedex", apis.TickersAPIs["binancedex"].GetProvider()) assert.Equal(t, "coinmarketcap", apis.TickersAPIs["coinmarketcap"].GetProvider()) assert.Equal(t, "coingecko", apis.TickersAPIs["coingecko"].GetProvider()) } diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 58dfe296..78003f4b 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -197,17 +197,6 @@ func testTickersBasic(t *testing.T, c config.Configuration) { Value: 12, LastUpdated: now, }, - { - ID: "c1", - Currency: "USD", - Provider: "binancedex", - Coin: 1, - TokenId: "", - Change24h: 1, - Value: 14, - ShowOption: 0, - LastUpdated: now, - }, } w := Init(nil, nil, dbMock, memory.Init(), c) @@ -260,7 +249,7 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Coin: 1, TokenId: "", Change24h: 1, @@ -281,10 +270,10 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { Coin: 1, TokenId: "", Price: watchmarket.Price{ - Change24h: 2, + Change24h: 1, Currency: "USD", - Provider: "coingecko", - Value: 12, + Provider: "coinmarketcap", + Value: 14, }, LastUpdate: res.LastUpdate, }, res) @@ -320,7 +309,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Coin: 1, TokenId: "", Change24h: 1, @@ -343,7 +332,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 14, }, LastUpdate: res.LastUpdate, @@ -380,7 +369,7 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Coin: 1, TokenId: "", Change24h: 1, @@ -401,10 +390,10 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { Coin: 1, TokenId: "", Price: watchmarket.Price{ - Change24h: 2, + Change24h: 1, Currency: "USD", - Provider: "coingecko", - Value: 12, + Provider: "coinmarketcap", + Value: 14, }, LastUpdate: res.LastUpdate, }, res) @@ -441,7 +430,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Coin: 1, TokenId: "", Change24h: 1, @@ -465,7 +454,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "binancedex", + Provider: "coinmarketcap", Value: 14, }, LastUpdate: res.LastUpdate, From 7fa030ae38b286b44f2d14d23a32813e009a55c0 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sun, 21 Feb 2021 16:45:54 +0800 Subject: [PATCH 31/96] Add BHC BEP20 pricing (#385) https://coinmarketcap.com/currencies/billionhappiness/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index cea48210..b40440ec 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13870,6 +13870,12 @@ const Mapping = `[ "token_id": "0xAe9269f27437f0fcBC232d39Ec814844a51d6b8f", "id": 7158 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x6fd7c98458a943f469E1Cf4eA85B173f5Cd342F4", + "id": 7182 + }, { "coin": 20000714, "type": "token", From bd2618f8c6946b994888d87bb2f1d926f32555ad Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Tue, 23 Feb 2021 09:31:00 +0700 Subject: [PATCH 32/96] Add token Newscrypto (#387) * Add token Newscrypto * Add into correct order Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index b40440ec..6de68edb 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -9689,6 +9689,12 @@ const Mapping = `[ "token_id": "0xade7B5f4a421d81DDaD8Ce86f77A0EfE8921E9CC", "id": 4885 }, + { + "coin": 60, + "type": "token", + "token_id": "0x968F6f898a6Df937fC1859b323aC2F14643e3fED", + "id": 4890 + }, { "coin": 60, "type": "token", From d50255fe5ad63b14fed6fb36c0302dfc25a37553 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 25 Feb 2021 16:34:10 +0700 Subject: [PATCH 33/96] Clean codebase (#378) * Clean codebase * Extract request model and remove cache checking * Fixed tests * Fixed tests --- api/api_test.go | 8 +- api/endpoint/tickers.go | 74 +++- db/db.go | 4 +- db/postgres/ticker.go | 17 +- pkg/watchmarket/models.go | 2 +- services/controllers/charts/base.go | 2 +- services/controllers/charts/base_test.go | 6 +- services/controllers/controllers.go | 3 +- services/controllers/info/base.go | 6 +- services/controllers/info/base_test.go | 2 +- services/controllers/tickers/base.go | 179 +++++++- services/controllers/tickers/base_test.go | 179 +------- services/controllers/tickers/normalization.go | 140 ------ .../controllers/tickers/normalization_test.go | 416 ------------------ services/controllers/tickers/rates.go | 83 ---- services/controllers/tickers/tickers.go | 76 ---- services/controllers/tickers/tickers_test.go | 6 +- services/worker/memory_test.go | 3 +- tests/integration/db_test/ticker_test.go | 13 +- 19 files changed, 254 insertions(+), 965 deletions(-) delete mode 100644 services/controllers/tickers/normalization.go delete mode 100644 services/controllers/tickers/normalization_test.go delete mode 100644 services/controllers/tickers/rates.go delete mode 100644 services/controllers/tickers/tickers.go diff --git a/api/api_test.go b/api/api_test.go index a38b18b4..fcf7c408 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -309,12 +309,8 @@ func (c infoControllerMock) HandleInfoRequest(dr controllers.DetailsRequest) (co return c.wantedInfo, c.wantedError } -func (c tickersControllerMock) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { - return c.wantedTickersV2, c.wantedError -} - -func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { - return c.wantedTickersV1, c.wantedError +func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (watchmarket.Tickers, error) { + return c.wantedTickersV1.Tickers, c.wantedError } func setupEngine() *gin.Engine { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index b499fcbf..76e9290e 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -2,6 +2,7 @@ package endpoint import ( "errors" + "github.com/trustwallet/golibs/asset" "net/http" "strings" @@ -26,18 +27,21 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } - response, err := controller.HandleTickersRequest(request) + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - if len(response.Tickers) == 0 { + if len(tickers) == 0 { handleTickersError(c, request) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, controllers.TickerResponse{ + Currency: request.Currency, + Tickers: tickers, + }) } } @@ -53,15 +57,17 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con // @Router /v2/market/ticker/{id} [get] func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) - request := controllers.TickerRequestV2{Currency: currency, Ids: []string{c.Param("id")}} - response, err := controller.HandleTickersRequestV2(request) + request := controllers.TickerRequest{ + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Assets: parseAssetIds([]string{c.Param("id")}), + } + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } @@ -76,20 +82,23 @@ func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Co // @Router /v2/market/tickers [post] func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - request := controllers.TickerRequestV2{Currency: watchmarket.DefaultCurrency} + var request controllers.TickerRequestV2 if err := c.BindJSON(&request); err != nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } request.Ids = removeDuplicates(request.Ids) - response, err := controller.HandleTickersRequestV2(request) + tickers, err := controller.HandleTickersRequest(controllers.TickerRequest{ + Currency: request.Currency, + Assets: parseAssetIds(request.Ids), + }) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } @@ -105,25 +114,43 @@ func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin. // @Router /v2/market/tickers/{assets} [get] func GetTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) assets := c.Param("assets") if len(assets) == 0 { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } assetsIds := removeDuplicates(strings.Split(assets, ",")) - request := controllers.TickerRequestV2{Currency: currency, Ids: assetsIds} - response, err := controller.HandleTickersRequestV2(request) + request := controllers.TickerRequest{ + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Assets: parseAssetIds(assetsIds), + } + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } +func mapToResponse(currency string, tickers watchmarket.Tickers) controllers.TickerResponseV2 { + response := controllers.TickerResponseV2{ + Currency: currency, + } + response.Tickers = make([]controllers.TickerPrice, 0, len(tickers)) + for _, ticker := range tickers { + response.Tickers = append(response.Tickers, controllers.TickerPrice{ + Change24h: ticker.Price.Change24h, + Provider: ticker.Price.Provider, + Price: ticker.Price.Value, + ID: asset.BuildID(ticker.Coin, ticker.TokenId), + }) + } + return response +} + func handleTickersError(c *gin.Context, req controllers.TickerRequest) { if len(req.Assets) == 0 || req.Assets == nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) @@ -144,14 +171,25 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { c.JSON(http.StatusOK, emptyResponse) } -func removeDuplicates(values []string) []string { +func removeDuplicates(values []string) (result []string) { keys := make(map[string]bool) - var list []string for _, entry := range values { if _, value := keys[entry]; !value { keys[entry] = true - list = append(list, entry) + result = append(result, entry) + } + } + return result +} + +func parseAssetIds(ids []string) (assets []controllers.Asset) { + for _, id := range ids { + if coinId, tokenId, err := asset.ParseID(id); err == nil { + assets = append(assets, controllers.Asset{ + CoinId: coinId, + TokenId: tokenId, + }) } } - return list + return assets } diff --git a/db/db.go b/db/db.go index 45edaabb..b844c8ed 100644 --- a/db/db.go +++ b/db/db.go @@ -2,6 +2,7 @@ package db import ( "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/services/controllers" ) type ( @@ -11,8 +12,7 @@ type ( AddRates(rates []models.Rate) error AddTickers(tickers []models.Ticker) error - GetTickers(coin uint, tokenId string) ([]models.Ticker, error) + GetTickers(assets []controllers.Asset) ([]models.Ticker, error) GetAllTickers() ([]models.Ticker, error) - GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) } ) diff --git a/db/postgres/ticker.go b/db/postgres/ticker.go index 3f8c2082..37b51c4c 100644 --- a/db/postgres/ticker.go +++ b/db/postgres/ticker.go @@ -1,7 +1,9 @@ package postgres import ( + "github.com/trustwallet/watchmarket/services/controllers" "strconv" + "strings" "github.com/trustwallet/watchmarket/db/models" "gorm.io/gorm/clause" @@ -57,11 +59,11 @@ func normalizeTickers(tickers []models.Ticker) []models.Ticker { return result } -func (i *Instance) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (i *Instance) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { var ticker []models.Ticker db := i.Gorm - for _, tq := range tickerQueries { - db = db.Or("coin = ? AND token_id = ?", tq.Coin, tq.TokenId) + for _, asset := range assets { + db = db.Or("coin = ? AND token_id = ?", asset.CoinId, strings.ToLower(asset.TokenId)) } if err := db.Find(&ticker).Error; err != nil { return nil, err @@ -69,15 +71,6 @@ func (i *Instance) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]mo return ticker, nil } -func (i *Instance) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - var ticker []models.Ticker - if err := i.Gorm.Where("coin = ? AND token_id = ?", coin, tokenId). - Find(&ticker).Error; err != nil { - return nil, err - } - return ticker, nil -} - func (i *Instance) GetAllTickers() ([]models.Ticker, error) { var tickers []models.Ticker if err := i.Gorm.Find(&tickers).Error; err != nil { diff --git a/pkg/watchmarket/models.go b/pkg/watchmarket/models.go index ae011319..9a733765 100755 --- a/pkg/watchmarket/models.go +++ b/pkg/watchmarket/models.go @@ -143,6 +143,6 @@ func IsFiatRate(currency string) bool { case "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BYR", "BZD", "CAD", "CDF", "CHF", "CLF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XCD", "XDR", "XOF", "XPF", "YER", "ZAR", "ZMK", "ZMW", "ZWL": return true default: + return false } - return false } diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index b60f30b9..91d1e5ff 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -81,7 +81,7 @@ func (c Controller) hasTickers(assetData controllers.Asset) bool { return false } } else { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) + dbTickers, err := c.database.GetTickers([]controllers.Asset{assetData}) if err != nil { return false } diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index 656b8841..6fa17ce3 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -160,11 +160,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/controllers.go b/services/controllers/controllers.go index bba40e8e..735744bb 100644 --- a/services/controllers/controllers.go +++ b/services/controllers/controllers.go @@ -6,8 +6,7 @@ import ( type ( TickersController interface { - HandleTickersRequest(tr TickerRequest) (TickerResponse, error) - HandleTickersRequestV2(tr TickerRequestV2) (TickerResponseV2, error) + HandleTickersRequest(tr TickerRequest) (watchmarket.Tickers, error) } RatesController interface { diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 58161253..1a4daef2 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -4,11 +4,9 @@ import ( "encoding/json" "errors" "fmt" - "github.com/trustwallet/watchmarket/db/models" - "strings" - log "github.com/sirupsen/logrus" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -94,7 +92,7 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller } func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: strings.ToLower(request.Asset.TokenId)}}) + dbTickers, err := c.database.GetTickers([]controllers.Asset{request.Asset}) if err != nil || len(dbTickers) == 0 { return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 44ee07c2..b25669f4 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -169,7 +169,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 5232afcf..617cd64f 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -1,14 +1,16 @@ package tickerscontroller import ( + "encoding/json" "errors" - "strings" - + "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" + "strings" ) type Controller struct { @@ -34,34 +36,177 @@ func NewController( } } -func (c Controller) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) +func (c Controller) HandleTickersRequest(request controllers.TickerRequest) (watchmarket.Tickers, error) { + rate, err := c.getRateByPriority(strings.ToUpper(request.Currency)) if err != nil { - return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrNotFound) + return watchmarket.Tickers{}, errors.New(watchmarket.ErrNotFound) } - tickers, err := c.getTickersByPriority(makeTickerQueriesV2(tr.Ids)) + tickers, err := c.getTickersByPriority(request.Assets) if err != nil { - return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrInternal) + return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) } + tickers = c.filterTickers(tickers, rate) + return tickers, nil +} - tickers = c.normalizeTickers(tickers, rate) - - return createResponseV2(tr, tickers), nil +func (c Controller) filterTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) (result watchmarket.Tickers) { + for _, ticker := range tickers { + r, ok := c.rateToDefaultCurrency(ticker, rate) + if !ok { + continue + } + if !watchmarket.IsSuitableUpdateTime(ticker.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { + continue + } + c.applyRateToTicker(&ticker, r) + result = append(result, ticker) + } + return result } -func (c Controller) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) +func (c Controller) getTickersByPriority(assets []controllers.Asset) (watchmarket.Tickers, error) { + if result, err := c.getCachedTickers(assets); err == nil { + return result, nil + } + tickers, err := c.database.GetTickers(assets) if err != nil { - return controllers.TickerResponse{}, errors.New(watchmarket.ErrNotFound) + return nil, err + } + result := make(watchmarket.Tickers, 0) + for _, assetData := range assets { + ticker := findBestTicker(assetData, tickers, c.tickersPriority, c.configuration) + if ticker == nil { + continue + } + result = append(result, watchmarket.Ticker{ + Coin: ticker.Coin, + CoinName: ticker.CoinName, + CoinType: watchmarket.CoinType(ticker.CoinType), + LastUpdate: ticker.LastUpdated, + Price: watchmarket.Price{ + Change24h: ticker.Change24h, + Currency: ticker.Currency, + Provider: ticker.Provider, + Value: ticker.Value, + }, + TokenId: ticker.TokenId, + }) + } + + return result, nil +} + +func findBestTicker(assetData controllers.Asset, tickers []models.Ticker, providers []string, configuration config.Configuration) *models.Ticker { + for _, p := range providers { + for _, ticker := range tickers { + baseCheck := assetData.CoinId == ticker.Coin && strings.ToLower(assetData.TokenId) == ticker.TokenId + + if baseCheck && ticker.ShowOption == models.AlwaysShow { + return &ticker + } + + if baseCheck && p == ticker.Provider && ticker.ShowOption != models.NeverShow && + (watchmarket.IsRespectableValue(ticker.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || ticker.Provider != "coingecko") && + (watchmarket.IsRespectableValue(ticker.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || ticker.Provider != "coingecko") { + return &ticker + } + } + } + return nil +} + +func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, err error) { + if result, err := c.getCachedRate(currency); err == nil { + return result, nil } - tickers, err := c.getTickersByPriority(makeTickerQueries(tr.Assets)) + rates, err := c.database.GetRates(currency) if err != nil { - return controllers.TickerResponse{}, errors.New(watchmarket.ErrInternal) + return result, err + } + isFiat := !watchmarket.IsFiatRate(currency) + + for _, p := range c.ratesPriority { + if isFiat && p != "fixer" { + continue + } + for _, r := range rates { + if p == r.Provider { + return watchmarket.Rate{ + Currency: r.Currency, + PercentChange24h: r.PercentChange24h, + Provider: r.Provider, + Rate: r.Rate, + Timestamp: r.LastUpdated.Unix(), + }, nil + } + } + } + return result, errors.New(watchmarket.ErrNotFound) +} + +func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { + if t.Price.Currency != watchmarket.DefaultCurrency { + newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) + if err != nil { + return watchmarket.Rate{}, false + } + rate.Rate /= newRate.Rate + rate.PercentChange24h = newRate.PercentChange24h + } + return rate, true +} + +func (c Controller) applyRateToTicker(ticker *watchmarket.Ticker, rate watchmarket.Rate) { + if ticker.Price.Currency == rate.Currency { + return + } + ticker.Price.Value *= 1 / rate.Rate + ticker.Price.Currency = rate.Currency + ticker.Volume *= 1 / rate.Rate + ticker.MarketCap *= 1 / rate.Rate + + if rate.PercentChange24h != 0 { + ticker.Price.Change24h -= rate.PercentChange24h // Look at it more detailed } +} - tickers = c.normalizeTickers(tickers, rate) +func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { + if c.cache == nil { + return watchmarket.Tickers{}, errors.New("cache isn't available") + } + var results watchmarket.Tickers + for _, assetData := range assets { + key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) + rawResult, err := c.cache.Get(key) + if err != nil { + continue + } + var result watchmarket.Ticker + if err = json.Unmarshal(rawResult, &result); err != nil { + continue + } + results = append(results, result) + } + if len(results) == len(assets) { + return results, nil + } else { + return results, errors.New("not found") + } +} - return createResponse(tr, tickers), nil +// TODO: Remove duplicates or make method +func (c Controller) getCachedRate(currency string) (result watchmarket.Rate, err error) { + if c.cache == nil { + return watchmarket.Rate{}, errors.New("cache isn't available") + } + rawResult, err := c.cache.Get(currency) + if err != nil { + return result, err + } + if err = json.Unmarshal(rawResult, &result); err != nil { + return result, err + } + return result, nil } diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index afe7ed33..8b431ff4 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -131,11 +131,11 @@ func TestController_HandleTickersRequest(t *testing.T) { sort.Slice(wantedResp.Tickers, func(i, j int) bool { return wantedResp.Tickers[i].Coin < wantedResp.Tickers[j].Coin }) - sort.Slice(response.Tickers, func(i, j int) bool { - return response.Tickers[i].Coin < response.Tickers[j].Coin + sort.Slice(response, func(i, j int) bool { + return response[i].Coin < response[j].Coin }) - assert.Equal(t, wantedResp, response) + assert.Equal(t, wantedResp.Tickers, response) controllerWithCache := setupController(t, db, true) assert.NotNil(t, controllerWithCache) @@ -161,14 +161,14 @@ func TestController_HandleTickersRequest(t *testing.T) { response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) - sort.Slice(response2.Tickers, func(i, j int) bool { - return response2.Tickers[i].Coin < response2.Tickers[j].Coin + sort.Slice(response2, func(i, j int) bool { + return response2[i].Coin < response2[j].Coin }) for i := range wantedResp.Tickers { - assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2.Tickers[i].LastUpdate)) - wantedResp.Tickers[i].LastUpdate = response2.Tickers[i].LastUpdate + assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2[i].LastUpdate)) + wantedResp.Tickers[i].LastUpdate = response2[i].LastUpdate } - assert.Equal(t, wantedResp, response2) + assert.Equal(t, wantedResp.Tickers, response2) } func TestController_HandleTickersRequest_Negative(t *testing.T) { @@ -183,163 +183,6 @@ func TestController_HandleTickersRequest_Negative(t *testing.T) { assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) } -func TestController_HandleTickersRequestV2(t *testing.T) { - timeUPD := time.Now() - rate := models.Rate{ - Currency: "USD", - PercentChange24h: 1, - Provider: "coinmarketcap", - Rate: 1, - LastUpdated: timeUPD, - } - rate2 := models.Rate{ - Currency: "USD", - PercentChange24h: 2, - Provider: "coingecko", - Rate: 2, - LastUpdated: timeUPD, - } - rate3 := models.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: "fixer", - Rate: 6, - LastUpdated: timeUPD, - } - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 10, - LastUpdated: timeUPD, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 10, - LastUpdated: timeUPD, - } - - ticker714ACG := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - LastUpdated: timeUPD, - } - - ticker714ABNB := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "binancedex", - Value: 100, - LastUpdated: timeUPD, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} - db.WantedRatesError = nil - db.WantedRates = []models.Rate{rate, rate2, rate3} - c := setupController(t, db, false) - assert.NotNil(t, c) - - response, err := c.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) - assert.Nil(t, err) - - wantedTicker1 := controllers.TickerPrice{ - ID: "c60_ta", - Change24h: 10, - Provider: "coinmarketcap", - Price: 10, - } - wantedTicker2 := controllers.TickerPrice{ - ID: "c714_ta", - Change24h: 10, - Provider: "coingecko", - Price: 100, - } - - wantedResp := controllers.TickerResponseV2{ - Currency: "USD", - Tickers: []controllers.TickerPrice{wantedTicker2, wantedTicker1}, - } - - sort.Slice(wantedResp.Tickers, func(i, j int) bool { - return wantedResp.Tickers[i].Price < wantedResp.Tickers[j].Price - }) - sort.Slice(response.Tickers, func(i, j int) bool { - return response.Tickers[i].Price < response.Tickers[j].Price - }) - - assert.Equal(t, wantedResp, response) - - controllerWithCache := setupController(t, db, true) - assert.NotNil(t, controllerWithCache) - wantedTicker1Raw, err := json.Marshal(&watchmarket.Ticker{ - Coin: 60, - TokenId: "a", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 10, - }, - LastUpdate: timeUPD, - }) - assert.Nil(t, err) - wantedTicker2Raw, err := json.Marshal(&watchmarket.Ticker{ - Coin: 714, - TokenId: "a", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - }, - LastUpdate: timeUPD, - }) - assert.Nil(t, err) - rateRaw, err := json.Marshal(&watchmarket.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: "fixer", - Rate: 6, - Timestamp: timeUPD.Unix(), - }) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c60_ta", wantedTicker1Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c714_ta", wantedTicker2Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("USD", rateRaw) - assert.Nil(t, err) - - response2, err := controllerWithCache.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) - assert.Nil(t, err) - - sort.Slice(response2.Tickers, func(i, j int) bool { - return response.Tickers[i].Price < response.Tickers[j].Price - }) - assert.Equal(t, wantedResp, response2) -} - func TestNewController(t *testing.T) { assert.NotNil(t, setupController(t, getDbMock(), false)) } @@ -397,10 +240,6 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (d dbMock) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go deleted file mode 100644 index 9b9b11f6..00000000 --- a/services/controllers/tickers/normalization.go +++ /dev/null @@ -1,140 +0,0 @@ -package tickerscontroller - -import ( - "strings" - "sync" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func createResponse(tr controllers.TickerRequest, tickers watchmarket.Tickers) controllers.TickerResponse { - mergedTickers := make(watchmarket.Tickers, 0, len(tickers)) - for _, t := range tickers { - newTicker, ok := findTickerInAssets(tr.Assets, t) - if !ok { - continue - } - mergedTickers = append(mergedTickers, newTicker) - } - return controllers.TickerResponse{Currency: tr.Currency, Tickers: mergedTickers} -} - -func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Tickers) controllers.TickerResponseV2 { - result := controllers.TickerResponseV2{ - Currency: tr.Currency, - } - tickersPrices := make([]controllers.TickerPrice, 0, len(tickers)) - for _, ticker := range tickers { - id, ok := findIDInRequest(tr, asset.BuildID(ticker.Coin, ticker.TokenId)) - if !ok { - log.Error("Cannot find ID in request") - } - tp := controllers.TickerPrice{ - Change24h: ticker.Price.Change24h, - Provider: ticker.Price.Provider, - Price: ticker.Price.Value, - ID: id, - } - tickersPrices = append(tickersPrices, tp) - } - result.Tickers = tickersPrices - return result -} - -func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { - tickerQueries := make([]models.TickerQuery, 0, len(coins)) - for _, c := range coins { - tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: c.CoinId, - TokenId: strings.ToLower(c.TokenId), - }) - } - return tickerQueries -} - -func makeTickerQueriesV2(ids []string) []models.TickerQuery { - tickerQueries := make([]models.TickerQuery, 0, len(ids)) - for _, id := range ids { - coin, token, err := asset.ParseID(id) - if err != nil { - continue - } - tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: coin, - TokenId: strings.ToLower(token), - }) - } - return tickerQueries -} - -func (c Controller) normalizeTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) watchmarket.Tickers { - result := make(watchmarket.Tickers, 0, len(tickers)) - for _, t := range tickers { - r, ok := c.rateToDefaultCurrency(t, rate) - if !ok { - continue - } - if !watchmarket.IsSuitableUpdateTime(t.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { - continue - } - result = append(result, applyRateToTicker(t, r)) - } - return result -} - -func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bool) { - for _, i := range request.Ids { - givenCoin, givenToken, err := asset.ParseID(i) - if err != nil { - continue - } - coin, token, err := asset.ParseID(id) - if err != nil { - continue - } - - if givenCoin == coin && strings.EqualFold(givenToken, token) { - return i, true - } - } - return id, false -} - -func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { - for _, c := range assets { - if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { - t.TokenId = c.TokenId - return t, true - } - } - return watchmarket.Ticker{}, false -} - -func findBestProviderForQuery(coin uint, token string, sliceToFind []models.Ticker, providers []string, wg *sync.WaitGroup, res *sortedTickersResponse, configuration config.Configuration) { - defer wg.Done() - for _, p := range providers { - for _, t := range sliceToFind { - baseCheck := coin == t.Coin && strings.ToLower(token) == t.TokenId - - if baseCheck && t.ShowOption == models.AlwaysShow { - res.Lock() - res.tickers = append(res.tickers, t) - res.Unlock() - return - } - if baseCheck && p == t.Provider && t.ShowOption != models.NeverShow && - (watchmarket.IsRespectableValue(t.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || t.Provider != "coingecko") && - (watchmarket.IsRespectableValue(t.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || t.Provider != "coingecko") { - res.Lock() - res.tickers = append(res.tickers, t) - res.Unlock() - return - } - } - } -} diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go deleted file mode 100644 index f77722ea..00000000 --- a/services/controllers/tickers/normalization_test.go +++ /dev/null @@ -1,416 +0,0 @@ -package tickerscontroller - -import ( - "sort" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func TestController_createResponse(t *testing.T) { - ticker := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "raven-f66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - } - - tr := controllers.TickerRequest{ - Currency: "EUR", - Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, - } - - response := createResponse(tr, watchmarket.Tickers{ticker}) - wantedResponse := controllers.TickerResponse{ - Currency: "EUR", - Tickers: watchmarket.Tickers{ - { - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "RAVEN-F66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - }, - }, - } - assert.Equal(t, wantedResponse, response) -} - -func Test_makeTickerQueriesV2(t *testing.T) { - ids := []string{"c60_ta", "c714", "c714_ta"} - wantedRes := []models.TickerQuery{ - { - Coin: 60, - TokenId: "a", - }, - { - Coin: 714, - TokenId: "", - }, - { - Coin: 714, - TokenId: "a", - }, - } - res := makeTickerQueriesV2(ids) - - sort.Slice(res, func(i, j int) bool { - return res[i].Coin < res[j].Coin - }) - sort.Slice(wantedRes, func(i, j int) bool { - return wantedRes[i].Coin < wantedRes[j].Coin - }) - - for i, r := range res { - assert.Equal(t, wantedRes[i], r) - } -} - -func Test_createResponseV2(t *testing.T) { - timeUPD := time.Now() - given1 := watchmarket.Ticker{ - Coin: 60, - CoinName: "ETH", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - given2 := watchmarket.Ticker{ - Coin: 714, - CoinName: "BNB", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - r := createResponseV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}, []watchmarket.Ticker{given1, given2}) - - wantedTicker1 := controllers.TickerPrice{ - ID: "c60_ta", - Change24h: 10, - Provider: "coinmarketcap", - Price: 100, - } - wantedTicker2 := controllers.TickerPrice{ - ID: "c714_ta", - Change24h: 10, - Provider: "coingecko", - Price: 100, - } - - wp := []controllers.TickerPrice{wantedTicker2, wantedTicker1} - sort.Slice(wp, func(i, j int) bool { - return wp[i].ID < wp[j].ID - }) - wantedResp := controllers.TickerResponseV2{ - Currency: "USD", - Tickers: wp, - } - - sort.Slice(r.Tickers, func(i, j int) bool { - return r.Tickers[i].ID < r.Tickers[j].ID - }) - - assert.Equal(t, wantedResp, r) -} - -func TestController_normalizeTickers(t *testing.T) { - modelRate2 := models.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - LastUpdated: time.Now(), - } - - rate := watchmarket.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - Timestamp: 12, - } - - now := time.Now() - - gotTicker1 := watchmarket.Ticker{ - Coin: 0, - CoinName: "BTC", - CoinType: "Coin", - Price: watchmarket.Price{ - Change24h: -4.03168, - Currency: "USD", - Provider: "coinmarketcap", - Value: 9360.20314131, - }, - TokenId: "", - LastUpdate: now, - } - db := getDbMock() - db.WantedRates = []models.Rate{modelRate2} - - c := setupController(t, db, false) - assert.NotNil(t, c) - - result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) - wanted := watchmarket.Ticker{ - Coin: 0, - CoinName: "BTC", - CoinType: "Coin", - Error: "", - Price: watchmarket.Price{ - Change24h: -4.03168, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 8514.78959355037, - }, - TokenId: "", - LastUpdate: now, - } - assert.Equal(t, wanted, result[0]) -} - -func TestController_normalizeTickers_advanced(t *testing.T) { - timeUPD := time.Now() - modelRate := models.Rate{ - Currency: "BNB", - PercentChange24h: 0, - Provider: "coingecko", - Rate: 16.16, - LastUpdated: timeUPD, - } - - modelRate2 := models.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - LastUpdated: timeUPD, - } - - rate := watchmarket.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - Timestamp: 12, - } - - gotTicker1 := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "BNB", - Provider: "coinmarketcap", - Value: 1, - }, - TokenId: "raven-f66", - Volume: 10, - MarketCap: 10, - LastUpdate: timeUPD, - } - - db := getDbMock() - db.WantedRates = []models.Rate{modelRate, modelRate2} - - c := setupController(t, db, false) - assert.NotNil(t, c) - - result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) - wanted := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "raven-f66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - LastUpdate: timeUPD, - } - assert.Equal(t, wanted, result[0]) -} - -func Test_findBestProviderForQuery(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - } - - providers := []string{"coinmarketcap", "coingecko"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} - -func Test_findBestProviderForQuery_advanced(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - ShowOption: models.NeverShow, - } - - providers := []string{"coingecko", "coinmarketcap"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} - -func Test_findBestProviderForQuery_showOption(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - ShowOption: models.AlwaysShow, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - } - - providers := []string{"coingecko", "coinmarketcap"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} diff --git a/services/controllers/tickers/rates.go b/services/controllers/tickers/rates.go deleted file mode 100644 index aa85914a..00000000 --- a/services/controllers/tickers/rates.go +++ /dev/null @@ -1,83 +0,0 @@ -package tickerscontroller - -import ( - "encoding/json" - "errors" - "strings" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -func (c Controller) getRateByPriority(currency string) (watchmarket.Rate, error) { - if c.configuration.RestAPI.UseMemoryCache { - rawResult, err := c.cache.Get(currency) - if err != nil { - return watchmarket.Rate{}, err - } - var result watchmarket.Rate - if err = json.Unmarshal(rawResult, &result); err != nil { - return watchmarket.Rate{}, err - } - return result, nil - } - - rates, err := c.database.GetRates(currency) - if err != nil { - log.Error(err, "getRateByPriority") - return watchmarket.Rate{}, err - } - - providers := c.ratesPriority - - var result models.Rate -ProvidersLoop: - for _, p := range providers { - for _, r := range rates { - if p == r.Provider { - result = r - break ProvidersLoop - } - } - } - emptyRate := models.Rate{} - if result == emptyRate || (watchmarket.IsFiatRate(result.Currency) && result.Provider != "fixer") { - return watchmarket.Rate{}, errors.New(watchmarket.ErrNotFound) - } - - return watchmarket.Rate{ - Currency: result.Currency, - PercentChange24h: result.PercentChange24h, - Provider: result.Provider, - Rate: result.Rate, - Timestamp: result.LastUpdated.Unix(), - }, nil -} - -func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { - if t.Price.Currency != watchmarket.DefaultCurrency { - newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) - if err != nil { - return watchmarket.Rate{}, false - } - rate.Rate /= newRate.Rate - rate.PercentChange24h = newRate.PercentChange24h - } - return rate, true -} - -func applyRateToTicker(t watchmarket.Ticker, rate watchmarket.Rate) watchmarket.Ticker { - if t.Price.Currency == rate.Currency { - return t - } - t.Price.Value *= 1 / rate.Rate - t.Price.Currency = rate.Currency - t.Volume *= 1 / rate.Rate - t.MarketCap *= 1 / rate.Rate - - if rate.PercentChange24h != 0 { - t.Price.Change24h -= rate.PercentChange24h // Look at it more detailed - } - return t -} diff --git a/services/controllers/tickers/tickers.go b/services/controllers/tickers/tickers.go deleted file mode 100644 index bcdbefce..00000000 --- a/services/controllers/tickers/tickers.go +++ /dev/null @@ -1,76 +0,0 @@ -package tickerscontroller - -import ( - "encoding/json" - "strings" - "sync" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -type ( - sortedTickersResponse struct { - sync.Mutex - tickers []models.Ticker - } -) - -func (c Controller) getTickersByPriority(tickerQueries []models.TickerQuery) (watchmarket.Tickers, error) { - if c.configuration.RestAPI.UseMemoryCache { - var results watchmarket.Tickers - for _, tr := range tickerQueries { - key := strings.ToLower(asset.BuildID(tr.Coin, tr.TokenId)) - rawResult, err := c.cache.Get(key) - if err != nil { - continue - } - var result watchmarket.Ticker - if err = json.Unmarshal(rawResult, &result); err != nil { - continue - } - results = append(results, result) - } - return results, nil - } - - dbTickers, err := c.database.GetTickersByQueries(tickerQueries) - if err != nil { - log.Error(err, "getTickersByPriority") - return nil, err - } - providers := c.tickersPriority - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c.configuration) - } - - wg.Wait() - - sortedTickers := res.tickers - - result := make(watchmarket.Tickers, len(sortedTickers)) - - for i, sr := range sortedTickers { - result[i] = watchmarket.Ticker{ - Coin: sr.Coin, - CoinName: sr.CoinName, - CoinType: watchmarket.CoinType(sr.CoinType), - LastUpdate: sr.LastUpdated, - Price: watchmarket.Price{ - Change24h: sr.Change24h, - Currency: sr.Currency, - Provider: sr.Provider, - Value: sr.Value, - }, - TokenId: sr.TokenId, - } - } - - return result, nil -} diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index 02d7f54f..7d530348 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -47,9 +47,7 @@ func TestController_getTickersByPriority(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - tickers, err := c.getTickersByPriority(makeTickerQueries( - []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, - )) + tickers, err := c.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}) assert.Nil(t, err) assert.NotNil(t, tickers) assert.Equal(t, 2, len(tickers)) @@ -88,7 +86,7 @@ func TestController_getTickersByPriority(t *testing.T) { db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) + tickers2, err := c2.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}}) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 78003f4b..50d7e0b3 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -2,6 +2,7 @@ package worker import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "testing" "time" @@ -499,7 +500,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return d.WantedRates, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/tests/integration/db_test/ticker_test.go b/tests/integration/db_test/ticker_test.go index 876ea95b..6c676746 100644 --- a/tests/integration/db_test/ticker_test.go +++ b/tests/integration/db_test/ticker_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/tests/integration/setup" "testing" @@ -37,12 +38,12 @@ func TestAddTickers(t *testing.T) { err := d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers(60, "60") + result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) - result2, err := d.GetTickers(70, "70") + result2, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, uint(70), result2[0].Coin) @@ -61,7 +62,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers(60, "60") + result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 2) @@ -70,7 +71,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result2, err = d.GetTickers(70, "70") + result2, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, float64(100500), result2[0].Value) @@ -116,7 +117,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers(60, "60") + result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) @@ -135,7 +136,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers(60, "60") + result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) } From 89b31ca9932e33c0f7485b26e79c2d6db3753793 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 25 Feb 2021 18:00:24 +0700 Subject: [PATCH 34/96] Revert "Clean codebase (#378)" (#392) This reverts commit d50255fe5ad63b14fed6fb36c0302dfc25a37553. --- api/api_test.go | 8 +- api/endpoint/tickers.go | 74 +--- db/db.go | 4 +- db/postgres/ticker.go | 17 +- pkg/watchmarket/models.go | 2 +- services/controllers/charts/base.go | 2 +- services/controllers/charts/base_test.go | 6 +- services/controllers/controllers.go | 3 +- services/controllers/info/base.go | 6 +- services/controllers/info/base_test.go | 2 +- services/controllers/tickers/base.go | 179 +------- services/controllers/tickers/base_test.go | 179 +++++++- services/controllers/tickers/normalization.go | 140 ++++++ .../controllers/tickers/normalization_test.go | 416 ++++++++++++++++++ services/controllers/tickers/rates.go | 83 ++++ services/controllers/tickers/tickers.go | 76 ++++ services/controllers/tickers/tickers_test.go | 6 +- services/worker/memory_test.go | 3 +- tests/integration/db_test/ticker_test.go | 13 +- 19 files changed, 965 insertions(+), 254 deletions(-) create mode 100644 services/controllers/tickers/normalization.go create mode 100644 services/controllers/tickers/normalization_test.go create mode 100644 services/controllers/tickers/rates.go create mode 100644 services/controllers/tickers/tickers.go diff --git a/api/api_test.go b/api/api_test.go index fcf7c408..a38b18b4 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -309,8 +309,12 @@ func (c infoControllerMock) HandleInfoRequest(dr controllers.DetailsRequest) (co return c.wantedInfo, c.wantedError } -func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (watchmarket.Tickers, error) { - return c.wantedTickersV1.Tickers, c.wantedError +func (c tickersControllerMock) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { + return c.wantedTickersV2, c.wantedError +} + +func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { + return c.wantedTickersV1, c.wantedError } func setupEngine() *gin.Engine { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index 76e9290e..b499fcbf 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -2,7 +2,6 @@ package endpoint import ( "errors" - "github.com/trustwallet/golibs/asset" "net/http" "strings" @@ -27,21 +26,18 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } - tickers, err := controller.HandleTickersRequest(request) + response, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - if len(tickers) == 0 { + if len(response.Tickers) == 0 { handleTickersError(c, request) return } - c.JSON(http.StatusOK, controllers.TickerResponse{ - Currency: request.Currency, - Tickers: tickers, - }) + c.JSON(http.StatusOK, response) } } @@ -57,17 +53,15 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con // @Router /v2/market/ticker/{id} [get] func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - request := controllers.TickerRequest{ - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - Assets: parseAssetIds([]string{c.Param("id")}), - } - tickers, err := controller.HandleTickersRequest(request) + currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) + request := controllers.TickerRequestV2{Currency: currency, Ids: []string{c.Param("id")}} + response, err := controller.HandleTickersRequestV2(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) + c.JSON(http.StatusOK, response) } } @@ -82,23 +76,20 @@ func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Co // @Router /v2/market/tickers [post] func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - var request controllers.TickerRequestV2 + request := controllers.TickerRequestV2{Currency: watchmarket.DefaultCurrency} if err := c.BindJSON(&request); err != nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } request.Ids = removeDuplicates(request.Ids) - tickers, err := controller.HandleTickersRequest(controllers.TickerRequest{ - Currency: request.Currency, - Assets: parseAssetIds(request.Ids), - }) + response, err := controller.HandleTickersRequestV2(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) + c.JSON(http.StatusOK, response) } } @@ -114,43 +105,25 @@ func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin. // @Router /v2/market/tickers/{assets} [get] func GetTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { + currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) assets := c.Param("assets") if len(assets) == 0 { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } assetsIds := removeDuplicates(strings.Split(assets, ",")) - request := controllers.TickerRequest{ - Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), - Assets: parseAssetIds(assetsIds), - } - tickers, err := controller.HandleTickersRequest(request) + request := controllers.TickerRequestV2{Currency: currency, Ids: assetsIds} + response, err := controller.HandleTickersRequestV2(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) + c.JSON(http.StatusOK, response) } } -func mapToResponse(currency string, tickers watchmarket.Tickers) controllers.TickerResponseV2 { - response := controllers.TickerResponseV2{ - Currency: currency, - } - response.Tickers = make([]controllers.TickerPrice, 0, len(tickers)) - for _, ticker := range tickers { - response.Tickers = append(response.Tickers, controllers.TickerPrice{ - Change24h: ticker.Price.Change24h, - Provider: ticker.Price.Provider, - Price: ticker.Price.Value, - ID: asset.BuildID(ticker.Coin, ticker.TokenId), - }) - } - return response -} - func handleTickersError(c *gin.Context, req controllers.TickerRequest) { if len(req.Assets) == 0 || req.Assets == nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) @@ -171,25 +144,14 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { c.JSON(http.StatusOK, emptyResponse) } -func removeDuplicates(values []string) (result []string) { +func removeDuplicates(values []string) []string { keys := make(map[string]bool) + var list []string for _, entry := range values { if _, value := keys[entry]; !value { keys[entry] = true - result = append(result, entry) - } - } - return result -} - -func parseAssetIds(ids []string) (assets []controllers.Asset) { - for _, id := range ids { - if coinId, tokenId, err := asset.ParseID(id); err == nil { - assets = append(assets, controllers.Asset{ - CoinId: coinId, - TokenId: tokenId, - }) + list = append(list, entry) } } - return assets + return list } diff --git a/db/db.go b/db/db.go index b844c8ed..45edaabb 100644 --- a/db/db.go +++ b/db/db.go @@ -2,7 +2,6 @@ package db import ( "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/services/controllers" ) type ( @@ -12,7 +11,8 @@ type ( AddRates(rates []models.Rate) error AddTickers(tickers []models.Ticker) error - GetTickers(assets []controllers.Asset) ([]models.Ticker, error) + GetTickers(coin uint, tokenId string) ([]models.Ticker, error) GetAllTickers() ([]models.Ticker, error) + GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) } ) diff --git a/db/postgres/ticker.go b/db/postgres/ticker.go index 37b51c4c..3f8c2082 100644 --- a/db/postgres/ticker.go +++ b/db/postgres/ticker.go @@ -1,9 +1,7 @@ package postgres import ( - "github.com/trustwallet/watchmarket/services/controllers" "strconv" - "strings" "github.com/trustwallet/watchmarket/db/models" "gorm.io/gorm/clause" @@ -59,11 +57,11 @@ func normalizeTickers(tickers []models.Ticker) []models.Ticker { return result } -func (i *Instance) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { +func (i *Instance) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { var ticker []models.Ticker db := i.Gorm - for _, asset := range assets { - db = db.Or("coin = ? AND token_id = ?", asset.CoinId, strings.ToLower(asset.TokenId)) + for _, tq := range tickerQueries { + db = db.Or("coin = ? AND token_id = ?", tq.Coin, tq.TokenId) } if err := db.Find(&ticker).Error; err != nil { return nil, err @@ -71,6 +69,15 @@ func (i *Instance) GetTickers(assets []controllers.Asset) ([]models.Ticker, erro return ticker, nil } +func (i *Instance) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { + var ticker []models.Ticker + if err := i.Gorm.Where("coin = ? AND token_id = ?", coin, tokenId). + Find(&ticker).Error; err != nil { + return nil, err + } + return ticker, nil +} + func (i *Instance) GetAllTickers() ([]models.Ticker, error) { var tickers []models.Ticker if err := i.Gorm.Find(&tickers).Error; err != nil { diff --git a/pkg/watchmarket/models.go b/pkg/watchmarket/models.go index 9a733765..ae011319 100755 --- a/pkg/watchmarket/models.go +++ b/pkg/watchmarket/models.go @@ -143,6 +143,6 @@ func IsFiatRate(currency string) bool { case "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BYR", "BZD", "CAD", "CDF", "CHF", "CLF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XCD", "XDR", "XOF", "XPF", "YER", "ZAR", "ZMK", "ZMW", "ZWL": return true default: - return false } + return false } diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index 91d1e5ff..b60f30b9 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -81,7 +81,7 @@ func (c Controller) hasTickers(assetData controllers.Asset) bool { return false } } else { - dbTickers, err := c.database.GetTickers([]controllers.Asset{assetData}) + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) if err != nil { return false } diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index 6fa17ce3..656b8841 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -160,7 +160,11 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { +func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} + +func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/controllers.go b/services/controllers/controllers.go index 735744bb..bba40e8e 100644 --- a/services/controllers/controllers.go +++ b/services/controllers/controllers.go @@ -6,7 +6,8 @@ import ( type ( TickersController interface { - HandleTickersRequest(tr TickerRequest) (watchmarket.Tickers, error) + HandleTickersRequest(tr TickerRequest) (TickerResponse, error) + HandleTickersRequestV2(tr TickerRequestV2) (TickerResponseV2, error) } RatesController interface { diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 1a4daef2..58161253 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -4,9 +4,11 @@ import ( "encoding/json" "errors" "fmt" + "github.com/trustwallet/watchmarket/db/models" + "strings" + log "github.com/sirupsen/logrus" "github.com/trustwallet/watchmarket/db" - "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -92,7 +94,7 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller } func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - dbTickers, err := c.database.GetTickers([]controllers.Asset{request.Asset}) + dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: strings.ToLower(request.Asset.TokenId)}}) if err != nil || len(dbTickers) == 0 { return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index b25669f4..44ee07c2 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -169,7 +169,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { +func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 617cd64f..5232afcf 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -1,16 +1,14 @@ package tickerscontroller import ( - "encoding/json" "errors" - "github.com/trustwallet/golibs/asset" + "strings" + "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" - "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" - "strings" ) type Controller struct { @@ -36,177 +34,34 @@ func NewController( } } -func (c Controller) HandleTickersRequest(request controllers.TickerRequest) (watchmarket.Tickers, error) { - rate, err := c.getRateByPriority(strings.ToUpper(request.Currency)) +func (c Controller) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { + rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) if err != nil { - return watchmarket.Tickers{}, errors.New(watchmarket.ErrNotFound) - } - - tickers, err := c.getTickersByPriority(request.Assets) - if err != nil { - return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) - } - tickers = c.filterTickers(tickers, rate) - return tickers, nil -} - -func (c Controller) filterTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) (result watchmarket.Tickers) { - for _, ticker := range tickers { - r, ok := c.rateToDefaultCurrency(ticker, rate) - if !ok { - continue - } - if !watchmarket.IsSuitableUpdateTime(ticker.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { - continue - } - c.applyRateToTicker(&ticker, r) - result = append(result, ticker) + return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrNotFound) } - return result -} -func (c Controller) getTickersByPriority(assets []controllers.Asset) (watchmarket.Tickers, error) { - if result, err := c.getCachedTickers(assets); err == nil { - return result, nil - } - tickers, err := c.database.GetTickers(assets) + tickers, err := c.getTickersByPriority(makeTickerQueriesV2(tr.Ids)) if err != nil { - return nil, err - } - result := make(watchmarket.Tickers, 0) - for _, assetData := range assets { - ticker := findBestTicker(assetData, tickers, c.tickersPriority, c.configuration) - if ticker == nil { - continue - } - result = append(result, watchmarket.Ticker{ - Coin: ticker.Coin, - CoinName: ticker.CoinName, - CoinType: watchmarket.CoinType(ticker.CoinType), - LastUpdate: ticker.LastUpdated, - Price: watchmarket.Price{ - Change24h: ticker.Change24h, - Currency: ticker.Currency, - Provider: ticker.Provider, - Value: ticker.Value, - }, - TokenId: ticker.TokenId, - }) + return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrInternal) } - return result, nil -} - -func findBestTicker(assetData controllers.Asset, tickers []models.Ticker, providers []string, configuration config.Configuration) *models.Ticker { - for _, p := range providers { - for _, ticker := range tickers { - baseCheck := assetData.CoinId == ticker.Coin && strings.ToLower(assetData.TokenId) == ticker.TokenId + tickers = c.normalizeTickers(tickers, rate) - if baseCheck && ticker.ShowOption == models.AlwaysShow { - return &ticker - } - - if baseCheck && p == ticker.Provider && ticker.ShowOption != models.NeverShow && - (watchmarket.IsRespectableValue(ticker.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || ticker.Provider != "coingecko") && - (watchmarket.IsRespectableValue(ticker.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || ticker.Provider != "coingecko") { - return &ticker - } - } - } - return nil + return createResponseV2(tr, tickers), nil } -func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, err error) { - if result, err := c.getCachedRate(currency); err == nil { - return result, nil - } - - rates, err := c.database.GetRates(currency) +func (c Controller) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { + rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) if err != nil { - return result, err + return controllers.TickerResponse{}, errors.New(watchmarket.ErrNotFound) } - isFiat := !watchmarket.IsFiatRate(currency) - for _, p := range c.ratesPriority { - if isFiat && p != "fixer" { - continue - } - for _, r := range rates { - if p == r.Provider { - return watchmarket.Rate{ - Currency: r.Currency, - PercentChange24h: r.PercentChange24h, - Provider: r.Provider, - Rate: r.Rate, - Timestamp: r.LastUpdated.Unix(), - }, nil - } - } - } - return result, errors.New(watchmarket.ErrNotFound) -} - -func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { - if t.Price.Currency != watchmarket.DefaultCurrency { - newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) - if err != nil { - return watchmarket.Rate{}, false - } - rate.Rate /= newRate.Rate - rate.PercentChange24h = newRate.PercentChange24h - } - return rate, true -} - -func (c Controller) applyRateToTicker(ticker *watchmarket.Ticker, rate watchmarket.Rate) { - if ticker.Price.Currency == rate.Currency { - return - } - ticker.Price.Value *= 1 / rate.Rate - ticker.Price.Currency = rate.Currency - ticker.Volume *= 1 / rate.Rate - ticker.MarketCap *= 1 / rate.Rate - - if rate.PercentChange24h != 0 { - ticker.Price.Change24h -= rate.PercentChange24h // Look at it more detailed + tickers, err := c.getTickersByPriority(makeTickerQueries(tr.Assets)) + if err != nil { + return controllers.TickerResponse{}, errors.New(watchmarket.ErrInternal) } -} -func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { - if c.cache == nil { - return watchmarket.Tickers{}, errors.New("cache isn't available") - } - var results watchmarket.Tickers - for _, assetData := range assets { - key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) - rawResult, err := c.cache.Get(key) - if err != nil { - continue - } - var result watchmarket.Ticker - if err = json.Unmarshal(rawResult, &result); err != nil { - continue - } - results = append(results, result) - } - if len(results) == len(assets) { - return results, nil - } else { - return results, errors.New("not found") - } -} + tickers = c.normalizeTickers(tickers, rate) -// TODO: Remove duplicates or make method -func (c Controller) getCachedRate(currency string) (result watchmarket.Rate, err error) { - if c.cache == nil { - return watchmarket.Rate{}, errors.New("cache isn't available") - } - rawResult, err := c.cache.Get(currency) - if err != nil { - return result, err - } - if err = json.Unmarshal(rawResult, &result); err != nil { - return result, err - } - return result, nil + return createResponse(tr, tickers), nil } diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index 8b431ff4..afe7ed33 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -131,11 +131,11 @@ func TestController_HandleTickersRequest(t *testing.T) { sort.Slice(wantedResp.Tickers, func(i, j int) bool { return wantedResp.Tickers[i].Coin < wantedResp.Tickers[j].Coin }) - sort.Slice(response, func(i, j int) bool { - return response[i].Coin < response[j].Coin + sort.Slice(response.Tickers, func(i, j int) bool { + return response.Tickers[i].Coin < response.Tickers[j].Coin }) - assert.Equal(t, wantedResp.Tickers, response) + assert.Equal(t, wantedResp, response) controllerWithCache := setupController(t, db, true) assert.NotNil(t, controllerWithCache) @@ -161,14 +161,14 @@ func TestController_HandleTickersRequest(t *testing.T) { response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) - sort.Slice(response2, func(i, j int) bool { - return response2[i].Coin < response2[j].Coin + sort.Slice(response2.Tickers, func(i, j int) bool { + return response2.Tickers[i].Coin < response2.Tickers[j].Coin }) for i := range wantedResp.Tickers { - assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2[i].LastUpdate)) - wantedResp.Tickers[i].LastUpdate = response2[i].LastUpdate + assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2.Tickers[i].LastUpdate)) + wantedResp.Tickers[i].LastUpdate = response2.Tickers[i].LastUpdate } - assert.Equal(t, wantedResp.Tickers, response2) + assert.Equal(t, wantedResp, response2) } func TestController_HandleTickersRequest_Negative(t *testing.T) { @@ -183,6 +183,163 @@ func TestController_HandleTickersRequest_Negative(t *testing.T) { assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) } +func TestController_HandleTickersRequestV2(t *testing.T) { + timeUPD := time.Now() + rate := models.Rate{ + Currency: "USD", + PercentChange24h: 1, + Provider: "coinmarketcap", + Rate: 1, + LastUpdated: timeUPD, + } + rate2 := models.Rate{ + Currency: "USD", + PercentChange24h: 2, + Provider: "coingecko", + Rate: 2, + LastUpdated: timeUPD, + } + rate3 := models.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: "fixer", + Rate: 6, + LastUpdated: timeUPD, + } + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 10, + LastUpdated: timeUPD, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 10, + LastUpdated: timeUPD, + } + + ticker714ACG := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + LastUpdated: timeUPD, + } + + ticker714ABNB := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "binancedex", + Value: 100, + LastUpdated: timeUPD, + } + + db := getDbMock() + + db.WantedTickersError = nil + db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} + db.WantedRatesError = nil + db.WantedRates = []models.Rate{rate, rate2, rate3} + c := setupController(t, db, false) + assert.NotNil(t, c) + + response, err := c.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) + assert.Nil(t, err) + + wantedTicker1 := controllers.TickerPrice{ + ID: "c60_ta", + Change24h: 10, + Provider: "coinmarketcap", + Price: 10, + } + wantedTicker2 := controllers.TickerPrice{ + ID: "c714_ta", + Change24h: 10, + Provider: "coingecko", + Price: 100, + } + + wantedResp := controllers.TickerResponseV2{ + Currency: "USD", + Tickers: []controllers.TickerPrice{wantedTicker2, wantedTicker1}, + } + + sort.Slice(wantedResp.Tickers, func(i, j int) bool { + return wantedResp.Tickers[i].Price < wantedResp.Tickers[j].Price + }) + sort.Slice(response.Tickers, func(i, j int) bool { + return response.Tickers[i].Price < response.Tickers[j].Price + }) + + assert.Equal(t, wantedResp, response) + + controllerWithCache := setupController(t, db, true) + assert.NotNil(t, controllerWithCache) + wantedTicker1Raw, err := json.Marshal(&watchmarket.Ticker{ + Coin: 60, + TokenId: "a", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 10, + }, + LastUpdate: timeUPD, + }) + assert.Nil(t, err) + wantedTicker2Raw, err := json.Marshal(&watchmarket.Ticker{ + Coin: 714, + TokenId: "a", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + }, + LastUpdate: timeUPD, + }) + assert.Nil(t, err) + rateRaw, err := json.Marshal(&watchmarket.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: "fixer", + Rate: 6, + Timestamp: timeUPD.Unix(), + }) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("c60_ta", wantedTicker1Raw) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("c714_ta", wantedTicker2Raw) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("USD", rateRaw) + assert.Nil(t, err) + + response2, err := controllerWithCache.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) + assert.Nil(t, err) + + sort.Slice(response2.Tickers, func(i, j int) bool { + return response.Tickers[i].Price < response.Tickers[j].Price + }) + assert.Equal(t, wantedResp, response2) +} + func TestNewController(t *testing.T) { assert.NotNil(t, setupController(t, getDbMock(), false)) } @@ -240,6 +397,10 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { +func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} + +func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go new file mode 100644 index 00000000..9b9b11f6 --- /dev/null +++ b/services/controllers/tickers/normalization.go @@ -0,0 +1,140 @@ +package tickerscontroller + +import ( + "strings" + "sync" + + log "github.com/sirupsen/logrus" + "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/controllers" +) + +func createResponse(tr controllers.TickerRequest, tickers watchmarket.Tickers) controllers.TickerResponse { + mergedTickers := make(watchmarket.Tickers, 0, len(tickers)) + for _, t := range tickers { + newTicker, ok := findTickerInAssets(tr.Assets, t) + if !ok { + continue + } + mergedTickers = append(mergedTickers, newTicker) + } + return controllers.TickerResponse{Currency: tr.Currency, Tickers: mergedTickers} +} + +func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Tickers) controllers.TickerResponseV2 { + result := controllers.TickerResponseV2{ + Currency: tr.Currency, + } + tickersPrices := make([]controllers.TickerPrice, 0, len(tickers)) + for _, ticker := range tickers { + id, ok := findIDInRequest(tr, asset.BuildID(ticker.Coin, ticker.TokenId)) + if !ok { + log.Error("Cannot find ID in request") + } + tp := controllers.TickerPrice{ + Change24h: ticker.Price.Change24h, + Provider: ticker.Price.Provider, + Price: ticker.Price.Value, + ID: id, + } + tickersPrices = append(tickersPrices, tp) + } + result.Tickers = tickersPrices + return result +} + +func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { + tickerQueries := make([]models.TickerQuery, 0, len(coins)) + for _, c := range coins { + tickerQueries = append(tickerQueries, models.TickerQuery{ + Coin: c.CoinId, + TokenId: strings.ToLower(c.TokenId), + }) + } + return tickerQueries +} + +func makeTickerQueriesV2(ids []string) []models.TickerQuery { + tickerQueries := make([]models.TickerQuery, 0, len(ids)) + for _, id := range ids { + coin, token, err := asset.ParseID(id) + if err != nil { + continue + } + tickerQueries = append(tickerQueries, models.TickerQuery{ + Coin: coin, + TokenId: strings.ToLower(token), + }) + } + return tickerQueries +} + +func (c Controller) normalizeTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) watchmarket.Tickers { + result := make(watchmarket.Tickers, 0, len(tickers)) + for _, t := range tickers { + r, ok := c.rateToDefaultCurrency(t, rate) + if !ok { + continue + } + if !watchmarket.IsSuitableUpdateTime(t.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { + continue + } + result = append(result, applyRateToTicker(t, r)) + } + return result +} + +func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bool) { + for _, i := range request.Ids { + givenCoin, givenToken, err := asset.ParseID(i) + if err != nil { + continue + } + coin, token, err := asset.ParseID(id) + if err != nil { + continue + } + + if givenCoin == coin && strings.EqualFold(givenToken, token) { + return i, true + } + } + return id, false +} + +func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { + for _, c := range assets { + if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { + t.TokenId = c.TokenId + return t, true + } + } + return watchmarket.Ticker{}, false +} + +func findBestProviderForQuery(coin uint, token string, sliceToFind []models.Ticker, providers []string, wg *sync.WaitGroup, res *sortedTickersResponse, configuration config.Configuration) { + defer wg.Done() + for _, p := range providers { + for _, t := range sliceToFind { + baseCheck := coin == t.Coin && strings.ToLower(token) == t.TokenId + + if baseCheck && t.ShowOption == models.AlwaysShow { + res.Lock() + res.tickers = append(res.tickers, t) + res.Unlock() + return + } + if baseCheck && p == t.Provider && t.ShowOption != models.NeverShow && + (watchmarket.IsRespectableValue(t.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || t.Provider != "coingecko") && + (watchmarket.IsRespectableValue(t.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || t.Provider != "coingecko") { + res.Lock() + res.tickers = append(res.tickers, t) + res.Unlock() + return + } + } + } +} diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go new file mode 100644 index 00000000..f77722ea --- /dev/null +++ b/services/controllers/tickers/normalization_test.go @@ -0,0 +1,416 @@ +package tickerscontroller + +import ( + "sort" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/controllers" +) + +func TestController_createResponse(t *testing.T) { + ticker := watchmarket.Ticker{ + Coin: 0, + CoinName: "BNB", + CoinType: "Token", + Error: "", + Price: watchmarket.Price{ + Change24h: -10.24, + Currency: "EUR", + Provider: "coinmarketcap", + Value: 14.700428799936965, + }, + TokenId: "raven-f66", + Volume: 147.00428799936964, + MarketCap: 147.00428799936964, + } + + tr := controllers.TickerRequest{ + Currency: "EUR", + Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, + } + + response := createResponse(tr, watchmarket.Tickers{ticker}) + wantedResponse := controllers.TickerResponse{ + Currency: "EUR", + Tickers: watchmarket.Tickers{ + { + Coin: 0, + CoinName: "BNB", + CoinType: "Token", + Error: "", + Price: watchmarket.Price{ + Change24h: -10.24, + Currency: "EUR", + Provider: "coinmarketcap", + Value: 14.700428799936965, + }, + TokenId: "RAVEN-F66", + Volume: 147.00428799936964, + MarketCap: 147.00428799936964, + }, + }, + } + assert.Equal(t, wantedResponse, response) +} + +func Test_makeTickerQueriesV2(t *testing.T) { + ids := []string{"c60_ta", "c714", "c714_ta"} + wantedRes := []models.TickerQuery{ + { + Coin: 60, + TokenId: "a", + }, + { + Coin: 714, + TokenId: "", + }, + { + Coin: 714, + TokenId: "a", + }, + } + res := makeTickerQueriesV2(ids) + + sort.Slice(res, func(i, j int) bool { + return res[i].Coin < res[j].Coin + }) + sort.Slice(wantedRes, func(i, j int) bool { + return wantedRes[i].Coin < wantedRes[j].Coin + }) + + for i, r := range res { + assert.Equal(t, wantedRes[i], r) + } +} + +func Test_createResponseV2(t *testing.T) { + timeUPD := time.Now() + given1 := watchmarket.Ticker{ + Coin: 60, + CoinName: "ETH", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 100, + }, + TokenId: "a", + LastUpdate: timeUPD, + } + given2 := watchmarket.Ticker{ + Coin: 714, + CoinName: "BNB", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + }, + TokenId: "a", + LastUpdate: timeUPD, + } + r := createResponseV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}, []watchmarket.Ticker{given1, given2}) + + wantedTicker1 := controllers.TickerPrice{ + ID: "c60_ta", + Change24h: 10, + Provider: "coinmarketcap", + Price: 100, + } + wantedTicker2 := controllers.TickerPrice{ + ID: "c714_ta", + Change24h: 10, + Provider: "coingecko", + Price: 100, + } + + wp := []controllers.TickerPrice{wantedTicker2, wantedTicker1} + sort.Slice(wp, func(i, j int) bool { + return wp[i].ID < wp[j].ID + }) + wantedResp := controllers.TickerResponseV2{ + Currency: "USD", + Tickers: wp, + } + + sort.Slice(r.Tickers, func(i, j int) bool { + return r.Tickers[i].ID < r.Tickers[j].ID + }) + + assert.Equal(t, wantedResp, r) +} + +func TestController_normalizeTickers(t *testing.T) { + modelRate2 := models.Rate{ + Currency: "EUR", + PercentChange24h: 0, + Provider: "fixer", + Rate: 1.0992876616, + LastUpdated: time.Now(), + } + + rate := watchmarket.Rate{ + Currency: "EUR", + PercentChange24h: 0, + Provider: "fixer", + Rate: 1.0992876616, + Timestamp: 12, + } + + now := time.Now() + + gotTicker1 := watchmarket.Ticker{ + Coin: 0, + CoinName: "BTC", + CoinType: "Coin", + Price: watchmarket.Price{ + Change24h: -4.03168, + Currency: "USD", + Provider: "coinmarketcap", + Value: 9360.20314131, + }, + TokenId: "", + LastUpdate: now, + } + db := getDbMock() + db.WantedRates = []models.Rate{modelRate2} + + c := setupController(t, db, false) + assert.NotNil(t, c) + + result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) + wanted := watchmarket.Ticker{ + Coin: 0, + CoinName: "BTC", + CoinType: "Coin", + Error: "", + Price: watchmarket.Price{ + Change24h: -4.03168, + Currency: "EUR", + Provider: "coinmarketcap", + Value: 8514.78959355037, + }, + TokenId: "", + LastUpdate: now, + } + assert.Equal(t, wanted, result[0]) +} + +func TestController_normalizeTickers_advanced(t *testing.T) { + timeUPD := time.Now() + modelRate := models.Rate{ + Currency: "BNB", + PercentChange24h: 0, + Provider: "coingecko", + Rate: 16.16, + LastUpdated: timeUPD, + } + + modelRate2 := models.Rate{ + Currency: "EUR", + PercentChange24h: 0, + Provider: "fixer", + Rate: 1.0992876616, + LastUpdated: timeUPD, + } + + rate := watchmarket.Rate{ + Currency: "EUR", + PercentChange24h: 0, + Provider: "fixer", + Rate: 1.0992876616, + Timestamp: 12, + } + + gotTicker1 := watchmarket.Ticker{ + Coin: 0, + CoinName: "BNB", + CoinType: "Token", + Price: watchmarket.Price{ + Change24h: -10.24, + Currency: "BNB", + Provider: "coinmarketcap", + Value: 1, + }, + TokenId: "raven-f66", + Volume: 10, + MarketCap: 10, + LastUpdate: timeUPD, + } + + db := getDbMock() + db.WantedRates = []models.Rate{modelRate, modelRate2} + + c := setupController(t, db, false) + assert.NotNil(t, c) + + result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) + wanted := watchmarket.Ticker{ + Coin: 0, + CoinName: "BNB", + CoinType: "Token", + Error: "", + Price: watchmarket.Price{ + Change24h: -10.24, + Currency: "EUR", + Provider: "coinmarketcap", + Value: 14.700428799936965, + }, + TokenId: "raven-f66", + Volume: 147.00428799936964, + MarketCap: 147.00428799936964, + LastUpdate: timeUPD, + } + assert.Equal(t, wanted, result[0]) +} + +func Test_findBestProviderForQuery(t *testing.T) { + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 100, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + } + + providers := []string{"coinmarketcap", "coingecko"} + dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} + for i := 0; i < 10000; i++ { + t := ticker60ACG + t.Value = t.Value + float64(i) + t.Coin = uint(i) + dbTickers = append(dbTickers, t) + } + + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + + res := new(sortedTickersResponse) + wg := new(sync.WaitGroup) + for _, q := range tickerQueries { + wg.Add(1) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + } + + wg.Wait() + + assert.Equal(t, ticker60ACMC, res.tickers[0]) +} + +func Test_findBestProviderForQuery_advanced(t *testing.T) { + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 100, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + ShowOption: models.NeverShow, + } + + providers := []string{"coingecko", "coinmarketcap"} + dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} + for i := 0; i < 10000; i++ { + t := ticker60ACG + t.Value = t.Value + float64(i) + t.Coin = uint(i) + dbTickers = append(dbTickers, t) + } + + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + + res := new(sortedTickersResponse) + wg := new(sync.WaitGroup) + for _, q := range tickerQueries { + wg.Add(1) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + } + + wg.Wait() + + assert.Equal(t, ticker60ACMC, res.tickers[0]) +} + +func Test_findBestProviderForQuery_showOption(t *testing.T) { + tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coinmarketcap", + Value: 100, + ShowOption: models.AlwaysShow, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "coingecko", + Value: 100, + } + + providers := []string{"coingecko", "coinmarketcap"} + dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} + for i := 0; i < 10000; i++ { + t := ticker60ACG + t.Value = t.Value + float64(i) + t.Coin = uint(i) + dbTickers = append(dbTickers, t) + } + + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + + res := new(sortedTickersResponse) + wg := new(sync.WaitGroup) + for _, q := range tickerQueries { + wg.Add(1) + go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) + } + + wg.Wait() + + assert.Equal(t, ticker60ACMC, res.tickers[0]) +} diff --git a/services/controllers/tickers/rates.go b/services/controllers/tickers/rates.go new file mode 100644 index 00000000..aa85914a --- /dev/null +++ b/services/controllers/tickers/rates.go @@ -0,0 +1,83 @@ +package tickerscontroller + +import ( + "encoding/json" + "errors" + "strings" + + log "github.com/sirupsen/logrus" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" +) + +func (c Controller) getRateByPriority(currency string) (watchmarket.Rate, error) { + if c.configuration.RestAPI.UseMemoryCache { + rawResult, err := c.cache.Get(currency) + if err != nil { + return watchmarket.Rate{}, err + } + var result watchmarket.Rate + if err = json.Unmarshal(rawResult, &result); err != nil { + return watchmarket.Rate{}, err + } + return result, nil + } + + rates, err := c.database.GetRates(currency) + if err != nil { + log.Error(err, "getRateByPriority") + return watchmarket.Rate{}, err + } + + providers := c.ratesPriority + + var result models.Rate +ProvidersLoop: + for _, p := range providers { + for _, r := range rates { + if p == r.Provider { + result = r + break ProvidersLoop + } + } + } + emptyRate := models.Rate{} + if result == emptyRate || (watchmarket.IsFiatRate(result.Currency) && result.Provider != "fixer") { + return watchmarket.Rate{}, errors.New(watchmarket.ErrNotFound) + } + + return watchmarket.Rate{ + Currency: result.Currency, + PercentChange24h: result.PercentChange24h, + Provider: result.Provider, + Rate: result.Rate, + Timestamp: result.LastUpdated.Unix(), + }, nil +} + +func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { + if t.Price.Currency != watchmarket.DefaultCurrency { + newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) + if err != nil { + return watchmarket.Rate{}, false + } + rate.Rate /= newRate.Rate + rate.PercentChange24h = newRate.PercentChange24h + } + return rate, true +} + +func applyRateToTicker(t watchmarket.Ticker, rate watchmarket.Rate) watchmarket.Ticker { + if t.Price.Currency == rate.Currency { + return t + } + t.Price.Value *= 1 / rate.Rate + t.Price.Currency = rate.Currency + t.Volume *= 1 / rate.Rate + t.MarketCap *= 1 / rate.Rate + + if rate.PercentChange24h != 0 { + t.Price.Change24h -= rate.PercentChange24h // Look at it more detailed + } + return t +} diff --git a/services/controllers/tickers/tickers.go b/services/controllers/tickers/tickers.go new file mode 100644 index 00000000..bcdbefce --- /dev/null +++ b/services/controllers/tickers/tickers.go @@ -0,0 +1,76 @@ +package tickerscontroller + +import ( + "encoding/json" + "strings" + "sync" + + log "github.com/sirupsen/logrus" + "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" +) + +type ( + sortedTickersResponse struct { + sync.Mutex + tickers []models.Ticker + } +) + +func (c Controller) getTickersByPriority(tickerQueries []models.TickerQuery) (watchmarket.Tickers, error) { + if c.configuration.RestAPI.UseMemoryCache { + var results watchmarket.Tickers + for _, tr := range tickerQueries { + key := strings.ToLower(asset.BuildID(tr.Coin, tr.TokenId)) + rawResult, err := c.cache.Get(key) + if err != nil { + continue + } + var result watchmarket.Ticker + if err = json.Unmarshal(rawResult, &result); err != nil { + continue + } + results = append(results, result) + } + return results, nil + } + + dbTickers, err := c.database.GetTickersByQueries(tickerQueries) + if err != nil { + log.Error(err, "getTickersByPriority") + return nil, err + } + providers := c.tickersPriority + + res := new(sortedTickersResponse) + wg := new(sync.WaitGroup) + for _, q := range tickerQueries { + wg.Add(1) + go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c.configuration) + } + + wg.Wait() + + sortedTickers := res.tickers + + result := make(watchmarket.Tickers, len(sortedTickers)) + + for i, sr := range sortedTickers { + result[i] = watchmarket.Ticker{ + Coin: sr.Coin, + CoinName: sr.CoinName, + CoinType: watchmarket.CoinType(sr.CoinType), + LastUpdate: sr.LastUpdated, + Price: watchmarket.Price{ + Change24h: sr.Change24h, + Currency: sr.Currency, + Provider: sr.Provider, + Value: sr.Value, + }, + TokenId: sr.TokenId, + } + } + + return result, nil +} diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index 7d530348..02d7f54f 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -47,7 +47,9 @@ func TestController_getTickersByPriority(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - tickers, err := c.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}) + tickers, err := c.getTickersByPriority(makeTickerQueries( + []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, + )) assert.Nil(t, err) assert.NotNil(t, tickers) assert.Equal(t, 2, len(tickers)) @@ -86,7 +88,7 @@ func TestController_getTickersByPriority(t *testing.T) { db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}}) + tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 50d7e0b3..78003f4b 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -2,7 +2,6 @@ package worker import ( "encoding/json" - "github.com/trustwallet/watchmarket/services/controllers" "testing" "time" @@ -500,7 +499,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return d.WantedRates, nil } -func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { +func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/tests/integration/db_test/ticker_test.go b/tests/integration/db_test/ticker_test.go index 6c676746..876ea95b 100644 --- a/tests/integration/db_test/ticker_test.go +++ b/tests/integration/db_test/ticker_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/tests/integration/setup" "testing" @@ -38,12 +37,12 @@ func TestAddTickers(t *testing.T) { err := d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) + result1, err := d.GetTickers(60, "60") assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) - result2, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) + result2, err := d.GetTickers(70, "70") assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, uint(70), result2[0].Coin) @@ -62,7 +61,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) + result1, err = d.GetTickers(60, "60") assert.Nil(t, err) assert.Len(t, result1, 2) @@ -71,7 +70,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result2, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) + result2, err = d.GetTickers(70, "70") assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, float64(100500), result2[0].Value) @@ -117,7 +116,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) + result1, err := d.GetTickers(60, "60") assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) @@ -136,7 +135,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) + result1, err = d.GetTickers(60, "60") assert.Nil(t, err) assert.Len(t, result1, 1) } From 4ba23ddd4c4e3809219d49b15f2ffc91c7ecafa5 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Fri, 26 Feb 2021 00:52:08 +0800 Subject: [PATCH 35/96] Add MATIC BEP2 pricing (#391) https://explorer.binance.org/asset/MATIC-84A --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 6de68edb..85de969a 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7653,6 +7653,12 @@ const Mapping = `[ "token_id": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", "id": 3890 }, + { + "coin": 714, + "type": "token", + "token_id": "MATIC-84A", + "id": 3890 + }, { "coin": 714, "type": "token", From 5436e52f46ed1a77ed1beb9b8afe1daa27d4168e Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Fri, 26 Feb 2021 00:52:25 +0800 Subject: [PATCH 36/96] Add SPAZ BEP20 pricing (#390) https://bscscan.com/token/0x37109a51e712471bd2c72d8d70718627e7ff0032 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 85de969a..1823b7ed 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -9511,6 +9511,12 @@ const Mapping = `[ "token_id": "0x810908B285f85Af668F6348cD8B26D76B3EC12e1", "id": 4797 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x37109a51e712471Bd2C72d8D70718627e7fF0032", + "id": 4797 + }, { "coin": 60, "type": "token", From 15991acea11513b5763be6a601afb581baf8b04b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 23:54:18 +0700 Subject: [PATCH 37/96] Bump github.com/sirupsen/logrus from 1.7.0 to 1.8.0 (#383) --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index af9acea9..3d089bed 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.9.0 github.com/robfig/cron/v3 v3.0.1 - github.com/sirupsen/logrus v1.7.0 + github.com/sirupsen/logrus v1.8.0 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.7.0 github.com/swaggo/gin-swagger v1.2.0 diff --git a/go.sum b/go.sum index bbd583d3..f9e451a1 100644 --- a/go.sum +++ b/go.sum @@ -358,6 +358,7 @@ github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -511,6 +512,7 @@ github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= From abdbb29bdc242518d974bfae95d02e40b1531de1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 23:54:43 +0700 Subject: [PATCH 38/96] Bump github.com/alicebob/miniredis/v2 from 2.14.2 to 2.14.3 (#384) --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3d089bed..2be2edf3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ go 1.15 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 - github.com/alicebob/miniredis/v2 v2.14.2 + github.com/alicebob/miniredis/v2 v2.14.3 github.com/chenjiandongx/ginprom v0.0.0-20200410120253-7cfb22707fa6 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.6.3 diff --git a/go.sum b/go.sum index f9e451a1..5ab2e070 100644 --- a/go.sum +++ b/go.sum @@ -45,6 +45,7 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn github.com/alicebob/miniredis/v2 v2.13.3 h1:kohgdtN58KW/r9ZDVmMJE3MrfbumwsDQStd0LPAGmmw= github.com/alicebob/miniredis/v2 v2.13.3/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg= github.com/alicebob/miniredis/v2 v2.14.2/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= +github.com/alicebob/miniredis/v2 v2.14.3/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= From 55ec95f439af8d689b36f0a8f1d28cd2827f58be Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 23:55:09 +0700 Subject: [PATCH 39/96] Bump github.com/trustwallet/golibs from 0.1.1 to 0.1.5 (#386) --- go.mod | 2 +- go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 2be2edf3..68598c4c 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/swag v1.6.7 - github.com/trustwallet/golibs v0.1.1 + github.com/trustwallet/golibs v0.1.5 github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab golang.org/x/tools v0.0.0-20200513175351-0951661448da // indirect gorm.io/driver/postgres v1.0.8 diff --git a/go.sum b/go.sum index 5ab2e070..e1417895 100644 --- a/go.sum +++ b/go.sum @@ -566,6 +566,7 @@ github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgt github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs v0.1.1 h1:ZV5zbPbGD/dHcX3jnIcmdq24Llou230xYGHhK2WVvWQ= github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs v0.1.5/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= From b8307b061705a2291aaf2913935469643f0b65a9 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Fri, 26 Feb 2021 02:04:23 +0800 Subject: [PATCH 40/96] add_BEP20_1INCH (#394) https://bscscan.com/token/0x111111111117dc0aa78b770fa6a738034120c302 https://1inch-exchange.medium.com/1inch-network-expands-to-binance-smart-chain-1a718a154034 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 1823b7ed..e901da1a 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14158,6 +14158,12 @@ const Mapping = `[ "token_id": "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", "id": 8049 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x111111111117dC0aa78b770fA6A738034120C302", + "id": 8104 + }, { "coin": 60, "type": "token", From 6a925cc39f487d377f5bef779f68ce57c7355d33 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Sat, 27 Feb 2021 03:00:32 +0800 Subject: [PATCH 41/96] add_ERC20_UNIFI (#395) * add_ERC20_UNIFI https://etherscan.io/token/0x0ef3b2024ae079e6dbc2b37435ce30d2731f0101 https://coinmarketcap.com/currencies/unifi-defi/ * Update mapping.go add_BEP20_LOT --- services/markets/coinmarketcap/mapping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index e901da1a..f0447170 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13780,6 +13780,12 @@ const Mapping = `[ "type": "token", "token_id": "0x23aEfF664c1B2bbA98422a0399586e96cc8a1C92", "id": 6811 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xb59490aB09A0f526Cc7305822aC65f2Ab12f9723", + "id": 6833 }, { "coin": 508, @@ -13882,6 +13888,12 @@ const Mapping = `[ "token_id": "TJvqNiWUN2v2NBG12UhfV7WSvReJkRP3VC", "id": 7096 }, + { + "coin": 60, + "type": "token", + "token_id": "0x0eF3b2024ae079e6dBC2b37435cE30d2731F0101", + "id": 7122 + }, { "coin": 20000714, "type": "token", From f077c0bf99fd79c4042e04d02e7fa5fc4ba617da Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Sat, 27 Feb 2021 21:47:10 -0800 Subject: [PATCH 42/96] Add BEP: ETH-1C9 map pricing --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f0447170..628c7f0d 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -537,6 +537,12 @@ const Mapping = `[ "token_id": "0x250632378E573c6Be1AC2f97Fcdf00515d0Aa91B", "id": 1027 }, + { + "coin": 714, + "type": "token", + "token_id": "ETH-1C9", + "id": 1027 + }, { "coin": 524, "type": "coin", From 63b03b94182f1a5efa6f64dd8995dda3a0f9be59 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Sun, 28 Feb 2021 09:55:42 -0800 Subject: [PATCH 43/96] Add BEP: USDT-6D8 map pricing --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 628c7f0d..f46347b0 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -441,6 +441,12 @@ const Mapping = `[ "type": "token", "token_id": "0x55d398326f99059fF775485246999027B3197955", "id": 825 + }, + { + "coin": 714, + "type": "token", + "token_id": "USDT-6D8", + "id": 825 }, { "coin": 84, From 3a50420a3d788c1dc1b6c2945101bcbe34f8a7f4 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:14:56 +0700 Subject: [PATCH 44/96] Clean code tickers (#393) * Clean codebase * Extract request model and remove cache checking * Fixed tests * Fixed tests * Fix checksum * Fix tests * Fix cache result --- api/api_test.go | 8 +- api/endpoint/tickers.go | 74 +++- db/db.go | 4 +- db/postgres/ticker.go | 17 +- pkg/watchmarket/models.go | 2 +- services/controllers/charts/base.go | 2 +- services/controllers/charts/base_test.go | 6 +- services/controllers/controllers.go | 3 +- services/controllers/info/base.go | 6 +- services/controllers/info/base_test.go | 2 +- services/controllers/tickers/base.go | 180 +++++++- services/controllers/tickers/base_test.go | 179 +------- services/controllers/tickers/normalization.go | 140 ------ .../controllers/tickers/normalization_test.go | 416 ------------------ services/controllers/tickers/rates.go | 83 ---- services/controllers/tickers/tickers.go | 76 ---- services/controllers/tickers/tickers_test.go | 10 +- services/worker/memory_test.go | 3 +- tests/integration/db_test/ticker_test.go | 13 +- 19 files changed, 257 insertions(+), 967 deletions(-) delete mode 100644 services/controllers/tickers/normalization.go delete mode 100644 services/controllers/tickers/normalization_test.go delete mode 100644 services/controllers/tickers/rates.go delete mode 100644 services/controllers/tickers/tickers.go diff --git a/api/api_test.go b/api/api_test.go index a38b18b4..fcf7c408 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -309,12 +309,8 @@ func (c infoControllerMock) HandleInfoRequest(dr controllers.DetailsRequest) (co return c.wantedInfo, c.wantedError } -func (c tickersControllerMock) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { - return c.wantedTickersV2, c.wantedError -} - -func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { - return c.wantedTickersV1, c.wantedError +func (c tickersControllerMock) HandleTickersRequest(tr controllers.TickerRequest) (watchmarket.Tickers, error) { + return c.wantedTickersV1.Tickers, c.wantedError } func setupEngine() *gin.Engine { diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index b499fcbf..76e9290e 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -2,6 +2,7 @@ package endpoint import ( "errors" + "github.com/trustwallet/golibs/asset" "net/http" "strings" @@ -26,18 +27,21 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } - response, err := controller.HandleTickersRequest(request) + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - if len(response.Tickers) == 0 { + if len(tickers) == 0 { handleTickersError(c, request) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, controllers.TickerResponse{ + Currency: request.Currency, + Tickers: tickers, + }) } } @@ -53,15 +57,17 @@ func GetTickersHandler(controller controllers.TickersController) func(c *gin.Con // @Router /v2/market/ticker/{id} [get] func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) - request := controllers.TickerRequestV2{Currency: currency, Ids: []string{c.Param("id")}} - response, err := controller.HandleTickersRequestV2(request) + request := controllers.TickerRequest{ + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Assets: parseAssetIds([]string{c.Param("id")}), + } + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } @@ -76,20 +82,23 @@ func GetTickerHandlerV2(controller controllers.TickersController) func(c *gin.Co // @Router /v2/market/tickers [post] func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - request := controllers.TickerRequestV2{Currency: watchmarket.DefaultCurrency} + var request controllers.TickerRequestV2 if err := c.BindJSON(&request); err != nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } request.Ids = removeDuplicates(request.Ids) - response, err := controller.HandleTickersRequestV2(request) + tickers, err := controller.HandleTickersRequest(controllers.TickerRequest{ + Currency: request.Currency, + Assets: parseAssetIds(request.Ids), + }) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } @@ -105,25 +114,43 @@ func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin. // @Router /v2/market/tickers/{assets} [get] func GetTickersHandlerV2(controller controllers.TickersController) func(c *gin.Context) { return func(c *gin.Context) { - currency := c.DefaultQuery("currency", watchmarket.DefaultCurrency) assets := c.Param("assets") if len(assets) == 0 { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) return } assetsIds := removeDuplicates(strings.Split(assets, ",")) - request := controllers.TickerRequestV2{Currency: currency, Ids: assetsIds} - response, err := controller.HandleTickersRequestV2(request) + request := controllers.TickerRequest{ + Currency: c.DefaultQuery("currency", watchmarket.DefaultCurrency), + Assets: parseAssetIds(assetsIds), + } + tickers, err := controller.HandleTickersRequest(request) if err != nil { code, response := createErrorResponseAndStatusCode(err) c.AbortWithStatusJSON(code, response) return } - c.JSON(http.StatusOK, response) + c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) } } +func mapToResponse(currency string, tickers watchmarket.Tickers) controllers.TickerResponseV2 { + response := controllers.TickerResponseV2{ + Currency: currency, + } + response.Tickers = make([]controllers.TickerPrice, 0, len(tickers)) + for _, ticker := range tickers { + response.Tickers = append(response.Tickers, controllers.TickerPrice{ + Change24h: ticker.Price.Change24h, + Provider: ticker.Price.Provider, + Price: ticker.Price.Value, + ID: asset.BuildID(ticker.Coin, ticker.TokenId), + }) + } + return response +} + func handleTickersError(c *gin.Context, req controllers.TickerRequest) { if len(req.Assets) == 0 || req.Assets == nil { c.JSON(http.StatusBadRequest, errorResponse(errors.New("Invalid request payload"))) @@ -144,14 +171,25 @@ func handleTickersError(c *gin.Context, req controllers.TickerRequest) { c.JSON(http.StatusOK, emptyResponse) } -func removeDuplicates(values []string) []string { +func removeDuplicates(values []string) (result []string) { keys := make(map[string]bool) - var list []string for _, entry := range values { if _, value := keys[entry]; !value { keys[entry] = true - list = append(list, entry) + result = append(result, entry) + } + } + return result +} + +func parseAssetIds(ids []string) (assets []controllers.Asset) { + for _, id := range ids { + if coinId, tokenId, err := asset.ParseID(id); err == nil { + assets = append(assets, controllers.Asset{ + CoinId: coinId, + TokenId: tokenId, + }) } } - return list + return assets } diff --git a/db/db.go b/db/db.go index 45edaabb..b844c8ed 100644 --- a/db/db.go +++ b/db/db.go @@ -2,6 +2,7 @@ package db import ( "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/services/controllers" ) type ( @@ -11,8 +12,7 @@ type ( AddRates(rates []models.Rate) error AddTickers(tickers []models.Ticker) error - GetTickers(coin uint, tokenId string) ([]models.Ticker, error) + GetTickers(assets []controllers.Asset) ([]models.Ticker, error) GetAllTickers() ([]models.Ticker, error) - GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) } ) diff --git a/db/postgres/ticker.go b/db/postgres/ticker.go index 3f8c2082..37b51c4c 100644 --- a/db/postgres/ticker.go +++ b/db/postgres/ticker.go @@ -1,7 +1,9 @@ package postgres import ( + "github.com/trustwallet/watchmarket/services/controllers" "strconv" + "strings" "github.com/trustwallet/watchmarket/db/models" "gorm.io/gorm/clause" @@ -57,11 +59,11 @@ func normalizeTickers(tickers []models.Ticker) []models.Ticker { return result } -func (i *Instance) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (i *Instance) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { var ticker []models.Ticker db := i.Gorm - for _, tq := range tickerQueries { - db = db.Or("coin = ? AND token_id = ?", tq.Coin, tq.TokenId) + for _, asset := range assets { + db = db.Or("coin = ? AND token_id = ?", asset.CoinId, strings.ToLower(asset.TokenId)) } if err := db.Find(&ticker).Error; err != nil { return nil, err @@ -69,15 +71,6 @@ func (i *Instance) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]mo return ticker, nil } -func (i *Instance) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - var ticker []models.Ticker - if err := i.Gorm.Where("coin = ? AND token_id = ?", coin, tokenId). - Find(&ticker).Error; err != nil { - return nil, err - } - return ticker, nil -} - func (i *Instance) GetAllTickers() ([]models.Ticker, error) { var tickers []models.Ticker if err := i.Gorm.Find(&tickers).Error; err != nil { diff --git a/pkg/watchmarket/models.go b/pkg/watchmarket/models.go index ae011319..9a733765 100755 --- a/pkg/watchmarket/models.go +++ b/pkg/watchmarket/models.go @@ -143,6 +143,6 @@ func IsFiatRate(currency string) bool { case "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BYR", "BZD", "CAD", "CDF", "CHF", "CLF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XCD", "XDR", "XOF", "XPF", "YER", "ZAR", "ZMK", "ZMW", "ZWL": return true default: + return false } - return false } diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index b60f30b9..91d1e5ff 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -81,7 +81,7 @@ func (c Controller) hasTickers(assetData controllers.Asset) bool { return false } } else { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: assetData.CoinId, TokenId: strings.ToLower(assetData.TokenId)}}) + dbTickers, err := c.database.GetTickers([]controllers.Asset{assetData}) if err != nil { return false } diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index 656b8841..6fa17ce3 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -160,11 +160,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/controllers.go b/services/controllers/controllers.go index bba40e8e..735744bb 100644 --- a/services/controllers/controllers.go +++ b/services/controllers/controllers.go @@ -6,8 +6,7 @@ import ( type ( TickersController interface { - HandleTickersRequest(tr TickerRequest) (TickerResponse, error) - HandleTickersRequestV2(tr TickerRequestV2) (TickerResponseV2, error) + HandleTickersRequest(tr TickerRequest) (watchmarket.Tickers, error) } RatesController interface { diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 58161253..1a4daef2 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -4,11 +4,9 @@ import ( "encoding/json" "errors" "fmt" - "github.com/trustwallet/watchmarket/db/models" - "strings" - log "github.com/sirupsen/logrus" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -94,7 +92,7 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller } func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - dbTickers, err := c.database.GetTickersByQueries([]models.TickerQuery{{Coin: request.Asset.CoinId, TokenId: strings.ToLower(request.Asset.TokenId)}}) + dbTickers, err := c.database.GetTickers([]controllers.Asset{request.Asset}) if err != nil || len(dbTickers) == 0 { return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 44ee07c2..b25669f4 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -169,7 +169,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 5232afcf..93662bd2 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -1,14 +1,16 @@ package tickerscontroller import ( + "encoding/json" "errors" - "strings" - + "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" + "strings" ) type Controller struct { @@ -34,34 +36,178 @@ func NewController( } } -func (c Controller) HandleTickersRequestV2(tr controllers.TickerRequestV2) (controllers.TickerResponseV2, error) { - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) +func (c Controller) HandleTickersRequest(request controllers.TickerRequest) (watchmarket.Tickers, error) { + rate, err := c.getRateByPriority(strings.ToUpper(request.Currency)) if err != nil { - return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrNotFound) + return watchmarket.Tickers{}, errors.New(watchmarket.ErrNotFound) } - tickers, err := c.getTickersByPriority(makeTickerQueriesV2(tr.Ids)) + tickers, err := c.getTickersByPriority(request.Assets) if err != nil { - return controllers.TickerResponseV2{}, errors.New(watchmarket.ErrInternal) + return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) } + tickers = c.filterTickers(tickers, rate) + return tickers, nil +} - tickers = c.normalizeTickers(tickers, rate) - - return createResponseV2(tr, tickers), nil +func (c Controller) filterTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) (result watchmarket.Tickers) { + for _, ticker := range tickers { + r, ok := c.rateToDefaultCurrency(ticker, rate) + if !ok { + continue + } + if !watchmarket.IsSuitableUpdateTime(ticker.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { + continue + } + c.applyRateToTicker(&ticker, r) + result = append(result, ticker) + } + return result } -func (c Controller) HandleTickersRequest(tr controllers.TickerRequest) (controllers.TickerResponse, error) { - rate, err := c.getRateByPriority(strings.ToUpper(tr.Currency)) +func (c Controller) getTickersByPriority(assets []controllers.Asset) (watchmarket.Tickers, error) { + if result, err := c.getCachedTickers(assets); err == nil { + return result, nil + } + tickers, err := c.database.GetTickers(assets) if err != nil { - return controllers.TickerResponse{}, errors.New(watchmarket.ErrNotFound) + return nil, err + } + result := make(watchmarket.Tickers, 0) + for _, assetData := range assets { + ticker := findBestTicker(assetData, tickers, c.tickersPriority, c.configuration) + if ticker == nil { + continue + } + result = append(result, watchmarket.Ticker{ + Coin: ticker.Coin, + CoinName: ticker.CoinName, + CoinType: watchmarket.CoinType(ticker.CoinType), + LastUpdate: ticker.LastUpdated, + Price: watchmarket.Price{ + Change24h: ticker.Change24h, + Currency: ticker.Currency, + Provider: ticker.Provider, + Value: ticker.Value, + }, + TokenId: assetData.TokenId, + }) + } + + return result, nil +} + +func findBestTicker(assetData controllers.Asset, tickers []models.Ticker, providers []string, configuration config.Configuration) *models.Ticker { + for _, p := range providers { + for _, ticker := range tickers { + baseCheck := assetData.CoinId == ticker.Coin && strings.ToLower(assetData.TokenId) == ticker.TokenId + + if baseCheck && ticker.ShowOption == models.AlwaysShow { + return &ticker + } + + if baseCheck && p == ticker.Provider && ticker.ShowOption != models.NeverShow && + (watchmarket.IsRespectableValue(ticker.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || ticker.Provider != "coingecko") && + (watchmarket.IsRespectableValue(ticker.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || ticker.Provider != "coingecko") { + return &ticker + } + } + } + return nil +} + +func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, err error) { + if result, err := c.getCachedRate(currency); err == nil { + return result, nil } - tickers, err := c.getTickersByPriority(makeTickerQueries(tr.Assets)) + rates, err := c.database.GetRates(currency) if err != nil { - return controllers.TickerResponse{}, errors.New(watchmarket.ErrInternal) + return result, err + } + isFiat := !watchmarket.IsFiatRate(currency) + + for _, p := range c.ratesPriority { + if isFiat && p != "fixer" { + continue + } + for _, r := range rates { + if p == r.Provider { + return watchmarket.Rate{ + Currency: r.Currency, + PercentChange24h: r.PercentChange24h, + Provider: r.Provider, + Rate: r.Rate, + Timestamp: r.LastUpdated.Unix(), + }, nil + } + } + } + return result, errors.New(watchmarket.ErrNotFound) +} + +func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { + if t.Price.Currency != watchmarket.DefaultCurrency { + newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) + if err != nil { + return watchmarket.Rate{}, false + } + rate.Rate /= newRate.Rate + rate.PercentChange24h = newRate.PercentChange24h + } + return rate, true +} + +func (c Controller) applyRateToTicker(ticker *watchmarket.Ticker, rate watchmarket.Rate) { + if ticker.Price.Currency == rate.Currency { + return + } + ticker.Price.Value *= 1 / rate.Rate + ticker.Price.Currency = rate.Currency + ticker.Volume *= 1 / rate.Rate + ticker.MarketCap *= 1 / rate.Rate + + if rate.PercentChange24h != 0 { + ticker.Price.Change24h -= rate.PercentChange24h // Look at it more detailed } +} - tickers = c.normalizeTickers(tickers, rate) +func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { + if c.cache == nil { + return watchmarket.Tickers{}, errors.New("cache isn't available") + } + var results watchmarket.Tickers + for _, assetData := range assets { + key := strings.ToLower(asset.BuildID(assetData.CoinId, assetData.TokenId)) + rawResult, err := c.cache.Get(key) + if err != nil { + continue + } + var result watchmarket.Ticker + if err = json.Unmarshal(rawResult, &result); err != nil { + continue + } + result.TokenId = assetData.TokenId + results = append(results, result) + } + if len(results) == len(assets) { + return results, nil + } else { + return results, errors.New("not found") + } +} - return createResponse(tr, tickers), nil +// TODO: Remove duplicates or make method +func (c Controller) getCachedRate(currency string) (result watchmarket.Rate, err error) { + if c.cache == nil { + return watchmarket.Rate{}, errors.New("cache isn't available") + } + rawResult, err := c.cache.Get(currency) + if err != nil { + return result, err + } + if err = json.Unmarshal(rawResult, &result); err != nil { + return result, err + } + return result, nil } diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index afe7ed33..8b431ff4 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -131,11 +131,11 @@ func TestController_HandleTickersRequest(t *testing.T) { sort.Slice(wantedResp.Tickers, func(i, j int) bool { return wantedResp.Tickers[i].Coin < wantedResp.Tickers[j].Coin }) - sort.Slice(response.Tickers, func(i, j int) bool { - return response.Tickers[i].Coin < response.Tickers[j].Coin + sort.Slice(response, func(i, j int) bool { + return response[i].Coin < response[j].Coin }) - assert.Equal(t, wantedResp, response) + assert.Equal(t, wantedResp.Tickers, response) controllerWithCache := setupController(t, db, true) assert.NotNil(t, controllerWithCache) @@ -161,14 +161,14 @@ func TestController_HandleTickersRequest(t *testing.T) { response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) assert.Nil(t, err) - sort.Slice(response2.Tickers, func(i, j int) bool { - return response2.Tickers[i].Coin < response2.Tickers[j].Coin + sort.Slice(response2, func(i, j int) bool { + return response2[i].Coin < response2[j].Coin }) for i := range wantedResp.Tickers { - assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2.Tickers[i].LastUpdate)) - wantedResp.Tickers[i].LastUpdate = response2.Tickers[i].LastUpdate + assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2[i].LastUpdate)) + wantedResp.Tickers[i].LastUpdate = response2[i].LastUpdate } - assert.Equal(t, wantedResp, response2) + assert.Equal(t, wantedResp.Tickers, response2) } func TestController_HandleTickersRequest_Negative(t *testing.T) { @@ -183,163 +183,6 @@ func TestController_HandleTickersRequest_Negative(t *testing.T) { assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) } -func TestController_HandleTickersRequestV2(t *testing.T) { - timeUPD := time.Now() - rate := models.Rate{ - Currency: "USD", - PercentChange24h: 1, - Provider: "coinmarketcap", - Rate: 1, - LastUpdated: timeUPD, - } - rate2 := models.Rate{ - Currency: "USD", - PercentChange24h: 2, - Provider: "coingecko", - Rate: 2, - LastUpdated: timeUPD, - } - rate3 := models.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: "fixer", - Rate: 6, - LastUpdated: timeUPD, - } - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 10, - LastUpdated: timeUPD, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 10, - LastUpdated: timeUPD, - } - - ticker714ACG := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - LastUpdated: timeUPD, - } - - ticker714ABNB := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "binancedex", - Value: 100, - LastUpdated: timeUPD, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} - db.WantedRatesError = nil - db.WantedRates = []models.Rate{rate, rate2, rate3} - c := setupController(t, db, false) - assert.NotNil(t, c) - - response, err := c.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) - assert.Nil(t, err) - - wantedTicker1 := controllers.TickerPrice{ - ID: "c60_ta", - Change24h: 10, - Provider: "coinmarketcap", - Price: 10, - } - wantedTicker2 := controllers.TickerPrice{ - ID: "c714_ta", - Change24h: 10, - Provider: "coingecko", - Price: 100, - } - - wantedResp := controllers.TickerResponseV2{ - Currency: "USD", - Tickers: []controllers.TickerPrice{wantedTicker2, wantedTicker1}, - } - - sort.Slice(wantedResp.Tickers, func(i, j int) bool { - return wantedResp.Tickers[i].Price < wantedResp.Tickers[j].Price - }) - sort.Slice(response.Tickers, func(i, j int) bool { - return response.Tickers[i].Price < response.Tickers[j].Price - }) - - assert.Equal(t, wantedResp, response) - - controllerWithCache := setupController(t, db, true) - assert.NotNil(t, controllerWithCache) - wantedTicker1Raw, err := json.Marshal(&watchmarket.Ticker{ - Coin: 60, - TokenId: "a", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 10, - }, - LastUpdate: timeUPD, - }) - assert.Nil(t, err) - wantedTicker2Raw, err := json.Marshal(&watchmarket.Ticker{ - Coin: 714, - TokenId: "a", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - }, - LastUpdate: timeUPD, - }) - assert.Nil(t, err) - rateRaw, err := json.Marshal(&watchmarket.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: "fixer", - Rate: 6, - Timestamp: timeUPD.Unix(), - }) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c60_ta", wantedTicker1Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c714_ta", wantedTicker2Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("USD", rateRaw) - assert.Nil(t, err) - - response2, err := controllerWithCache.HandleTickersRequestV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}) - assert.Nil(t, err) - - sort.Slice(response2.Tickers, func(i, j int) bool { - return response.Tickers[i].Price < response.Tickers[j].Price - }) - assert.Equal(t, wantedResp, response2) -} - func TestNewController(t *testing.T) { assert.NotNil(t, setupController(t, getDbMock(), false)) } @@ -397,10 +240,6 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { +func (d dbMock) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/services/controllers/tickers/normalization.go b/services/controllers/tickers/normalization.go deleted file mode 100644 index 9b9b11f6..00000000 --- a/services/controllers/tickers/normalization.go +++ /dev/null @@ -1,140 +0,0 @@ -package tickerscontroller - -import ( - "strings" - "sync" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func createResponse(tr controllers.TickerRequest, tickers watchmarket.Tickers) controllers.TickerResponse { - mergedTickers := make(watchmarket.Tickers, 0, len(tickers)) - for _, t := range tickers { - newTicker, ok := findTickerInAssets(tr.Assets, t) - if !ok { - continue - } - mergedTickers = append(mergedTickers, newTicker) - } - return controllers.TickerResponse{Currency: tr.Currency, Tickers: mergedTickers} -} - -func createResponseV2(tr controllers.TickerRequestV2, tickers watchmarket.Tickers) controllers.TickerResponseV2 { - result := controllers.TickerResponseV2{ - Currency: tr.Currency, - } - tickersPrices := make([]controllers.TickerPrice, 0, len(tickers)) - for _, ticker := range tickers { - id, ok := findIDInRequest(tr, asset.BuildID(ticker.Coin, ticker.TokenId)) - if !ok { - log.Error("Cannot find ID in request") - } - tp := controllers.TickerPrice{ - Change24h: ticker.Price.Change24h, - Provider: ticker.Price.Provider, - Price: ticker.Price.Value, - ID: id, - } - tickersPrices = append(tickersPrices, tp) - } - result.Tickers = tickersPrices - return result -} - -func makeTickerQueries(coins []controllers.Asset) []models.TickerQuery { - tickerQueries := make([]models.TickerQuery, 0, len(coins)) - for _, c := range coins { - tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: c.CoinId, - TokenId: strings.ToLower(c.TokenId), - }) - } - return tickerQueries -} - -func makeTickerQueriesV2(ids []string) []models.TickerQuery { - tickerQueries := make([]models.TickerQuery, 0, len(ids)) - for _, id := range ids { - coin, token, err := asset.ParseID(id) - if err != nil { - continue - } - tickerQueries = append(tickerQueries, models.TickerQuery{ - Coin: coin, - TokenId: strings.ToLower(token), - }) - } - return tickerQueries -} - -func (c Controller) normalizeTickers(tickers watchmarket.Tickers, rate watchmarket.Rate) watchmarket.Tickers { - result := make(watchmarket.Tickers, 0, len(tickers)) - for _, t := range tickers { - r, ok := c.rateToDefaultCurrency(t, rate) - if !ok { - continue - } - if !watchmarket.IsSuitableUpdateTime(t.LastUpdate, c.configuration.RestAPI.Tickers.RespectableUpdateTime) { - continue - } - result = append(result, applyRateToTicker(t, r)) - } - return result -} - -func findIDInRequest(request controllers.TickerRequestV2, id string) (string, bool) { - for _, i := range request.Ids { - givenCoin, givenToken, err := asset.ParseID(i) - if err != nil { - continue - } - coin, token, err := asset.ParseID(id) - if err != nil { - continue - } - - if givenCoin == coin && strings.EqualFold(givenToken, token) { - return i, true - } - } - return id, false -} - -func findTickerInAssets(assets []controllers.Asset, t watchmarket.Ticker) (watchmarket.Ticker, bool) { - for _, c := range assets { - if c.CoinId == t.Coin && strings.ToLower(c.TokenId) == t.TokenId { - t.TokenId = c.TokenId - return t, true - } - } - return watchmarket.Ticker{}, false -} - -func findBestProviderForQuery(coin uint, token string, sliceToFind []models.Ticker, providers []string, wg *sync.WaitGroup, res *sortedTickersResponse, configuration config.Configuration) { - defer wg.Done() - for _, p := range providers { - for _, t := range sliceToFind { - baseCheck := coin == t.Coin && strings.ToLower(token) == t.TokenId - - if baseCheck && t.ShowOption == models.AlwaysShow { - res.Lock() - res.tickers = append(res.tickers, t) - res.Unlock() - return - } - if baseCheck && p == t.Provider && t.ShowOption != models.NeverShow && - (watchmarket.IsRespectableValue(t.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || t.Provider != "coingecko") && - (watchmarket.IsRespectableValue(t.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || t.Provider != "coingecko") { - res.Lock() - res.tickers = append(res.tickers, t) - res.Unlock() - return - } - } - } -} diff --git a/services/controllers/tickers/normalization_test.go b/services/controllers/tickers/normalization_test.go deleted file mode 100644 index f77722ea..00000000 --- a/services/controllers/tickers/normalization_test.go +++ /dev/null @@ -1,416 +0,0 @@ -package tickerscontroller - -import ( - "sort" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func TestController_createResponse(t *testing.T) { - ticker := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "raven-f66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - } - - tr := controllers.TickerRequest{ - Currency: "EUR", - Assets: []controllers.Asset{{CoinId: 0, CoinType: "Token", TokenId: "RAVEN-F66"}}, - } - - response := createResponse(tr, watchmarket.Tickers{ticker}) - wantedResponse := controllers.TickerResponse{ - Currency: "EUR", - Tickers: watchmarket.Tickers{ - { - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "RAVEN-F66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - }, - }, - } - assert.Equal(t, wantedResponse, response) -} - -func Test_makeTickerQueriesV2(t *testing.T) { - ids := []string{"c60_ta", "c714", "c714_ta"} - wantedRes := []models.TickerQuery{ - { - Coin: 60, - TokenId: "a", - }, - { - Coin: 714, - TokenId: "", - }, - { - Coin: 714, - TokenId: "a", - }, - } - res := makeTickerQueriesV2(ids) - - sort.Slice(res, func(i, j int) bool { - return res[i].Coin < res[j].Coin - }) - sort.Slice(wantedRes, func(i, j int) bool { - return wantedRes[i].Coin < wantedRes[j].Coin - }) - - for i, r := range res { - assert.Equal(t, wantedRes[i], r) - } -} - -func Test_createResponseV2(t *testing.T) { - timeUPD := time.Now() - given1 := watchmarket.Ticker{ - Coin: 60, - CoinName: "ETH", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - given2 := watchmarket.Ticker{ - Coin: 714, - CoinName: "BNB", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - r := createResponseV2(controllers.TickerRequestV2{Currency: "USD", Ids: []string{"c60_ta", "c714_ta"}}, []watchmarket.Ticker{given1, given2}) - - wantedTicker1 := controllers.TickerPrice{ - ID: "c60_ta", - Change24h: 10, - Provider: "coinmarketcap", - Price: 100, - } - wantedTicker2 := controllers.TickerPrice{ - ID: "c714_ta", - Change24h: 10, - Provider: "coingecko", - Price: 100, - } - - wp := []controllers.TickerPrice{wantedTicker2, wantedTicker1} - sort.Slice(wp, func(i, j int) bool { - return wp[i].ID < wp[j].ID - }) - wantedResp := controllers.TickerResponseV2{ - Currency: "USD", - Tickers: wp, - } - - sort.Slice(r.Tickers, func(i, j int) bool { - return r.Tickers[i].ID < r.Tickers[j].ID - }) - - assert.Equal(t, wantedResp, r) -} - -func TestController_normalizeTickers(t *testing.T) { - modelRate2 := models.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - LastUpdated: time.Now(), - } - - rate := watchmarket.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - Timestamp: 12, - } - - now := time.Now() - - gotTicker1 := watchmarket.Ticker{ - Coin: 0, - CoinName: "BTC", - CoinType: "Coin", - Price: watchmarket.Price{ - Change24h: -4.03168, - Currency: "USD", - Provider: "coinmarketcap", - Value: 9360.20314131, - }, - TokenId: "", - LastUpdate: now, - } - db := getDbMock() - db.WantedRates = []models.Rate{modelRate2} - - c := setupController(t, db, false) - assert.NotNil(t, c) - - result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) - wanted := watchmarket.Ticker{ - Coin: 0, - CoinName: "BTC", - CoinType: "Coin", - Error: "", - Price: watchmarket.Price{ - Change24h: -4.03168, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 8514.78959355037, - }, - TokenId: "", - LastUpdate: now, - } - assert.Equal(t, wanted, result[0]) -} - -func TestController_normalizeTickers_advanced(t *testing.T) { - timeUPD := time.Now() - modelRate := models.Rate{ - Currency: "BNB", - PercentChange24h: 0, - Provider: "coingecko", - Rate: 16.16, - LastUpdated: timeUPD, - } - - modelRate2 := models.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - LastUpdated: timeUPD, - } - - rate := watchmarket.Rate{ - Currency: "EUR", - PercentChange24h: 0, - Provider: "fixer", - Rate: 1.0992876616, - Timestamp: 12, - } - - gotTicker1 := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "BNB", - Provider: "coinmarketcap", - Value: 1, - }, - TokenId: "raven-f66", - Volume: 10, - MarketCap: 10, - LastUpdate: timeUPD, - } - - db := getDbMock() - db.WantedRates = []models.Rate{modelRate, modelRate2} - - c := setupController(t, db, false) - assert.NotNil(t, c) - - result := c.normalizeTickers([]watchmarket.Ticker{gotTicker1}, rate) - wanted := watchmarket.Ticker{ - Coin: 0, - CoinName: "BNB", - CoinType: "Token", - Error: "", - Price: watchmarket.Price{ - Change24h: -10.24, - Currency: "EUR", - Provider: "coinmarketcap", - Value: 14.700428799936965, - }, - TokenId: "raven-f66", - Volume: 147.00428799936964, - MarketCap: 147.00428799936964, - LastUpdate: timeUPD, - } - assert.Equal(t, wanted, result[0]) -} - -func Test_findBestProviderForQuery(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - } - - providers := []string{"coinmarketcap", "coingecko"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} - -func Test_findBestProviderForQuery_advanced(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - ShowOption: models.NeverShow, - } - - providers := []string{"coingecko", "coinmarketcap"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} - -func Test_findBestProviderForQuery_showOption(t *testing.T) { - tickerQueries := []controllers.Asset{{CoinId: 60, TokenId: "A"}} - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coinmarketcap", - Value: 100, - ShowOption: models.AlwaysShow, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "coingecko", - Value: 100, - } - - providers := []string{"coingecko", "coinmarketcap"} - dbTickers := []models.Ticker{ticker60ACMC, ticker60ACG} - for i := 0; i < 10000; i++ { - t := ticker60ACG - t.Value = t.Value + float64(i) - t.Coin = uint(i) - dbTickers = append(dbTickers, t) - } - - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.CoinId, q.TokenId, dbTickers, providers, wg, res, c) - } - - wg.Wait() - - assert.Equal(t, ticker60ACMC, res.tickers[0]) -} diff --git a/services/controllers/tickers/rates.go b/services/controllers/tickers/rates.go deleted file mode 100644 index aa85914a..00000000 --- a/services/controllers/tickers/rates.go +++ /dev/null @@ -1,83 +0,0 @@ -package tickerscontroller - -import ( - "encoding/json" - "errors" - "strings" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -func (c Controller) getRateByPriority(currency string) (watchmarket.Rate, error) { - if c.configuration.RestAPI.UseMemoryCache { - rawResult, err := c.cache.Get(currency) - if err != nil { - return watchmarket.Rate{}, err - } - var result watchmarket.Rate - if err = json.Unmarshal(rawResult, &result); err != nil { - return watchmarket.Rate{}, err - } - return result, nil - } - - rates, err := c.database.GetRates(currency) - if err != nil { - log.Error(err, "getRateByPriority") - return watchmarket.Rate{}, err - } - - providers := c.ratesPriority - - var result models.Rate -ProvidersLoop: - for _, p := range providers { - for _, r := range rates { - if p == r.Provider { - result = r - break ProvidersLoop - } - } - } - emptyRate := models.Rate{} - if result == emptyRate || (watchmarket.IsFiatRate(result.Currency) && result.Provider != "fixer") { - return watchmarket.Rate{}, errors.New(watchmarket.ErrNotFound) - } - - return watchmarket.Rate{ - Currency: result.Currency, - PercentChange24h: result.PercentChange24h, - Provider: result.Provider, - Rate: result.Rate, - Timestamp: result.LastUpdated.Unix(), - }, nil -} - -func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { - if t.Price.Currency != watchmarket.DefaultCurrency { - newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) - if err != nil { - return watchmarket.Rate{}, false - } - rate.Rate /= newRate.Rate - rate.PercentChange24h = newRate.PercentChange24h - } - return rate, true -} - -func applyRateToTicker(t watchmarket.Ticker, rate watchmarket.Rate) watchmarket.Ticker { - if t.Price.Currency == rate.Currency { - return t - } - t.Price.Value *= 1 / rate.Rate - t.Price.Currency = rate.Currency - t.Volume *= 1 / rate.Rate - t.MarketCap *= 1 / rate.Rate - - if rate.PercentChange24h != 0 { - t.Price.Change24h -= rate.PercentChange24h // Look at it more detailed - } - return t -} diff --git a/services/controllers/tickers/tickers.go b/services/controllers/tickers/tickers.go deleted file mode 100644 index bcdbefce..00000000 --- a/services/controllers/tickers/tickers.go +++ /dev/null @@ -1,76 +0,0 @@ -package tickerscontroller - -import ( - "encoding/json" - "strings" - "sync" - - log "github.com/sirupsen/logrus" - "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -type ( - sortedTickersResponse struct { - sync.Mutex - tickers []models.Ticker - } -) - -func (c Controller) getTickersByPriority(tickerQueries []models.TickerQuery) (watchmarket.Tickers, error) { - if c.configuration.RestAPI.UseMemoryCache { - var results watchmarket.Tickers - for _, tr := range tickerQueries { - key := strings.ToLower(asset.BuildID(tr.Coin, tr.TokenId)) - rawResult, err := c.cache.Get(key) - if err != nil { - continue - } - var result watchmarket.Ticker - if err = json.Unmarshal(rawResult, &result); err != nil { - continue - } - results = append(results, result) - } - return results, nil - } - - dbTickers, err := c.database.GetTickersByQueries(tickerQueries) - if err != nil { - log.Error(err, "getTickersByPriority") - return nil, err - } - providers := c.tickersPriority - - res := new(sortedTickersResponse) - wg := new(sync.WaitGroup) - for _, q := range tickerQueries { - wg.Add(1) - go findBestProviderForQuery(q.Coin, q.TokenId, dbTickers, providers, wg, res, c.configuration) - } - - wg.Wait() - - sortedTickers := res.tickers - - result := make(watchmarket.Tickers, len(sortedTickers)) - - for i, sr := range sortedTickers { - result[i] = watchmarket.Ticker{ - Coin: sr.Coin, - CoinName: sr.CoinName, - CoinType: watchmarket.CoinType(sr.CoinType), - LastUpdate: sr.LastUpdated, - Price: watchmarket.Price{ - Change24h: sr.Change24h, - Currency: sr.Currency, - Provider: sr.Provider, - Value: sr.Value, - }, - TokenId: sr.TokenId, - } - } - - return result, nil -} diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index 02d7f54f..fac6cbd8 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -47,9 +47,7 @@ func TestController_getTickersByPriority(t *testing.T) { c := setupController(t, db, false) assert.NotNil(t, c) - tickers, err := c.getTickersByPriority(makeTickerQueries( - []controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}, - )) + tickers, err := c.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}) assert.Nil(t, err) assert.NotNil(t, tickers) assert.Equal(t, 2, len(tickers)) @@ -64,7 +62,7 @@ func TestController_getTickersByPriority(t *testing.T) { Provider: "coinmarketcap", Value: 100, }, - TokenId: "a", + TokenId: "A", } wantedTicker2 := watchmarket.Ticker{ Coin: 714, @@ -84,11 +82,11 @@ func TestController_getTickersByPriority(t *testing.T) { counter++ } } - assert.Equal(t, 2, counter) + assert.Equal(t, 1, counter) db2 := getDbMock() db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority(makeTickerQueries([]controllers.Asset{{CoinId: 60, TokenId: "A"}})) + tickers2, err := c2.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}}) assert.Nil(t, err) assert.NotNil(t, tickers2) assert.Equal(t, 1, len(tickers2)) diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 78003f4b..50d7e0b3 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -2,6 +2,7 @@ package worker import ( "encoding/json" + "github.com/trustwallet/watchmarket/services/controllers" "testing" "time" @@ -499,7 +500,7 @@ func (d dbMock) GetAllRates() ([]models.Rate, error) { return d.WantedRates, nil } -func (d dbMock) GetTickers(coin uint, tokenId string) ([]models.Ticker, error) { +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { return d.WantedTickers, d.WantedTickersError } diff --git a/tests/integration/db_test/ticker_test.go b/tests/integration/db_test/ticker_test.go index 876ea95b..6c676746 100644 --- a/tests/integration/db_test/ticker_test.go +++ b/tests/integration/db_test/ticker_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/tests/integration/setup" "testing" @@ -37,12 +38,12 @@ func TestAddTickers(t *testing.T) { err := d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers(60, "60") + result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) - result2, err := d.GetTickers(70, "70") + result2, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, uint(70), result2[0].Coin) @@ -61,7 +62,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers(60, "60") + result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 2) @@ -70,7 +71,7 @@ func TestAddTickers(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result2, err = d.GetTickers(70, "70") + result2, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 70, TokenId: "70"}}) assert.Nil(t, err) assert.Len(t, result2, 1) assert.Equal(t, float64(100500), result2[0].Value) @@ -116,7 +117,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err := d.GetTickers(60, "60") + result1, err := d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) assert.Equal(t, uint(60), result1[0].Coin) @@ -135,7 +136,7 @@ func TestAddTickersMult(t *testing.T) { err = d.AddTickers(tickers) assert.Nil(t, err) - result1, err = d.GetTickers(60, "60") + result1, err = d.GetTickers([]controllers.Asset{controllers.Asset{CoinId: 60, TokenId: "60"}}) assert.Nil(t, err) assert.Len(t, result1, 1) } From ae3ae0d34b840ff71490afb2906f3e578afc6fe8 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Mon, 1 Mar 2021 14:01:03 +0700 Subject: [PATCH 45/96] Fix default currency (#396) --- api/endpoint/tickers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/endpoint/tickers.go b/api/endpoint/tickers.go index 76e9290e..b0d17155 100644 --- a/api/endpoint/tickers.go +++ b/api/endpoint/tickers.go @@ -88,8 +88,12 @@ func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin. return } request.Ids = removeDuplicates(request.Ids) + currency := request.Currency + if len(currency) == 0 { + currency = watchmarket.DefaultCurrency + } tickers, err := controller.HandleTickersRequest(controllers.TickerRequest{ - Currency: request.Currency, + Currency: currency, Assets: parseAssetIds(request.Ids), }) if err != nil { @@ -98,7 +102,7 @@ func PostTickersHandlerV2(controller controllers.TickersController) func(c *gin. return } - c.JSON(http.StatusOK, mapToResponse(request.Currency, tickers)) + c.JSON(http.StatusOK, mapToResponse(currency, tickers)) } } From c41d0d018c4858f034f52bd7ac5117c9d7f06d40 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Mon, 1 Mar 2021 21:16:10 +0800 Subject: [PATCH 46/96] Add DITTO (BEP20) pricing (#398) https://coinmarketcap.com/currencies/ditto/ https://bscscan.com/address/0x233d91a0713155003fc4dce0afa871b508b3b715 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f46347b0..2535b340 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14182,6 +14182,12 @@ const Mapping = `[ "token_id": "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", "id": 8049 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x233d91A0713155003fc4DcE0AFa871b508B3B715", + "id": 8086 + }, { "coin": 20000714, "type": "token", From 91c3318f6d6c4c3a3d0c469b18ff572d4a98a8fd Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 1 Mar 2021 21:54:19 +0800 Subject: [PATCH 47/96] add_BEP20_DODO (#399) https://bscscan.com/token/0x67ee3cb086f8a16f34bee3ca72fad36f7db929e2 https://coinmarketcap.com/currencies/dodo/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 2535b340..af9c30b1 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13930,6 +13930,12 @@ const Mapping = `[ "token_id": "0x25e1474170c4c0aA64fa98123bdc8dB49D7802fa", "id": 7200 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2", + "id": 7224 + }, { "coin": 60, "type": "token", From 55751826dcef4fb689e05d37ca127abe3bdb8828 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 1 Mar 2021 23:37:41 +0800 Subject: [PATCH 48/96] add_BEP2_XRP+BKBT (#400) --- services/markets/coinmarketcap/mapping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index af9c30b1..b5db8e99 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -84,6 +84,12 @@ const Mapping = `[ "type": "coin", "id": 52 }, + { + "coin": 714, + "type": "token", + "token_id": "XRP-BF2", + "id": 52 + }, { "coin": 20000714, "type": "token", @@ -4674,6 +4680,12 @@ const Mapping = `[ "token_id": "0x6A27348483D59150aE76eF4C0f3622A78B0cA698", "id": 2914 }, + { + "coin": 714, + "type": "token", + "token_id": "BKBT-3A6", + "id": 2914 + }, { "coin": 60, "type": "token", From 94ea339d645d79b831fb32dd5c1577dd2fea3032 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Tue, 2 Mar 2021 22:17:36 +0800 Subject: [PATCH 49/96] Update DNA (ERC20) pricing (#401) Change from 0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81 to 0xef6344de1fcfC5F48c30234C16c1389e8CdC572C --- services/markets/coinmarketcap/mapping.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index b5db8e99..d2f363a6 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -2169,7 +2169,7 @@ const Mapping = `[ { "coin": 60, "type": "token", - "token_id": "0x82b0E50478eeaFde392D45D1259Ed1071B6fDa81", + "token_id": "0xef6344de1fcfC5F48c30234C16c1389e8CdC572C", "id": 2208 }, { From 06d702e03d33da1797e858764d4af63b84f5ada4 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Wed, 3 Mar 2021 10:15:32 +0800 Subject: [PATCH 50/96] add_BEP20_RAMP (#402) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index d2f363a6..1723df6f 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14026,6 +14026,12 @@ const Mapping = `[ "token_id": "0xE10e9822A5de22F8761919310DDA35CD997d63c0", "id": 7409 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x8519EA49c997f50cefFa444d240fB655e89248Aa", + "id": 7463 + }, { "coin": 60, "type": "token", From 84887056b2b2ae5be0e3e74a224f7a957454df90 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Fri, 5 Mar 2021 01:16:07 +0800 Subject: [PATCH 51/96] add_BEP20_SUSHI (#403) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 1723df6f..f873ece0 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13799,6 +13799,12 @@ const Mapping = `[ "token_id": "TVj7RNVHy6thbM7BWdSe9G6gXwKhjhdNZS", "id": 6724 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x947950BcC74888a40Ffa2593C5798F11Fc9124C4", + "id": 6758 + }, { "coin": 60, "type": "token", From 4cbacf7f117fec99c6fa1a38cd48e977a1c5703f Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Fri, 5 Mar 2021 21:45:27 -0800 Subject: [PATCH 52/96] Add BEP2 (UNI) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f873ece0..fde4b433 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13912,6 +13912,12 @@ const Mapping = `[ "token_id": "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", "id": 7083 }, + { + "coin": 714, + "type": "token", + "token_id": "UNI-DD8", + "id": 7083 + }, { "coin": 195, "type": "token", From f265ed31fe78fcd79927e082e8efaca9d2cedb06 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Sat, 6 Mar 2021 23:00:45 +0800 Subject: [PATCH 53/96] add_BEP2_AWC (#405) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index fde4b433..a52e97f9 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -6820,6 +6820,12 @@ const Mapping = `[ "token_id": "0xaD22f63404f7305e4713CcBd4F296f34770513f4", "id": 3667 }, + { + "coin": 714, + "type": "token", + "token_id": "AWC-986", + "id": 3667 + }, { "coin": 60, "type": "token", From 0bc8c64943e184b727f2ae7365985a659102d2a3 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:32:53 +0800 Subject: [PATCH 54/96] Add Jetfuel Finance (FUEL) BEP20 pricing (#406) https://coinmarketcap.com/currencies/jetfuel-finance/ https://www.coingecko.com/en/coins/jetfuel-finance --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index a52e97f9..4c3be23f 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14295,5 +14295,11 @@ const Mapping = `[ "type": "token", "token_id": "0xa184088a740c695E156F91f5cC086a06bb78b827", "id": 8387 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x2090c8295769791ab7A3CF1CC6e0AA19F35e441A", + "id": 8659 } ]` From 4fe5bc86adf8747d5828c5f44f92c51fa1a128c4 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Sun, 7 Mar 2021 22:07:17 +0800 Subject: [PATCH 55/96] add_BEP2_SUSHI (#407) https://github.com/trustwallet/assets/pull/5837 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 4c3be23f..6cbf23e2 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13805,6 +13805,12 @@ const Mapping = `[ "token_id": "TVj7RNVHy6thbM7BWdSe9G6gXwKhjhdNZS", "id": 6724 }, + { + "coin": 714, + "type": "token", + "token_id": "SUSHI-134", + "id": 6758 + }, { "coin": 20000714, "type": "token", From cb70d3299d243abeacb49b4572cfa8222d98b6b2 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Sun, 7 Mar 2021 22:25:01 +0800 Subject: [PATCH 56/96] add_BEP2-BEP20_COCOS (#408) --- services/markets/coinmarketcap/mapping.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 6cbf23e2..691bed71 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -8919,7 +8919,19 @@ const Mapping = `[ { "coin": 60, "type": "token", - "token_id": "0x0C6f5F7D555E7518f6841a79436BD2b1Eef03381", + "token_id": "0xc4c7Ea4FAB34BD9fb9a5e1B1a98Df76E26E6407c", + "id": 4275 + }, + { + "coin": 714, + "type": "token", + "token_id": "COCOS-CED", + "id": 4275 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xAb301DaE71f5B386C566f484e636Aee60318F12F", "id": 4275 }, { From 6d9cbdc69b25d86a6560a9fda90960bbdab5fd49 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Mon, 8 Mar 2021 00:32:28 +0800 Subject: [PATCH 57/96] add_BEP2_SXP (#409) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 691bed71..ecbba4fd 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -8946,6 +8946,12 @@ const Mapping = `[ "token_id": "0x8CE9137d39326AD0cD6491fb5CC0CbA0e089b6A9", "id": 4279 }, + { + "coin": 714, + "type": "token", + "token_id": "SXP-CCC", + "id": 4279 + }, { "coin": 20000714, "type": "token", From 06329a5b2074385a287732076c85814c6f15c9d4 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Mon, 8 Mar 2021 13:42:00 -0800 Subject: [PATCH 58/96] Add LTO (ERC20) price mapping --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index ecbba4fd..73a44f70 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -6942,6 +6942,12 @@ const Mapping = `[ "token_id": "LTO-BDF", "id": 3714 }, + { + "coin": 60, + "type": "token", + "token_id": "0x3DB6Ba6ab6F95efed1a6E794caD492fAAabF294D", + "id": 3714 + }, { "coin": 60, "type": "token", From 4e56b7f7b41fa1e0eec209d0d49612ebd22f6c05 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:28:03 +0800 Subject: [PATCH 59/96] Add Shadows (DOWS) ERC20 pricing (#410) https://coinmarketcap.com/currencies/shadows/ https://www.coingecko.com/en/coins/shadows/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 73a44f70..540c27e7 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14326,6 +14326,12 @@ const Mapping = `[ "token_id": "0xa184088a740c695E156F91f5cC086a06bb78b827", "id": 8387 }, + { + "coin": 60, + "type": "token", + "token_id": "0x661Ab0Ed68000491d98C796146bcF28c20d7c559", + "id": 8643 + }, { "coin": 20000714, "type": "token", From 324dd1e9f713d262943823823a82441f05dedf10 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 9 Mar 2021 15:53:46 +0800 Subject: [PATCH 60/96] add_ERC20_POLK (#411) https://etherscan.io/token/0xd478161c952357f05f0292b56012cd8457f1cfbf https://coinmarketcap.com/currencies/polkamarkets/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 540c27e7..99455fc1 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14326,6 +14326,12 @@ const Mapping = `[ "token_id": "0xa184088a740c695E156F91f5cC086a06bb78b827", "id": 8387 }, + { + "coin": 60, + "type": "token", + "token_id": "0xD478161C952357F05f0292B56012Cd8457F1cfbF", + "id": 8579 + }, { "coin": 60, "type": "token", From 847b9f527ebc8ea1bdd9b68cb6b364bf5258be39 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Wed, 10 Mar 2021 13:34:09 +0800 Subject: [PATCH 61/96] Add Spartan Protocol Token (SPARTA) BEP20 pricing (#412) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 99455fc1..62edceb2 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13930,6 +13930,12 @@ const Mapping = `[ "token_id": "TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9", "id": 6990 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xE4Ae305ebE1AbE663f261Bc00534067C80ad677C", + "id": 6992 + }, { "coin": 60, "type": "token", From df3af6a00b582ace2bdeb084f15a182f415a8ace Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Wed, 10 Mar 2021 19:37:19 -0800 Subject: [PATCH 62/96] Add FCL (ERC20) price information --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 62edceb2..90f1e3ed 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14332,6 +14332,12 @@ const Mapping = `[ "token_id": "0xa184088a740c695E156F91f5cC086a06bb78b827", "id": 8387 }, + { + "coin": 60, + "type": "token", + "token_id": "0xF4d861575ecC9493420A3f5a14F85B13f0b50EB3", + "id": 8544 + }, { "coin": 60, "type": "token", From ca2a120bd182e3e0f5750c710aa3adcc41e6fc4b Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Wed, 10 Mar 2021 19:40:59 -0800 Subject: [PATCH 63/96] Add Paid V2 (ERC20) coin pricing --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 90f1e3ed..aae938e3 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14314,6 +14314,12 @@ const Mapping = `[ "token_id": "0xc1D99537392084Cc02D3F52386729b79d01035ce", "id": 8283 }, + { + "coin": 60, + "type": "token", + "token_id": "0x8c8687fC965593DFb2F0b4EAeFD55E9D8df348df", + "id": 8329 + }, { "coin": 20000714, "type": "token", From f81ea90efcb3a585b8a4ef1d2f320d46e02f77e9 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 11 Mar 2021 13:05:45 +0700 Subject: [PATCH 64/96] Add fiat rates endpoint (#416) * Add fiat rates endpoint * Fix tests --- api/api.go | 1 + api/endpoint/rates.go | 21 ++++++++++++++++++++- db/db.go | 1 + db/postgres/rate.go | 8 ++++++++ services/controllers/charts/base_test.go | 4 ++++ services/controllers/controllers.go | 1 + services/controllers/info/base_test.go | 4 ++++ services/controllers/models.go | 7 +++++++ services/controllers/rates/base.go | 15 +++++++++++++++ services/controllers/tickers/base_test.go | 4 ++++ services/worker/memory_test.go | 4 ++++ 11 files changed, 69 insertions(+), 1 deletion(-) diff --git a/api/api.go b/api/api.go index 72a4f1f6..43afc056 100755 --- a/api/api.go +++ b/api/api.go @@ -56,4 +56,5 @@ func SetupTickersAPI(engine *gin.Engine, tickers controllers.TickersController, func SetupRatesAPI(engine *gin.Engine, rates controllers.RatesController) { engine.GET("/v1/market/rate", endpoint.GetRate(rates)) + engine.GET("/fiat_rates", endpoint.GetFiatRates(rates)) } diff --git a/api/endpoint/rates.go b/api/endpoint/rates.go index 99ed983f..b1bfda1a 100644 --- a/api/endpoint/rates.go +++ b/api/endpoint/rates.go @@ -20,7 +20,7 @@ import ( // @Param amount query string false "Amount" default(100) // @Success 200 {object} controllers.RateResponse // @Router /v1/market/rate [get] -func GetRate(controller controllers.RatesController) func(c *gin.Context) { +func GetRate(controller controllers.RatesController) func(context *gin.Context) { return func(c *gin.Context) { from := c.DefaultQuery("from", watchmarket.DefaultCurrency) to := c.Query("to") @@ -42,3 +42,22 @@ func GetRate(controller controllers.RatesController) func(c *gin.Context) { c.JSON(http.StatusOK, response) } } + +// @Summary Get Fiat Rates +// @Description Get Fiat Rates +// @Accept json +// @Produce json +// @Tags Rates +// @Success 200 {object} controllers.FiatRates +// @Router /fiat_rates [get] +func GetFiatRates(controller controllers.RatesController) func(context *gin.Context) { + return func(context *gin.Context) { + rates, err := controller.GetFiatRates() + if err != nil { + code, response := createErrorResponseAndStatusCode(err) + context.AbortWithStatusJSON(code, response) + return + } + context.JSON(http.StatusOK, rates) + } +} diff --git a/db/db.go b/db/db.go index b844c8ed..d9ae6380 100644 --- a/db/db.go +++ b/db/db.go @@ -9,6 +9,7 @@ type ( Instance interface { GetRates(currency string) ([]models.Rate, error) GetAllRates() ([]models.Rate, error) + GetRatesByProvider(provider string) ([]models.Rate, error) AddRates(rates []models.Rate) error AddTickers(tickers []models.Ticker) error diff --git a/db/postgres/rate.go b/db/postgres/rate.go index 7bcc1808..a8692360 100644 --- a/db/postgres/rate.go +++ b/db/postgres/rate.go @@ -43,6 +43,14 @@ func (i *Instance) GetAllRates() ([]models.Rate, error) { return rates, nil } +func (i *Instance) GetRatesByProvider(provider string) ([]models.Rate, error) { + var rates []models.Rate + if err := i.Gorm.Where("provider = ?", provider).Find(&rates).Error; err != nil { + return nil, err + } + return rates, nil +} + func normalizeRates(rates []models.Rate) []models.Rate { ratesMap := make(map[string]models.Rate) for _, rate := range rates { diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index 6fa17ce3..17b72fd5 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -156,6 +156,10 @@ func (d dbMock) GetAllTickers() ([]models.Ticker, error) { return nil, nil } +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + func (d dbMock) GetAllRates() ([]models.Rate, error) { return nil, nil } diff --git a/services/controllers/controllers.go b/services/controllers/controllers.go index 735744bb..30049d1e 100644 --- a/services/controllers/controllers.go +++ b/services/controllers/controllers.go @@ -11,6 +11,7 @@ type ( RatesController interface { HandleRatesRequest(r RateRequest) (RateResponse, error) + GetFiatRates() (FiatRates, error) } ChartsController interface { diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index b25669f4..6433193e 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -161,6 +161,10 @@ func (d dbMock) AddTickers(tickers []models.Ticker) error { return nil } +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + func (d dbMock) GetAllTickers() ([]models.Ticker, error) { return nil, nil } diff --git a/services/controllers/models.go b/services/controllers/models.go index ba54034b..2841ee1a 100644 --- a/services/controllers/models.go +++ b/services/controllers/models.go @@ -46,6 +46,13 @@ type ( Amount float64 `json:"amount"` } + FiatRate struct { + Currency string `json:"currency"` + Rate float64 `json:"rate"` + } + + FiatRates []FiatRate + TickerPrice struct { Change24h float64 `json:"change_24h"` Provider string `json:"provider"` diff --git a/services/controllers/rates/base.go b/services/controllers/rates/base.go index d71a91f2..0931601e 100644 --- a/services/controllers/rates/base.go +++ b/services/controllers/rates/base.go @@ -51,6 +51,21 @@ func (c Controller) HandleRatesRequest(r controllers.RateRequest) (controllers.R return controllers.RateResponse{Amount: result}, nil } +func (c Controller) GetFiatRates() (controllers.FiatRates, error) { + rates, err := c.database.GetRatesByProvider("fixer") + if err != nil { + return nil, err + } + var response controllers.FiatRates + for _, rate := range rates { + response = append(response, controllers.FiatRate{ + Currency: rate.Currency, + Rate: rate.Rate, + }) + } + return response, nil +} + func (c Controller) getRateByCurrency(currency string) (watchmarket.Rate, error) { if c.configuration.RestAPI.UseMemoryCache { rawResult, err := c.dataCache.Get(currency) diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index 8b431ff4..8fa3aed4 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -228,6 +228,10 @@ func (d dbMock) AddRates(rates []models.Rate) error { return nil } +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + func (d dbMock) AddTickers(tickers []models.Ticker) error { return nil } diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 50d7e0b3..48422113 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -488,6 +488,10 @@ func (d dbMock) AddRates(rates []models.Rate) error { return nil } +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + func (d dbMock) AddTickers(tickers []models.Ticker) error { return nil } From 95eca6ba86b3c5c1a0edfbf85348a90df82f6468 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Thu, 11 Mar 2021 21:32:59 +0800 Subject: [PATCH 65/96] edit_ERC20_PAID (#417) https://github.com/trustwallet/assets/pull/5892 --- services/markets/coinmarketcap/mapping.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index aae938e3..ee605b23 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14317,7 +14317,7 @@ const Mapping = `[ { "coin": 60, "type": "token", - "token_id": "0x8c8687fC965593DFb2F0b4EAeFD55E9D8df348df", + "token_id": "0x1614F18Fc94f47967A3Fbe5FfcD46d4e7Da3D787", "id": 8329 }, { From 1fa2a2dddff9b6e248de0f5084d334fed541d70c Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Thu, 11 Mar 2021 14:06:10 -0800 Subject: [PATCH 66/96] Change api route /fiat_rates => /v1/fiat_rates --- api/api.go | 2 +- api/endpoint/rates.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index 43afc056..0fad553d 100755 --- a/api/api.go +++ b/api/api.go @@ -56,5 +56,5 @@ func SetupTickersAPI(engine *gin.Engine, tickers controllers.TickersController, func SetupRatesAPI(engine *gin.Engine, rates controllers.RatesController) { engine.GET("/v1/market/rate", endpoint.GetRate(rates)) - engine.GET("/fiat_rates", endpoint.GetFiatRates(rates)) + engine.GET("/v1/fiat_rates", endpoint.GetFiatRates(rates)) } diff --git a/api/endpoint/rates.go b/api/endpoint/rates.go index b1bfda1a..9112425f 100644 --- a/api/endpoint/rates.go +++ b/api/endpoint/rates.go @@ -49,7 +49,7 @@ func GetRate(controller controllers.RatesController) func(context *gin.Context) // @Produce json // @Tags Rates // @Success 200 {object} controllers.FiatRates -// @Router /fiat_rates [get] +// @Router /v1/fiat_rates [get] func GetFiatRates(controller controllers.RatesController) func(context *gin.Context) { return func(context *gin.Context) { rates, err := controller.GetFiatRates() From 89ca4d6fdfeff30dff77d7bd1b288e7670ebf5cd Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Fri, 12 Mar 2021 13:51:12 +0800 Subject: [PATCH 67/96] Update Verasity (VRA) ERC20 pricing (#418) Change token_id from 0xdF1D6405df92d981a2fB3ce68F6A03baC6C0E41F to 0xF411903cbC70a74d22900a5DE66A2dda66507255 https://coinmarketcap.com/currencies/verasity/ https://www.coingecko.com/en/coins/verasity https://twitter.com/verasitytech/status/1359152323411529737 --- services/markets/coinmarketcap/mapping.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index ee605b23..25e28182 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7400,7 +7400,7 @@ const Mapping = `[ { "coin": 60, "type": "token", - "token_id": "0xdF1D6405df92d981a2fB3ce68F6A03baC6C0E41F", + "token_id": "0xF411903cbC70a74d22900a5DE66A2dda66507255", "id": 3816 }, { From 75721968579ba0e5545d78133ec45e8bee8e8d99 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sun, 14 Mar 2021 14:53:50 +0800 Subject: [PATCH 68/96] Add DOS Network (DOS) BEP2 and BEP20 pricing (#419) --- services/markets/coinmarketcap/mapping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 25e28182..4361229e 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7355,12 +7355,24 @@ const Mapping = `[ "token_id": "0x1C5b760F133220855340003B43cC9113EC494823", "id": 3808 }, + { + "coin": 714, + "type": "token", + "token_id": "DOS-120", + "id": 3809 + }, { "coin": 60, "type": "token", "token_id": "0x0A913beaD80F321E7Ac35285Ee10d9d922659cB7", "id": 3809 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xDc0f0a5719c39764b011eDd02811BD228296887C", + "id": 3809 + }, { "coin": 60, "type": "token", From 340ca3e369cbf660129ff71d6d17ea483d674201 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 16 Mar 2021 01:39:27 +0800 Subject: [PATCH 69/96] add_ERC20_IYF (#420) https://etherscan.io/token/0x5d762f76b9e91f71cc4f94391bdfe6333db8519c https://coinmarketcap.com/currencies/iyf-finance/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 4361229e..1cf52a27 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13984,6 +13984,12 @@ const Mapping = `[ "token_id": "0x0eF3b2024ae079e6dBC2b37435cE30d2731F0101", "id": 7122 }, + { + "coin": 60, + "type": "token", + "token_id": "0x5D762F76b9E91F71cc4F94391BDFe6333dB8519c", + "id": 7146 + }, { "coin": 20000714, "type": "token", From 4c7794fe340cb77456c57edcad2c18ebc974cd2f Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 16 Mar 2021 01:53:44 +0800 Subject: [PATCH 70/96] add_BEP2_IRIS (#421) https://explorer.binance.org/asset/IRIS-D88 https://coinmarketcap.com/currencies/irisnet/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 1cf52a27..10932419 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7641,6 +7641,12 @@ const Mapping = `[ "token_id": "0xEF19F4E48830093Ce5bC8b3Ff7f903A0AE3E9Fa1", "id": 3873 }, + { + "coin": 714, + "type": "token", + "token_id": "IRIS-D88", + "id": 3874 + }, { "coin": 60, "type": "token", From 0f2007619f7365a75063afc688142840adb61589 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 16 Mar 2021 21:22:06 +0800 Subject: [PATCH 71/96] add_BEP2_missing_price_3/16 (#422) added several missing BEP2 token price --- services/markets/coinmarketcap/mapping.go | 144 ++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 10932419..e3a6eb67 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -23,6 +23,12 @@ const Mapping = `[ "type": "coin", "id": 2 }, + { + "coin": 714, + "type": "token", + "token_id": "LTC-F07", + "id": 2 + }, { "coin": 20000714, "type": "token", @@ -121,6 +127,12 @@ const Mapping = `[ "type": "coin", "id": 74 }, + { + "coin": 714, + "type": "token", + "token_id": "DOGE-B67", + "id": 74 + }, { "coin": 20000714, "type": "token", @@ -555,6 +567,12 @@ const Mapping = `[ "token_id": "ETH-1C9", "id": 1027 }, + { + "coin": 714, + "type": "token", + "token_id": "BETH-654", + "id": 1027 + }, { "coin": 524, "type": "coin", @@ -824,6 +842,12 @@ const Mapping = `[ "token_id": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", "id": 1518 }, + { + "coin": 714, + "type": "token", + "token_id": "MKR-F04", + "id": 1518 + }, { "coin": 20000714, "type": "token", @@ -996,6 +1020,12 @@ const Mapping = `[ "token_id": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF", "id": 1697 }, + { + "coin": 714, + "type": "token", + "token_id": "BAT-07A", + "id": 1697 + }, { "coin": 20000714, "type": "token", @@ -1268,6 +1298,12 @@ const Mapping = `[ "type": "coin", "id": 1831 }, + { + "coin": 714, + "type": "token", + "token_id": "BCH-1FD", + "id": 1831 + }, { "coin": 20000714, "type": "token", @@ -1579,6 +1615,12 @@ const Mapping = `[ "token_id": "0x514910771AF9Ca656af840dff83E8264EcF986CA", "id": 1975 }, + { + "coin": 714, + "type": "token", + "token_id": "LINK-AAD", + "id": 1975 + }, { "coin": 20000714, "type": "token", @@ -1687,6 +1729,12 @@ const Mapping = `[ "type": "coin", "id": 2011 }, + { + "coin": 714, + "type": "token", + "token_id": "XTZ-F7A", + "id": 2011 + }, { "coin": 20000714, "type": "token", @@ -2465,6 +2513,12 @@ const Mapping = `[ "token_id": "0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e", "id": 2299 }, + { + "coin": 714, + "type": "token", + "token_id": "ELF-D72", + "id": 2299 + }, { "coin": 20000714, "type": "token", @@ -2633,6 +2687,12 @@ const Mapping = `[ "token_id": "0x814e0908b12A99FeCf5BC101bB5d0b8B5cDf7d26", "id": 2348 }, + { + "coin": 714, + "type": "token", + "token_id": "MDT-14A", + "id": 2348 + }, { "coin": 60, "type": "token", @@ -2680,6 +2740,12 @@ const Mapping = `[ "token_id": "0x4824A7b64E3966B0133f4f4FFB1b9D6bEb75FFF7", "id": 2364 }, + { + "coin": 714, + "type": "token", + "token_id": "TCT-826", + "id": 2364 + }, { "coin": 20000714, "type": "token", @@ -3461,6 +3527,12 @@ const Mapping = `[ "type": "coin", "id": 2566 }, + { + "coin": 714, + "type": "token", + "token_id": "ONT-33D", + "id": 2566 + }, { "coin": 20000714, "type": "token", @@ -3561,6 +3633,12 @@ const Mapping = `[ "token_id": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F", "id": 2586 }, + { + "coin": 714, + "type": "token", + "token_id": "SNX-C26", + "id": 2586 + }, { "coin": 20000714, "type": "token", @@ -4310,6 +4388,12 @@ const Mapping = `[ "type": "coin", "id": 2777 }, + { + "coin": 714, + "type": "token", + "token_id": "IOTX-0ED", + "id": 2777 + }, { "coin": 20000714, "type": "token", @@ -5927,6 +6011,12 @@ const Mapping = `[ "token_id": "0x8E870D67F660D95d5be530380D0eC0bd388289E1", "id": 3330 }, + { + "coin": 714, + "type": "token", + "token_id": "PAX-F25", + "id": 3330 + }, { "coin": 20000714, "type": "token", @@ -6167,6 +6257,12 @@ const Mapping = `[ "token_id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "id": 3408 }, + { + "coin": 714, + "type": "token", + "token_id": "USDC-CD2", + "id": 3408 + }, { "coin": 20000714, "type": "token", @@ -7290,6 +7386,12 @@ const Mapping = `[ "type": "coin", "id": 3794 }, + { + "coin": 714, + "type": "token", + "token_id": "ATOM-596", + "id": 3794 + }, { "coin": 20000714, "type": "token", @@ -7900,6 +8002,12 @@ const Mapping = `[ "token_id": "0x799a4202c12ca952cB311598a024C80eD371a41e", "id": 3945 }, + { + "coin": 714, + "type": "token", + "token_id": "ONE-5F9", + "id": 3945 + }, { "coin": 1023, "type": "coin", @@ -11548,6 +11656,12 @@ const Mapping = `[ "token_id": "0xc00e94Cb662C3520282E6f5717214004A7f26888", "id": 5692 }, + { + "coin": 714, + "type": "token", + "token_id": "COMP-DEE", + "id": 5692 + }, { "coin": 20000714, "type": "token", @@ -12039,6 +12153,12 @@ const Mapping = `[ "token_id": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", "id": 5864 }, + { + "coin": 714, + "type": "token", + "token_id": "YFI-1A4", + "id": 5864 + }, { "coin": 20000714, "type": "token", @@ -12332,6 +12452,12 @@ const Mapping = `[ "token_id": "0xa1d0E215a23d7030842FC67cE582a6aFa3CCaB83", "id": 5957 }, + { + "coin": 714, + "type": "token", + "token_id": "YFII-061", + "id": 5957 + }, { "coin": 20000714, "type": "token", @@ -13471,6 +13597,12 @@ const Mapping = `[ "type": "coin", "id": 6535 }, + { + "coin": 714, + "type": "token", + "token_id": "NEAR-4FD", + "id": 6535 + }, { "coin": 20000714, "type": "token", @@ -13876,6 +14008,12 @@ const Mapping = `[ "type": "coin", "id": 6892 }, + { + "coin": 714, + "type": "token", + "token_id": "EGLD-745", + "id": 6892 + }, { "coin": 20000714, "type": "token", @@ -13888,6 +14026,12 @@ const Mapping = `[ "token_id": "0xA91ac63D040dEB1b7A5E4d4134aD23eb0ba07e14", "id": 6928 }, + { + "coin": 714, + "type": "token", + "token_id": "BEL-D85", + "id": 6928 + }, { "coin": 20000714, "type": "token", From e2b877b67490ef291e4dcfc2b713612120468b81 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 16 Mar 2021 21:42:00 +0800 Subject: [PATCH 72/96] add_ERC20_BEP20_missing (#423) added several missing assets BFI BDO bwJUP arNXM EWTB --- services/markets/coinmarketcap/mapping.go | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index e3a6eb67..687a4a52 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -831,6 +831,12 @@ const Mapping = `[ "token_id": "0x667088b212ce3d06a1b553a7221E1fD19000d9aF", "id": 1500 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x0231f91e02DebD20345Ae8AB7D71A41f8E140cE7", + "id": 1503 + }, { "coin": 213, "type": "coin", @@ -10696,6 +10702,12 @@ const Mapping = `[ "type": "coin", "id": 5268 }, + { + "coin": 60, + "type": "token", + "token_id": "0x178c820f862B14f316509ec36b13123DA19A6054", + "id": 5268 + }, { "coin": 485, "type": "coin", @@ -14470,6 +14482,12 @@ const Mapping = `[ "token_id": "0x78650B139471520656b9E7aA7A5e9276814a38e9", "id": 8210 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454", + "id": 8219 + }, { "coin": 20000714, "type": "token", @@ -14482,6 +14500,12 @@ const Mapping = `[ "token_id": "0xc1D99537392084Cc02D3F52386729b79d01035ce", "id": 8283 }, + { + "coin": 60, + "type": "token", + "token_id": "0x1337DEF18C680aF1f9f45cBcab6309562975b1dD", + "id": 8328 + }, { "coin": 60, "type": "token", @@ -14529,5 +14553,11 @@ const Mapping = `[ "type": "token", "token_id": "0x2090c8295769791ab7A3CF1CC6e0AA19F35e441A", "id": 8659 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x81859801b01764D4f0Fa5E64729f5a6C3b91435b", + "id": 8796 } ]` From f283cb618ec59a33043173bceb4bb3faea25dbdf Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Wed, 17 Mar 2021 00:14:58 +0700 Subject: [PATCH 73/96] Remove bad code (#424) --- services/controllers/tickers/base.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 93662bd2..24ec5d62 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -190,11 +190,7 @@ func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Ti result.TokenId = assetData.TokenId results = append(results, result) } - if len(results) == len(assets) { - return results, nil - } else { - return results, errors.New("not found") - } + return results, nil } // TODO: Remove duplicates or make method From 261df02a1d92104b5f6fce7453984cdac1f7e83b Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Tue, 16 Mar 2021 19:45:41 -0700 Subject: [PATCH 74/96] Add BEP(DEFI-FA5) mapping --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 687a4a52..46e9d2ab 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -9078,6 +9078,12 @@ const Mapping = `[ "token_id": "0x98b2dE885E916b598f65DeD2fDbb63187EAEf184", "id": 4276 }, + { + "coin": 714, + "type": "token", + "token_id": "DEFI-FA5", + "id": 4276 + }, { "coin": 60, "type": "token", From 426c0d89209a7a16c7b32a5cc78241fbc7d907ac Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Thu, 18 Mar 2021 15:50:54 +0800 Subject: [PATCH 75/96] Add CAKE-435 BEP2 pricing (#426) https://explorer.binance.org/asset/CAKE-435 https://coinmarketcap.com/currencies/pancakeswap/ https://www.coingecko.com/en/coins/pancakeswap --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 46e9d2ab..b4ea73c5 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14170,6 +14170,12 @@ const Mapping = `[ "token_id": "0x6fd7c98458a943f469E1Cf4eA85B173f5Cd342F4", "id": 7182 }, + { + "coin": 714, + "type": "token", + "token_id": "CAKE-435", + "id": 7186 + }, { "coin": 20000714, "type": "token", From 7f060e30ed4faf7bbc9bbcd4a9a0a93bd8e92687 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Fri, 19 Mar 2021 00:20:19 +0800 Subject: [PATCH 76/96] Add BOLT-4C6 BEP2 pricing (#427) --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index b4ea73c5..af74f513 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7618,6 +7618,12 @@ const Mapping = `[ "token_id": "0xA6446D655a0c34bC4F05042EE88170D056CBAf45", "id": 3842 }, + { + "coin": 714, + "type": "token", + "token_id": "BOLT-4C6", + "id": 3843 + }, { "coin": 60, "type": "token", From 61e52f36704b9d05cdc1acdf33e15b661fb3d34b Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Fri, 19 Mar 2021 17:59:18 +0800 Subject: [PATCH 77/96] add_BEP20_TFF https://bscscan.com/token/0x2d69c55baecefc6ec815239da0a985747b50db6e https://coinmarketcap.com/currencies/tutti-frutti/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index af74f513..c391545a 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14577,5 +14577,11 @@ const Mapping = `[ "type": "token", "token_id": "0x81859801b01764D4f0Fa5E64729f5a6C3b91435b", "id": 8796 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x2d69c55baEcefC6ec815239DA0a985747B50Db6E", + "id": 8870 } ]` From f943245012ddb0f8b042956b6a315f4460f1c287 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sat, 20 Mar 2021 15:53:25 +0800 Subject: [PATCH 78/96] Update Tellor (TRB) ERC20 pricing (#428) --- services/markets/coinmarketcap/mapping.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index c391545a..a8527fa6 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -10028,7 +10028,7 @@ const Mapping = `[ { "coin": 60, "type": "token", - "token_id": "0x0Ba45A8b5d5575935B8158a88C631E9F9C95a2e5", + "token_id": "0x88dF592F8eb5D7Bd38bFeF7dEb0fBc02cf3778a0", "id": 4944 }, { From b813f2a2743bc2a783324d0135e332e615825955 Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Sun, 21 Mar 2021 00:04:40 +0800 Subject: [PATCH 79/96] add_BEP2_BTTB https://explorer.binance.org/asset/BTTB-D31 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index a8527fa6..84379211 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7073,6 +7073,12 @@ const Mapping = `[ "token_id": "1002000", "id": 3718 }, + { + "coin": 714, + "type": "token", + "token_id": "BTTB-D31", + "id": 3718 + }, { "coin": 60, "type": "token", From 9e3c779e232475f35010ab37e3a915d4b269649d Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Sun, 21 Mar 2021 12:04:11 +0800 Subject: [PATCH 80/96] add_BEP20_KGO https://coinmarketcap.com/currencies/kiwigo/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 84379211..157d714d 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14589,5 +14589,11 @@ const Mapping = `[ "type": "token", "token_id": "0x2d69c55baEcefC6ec815239DA0a985747B50Db6E", "id": 8870 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x5d3AfBA1924aD748776E4Ca62213BF7acf39d773", + "id": 8877 } ]` From 26faeb6f118581da8872ac9823324ca0884784a3 Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Sun, 21 Mar 2021 17:50:09 +0800 Subject: [PATCH 81/96] add_BEP20_WATCH https://github.com/trustwallet/assets/pull/6001 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 157d714d..1e010af3 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14566,6 +14566,12 @@ const Mapping = `[ "token_id": "0xD478161C952357F05f0292B56012Cd8457F1cfbF", "id": 8579 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x7A9f28EB62C791422Aa23CeAE1dA9C847cBeC9b0", + "id": 8621 + }, { "coin": 60, "type": "token", From 6b4b76577abd8d644a3f095f9c474c4f010391cd Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sun, 21 Mar 2021 20:55:31 +0800 Subject: [PATCH 82/96] Update Bitcoin Standard Hashrate Token (BTCST) BEP20 pricing (#429) https://btcst.medium.com/btcst-to-implement-results-of-stp-4-1-10-redenomination-the-week-of-march-15-872c9ea3d5b7 https://bscscan.com/address/0x78650b139471520656b9e7aa7a5e9276814a38e9 https://coinmarketcap.com/currencies/btc-standard-hashrate-token/ https://www.coingecko.com/en/coins/btc-standard-hashrate-token --- services/markets/coinmarketcap/mapping.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 1e010af3..f4711861 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14500,12 +14500,6 @@ const Mapping = `[ "token_id": "0x66a0f676479Cee1d7373f3DC2e2952778BfF5bd6", "id": 8167 }, - { - "coin": 20000714, - "type": "token", - "token_id": "0x78650B139471520656b9E7aA7A5e9276814a38e9", - "id": 8210 - }, { "coin": 20000714, "type": "token", @@ -14601,5 +14595,11 @@ const Mapping = `[ "type": "token", "token_id": "0x5d3AfBA1924aD748776E4Ca62213BF7acf39d773", "id": 8877 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x78650B139471520656b9E7aA7A5e9276814a38e9", + "id": 8891 } ]` From 239bea901b8235f1f8950a4a4579e09b4e399989 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Mon, 22 Mar 2021 15:08:54 +0800 Subject: [PATCH 83/96] Add Ecomi (OMI) GO20 pricing (#430) https://coinmarketcap.com/currencies/ecomi/ https://www.coingecko.com/en/coins/ecomi --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f4711861..14b0ae5e 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -13405,6 +13405,12 @@ const Mapping = `[ "token_id": "0x7A939Bb714fd2A48EbeB1E495AA9aaa74BA9fA68", "id": 6430 }, + { + "coin": 6060, + "type": "token", + "token_id": "0x5347FDeA6AA4d7770B31734408Da6d34a8a07BdF", + "id": 6432 + }, { "coin": 454, "type": "coin", From 6c391187a5cf6fdbe36be9ce4b2cc09defac5ce5 Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:40:19 +0800 Subject: [PATCH 84/96] add_BEP20_SAFEMOON https://github.com/trustwallet/assets/pull/6029 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 14b0ae5e..48b2fb5b 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14584,6 +14584,12 @@ const Mapping = `[ "token_id": "0x2090c8295769791ab7A3CF1CC6e0AA19F35e441A", "id": 8659 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x8076C74C5e3F5852037F31Ff0093Eeb8c8ADd8D3", + "id": 8757 + }, { "coin": 20000714, "type": "token", From a9a276e989118162d3c4ca8c85d1090aab17d509 Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Tue, 23 Mar 2021 22:36:49 +0800 Subject: [PATCH 85/96] add_ERC20_PKF https://coinmarketcap.com/currencies/polkafoundry/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 48b2fb5b..21ba10d7 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14566,6 +14566,12 @@ const Mapping = `[ "token_id": "0xD478161C952357F05f0292B56012Cd8457F1cfbF", "id": 8579 }, + { + "coin": 60, + "type": "token", + "token_id": "0x8B39B70E39Aa811b69365398e0aACe9bee238AEb", + "id": 8617 + }, { "coin": 20000714, "type": "token", From 9b605e721c84d5e82fbc3354f96f7a677eeb0b38 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Tue, 23 Mar 2021 23:29:31 -0700 Subject: [PATCH 86/96] [Rates] Store only fixer rates + some fixed crypto rates #191 (#431) * [Rates] Store only fixer rates + some fixed crypto rates #191 Fixes: https://github.com/trustwallet/watchmarket/issues/191 * Fix fetching rates for cmc --- api/api_test.go | 16 +- cmd/worker/main.go | 3 +- config.yml | 2 + config/config.go | 9 +- config/config_test.go | 8 +- go.sum | 4 + pkg/watchmarket/models.go | 4 + services/controllers/charts/base_test.go | 20 +- services/controllers/info/base_test.go | 2 +- services/controllers/rates/base.go | 2 +- services/controllers/tickers/base.go | 5 +- services/controllers/tickers/base_test.go | 18 +- services/controllers/tickers/rates_test.go | 8 +- services/controllers/tickers/tickers_test.go | 10 +- services/markets/coingecko/base.go | 7 +- services/markets/coingecko/base_test.go | 5 +- services/markets/coingecko/tickers_test.go | 2 +- services/markets/coinmarketcap/base.go | 4 +- services/markets/coinmarketcap/base_test.go | 6 +- services/markets/coinmarketcap/client.go | 4 +- .../markets/coinmarketcap/mocks/rates.json | 187 +++++++++++------- services/markets/coinmarketcap/rates.go | 8 +- services/markets/coinmarketcap/tickers.go | 2 +- .../markets/coinmarketcap/tickers_test.go | 10 +- services/markets/fixer/base_test.go | 6 +- services/markets/fixer/rates.go | 2 +- services/markets/fixer/rates_test.go | 2 +- services/markets/markets_test.go | 18 +- services/worker/memory.go | 2 +- services/worker/memory_test.go | 65 +++--- services/worker/models.go | 7 +- services/worker/rates.go | 20 +- services/worker/rates_test.go | 70 +++++++ 33 files changed, 343 insertions(+), 195 deletions(-) create mode 100644 services/worker/rates_test.go diff --git a/api/api_test.go b/api/api_test.go index fcf7c408..a66f2a04 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -49,7 +49,7 @@ func TestSetupTickersAPI(t *testing.T) { Price: watchmarket.Price{ Change24h: 2, Currency: "", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 1, }, }, @@ -57,7 +57,7 @@ func TestSetupTickersAPI(t *testing.T) { } wantedTickersV2 := controllers.TickerResponseV2{ Currency: "USD", - Tickers: []controllers.TickerPrice{{Change24h: 2, Provider: "coinmarketcap", Price: 1, ID: "c60_ta"}}, + Tickers: []controllers.TickerPrice{{Change24h: 2, Provider: watchmarket.CoinMarketCap, Price: 1, ID: "c60_ta"}}, } SetupTickersAPI(e, getTickersMock(wantedTickers, wantedTickersV2, nil), time.Minute) @@ -87,7 +87,7 @@ func TestSetupTickersAPI(t *testing.T) { assert.Equal(t, "a", givenV1Resp.Tickers[0].TokenId) assert.Equal(t, float64(1), givenV1Resp.Tickers[0].Price.Value) assert.Equal(t, float64(2), givenV1Resp.Tickers[0].Price.Change24h) - assert.Equal(t, "coinmarketcap", givenV1Resp.Tickers[0].Price.Provider) + assert.Equal(t, watchmarket.CoinMarketCap, givenV1Resp.Tickers[0].Price.Provider) givenV2Resp := controllers.TickerResponseV2{} @@ -107,7 +107,7 @@ func TestSetupTickersAPI(t *testing.T) { assert.Equal(t, "c60_ta", givenV2Resp.Tickers[0].ID) assert.Equal(t, float64(1), givenV2Resp.Tickers[0].Price) assert.Equal(t, float64(2), givenV2Resp.Tickers[0].Change24h) - assert.Equal(t, "coinmarketcap", givenV2Resp.Tickers[0].Provider) + assert.Equal(t, watchmarket.CoinMarketCap, givenV2Resp.Tickers[0].Provider) resp3, err := http.Get(server.URL + "/v2/market/ticker/c60_ta") assert.Nil(t, err) @@ -123,7 +123,7 @@ func TestSetupTickersAPI(t *testing.T) { assert.Equal(t, "c60_ta", givenV2Resp2.Tickers[0].ID) assert.Equal(t, float64(1), givenV2Resp2.Tickers[0].Price) assert.Equal(t, float64(2), givenV2Resp2.Tickers[0].Change24h) - assert.Equal(t, "coinmarketcap", givenV2Resp2.Tickers[0].Provider) + assert.Equal(t, watchmarket.CoinMarketCap, givenV2Resp2.Tickers[0].Provider) resp4, err := http.Get(server.URL + "/v2/market/tickers/c60_ta") assert.Nil(t, err) @@ -139,7 +139,7 @@ func TestSetupTickersAPI(t *testing.T) { assert.Equal(t, "c60_ta", givenV2Resp3.Tickers[0].ID) assert.Equal(t, float64(1), givenV2Resp3.Tickers[0].Price) assert.Equal(t, float64(2), givenV2Resp3.Tickers[0].Change24h) - assert.Equal(t, "coinmarketcap", givenV2Resp3.Tickers[0].Provider) + assert.Equal(t, watchmarket.CoinMarketCap, givenV2Resp3.Tickers[0].Provider) } func TestSetupChartsAPI(t *testing.T) { @@ -147,7 +147,7 @@ func TestSetupChartsAPI(t *testing.T) { server := httptest.NewServer(e) defer server.Close() wantedCharts := watchmarket.Chart{ - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Prices: []watchmarket.ChartPrice{{Price: 10, Date: 10}}, } SetupChartsAPI(e, getChartsMock(wantedCharts, nil), time.Minute) @@ -191,7 +191,7 @@ func TestSetupInfoAPI(t *testing.T) { server := httptest.NewServer(e) defer server.Close() wantedInfo := controllers.InfoResponse{ - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Info: &watchmarket.Info{ Name: "a", Website: "b", diff --git a/cmd/worker/main.go b/cmd/worker/main.go index 0cfea6e9..80da5ec5 100644 --- a/cmd/worker/main.go +++ b/cmd/worker/main.go @@ -1,12 +1,13 @@ package main import ( - "github.com/trustwallet/watchmarket/services/assets" "os" "os/signal" "syscall" "time" + "github.com/trustwallet/watchmarket/services/assets" + "github.com/trustwallet/golibs/network/middleware" "github.com/robfig/cron/v3" diff --git a/config.yml b/config.yml index 9fa69459..e5661fe7 100644 --- a/config.yml +++ b/config.yml @@ -4,6 +4,7 @@ markets: coin_info: [coinmarketcap, coingecko] tickers: [coinmarketcap, coingecko] rates: [fixer, coinmarketcap, coingecko] + rates_allow: [BTC, ETH, BNB] # include additional crypto currency to fiat rates coinmarketcap: api: https://pro-api.coinmarketcap.com @@ -33,6 +34,7 @@ storage: worker: tickers: 5m rates: 5m + allowCryptoCurrency: [] rest_api: mode: release # Possible values: "debug", "release" diff --git a/config/config.go b/config/config.go index ba34d039..91b20ce6 100644 --- a/config/config.go +++ b/config/config.go @@ -15,10 +15,11 @@ import ( type Configuration struct { Markets struct { Priority struct { - Charts []string `mapstructure:"charts"` - CoinInfo []string `mapstructure:"coin_info"` - Tickers []string `mapstructure:"tickers"` - Rates []string `mapstructure:"rates"` + Charts []string `mapstructure:"charts"` + CoinInfo []string `mapstructure:"coin_info"` + Tickers []string `mapstructure:"tickers"` + Rates []string `mapstructure:"rates"` + RatesAllow []string `mapstructure:"rates_allow"` } `mapstructure:"priority"` Coinmarketcap struct { API string `mapstructure:"api"` diff --git a/config/config_test.go b/config/config_test.go index fb8e8f87..86233121 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -4,15 +4,17 @@ import ( "testing" "time" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/stretchr/testify/assert" ) func TestInit(t *testing.T) { c, _ := Init("../config.yml") - assert.Equal(t, []string{"coinmarketcap", "coingecko"}, c.Markets.Priority.Charts) - assert.Equal(t, []string{"fixer", "coinmarketcap", "coingecko"}, c.Markets.Priority.Rates) - assert.Equal(t, []string{"coinmarketcap", "coingecko"}, c.Markets.Priority.CoinInfo) + assert.Equal(t, []string{watchmarket.CoinMarketCap, watchmarket.CoinGecko}, c.Markets.Priority.Charts) + assert.Equal(t, []string{watchmarket.Fixer, watchmarket.CoinMarketCap, watchmarket.CoinGecko}, c.Markets.Priority.Rates) + assert.Equal(t, []string{watchmarket.CoinMarketCap, watchmarket.CoinGecko}, c.Markets.Priority.CoinInfo) assert.Equal(t, "USD", c.Markets.Coinmarketcap.Currency) assert.Equal(t, "https://pro-api.coinmarketcap.com", c.Markets.Coinmarketcap.API) diff --git a/go.sum b/go.sum index e1417895..f427eb0b 100644 --- a/go.sum +++ b/go.sum @@ -45,6 +45,7 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn github.com/alicebob/miniredis/v2 v2.13.3 h1:kohgdtN58KW/r9ZDVmMJE3MrfbumwsDQStd0LPAGmmw= github.com/alicebob/miniredis/v2 v2.13.3/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg= github.com/alicebob/miniredis/v2 v2.14.2/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= +github.com/alicebob/miniredis/v2 v2.14.3 h1:QWoo2wchYmLgOB6ctlTt2dewQ1Vu6phl+iQbwT8SYGo= github.com/alicebob/miniredis/v2 v2.14.3/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -513,6 +514,7 @@ github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU= github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -566,6 +568,7 @@ github.com/trustwallet/golibs v0.1.0 h1:uo52Hy3WTfGkkd1Y7ti5Hl6BPhvudXG5BlmhBtgt github.com/trustwallet/golibs v0.1.0/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs v0.1.1 h1:ZV5zbPbGD/dHcX3jnIcmdq24Llou230xYGHhK2WVvWQ= github.com/trustwallet/golibs v0.1.1/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= +github.com/trustwallet/golibs v0.1.5 h1:8kMIWrU38a1Rfl9kLXo0egN+PBtSXr78T2sc+UpJ4Q8= github.com/trustwallet/golibs v0.1.5/go.mod h1:SQ3mijAuOTX9GRyaqph3NY2ox04JD5WQ6PkWqX2NB8w= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab h1:djqS58OXHs6tkRoCyuPnMu5q5woQj/1bxUFnSN0Xlew= github.com/trustwallet/golibs/network v0.0.0-20210124080535-8638b407c4ab/go.mod h1:LDMLFnOnwmC30WuCCIJ56TWeXxwCVcrMFJYeC6GEnxY= @@ -584,6 +587,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg= github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= diff --git a/pkg/watchmarket/models.go b/pkg/watchmarket/models.go index 9a733765..2d0f01fb 100755 --- a/pkg/watchmarket/models.go +++ b/pkg/watchmarket/models.go @@ -90,6 +90,10 @@ const ( ErrNotFound = "not found" ErrBadRequest = "bad request" ErrInternal = "internal" + + CoinMarketCap = "coinmarketcap" + CoinGecko = "coingecko" + Fixer = "fixer" ) func (d Chart) IsEmpty() bool { diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go index 17b72fd5..03fd6413 100644 --- a/services/controllers/charts/base_test.go +++ b/services/controllers/charts/base_test.go @@ -17,21 +17,21 @@ func TestController_HandleChartsRequest(t *testing.T) { rate := models.Rate{ Currency: "USD", PercentChange24h: 1, - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Rate: 1, LastUpdated: time.Now(), } rate2 := models.Rate{ Currency: "USD", PercentChange24h: 2, - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Rate: 2, LastUpdated: time.Now(), } rate3 := models.Rate{ Currency: "USD", PercentChange24h: 4, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 6, LastUpdated: time.Now(), } @@ -42,7 +42,7 @@ func TestController_HandleChartsRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, } @@ -52,7 +52,7 @@ func TestController_HandleChartsRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, } @@ -62,7 +62,7 @@ func TestController_HandleChartsRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, } @@ -72,7 +72,7 @@ func TestController_HandleChartsRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, } @@ -83,7 +83,7 @@ func TestController_HandleChartsRequest(t *testing.T) { db.WantedRatesError = nil db.WantedRates = []models.Rate{rate, rate2, rate3} - wCharts := watchmarket.Chart{Provider: "coinmarketcap", Error: "", Prices: []watchmarket.ChartPrice{{Price: 1, Date: 1}, {Price: 3, Date: 3}}} + wCharts := watchmarket.Chart{Provider: watchmarket.CoinMarketCap, Error: "", Prices: []watchmarket.ChartPrice{{Price: 1, Date: 1}, {Price: 3, Date: 3}}} cm := getChartsMock() cm.wantedCharts = wCharts @@ -113,7 +113,7 @@ func setupController(t *testing.T, d dbMock, ch cache.Provider, cm chartsMock) C assert.NotNil(t, c) c.RestAPI.UseMemoryCache = false - chartsPriority := []string{"coinmarketcap"} + chartsPriority := []string{watchmarket.CoinMarketCap} chartsAPIs := make(markets.ChartsAPIs, 1) chartsAPIs[cm.GetProvider()] = cm @@ -223,5 +223,5 @@ func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watc } func (cm chartsMock) GetProvider() string { - return "coinmarketcap" + return watchmarket.CoinMarketCap } diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go index 6433193e..7565c7e3 100644 --- a/services/controllers/info/base_test.go +++ b/services/controllers/info/base_test.go @@ -15,7 +15,7 @@ import ( func TestController_HandleDetailsRequest(t *testing.T) { cm := getChartsMock() wantedD := watchmarket.CoinDetails{ - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Info: &watchmarket.Info{ Name: "2", Website: "2", diff --git a/services/controllers/rates/base.go b/services/controllers/rates/base.go index 0931601e..0a3a24fd 100644 --- a/services/controllers/rates/base.go +++ b/services/controllers/rates/base.go @@ -52,7 +52,7 @@ func (c Controller) HandleRatesRequest(r controllers.RateRequest) (controllers.R } func (c Controller) GetFiatRates() (controllers.FiatRates, error) { - rates, err := c.database.GetRatesByProvider("fixer") + rates, err := c.database.GetRatesByProvider(watchmarket.Fixer) if err != nil { return nil, err } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 24ec5d62..547cd805 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -3,6 +3,8 @@ package tickerscontroller import ( "encoding/json" "errors" + "strings" + "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" @@ -10,7 +12,6 @@ import ( "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" - "strings" ) type Controller struct { @@ -128,7 +129,7 @@ func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, isFiat := !watchmarket.IsFiatRate(currency) for _, p := range c.ratesPriority { - if isFiat && p != "fixer" { + if isFiat && p != watchmarket.Fixer { continue } for _, r := range rates { diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go index 8fa3aed4..e69bc1c7 100644 --- a/services/controllers/tickers/base_test.go +++ b/services/controllers/tickers/base_test.go @@ -21,21 +21,21 @@ func TestController_HandleTickersRequest(t *testing.T) { rate := models.Rate{ Currency: "USD", PercentChange24h: 1, - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Rate: 1, LastUpdated: timeUPD, } rate2 := models.Rate{ Currency: "USD", PercentChange24h: 2, - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Rate: 2, LastUpdated: timeUPD, } rate3 := models.Rate{ Currency: "USD", PercentChange24h: 4, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 6, LastUpdated: timeUPD, } @@ -46,7 +46,7 @@ func TestController_HandleTickersRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, LastUpdated: timeUPD, } @@ -57,7 +57,7 @@ func TestController_HandleTickersRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, LastUpdated: timeUPD, } @@ -68,7 +68,7 @@ func TestController_HandleTickersRequest(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, LastUpdated: timeUPD, } @@ -103,7 +103,7 @@ func TestController_HandleTickersRequest(t *testing.T) { Price: watchmarket.Price{ Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, }, TokenId: "a", @@ -116,7 +116,7 @@ func TestController_HandleTickersRequest(t *testing.T) { Price: watchmarket.Price{ Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, }, TokenId: "a", @@ -146,7 +146,7 @@ func TestController_HandleTickersRequest(t *testing.T) { rateRaw, err := json.Marshal(&watchmarket.Rate{ Currency: "USD", PercentChange24h: 4, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 6, Timestamp: timeUPD.Unix(), }) diff --git a/services/controllers/tickers/rates_test.go b/services/controllers/tickers/rates_test.go index 1823ce9c..bf5d371e 100644 --- a/services/controllers/tickers/rates_test.go +++ b/services/controllers/tickers/rates_test.go @@ -14,21 +14,21 @@ func TestController_getRateByPriority(t *testing.T) { rate := models.Rate{ Currency: "USD", PercentChange24h: 1, - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Rate: 1, LastUpdated: now, } rate2 := models.Rate{ Currency: "USD", PercentChange24h: 2, - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Rate: 2, LastUpdated: now, } rate3 := models.Rate{ Currency: "USD", PercentChange24h: 4, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 6, LastUpdated: now, } @@ -48,7 +48,7 @@ func TestController_getRateByPriority(t *testing.T) { assert.Equal(t, watchmarket.Rate{ Currency: "USD", PercentChange24h: 4, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 6, Timestamp: now.Unix(), }, r) diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go index fac6cbd8..5e282251 100644 --- a/services/controllers/tickers/tickers_test.go +++ b/services/controllers/tickers/tickers_test.go @@ -16,7 +16,7 @@ func TestController_getTickersByPriority(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, } @@ -26,7 +26,7 @@ func TestController_getTickersByPriority(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, } @@ -36,7 +36,7 @@ func TestController_getTickersByPriority(t *testing.T) { TokenId: "a", Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, } @@ -59,7 +59,7 @@ func TestController_getTickersByPriority(t *testing.T) { Price: watchmarket.Price{ Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 100, }, TokenId: "A", @@ -71,7 +71,7 @@ func TestController_getTickersByPriority(t *testing.T) { Price: watchmarket.Price{ Change24h: 10, Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Value: 100, }, TokenId: "a", diff --git a/services/markets/coingecko/base.go b/services/markets/coingecko/base.go index 0bff3914..df5ae096 100755 --- a/services/markets/coingecko/base.go +++ b/services/markets/coingecko/base.go @@ -1,9 +1,12 @@ package coingecko -import "github.com/trustwallet/watchmarket/services/assets" +import ( + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/assets" +) const ( - id = "coingecko" + id = watchmarket.CoinGecko bucketSize = 200 chartDataSize = 2 ) diff --git a/services/markets/coingecko/base_test.go b/services/markets/coingecko/base_test.go index 51c97e9a..258d1cb0 100755 --- a/services/markets/coingecko/base_test.go +++ b/services/markets/coingecko/base_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/trustwallet/golibs/mock" + "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" ) @@ -26,12 +27,12 @@ func TestInitProvider(t *testing.T) { assert.NotNil(t, provider) assert.Equal(t, "web.api", provider.client.client.BaseUrl) assert.Equal(t, "USD", provider.currency) - assert.Equal(t, "coingecko", provider.id) + assert.Equal(t, watchmarket.CoinGecko, provider.id) } func TestProvider_GetProvider(t *testing.T) { provider := InitProvider("web.api", "USD", assets.Init("assets.api")) - assert.Equal(t, "coingecko", provider.GetProvider()) + assert.Equal(t, watchmarket.CoinGecko, provider.GetProvider()) } func createMockedAPI() http.Handler { diff --git a/services/markets/coingecko/tickers_test.go b/services/markets/coingecko/tickers_test.go index b374ee6b..31bbe60c 100755 --- a/services/markets/coingecko/tickers_test.go +++ b/services/markets/coingecko/tickers_test.go @@ -160,7 +160,7 @@ func Test_createTicker(t *testing.T) { wantedTickers = append(wantedTickers, normalTicker) for i, price := range prices { - ticker := createTicker(price, watchmarket.Token, watchmarket.UnknownCoinID, "shitcoin", "shitcoinID", "coingecko", "USD") + ticker := createTicker(price, watchmarket.Token, watchmarket.UnknownCoinID, "shitcoin", "shitcoinID", watchmarket.CoinGecko, "USD") assert.Equal(t, ticker.Price.Value, wantedTickers[i].Price.Value) assert.Equal(t, ticker.Price.Change24h, wantedTickers[i].Price.Change24h) diff --git a/services/markets/coinmarketcap/base.go b/services/markets/coinmarketcap/base.go index 6906b65a..01275e0b 100755 --- a/services/markets/coinmarketcap/base.go +++ b/services/markets/coinmarketcap/base.go @@ -2,12 +2,14 @@ package coinmarketcap import ( "encoding/json" + log "github.com/sirupsen/logrus" + "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" ) const ( - id = "coinmarketcap" + id = watchmarket.CoinMarketCap ) type Provider struct { diff --git a/services/markets/coinmarketcap/base_test.go b/services/markets/coinmarketcap/base_test.go index 51cf6e11..fc9f541b 100755 --- a/services/markets/coinmarketcap/base_test.go +++ b/services/markets/coinmarketcap/base_test.go @@ -5,6 +5,8 @@ import ( "net/http" "testing" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/stretchr/testify/assert" "github.com/trustwallet/golibs/mock" "github.com/trustwallet/watchmarket/services/assets" @@ -33,14 +35,14 @@ func TestInitProvider(t *testing.T) { assert.Equal(t, "web.api", provider.client.webApi.BaseUrl) assert.Equal(t, "widget.api", provider.client.widgetApi.BaseUrl) assert.Equal(t, "USD", provider.currency) - assert.Equal(t, "coinmarketcap", provider.id) + assert.Equal(t, watchmarket.CoinMarketCap, provider.id) assert.Less(t, 1, len(provider.Cm)) } func TestProvider_GetProvider(t *testing.T) { provider := InitProvider("pro.api", "web.api", "widget.api", "key", "USD", assets.Init("assets.api")) - assert.Equal(t, "coinmarketcap", provider.GetProvider()) + assert.Equal(t, watchmarket.CoinMarketCap, provider.GetProvider()) } func createMockedAPI() http.Handler { diff --git a/services/markets/coinmarketcap/client.go b/services/markets/coinmarketcap/client.go index 0080400f..ce959f92 100755 --- a/services/markets/coinmarketcap/client.go +++ b/services/markets/coinmarketcap/client.go @@ -24,8 +24,8 @@ func NewClient(proApi, webApi, widgetApi, key string) Client { return c } -func (c Client) fetchPrices(currency string) (result CoinPrices, err error) { - params := url.Values{"limit": {"5000"}, "convert": {currency}} +func (c Client) fetchPrices(currency, cryptocurrencyType string) (result CoinPrices, err error) { + params := url.Values{"limit": {"5000"}, "convert": {currency}, "cryptocurrency_type": {cryptocurrencyType}} err = c.proApi.Get(&result, "/v1/cryptocurrency/listings/latest", params) return } diff --git a/services/markets/coinmarketcap/mocks/rates.json b/services/markets/coinmarketcap/mocks/rates.json index 43e99a0d..23d2f110 100644 --- a/services/markets/coinmarketcap/mocks/rates.json +++ b/services/markets/coinmarketcap/mocks/rates.json @@ -1,107 +1,142 @@ [ { - "currency": "BTC", - "percent_change_24h": 5.47477, - "provider": "coinmarketcap", - "rate": 9862.53985763, - "timestamp": 1588890514 + "currency":"BTC", + "percent_change_24h":5.47477, + "provider":"coinmarketcap", + "rate":9862.53985763, + "timestamp":1588890514 }, { - "currency": "ETH", - "percent_change_24h": 2.48595, - "provider": "coinmarketcap", - "rate": 213.544073721, - "timestamp": 1588890505 + "currency":"ETH", + "percent_change_24h":2.48595, + "provider":"coinmarketcap", + "rate":213.544073721, + "timestamp":1588890505 }, { - "currency": "XRP", - "percent_change_24h": 0.191592, - "provider": "coinmarketcap", - "rate": 0.2190265248, - "timestamp": 1588890545 + "currency":"XRP", + "percent_change_24h":0.191592, + "provider":"coinmarketcap", + "rate":0.2190265248, + "timestamp":1588890545 }, { - "currency": "BCH", - "percent_change_24h": 1.42361, - "provider": "coinmarketcap", - "rate": 253.196839314, - "timestamp": 1588890547 + "currency":"USDT", + "percent_change_24h":-0.498649, + "provider":"coinmarketcap", + "rate":1.005833132, + "timestamp":1588890502 }, { - "currency": "BSV", - "percent_change_24h": 0.471004, - "provider": "coinmarketcap", - "rate": 210.045381795, - "timestamp": 1588890553 + "currency":"BCH", + "percent_change_24h":1.42361, + "provider":"coinmarketcap", + "rate":253.196839314, + "timestamp":1588890547 }, { - "currency": "LTC", - "percent_change_24h": 1.09024, - "provider": "coinmarketcap", - "rate": 47.5118592612, - "timestamp": 1588890544 + "currency":"BSV", + "percent_change_24h":0.471004, + "provider":"coinmarketcap", + "rate":210.045381795, + "timestamp":1588890553 }, { - "currency": "BNB", - "percent_change_24h": 0.906496, - "provider": "coinmarketcap", - "rate": 17.1140649277, - "timestamp": 1588890547 + "currency":"LTC", + "percent_change_24h":1.09024, + "provider":"coinmarketcap", + "rate":47.5118592612, + "timestamp":1588890544 }, { - "currency": "EOS", - "percent_change_24h": -0.562061, - "provider": "coinmarketcap", - "rate": 2.7625045765, - "timestamp": 1588890546 + "currency":"BNB", + "percent_change_24h":0.906496, + "provider":"coinmarketcap", + "rate":17.1140649277, + "timestamp":1588890547 }, { - "currency": "XTZ", - "percent_change_24h": 1.86731, - "provider": "coinmarketcap", - "rate": 2.7897718177, - "timestamp": 1588890547 + "currency":"EOS", + "percent_change_24h":-0.562061, + "provider":"coinmarketcap", + "rate":2.7625045765, + "timestamp":1588890546 }, { - "currency": "XLM", - "percent_change_24h": 0.655066, - "provider": "coinmarketcap", - "rate": 0.0728177647, - "timestamp": 1588890545 + "currency":"XTZ", + "percent_change_24h":1.86731, + "provider":"coinmarketcap", + "rate":2.7897718177, + "timestamp":1588890547 }, { - "currency": "ADA", - "percent_change_24h": 0.826166, - "provider": "coinmarketcap", - "rate": 0.0510633352, - "timestamp": 1588890547 + "currency":"XLM", + "percent_change_24h":0.655066, + "provider":"coinmarketcap", + "rate":0.0728177647, + "timestamp":1588890545 }, { - "currency": "XMR", - "percent_change_24h": 6.70904, - "provider": "coinmarketcap", - "rate": 63.6958970684, - "timestamp": 1588890543 + "currency":"ADA", + "percent_change_24h":0.826166, + "provider":"coinmarketcap", + "rate":0.0510633352, + "timestamp":1588890547 }, { - "currency": "TRX", - "percent_change_24h": 0.328149, - "provider": "coinmarketcap", - "rate": 0.0161019012, - "timestamp": 1588890547 + "currency":"LINK", + "percent_change_24h":2.4664, + "provider":"coinmarketcap", + "rate":3.7792003438, + "timestamp":1588890547 }, { - "currency": "ETC", - "percent_change_24h": -0.447855, - "provider": "coinmarketcap", - "rate": 7.1517170166, - "timestamp": 1588890544 + "currency":"XMR", + "percent_change_24h":6.70904, + "provider":"coinmarketcap", + "rate":63.6958970684, + "timestamp":1588890543 }, { - "currency": "DASH", - "percent_change_24h": -0.531529, - "provider": "coinmarketcap", - "rate": 79.2516409705, - "timestamp": 1588890544 + "currency":"CRO", + "percent_change_24h":1.58403, + "provider":"coinmarketcap", + "rate":0.066128997, + "timestamp":1588890552 + }, + { + "currency":"TRX", + "percent_change_24h":0.328149, + "provider":"coinmarketcap", + "rate":0.0161019012, + "timestamp":1588890547 + }, + { + "currency":"LEO", + "percent_change_24h":-0.475802, + "provider":"coinmarketcap", + "rate":1.0642871664, + "timestamp":1588890553 + }, + { + "currency":"HT", + "percent_change_24h":-0.303191, + "provider":"coinmarketcap", + "rate":4.2165442726, + "timestamp":1588890550 + }, + { + "currency":"ETC", + "percent_change_24h":-0.447855, + "provider":"coinmarketcap", + "rate":7.1517170166, + "timestamp":1588890544 + }, + { + "currency":"DASH", + "percent_change_24h":-0.531529, + "provider":"coinmarketcap", + "rate":79.2516409705, + "timestamp":1588890544 } -] +] \ No newline at end of file diff --git a/services/markets/coinmarketcap/rates.go b/services/markets/coinmarketcap/rates.go index bef65d55..c7195df6 100755 --- a/services/markets/coinmarketcap/rates.go +++ b/services/markets/coinmarketcap/rates.go @@ -7,7 +7,7 @@ import ( ) func (p Provider) GetRates() (rates watchmarket.Rates, err error) { - prices, err := p.client.fetchPrices(p.currency) + prices, err := p.client.fetchPrices(p.currency, "coins") if err != nil { return } @@ -17,14 +17,10 @@ func (p Provider) GetRates() (rates watchmarket.Rates, err error) { func normalizeRates(prices CoinPrices, provider string) watchmarket.Rates { var ( - result watchmarket.Rates - emptyPlatform Platform + result watchmarket.Rates ) for _, price := range prices.Data { - if price.Platform != emptyPlatform { - continue - } result = append(result, watchmarket.Rate{ Currency: strings.ToUpper(price.Symbol), Rate: watchmarket.TruncateWithPrecision(price.Quote.USD.Price, watchmarket.DefaultPrecision), diff --git a/services/markets/coinmarketcap/tickers.go b/services/markets/coinmarketcap/tickers.go index f2e8fc8b..859abf19 100755 --- a/services/markets/coinmarketcap/tickers.go +++ b/services/markets/coinmarketcap/tickers.go @@ -9,7 +9,7 @@ import ( ) func (p Provider) GetTickers() (watchmarket.Tickers, error) { - prices, err := p.client.fetchPrices(p.currency) + prices, err := p.client.fetchPrices(p.currency, "all") if err != nil { return nil, err } diff --git a/services/markets/coinmarketcap/tickers_test.go b/services/markets/coinmarketcap/tickers_test.go index 23e610f8..a022fb6f 100755 --- a/services/markets/coinmarketcap/tickers_test.go +++ b/services/markets/coinmarketcap/tickers_test.go @@ -30,7 +30,7 @@ func TestProvider_GetTickers(t *testing.T) { Price: watchmarket.Price{ Change24h: 5.47477, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 9862.53985763, }, LastUpdate: time.Time{}, @@ -84,7 +84,7 @@ func Test_normalizeTickers(t *testing.T) { Value: 223.55, Change24h: 10, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, }, }, watchmarket.Ticker{Coin: watchmarket.UnknownCoinID, CoinName: "ETH", CoinType: watchmarket.Coin, LastUpdate: time.Unix(333, 0), @@ -92,7 +92,7 @@ func Test_normalizeTickers(t *testing.T) { Value: 11.11, Change24h: 20, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, }, }, watchmarket.Ticker{Coin: watchmarket.UnknownCoinID, CoinName: "ETH", TokenId: "0x8ce9137d39326ad0cd6491fb5cc0cba0e089b6a9", CoinType: watchmarket.Token, LastUpdate: time.Unix(444, 0), @@ -100,7 +100,7 @@ func Test_normalizeTickers(t *testing.T) { Value: 463.22, Change24h: -3, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, }, }, watchmarket.Ticker{Coin: 1023, CoinName: "ONE", CoinType: watchmarket.Coin, LastUpdate: time.Unix(555, 0), @@ -108,7 +108,7 @@ func Test_normalizeTickers(t *testing.T) { Value: 123.09, Change24h: -1.4, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, }, }, }, diff --git a/services/markets/fixer/base_test.go b/services/markets/fixer/base_test.go index 47019353..1912e703 100755 --- a/services/markets/fixer/base_test.go +++ b/services/markets/fixer/base_test.go @@ -5,6 +5,8 @@ import ( "net/http" "testing" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/stretchr/testify/assert" "github.com/trustwallet/golibs/mock" ) @@ -19,13 +21,13 @@ func TestInitProvider(t *testing.T) { assert.NotNil(t, provider) assert.Equal(t, "demo.api", provider.client.client.BaseUrl) assert.Equal(t, "key", provider.client.key) - assert.Equal(t, "fixer", provider.id) + assert.Equal(t, watchmarket.Fixer, provider.id) assert.Equal(t, "USD", provider.currency) } func TestProvider_GetProvider(t *testing.T) { provider := InitProvider("demo.api", "key", "USD") - assert.Equal(t, "fixer", provider.GetProvider()) + assert.Equal(t, watchmarket.Fixer, provider.GetProvider()) } func createMockedAPI() http.Handler { diff --git a/services/markets/fixer/rates.go b/services/markets/fixer/rates.go index 6cefc8af..bb4a75b8 100755 --- a/services/markets/fixer/rates.go +++ b/services/markets/fixer/rates.go @@ -7,7 +7,7 @@ import ( ) const ( - id = "fixer" + id = watchmarket.Fixer ) func (p Provider) GetRates() (watchmarket.Rates, error) { diff --git a/services/markets/fixer/rates_test.go b/services/markets/fixer/rates_test.go index fa136d9e..a8599319 100755 --- a/services/markets/fixer/rates_test.go +++ b/services/markets/fixer/rates_test.go @@ -26,7 +26,7 @@ func TestProvider_GetRates(t *testing.T) { } func Test_normalizeRates(t *testing.T) { - provider := "fixer" + provider := watchmarket.Fixer tests := []struct { name string latest Rate diff --git a/services/markets/markets_test.go b/services/markets/markets_test.go index 7cfd9f38..bb77bf46 100755 --- a/services/markets/markets_test.go +++ b/services/markets/markets_test.go @@ -1,10 +1,12 @@ package markets import ( + "testing" + "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/assets" - "testing" ) func TestInit(t *testing.T) { @@ -20,13 +22,13 @@ func TestInit(t *testing.T) { assert.Equal(t, 3, len(apis.RatesAPIs)) assert.Equal(t, 2, len(apis.TickersAPIs)) - assert.Equal(t, "coingecko", apis.ChartsAPIs["coingecko"].GetProvider()) - assert.Equal(t, "coinmarketcap", apis.ChartsAPIs["coinmarketcap"].GetProvider()) + assert.Equal(t, watchmarket.CoinGecko, apis.ChartsAPIs[watchmarket.CoinGecko].GetProvider()) + assert.Equal(t, watchmarket.CoinMarketCap, apis.ChartsAPIs[watchmarket.CoinMarketCap].GetProvider()) - assert.Equal(t, "fixer", apis.RatesAPIs["fixer"].GetProvider()) - assert.Equal(t, "coinmarketcap", apis.RatesAPIs["coinmarketcap"].GetProvider()) - assert.Equal(t, "coingecko", apis.RatesAPIs["coingecko"].GetProvider()) + assert.Equal(t, watchmarket.Fixer, apis.RatesAPIs[watchmarket.Fixer].GetProvider()) + assert.Equal(t, watchmarket.CoinMarketCap, apis.RatesAPIs[watchmarket.CoinMarketCap].GetProvider()) + assert.Equal(t, watchmarket.CoinGecko, apis.RatesAPIs[watchmarket.CoinGecko].GetProvider()) - assert.Equal(t, "coinmarketcap", apis.TickersAPIs["coinmarketcap"].GetProvider()) - assert.Equal(t, "coingecko", apis.TickersAPIs["coingecko"].GetProvider()) + assert.Equal(t, watchmarket.CoinMarketCap, apis.TickersAPIs[watchmarket.CoinMarketCap].GetProvider()) + assert.Equal(t, watchmarket.CoinGecko, apis.TickersAPIs[watchmarket.CoinGecko].GetProvider()) } diff --git a/services/worker/memory.go b/services/worker/memory.go index bc4991da..bdfa0e8d 100644 --- a/services/worker/memory.go +++ b/services/worker/memory.go @@ -107,7 +107,7 @@ func createRatesMap(allRates []models.Rate, configuration config.Configuration) m[key] = fromModelToRate(rate) continue } - if rate.Provider == "fixer" { + if rate.Provider == watchmarket.Fixer { if !watchmarket.IsFiatRate(key) { continue } diff --git a/services/worker/memory_test.go b/services/worker/memory_test.go index 48422113..e48b34dc 100644 --- a/services/worker/memory_test.go +++ b/services/worker/memory_test.go @@ -2,10 +2,11 @@ package worker import ( "encoding/json" - "github.com/trustwallet/watchmarket/services/controllers" "testing" "time" + "github.com/trustwallet/watchmarket/services/controllers" + "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db/models" @@ -28,7 +29,7 @@ func testRatesBasic(t *testing.T, c config.Configuration) { dbMock.WantedRates = []models.Rate{ { Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, PercentChange24h: 1, Rate: 1, ShowOption: 0, @@ -36,7 +37,7 @@ func testRatesBasic(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, PercentChange24h: 2, Rate: 2, ShowOption: 0, @@ -44,7 +45,7 @@ func testRatesBasic(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "fixer", + Provider: watchmarket.Fixer, PercentChange24h: 11, Rate: 1.5, ShowOption: 0, @@ -62,7 +63,7 @@ func testRatesBasic(t *testing.T, c config.Configuration) { assert.Equal(t, watchmarket.Rate{ Currency: "USD", PercentChange24h: 11, - Provider: "fixer", + Provider: watchmarket.Fixer, Rate: 1.5, Timestamp: now.Unix(), }, res) @@ -74,7 +75,7 @@ func testRatesShowOptionAlways(t *testing.T, c config.Configuration) { dbMock.WantedRates = []models.Rate{ { Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, PercentChange24h: 1, Rate: 1, ShowOption: 0, @@ -82,7 +83,7 @@ func testRatesShowOptionAlways(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, PercentChange24h: 2, Rate: 2, ShowOption: 0, @@ -90,7 +91,7 @@ func testRatesShowOptionAlways(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "fixer", + Provider: watchmarket.Fixer, PercentChange24h: 11, Rate: 1.5, ShowOption: models.NeverShow, @@ -108,7 +109,7 @@ func testRatesShowOptionAlways(t *testing.T, c config.Configuration) { assert.Equal(t, watchmarket.Rate{ Currency: "USD", PercentChange24h: 1, - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Rate: 1, Timestamp: now.Unix(), }, res2) @@ -120,7 +121,7 @@ func testRatesShowOptionNever(t *testing.T, c config.Configuration) { dbMock.WantedRates = []models.Rate{ { Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, PercentChange24h: 1, Rate: 1, ShowOption: 0, @@ -128,7 +129,7 @@ func testRatesShowOptionNever(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, PercentChange24h: 2, Rate: 2, ShowOption: models.AlwaysShow, @@ -136,7 +137,7 @@ func testRatesShowOptionNever(t *testing.T, c config.Configuration) { }, { Currency: "USD", - Provider: "fixer", + Provider: watchmarket.Fixer, PercentChange24h: 11, Rate: 1.5, ShowOption: 0, @@ -154,7 +155,7 @@ func testRatesShowOptionNever(t *testing.T, c config.Configuration) { assert.Equal(t, watchmarket.Rate{ Currency: "USD", PercentChange24h: 2, - Provider: "coingecko", + Provider: watchmarket.CoinGecko, Rate: 2, Timestamp: now.Unix(), }, res3) @@ -179,7 +180,7 @@ func testTickersBasic(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, ShowOption: 0, Coin: 1, TokenId: "", @@ -190,7 +191,7 @@ func testTickersBasic(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, ShowOption: 0, Coin: 1, TokenId: "", @@ -213,7 +214,7 @@ func testTickersBasic(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 11, }, LastUpdate: res.LastUpdate, @@ -228,7 +229,7 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, ShowOption: 2, Coin: 1, TokenId: "", @@ -239,7 +240,7 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, ShowOption: 0, Coin: 1, TokenId: "", @@ -250,7 +251,7 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Coin: 1, TokenId: "", Change24h: 1, @@ -273,7 +274,7 @@ func testTickersShowOptionNever(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 14, }, LastUpdate: res.LastUpdate, @@ -288,7 +289,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, ShowOption: 2, Coin: 1, TokenId: "", @@ -299,7 +300,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, ShowOption: 0, Coin: 1, TokenId: "", @@ -310,7 +311,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Coin: 1, TokenId: "", Change24h: 1, @@ -333,7 +334,7 @@ func testTickersShowOptionAlways(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 14, }, LastUpdate: res.LastUpdate, @@ -348,7 +349,7 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, ShowOption: 2, Coin: 1, TokenId: "", @@ -359,7 +360,7 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, ShowOption: 0, Coin: 1, TokenId: "", @@ -370,7 +371,7 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Coin: 1, TokenId: "", Change24h: 1, @@ -393,7 +394,7 @@ func testTickersOutdated(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 14, }, LastUpdate: res.LastUpdate, @@ -409,7 +410,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, ShowOption: 2, Coin: 1, TokenId: "", @@ -420,7 +421,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coingecko", + Provider: watchmarket.CoinGecko, ShowOption: 0, Coin: 1, TokenId: "", @@ -431,7 +432,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { { ID: "c1", Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Coin: 1, TokenId: "", Change24h: 1, @@ -455,7 +456,7 @@ func testTickersVolume(t *testing.T, c config.Configuration) { Price: watchmarket.Price{ Change24h: 1, Currency: "USD", - Provider: "coinmarketcap", + Provider: watchmarket.CoinMarketCap, Value: 14, }, LastUpdate: res.LastUpdate, diff --git a/services/worker/models.go b/services/worker/models.go index 959ae370..704a11a0 100644 --- a/services/worker/models.go +++ b/services/worker/models.go @@ -1,11 +1,12 @@ package worker import ( + "sync" + "time" + "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" - "sync" - "time" ) type ( @@ -68,7 +69,7 @@ func toTickersModel(tickers watchmarket.Tickers) []models.Ticker { } func toRatesModel(rates watchmarket.Rates) []models.Rate { - result := make([]models.Rate, 0, len(rates)) + result := make([]models.Rate, 0) for _, r := range rates { result = append(result, models.Rate{ Currency: r.Currency, diff --git a/services/worker/rates.go b/services/worker/rates.go index c864f28e..031daa61 100644 --- a/services/worker/rates.go +++ b/services/worker/rates.go @@ -11,13 +11,31 @@ import ( func (w Worker) FetchAndSaveRates() { log.Info("Fetching Rates ...") fetchedRates := fetchRates(w.ratesApis) - normalizedRates := toRatesModel(fetchedRates) + + allowCryptoCurrency := make(map[string]bool) + for _, r := range w.configuration.Markets.Priority.RatesAllow { + allowCryptoCurrency[r] = true + } + + rates := FilterRates(fetchedRates, allowCryptoCurrency) + + normalizedRates := toRatesModel(rates) if err := w.db.AddRates(normalizedRates); err != nil { log.Error(err) } } +func FilterRates(rates []watchmarket.Rate, cryptoCurrency map[string]bool) []watchmarket.Rate { + result := make([]watchmarket.Rate, 0) + for _, rate := range rates { + if rate.Provider == watchmarket.Fixer || cryptoCurrency[rate.Currency] { + result = append(result, rate) + } + } + return result +} + func fetchRates(ratesApis markets.RatesAPIs) watchmarket.Rates { wg := new(sync.WaitGroup) s := new(rates) diff --git a/services/worker/rates_test.go b/services/worker/rates_test.go new file mode 100644 index 00000000..5d883436 --- /dev/null +++ b/services/worker/rates_test.go @@ -0,0 +1,70 @@ +package worker + +import ( + "reflect" + "testing" + + "github.com/trustwallet/watchmarket/pkg/watchmarket" +) + +func TestFilterRates(t *testing.T) { + type args struct { + rates []watchmarket.Rate + cryptoCurrency map[string]bool + } + tests := []struct { + name string + args args + want []watchmarket.Rate + }{ + { + "Test only include allow rates", + args{ + rates: []watchmarket.Rate{ + { + Currency: "USD", + Provider: watchmarket.Fixer, + }, + { + Currency: "BTC", + Provider: watchmarket.CoinMarketCap, + }, + { + Currency: "TRX", + Provider: watchmarket.CoinGecko, + }, + { + Currency: "RU", + Provider: watchmarket.CoinGecko, + }, + { + Currency: "ETH", + Provider: watchmarket.CoinGecko, + }, + }, + cryptoCurrency: map[string]bool{"BTC": true, "ETH": true}, + }, + []watchmarket.Rate{ + { + Currency: "USD", + Provider: watchmarket.Fixer, + }, + { + Currency: "BTC", + Provider: watchmarket.CoinMarketCap, + }, + { + Currency: "ETH", + Provider: watchmarket.CoinGecko, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := FilterRates(tt.args.rates, tt.args.cryptoCurrency); !reflect.DeepEqual(got, tt.want) { + t.Errorf("FilterRates() = %v, want %v", got, tt.want) + } + }) + } +} From b85980ecf249c7a6efe2f75897d101be80b3d011 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Thu, 25 Mar 2021 02:50:53 +0800 Subject: [PATCH 87/96] Add MATIC (BEP20) (#432) https://bscscan.com/token/0xcc42724c6683b7e57334c4e856f4c9965ed682bd https://coinmarketcap.com/currencies/polygon/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 21ba10d7..584aa4a5 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -7833,6 +7833,12 @@ const Mapping = `[ "token_id": "MATIC-84A", "id": 3890 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", + "id": 3890 + }, { "coin": 714, "type": "token", From 4f0124bbb340f85cffa917afe6f99ada575d0732 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 25 Mar 2021 15:36:02 +0700 Subject: [PATCH 88/96] Remove database requests (#425) * Remove db from api * Clean code * Improve errors * Remove flaky tests * Clean code --- cmd/api/main.go | 4 +- services/controllers/charts/base.go | 29 +-- services/controllers/charts/base_test.go | 227 ----------------- services/controllers/info/base.go | 62 ++--- services/controllers/info/base_test.go | 182 -------------- services/controllers/rates/base.go | 46 +--- services/controllers/tickers/base.go | 99 +------- services/controllers/tickers/base_test.go | 249 ------------------- services/controllers/tickers/rates_test.go | 55 ---- services/controllers/tickers/tickers_test.go | 94 ------- 10 files changed, 36 insertions(+), 1011 deletions(-) delete mode 100644 services/controllers/charts/base_test.go delete mode 100644 services/controllers/info/base_test.go delete mode 100644 services/controllers/tickers/base_test.go delete mode 100644 services/controllers/tickers/rates_test.go delete mode 100644 services/controllers/tickers/tickers_test.go diff --git a/cmd/api/main.go b/cmd/api/main.go index 3f9a0f5c..443938a2 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -89,8 +89,8 @@ func init() { log.Fatal(err) } - charts = chartscontroller.NewController(redisCache, memoryCache, database, chartsPriority, m.ChartsAPIs, configuration) - info = infocontroller.NewController(database, memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) + charts = chartscontroller.NewController(redisCache, memoryCache, chartsPriority, m.ChartsAPIs) + info = infocontroller.NewController(memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) tickers = tickerscontroller.NewController(database, memoryCache, ratesPriority, tickerPriority, configuration) rates = ratescontroller.NewController(database, memoryCache, ratesPriority, configuration) } diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index 91d1e5ff..61e417aa 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -5,12 +5,10 @@ import ( "errors" "fmt" "github.com/trustwallet/golibs/asset" - "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db/models" "strings" log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -22,33 +20,26 @@ const charts = "charts" type Controller struct { redisCache cache.Provider memoryCache cache.Provider - database db.Instance availableProviders []string api markets.ChartsAPIs - useMemoryCache bool } func NewController( redisCache cache.Provider, memoryCache cache.Provider, - database db.Instance, chartsPriority []string, api markets.ChartsAPIs, - configuration config.Configuration, ) Controller { return Controller{ redisCache, memoryCache, - database, chartsPriority, api, - configuration.RestAPI.UseMemoryCache, } } // ChartsController interface implementation func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart watchmarket.Chart, err error) { - if !c.hasTickers(request.Asset) { return chart, nil } @@ -73,25 +64,11 @@ func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart } func (c Controller) hasTickers(assetData controllers.Asset) bool { - var tickers []models.Ticker - var err error - - if c.useMemoryCache { - if tickers, err = c.getChartsFromMemory(assetData); err != nil { - return false - } + if tickers, err := c.getChartsFromMemory(assetData); err != nil { + return false } else { - dbTickers, err := c.database.GetTickers([]controllers.Asset{assetData}) - if err != nil { - return false - } - for _, t := range dbTickers { - if t.ShowOption != 2 { // TODO: 2 to constants - tickers = append(tickers, t) - } - } + return len(tickers) > 0 } - return len(tickers) > 0 } func (c Controller) getChartsFromApi(data controllers.ChartRequest) (ch watchmarket.Chart, err error) { diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go deleted file mode 100644 index 03fd6413..00000000 --- a/services/controllers/charts/base_test.go +++ /dev/null @@ -1,227 +0,0 @@ -package chartscontroller - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/cache" - "github.com/trustwallet/watchmarket/services/controllers" - "github.com/trustwallet/watchmarket/services/markets" -) - -func TestController_HandleChartsRequest(t *testing.T) { - rate := models.Rate{ - Currency: "USD", - PercentChange24h: 1, - Provider: watchmarket.CoinMarketCap, - Rate: 1, - LastUpdated: time.Now(), - } - rate2 := models.Rate{ - Currency: "USD", - PercentChange24h: 2, - Provider: watchmarket.CoinGecko, - Rate: 2, - LastUpdated: time.Now(), - } - rate3 := models.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: watchmarket.Fixer, - Rate: 6, - LastUpdated: time.Now(), - } - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - } - - ticker714ACG := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - } - - ticker714ABNB := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} - db.WantedRatesError = nil - db.WantedRates = []models.Rate{rate, rate2, rate3} - - wCharts := watchmarket.Chart{Provider: watchmarket.CoinMarketCap, Error: "", Prices: []watchmarket.ChartPrice{{Price: 1, Date: 1}, {Price: 3, Date: 3}}} - cm := getChartsMock() - cm.wantedCharts = wCharts - - c := setupController(t, db, getCacheMock(), cm) - assert.NotNil(t, c) - - chart, err := c.HandleChartsRequest(controllers.ChartRequest{ - Asset: controllers.Asset{ - CoinId: 60, - TokenId: "a", - }, - Currency: "USD", - TimeStart: 1577871126, - MaxItems: 64, - }) - assert.Nil(t, err) - - assert.Equal(t, wCharts, chart) -} - -func TestNewController(t *testing.T) { - assert.NotNil(t, setupController(t, getDbMock(), getCacheMock(), getChartsMock())) -} - -func setupController(t *testing.T, d dbMock, ch cache.Provider, cm chartsMock) Controller { - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - c.RestAPI.UseMemoryCache = false - - chartsPriority := []string{watchmarket.CoinMarketCap} - - chartsAPIs := make(markets.ChartsAPIs, 1) - chartsAPIs[cm.GetProvider()] = cm - - controller := NewController(ch, ch, d, chartsPriority, chartsAPIs, c) - assert.NotNil(t, controller) - return controller - -} -func getDbMock() dbMock { - return dbMock{} -} - -type dbMock struct { - WantedRates []models.Rate - WantedTickers []models.Ticker - WantedTickersError error - WantedRatesError error -} - -func (d dbMock) GetRates(currency string) ([]models.Rate, error) { - res := make([]models.Rate, 0) - for _, r := range d.WantedRates { - if r.Currency == currency { - res = append(res, r) - } - } - return res, d.WantedRatesError -} - -func (d dbMock) AddRates(rates []models.Rate) error { - return nil -} - -func (d dbMock) AddTickers(tickers []models.Ticker) error { - return nil -} - -func (d dbMock) GetAllTickers() ([]models.Ticker, error) { - return nil, nil -} - -func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) GetAllRates() ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func getCacheMock() cache.Provider { - i := cacheMock{} - return i -} - -type cacheMock struct { -} - -func (c cacheMock) GetID() string { - return "" -} - -func (c cacheMock) GenerateKey(data string) string { - return "" -} - -func (c cacheMock) Get(key string) ([]byte, error) { - return nil, nil -} - -func (c cacheMock) Set(key string, data []byte) error { - return nil -} - -func (c cacheMock) GetWithTime(key string, time int64) ([]byte, error) { - return nil, nil -} - -func (c cacheMock) SetWithTime(key string, data []byte, time int64) error { - return nil -} - -func (c cacheMock) GetLenOfSavedItems() int { - return 0 -} - -func getChartsMock() chartsMock { - cm := chartsMock{} - return cm -} - -type chartsMock struct { - wantedCharts watchmarket.Chart - wantedDetails watchmarket.CoinDetails -} - -func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { - return cm.wantedCharts, nil -} - -func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { - return cm.wantedDetails, nil -} - -func (cm chartsMock) GetProvider() string { - return watchmarket.CoinMarketCap -} diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 1a4daef2..0969f713 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -5,18 +5,17 @@ import ( "errors" "fmt" log "github.com/sirupsen/logrus" - "github.com/trustwallet/watchmarket/db" - "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/services/markets" + "strings" ) const info = "info" type Controller struct { - database db.Instance cache cache.Provider coinInfoPriority []string ratesPriority []string @@ -24,14 +23,12 @@ type Controller struct { } func NewController( - database db.Instance, cache cache.Provider, coinInfoPriority []string, ratesPriority []string, api markets.ChartsAPIs, ) Controller { return Controller{ - database, cache, coinInfoPriority, ratesPriority, @@ -84,7 +81,7 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller cachedDetails, err := c.cache.Get(key) if err != nil || len(cachedDetails) <= 0 { - return controllers.InfoResponse{}, errors.New("cache is empty") + return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) } var infoResponse controllers.InfoResponse err = json.Unmarshal(cachedDetails, &infoResponse) @@ -92,15 +89,14 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller } func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - dbTickers, err := c.database.GetTickers([]controllers.Asset{request.Asset}) - - if err != nil || len(dbTickers) == 0 { - return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) - } - - ticker, err := c.getTickerDataAccordingToPriority(dbTickers) + key := strings.ToLower(asset.BuildID(request.Asset.CoinId, request.Asset.TokenId)) + rawResult, err := c.cache.Get(key) if err != nil { - return controllers.InfoResponse{}, err + return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + } + var ticker watchmarket.Ticker + if err = json.Unmarshal(rawResult, &ticker); err != nil { + return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) } result := c.getCoinDataFromApi(request.Asset, request.Currency) result.CirculatingSupply = ticker.CirculatingSupply @@ -109,16 +105,16 @@ func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (co result.TotalSupply = ticker.TotalSupply if request.Currency != watchmarket.DefaultCurrency { - rates, err := c.database.GetRates(request.Currency) - if err != nil || len(rates) == 0 { - return controllers.InfoResponse{}, fmt.Errorf("empty db rate or db error: %w", err) - } - rate, err := c.getRateDataAccordingToPriority(rates) + rateRaw, err := c.cache.Get(request.Currency) + var rate watchmarket.Rate if err != nil { - return controllers.InfoResponse{}, err + return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + } + if err = json.Unmarshal(rateRaw, &rate); err != nil { + return result, err } - result.MarketCap *= 1 / rate - result.Vol24 *= 1 / rate + result.MarketCap *= 1 / rate.Rate + result.Vol24 *= 1 / rate.Rate } return result, nil } @@ -136,25 +132,3 @@ func (c Controller) getCoinDataFromApi(assetData controllers.Asset, currency str } return result } - -func (c Controller) getTickerDataAccordingToPriority(tickers []models.Ticker) (models.Ticker, error) { - for _, p := range c.coinInfoPriority { - for _, t := range tickers { - if t.Provider == p && t.ShowOption != models.NeverShow { - return t, nil - } - } - } - return models.Ticker{}, errors.New("bad ticker or providers") -} - -func (c Controller) getRateDataAccordingToPriority(rates []models.Rate) (float64, error) { - for _, p := range c.ratesPriority { - for _, r := range rates { - if r.Provider == p && r.ShowOption != models.NeverShow { - return r.Rate, nil - } - } - } - return 0, errors.New("bad ticker or providers") -} diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go deleted file mode 100644 index 7565c7e3..00000000 --- a/services/controllers/info/base_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package infocontroller - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/cache" - "github.com/trustwallet/watchmarket/services/controllers" - "github.com/trustwallet/watchmarket/services/markets" -) - -func TestController_HandleDetailsRequest(t *testing.T) { - cm := getChartsMock() - wantedD := watchmarket.CoinDetails{ - Provider: watchmarket.CoinMarketCap, - Info: &watchmarket.Info{ - Name: "2", - Website: "2", - SourceCode: "2", - WhitePaper: "2", - Description: "2", - ShortDescription: "2", - Research: "2", - Explorer: "2", - Socials: nil, - }, - } - cm.wantedDetails = wantedD - - db := getDbMock() - db.WantedTickers = []models.Ticker{{CirculatingSupply: 1, TotalSupply: 1, MarketCap: 1, Volume: 1, Provider: "coinmarketcap"}} - db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "coinmarketcap"}} - c := setupController(t, db, getCacheMock(), cm) - assert.NotNil(t, c) - details, err := c.HandleInfoRequest(controllers.DetailsRequest{ - Asset: controllers.Asset{ - CoinId: 0, - TokenId: "2", - }, - Currency: "RUB", - }) - assert.Nil(t, err) - assert.Equal(t, controllers.InfoResponse{ - Provider: wantedD.Provider, - ProviderURL: wantedD.ProviderURL, - Vol24: 0.1, - MarketCap: 0.1, - CirculatingSupply: 1, - TotalSupply: 1, - Info: wantedD.Info, - }, details) -} - -func TestNewController(t *testing.T) { - assert.NotNil(t, setupController(t, getDbMock(), getCacheMock(), getChartsMock())) -} - -func setupController(t *testing.T, db dbMock, ch cache.Provider, cm chartsMock) Controller { - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - - ratesPriority := []string{"coinmarketcap"} - coinInfoPriority := []string{"coinmarketcap"} - - chartsAPIs := make(markets.ChartsAPIs, 1) - chartsAPIs[cm.GetProvider()] = cm - - controller := NewController(db, ch, coinInfoPriority, ratesPriority, chartsAPIs) - assert.NotNil(t, controller) - return controller - -} - -func getCacheMock() cache.Provider { - i := cacheMock{} - return i -} - -type cacheMock struct { -} - -func (c cacheMock) GetID() string { - return "" -} - -func (c cacheMock) GenerateKey(data string) string { - return "" -} - -func (c cacheMock) Get(key string) ([]byte, error) { - return nil, nil -} - -func (c cacheMock) Set(key string, data []byte) error { - return nil -} - -func (c cacheMock) GetWithTime(key string, time int64) ([]byte, error) { - return nil, nil -} - -func (c cacheMock) SetWithTime(key string, data []byte, time int64) error { - return nil -} - -func (c cacheMock) GetLenOfSavedItems() int { - return 0 -} - -func getChartsMock() chartsMock { - cm := chartsMock{} - return cm -} - -type chartsMock struct { - wantedCharts watchmarket.Chart - wantedDetails watchmarket.CoinDetails -} - -func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { - return cm.wantedCharts, nil -} - -func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { - return cm.wantedDetails, nil -} - -func (cm chartsMock) GetProvider() string { - return "coinmarketcap" -} - -func getDbMock() dbMock { - return dbMock{} -} - -type dbMock struct { - WantedRates []models.Rate - WantedTickers []models.Ticker - WantedTickersError error - WantedRatesError error -} - -func (d dbMock) GetRates(currency string) ([]models.Rate, error) { - res := make([]models.Rate, 0) - for _, r := range d.WantedRates { - if r.Currency == currency { - res = append(res, r) - } - } - return res, d.WantedRatesError -} - -func (d dbMock) AddRates(rates []models.Rate) error { - return nil -} - -func (d dbMock) AddTickers(tickers []models.Ticker) error { - return nil -} - -func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) GetAllTickers() ([]models.Ticker, error) { - return nil, nil -} - -func (d dbMock) GetAllRates() ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} - -func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} diff --git a/services/controllers/rates/base.go b/services/controllers/rates/base.go index 0a3a24fd..adf9f653 100644 --- a/services/controllers/rates/base.go +++ b/services/controllers/rates/base.go @@ -4,10 +4,8 @@ import ( "encoding/json" "errors" - log "github.com/sirupsen/logrus" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" - "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -67,45 +65,13 @@ func (c Controller) GetFiatRates() (controllers.FiatRates, error) { } func (c Controller) getRateByCurrency(currency string) (watchmarket.Rate, error) { - if c.configuration.RestAPI.UseMemoryCache { - rawResult, err := c.dataCache.Get(currency) - if err != nil { - return watchmarket.Rate{}, err - } - var result watchmarket.Rate - if err = json.Unmarshal(rawResult, &result); err != nil { - return watchmarket.Rate{}, err - } - return result, nil - } - emptyRate := watchmarket.Rate{} - rates, err := c.database.GetRates(currency) + rawResult, err := c.dataCache.Get(currency) if err != nil { - log.Error(err, "getRateByPriority") - return emptyRate, err + return watchmarket.Rate{}, err } - - providers := c.ratesPriority - var result models.Rate -ProvidersLoop: - for _, p := range providers { - for _, r := range rates { - if p == r.Provider { - result = r - break ProvidersLoop - } - } + var result watchmarket.Rate + if err = json.Unmarshal(rawResult, &result); err != nil { + return watchmarket.Rate{}, err } - - if result.Currency == "" || result.Rate == 0 { - return emptyRate, errors.New(watchmarket.ErrNotFound) - } - - return watchmarket.Rate{ - Currency: result.Currency, - PercentChange24h: result.PercentChange24h, - Provider: result.Provider, - Rate: result.Rate, - Timestamp: result.LastUpdated.Unix(), - }, nil + return result, nil } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 547cd805..4dd526b4 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -8,14 +8,12 @@ import ( "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" - "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" ) type Controller struct { - database db.Instance cache cache.Provider ratesPriority []string tickersPriority []string @@ -29,7 +27,6 @@ func NewController( configuration config.Configuration, ) Controller { return Controller{ - database, cache, ratesPriority, tickersPriority, @@ -38,12 +35,12 @@ func NewController( } func (c Controller) HandleTickersRequest(request controllers.TickerRequest) (watchmarket.Tickers, error) { - rate, err := c.getRateByPriority(strings.ToUpper(request.Currency)) + rate, err := c.getCacheRate(strings.ToUpper(request.Currency)) if err != nil { return watchmarket.Tickers{}, errors.New(watchmarket.ErrNotFound) } - tickers, err := c.getTickersByPriority(request.Assets) + tickers, err := c.getCacheTickers(request.Assets) if err != nil { return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) } @@ -66,90 +63,9 @@ func (c Controller) filterTickers(tickers watchmarket.Tickers, rate watchmarket. return result } -func (c Controller) getTickersByPriority(assets []controllers.Asset) (watchmarket.Tickers, error) { - if result, err := c.getCachedTickers(assets); err == nil { - return result, nil - } - tickers, err := c.database.GetTickers(assets) - if err != nil { - return nil, err - } - result := make(watchmarket.Tickers, 0) - for _, assetData := range assets { - ticker := findBestTicker(assetData, tickers, c.tickersPriority, c.configuration) - if ticker == nil { - continue - } - result = append(result, watchmarket.Ticker{ - Coin: ticker.Coin, - CoinName: ticker.CoinName, - CoinType: watchmarket.CoinType(ticker.CoinType), - LastUpdate: ticker.LastUpdated, - Price: watchmarket.Price{ - Change24h: ticker.Change24h, - Currency: ticker.Currency, - Provider: ticker.Provider, - Value: ticker.Value, - }, - TokenId: assetData.TokenId, - }) - } - - return result, nil -} - -func findBestTicker(assetData controllers.Asset, tickers []models.Ticker, providers []string, configuration config.Configuration) *models.Ticker { - for _, p := range providers { - for _, ticker := range tickers { - baseCheck := assetData.CoinId == ticker.Coin && strings.ToLower(assetData.TokenId) == ticker.TokenId - - if baseCheck && ticker.ShowOption == models.AlwaysShow { - return &ticker - } - - if baseCheck && p == ticker.Provider && ticker.ShowOption != models.NeverShow && - (watchmarket.IsRespectableValue(ticker.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || ticker.Provider != "coingecko") && - (watchmarket.IsRespectableValue(ticker.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || ticker.Provider != "coingecko") { - return &ticker - } - } - } - return nil -} - -func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, err error) { - if result, err := c.getCachedRate(currency); err == nil { - return result, nil - } - - rates, err := c.database.GetRates(currency) - if err != nil { - return result, err - } - isFiat := !watchmarket.IsFiatRate(currency) - - for _, p := range c.ratesPriority { - if isFiat && p != watchmarket.Fixer { - continue - } - for _, r := range rates { - if p == r.Provider { - return watchmarket.Rate{ - Currency: r.Currency, - PercentChange24h: r.PercentChange24h, - Provider: r.Provider, - Rate: r.Rate, - Timestamp: r.LastUpdated.Unix(), - }, nil - } - } - } - return result, errors.New(watchmarket.ErrNotFound) -} - func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { if t.Price.Currency != watchmarket.DefaultCurrency { - newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) + newRate, err := c.getCacheRate(strings.ToUpper(t.Price.Currency)) if err != nil { return watchmarket.Rate{}, false } @@ -173,9 +89,9 @@ func (c Controller) applyRateToTicker(ticker *watchmarket.Ticker, rate watchmark } } -func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { +func (c Controller) getCacheTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { if c.cache == nil { - return watchmarket.Tickers{}, errors.New("cache isn't available") + return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) } var results watchmarket.Tickers for _, assetData := range assets { @@ -194,10 +110,9 @@ func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Ti return results, nil } -// TODO: Remove duplicates or make method -func (c Controller) getCachedRate(currency string) (result watchmarket.Rate, err error) { +func (c Controller) getCacheRate(currency string) (result watchmarket.Rate, err error) { if c.cache == nil { - return watchmarket.Rate{}, errors.New("cache isn't available") + return watchmarket.Rate{}, errors.New(watchmarket.ErrInternal) } rawResult, err := c.cache.Get(currency) if err != nil { diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go deleted file mode 100644 index e69bc1c7..00000000 --- a/services/controllers/tickers/base_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package tickerscontroller - -import ( - "encoding/json" - "errors" - "sort" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/config" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/cache" - "github.com/trustwallet/watchmarket/services/cache/memory" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func TestController_HandleTickersRequest(t *testing.T) { - timeUPD := time.Now() - rate := models.Rate{ - Currency: "USD", - PercentChange24h: 1, - Provider: watchmarket.CoinMarketCap, - Rate: 1, - LastUpdated: timeUPD, - } - rate2 := models.Rate{ - Currency: "USD", - PercentChange24h: 2, - Provider: watchmarket.CoinGecko, - Rate: 2, - LastUpdated: timeUPD, - } - rate3 := models.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: watchmarket.Fixer, - Rate: 6, - LastUpdated: timeUPD, - } - - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - LastUpdated: timeUPD, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - LastUpdated: timeUPD, - } - - ticker714ACG := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - LastUpdated: timeUPD, - } - - ticker714ABNB := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: "binancedex", - Value: 100, - LastUpdated: timeUPD, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} - db.WantedRatesError = nil - db.WantedRates = []models.Rate{rate, rate2, rate3} - c := setupController(t, db, false) - assert.NotNil(t, c) - - response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) - assert.Nil(t, err) - - wantedTicker1 := watchmarket.Ticker{ - Coin: 60, - CoinName: "ETH", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - wantedTicker2 := watchmarket.Ticker{ - Coin: 714, - CoinName: "BNB", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - }, - TokenId: "a", - LastUpdate: timeUPD, - } - - wantedResp := controllers.TickerResponse{ - Currency: "USD", - Tickers: []watchmarket.Ticker{wantedTicker2, wantedTicker1}, - } - - sort.Slice(wantedResp.Tickers, func(i, j int) bool { - return wantedResp.Tickers[i].Coin < wantedResp.Tickers[j].Coin - }) - sort.Slice(response, func(i, j int) bool { - return response[i].Coin < response[j].Coin - }) - - assert.Equal(t, wantedResp.Tickers, response) - - controllerWithCache := setupController(t, db, true) - assert.NotNil(t, controllerWithCache) - wantedTicker1Raw, err := json.Marshal(&wantedTicker1) - assert.Nil(t, err) - wantedTicker2Raw, err := json.Marshal(&wantedTicker2) - assert.Nil(t, err) - rateRaw, err := json.Marshal(&watchmarket.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: watchmarket.Fixer, - Rate: 6, - Timestamp: timeUPD.Unix(), - }) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c60_ta", wantedTicker1Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("c714_ta", wantedTicker2Raw) - assert.Nil(t, err) - err = controllerWithCache.cache.Set("USD", rateRaw) - assert.Nil(t, err) - - response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) - assert.Nil(t, err) - - sort.Slice(response2, func(i, j int) bool { - return response2[i].Coin < response2[j].Coin - }) - for i := range wantedResp.Tickers { - assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2[i].LastUpdate)) - wantedResp.Tickers[i].LastUpdate = response2[i].LastUpdate - } - assert.Equal(t, wantedResp.Tickers, response2) -} - -func TestController_HandleTickersRequest_Negative(t *testing.T) { - db := getDbMock() - - db.WantedTickersError = nil - db.WantedRatesError = errors.New("not found") - c := setupController(t, db, false) - assert.NotNil(t, c) - - _, err := c.HandleTickersRequest(controllers.TickerRequest{}) - assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) -} - -func TestNewController(t *testing.T) { - assert.NotNil(t, setupController(t, getDbMock(), false)) -} - -func setupController(t *testing.T, d dbMock, useMemoryCache bool) Controller { - c, _ := config.Init("../../../config.yml") - assert.NotNil(t, c) - c.RestAPI.UseMemoryCache = useMemoryCache - - ratesPriority := c.Markets.Priority.Rates - tickerPriority := c.Markets.Priority.Tickers - var ch cache.Provider - if useMemoryCache { - ch = memory.Init() - } - controller := NewController(d, ch, ratesPriority, tickerPriority, c) - assert.NotNil(t, controller) - return controller - -} -func getDbMock() dbMock { - return dbMock{} -} - -type dbMock struct { - WantedRates []models.Rate - WantedTickers []models.Ticker - WantedTickersError error - WantedRatesError error -} - -func (d dbMock) GetRates(currency string) ([]models.Rate, error) { - res := make([]models.Rate, 0) - for _, r := range d.WantedRates { - if r.Currency == currency { - res = append(res, r) - } - } - return res, d.WantedRatesError -} - -func (d dbMock) AddRates(rates []models.Rate) error { - return nil -} - -func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) AddTickers(tickers []models.Ticker) error { - return nil -} - -func (d dbMock) GetAllTickers() ([]models.Ticker, error) { - return nil, nil -} - -func (d dbMock) GetAllRates() ([]models.Rate, error) { - return nil, nil -} - -func (d dbMock) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { - return d.WantedTickers, d.WantedTickersError -} diff --git a/services/controllers/tickers/rates_test.go b/services/controllers/tickers/rates_test.go deleted file mode 100644 index bf5d371e..00000000 --- a/services/controllers/tickers/rates_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package tickerscontroller - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" -) - -func TestController_getRateByPriority(t *testing.T) { - now := time.Now() - rate := models.Rate{ - Currency: "USD", - PercentChange24h: 1, - Provider: watchmarket.CoinMarketCap, - Rate: 1, - LastUpdated: now, - } - rate2 := models.Rate{ - Currency: "USD", - PercentChange24h: 2, - Provider: watchmarket.CoinGecko, - Rate: 2, - LastUpdated: now, - } - rate3 := models.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: watchmarket.Fixer, - Rate: 6, - LastUpdated: now, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedRatesError = nil - db.WantedRates = []models.Rate{rate, rate2, rate3} - - c := setupController(t, db, false) - assert.NotNil(t, c) - - r, err := c.getRateByPriority("USD") - assert.Nil(t, err) - - assert.Equal(t, watchmarket.Rate{ - Currency: "USD", - PercentChange24h: 4, - Provider: watchmarket.Fixer, - Rate: 6, - Timestamp: now.Unix(), - }, r) -} diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go deleted file mode 100644 index 5e282251..00000000 --- a/services/controllers/tickers/tickers_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package tickerscontroller - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/trustwallet/watchmarket/db/models" - "github.com/trustwallet/watchmarket/pkg/watchmarket" - "github.com/trustwallet/watchmarket/services/controllers" -) - -func TestController_getTickersByPriority(t *testing.T) { - ticker60ACMC := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - } - - ticker60ACG := models.Ticker{ - Coin: 60, - CoinName: "ETH", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - } - - ticker714ACG := models.Ticker{ - Coin: 714, - CoinName: "BNB", - TokenId: "a", - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - } - - db := getDbMock() - - db.WantedTickersError = nil - db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG} - c := setupController(t, db, false) - assert.NotNil(t, c) - - tickers, err := c.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}) - assert.Nil(t, err) - assert.NotNil(t, tickers) - assert.Equal(t, 2, len(tickers)) - - wantedTicker1 := watchmarket.Ticker{ - Coin: 60, - CoinName: "ETH", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinMarketCap, - Value: 100, - }, - TokenId: "A", - } - wantedTicker2 := watchmarket.Ticker{ - Coin: 714, - CoinName: "BNB", - CoinType: "", - Price: watchmarket.Price{ - Change24h: 10, - Currency: "USD", - Provider: watchmarket.CoinGecko, - Value: 100, - }, - TokenId: "a", - } - var counter int - for _, t := range tickers { - if t == wantedTicker1 || t == wantedTicker2 { - counter++ - } - } - assert.Equal(t, 1, counter) - db2 := getDbMock() - db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} - c2 := setupController(t, db2, false) - tickers2, err := c2.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}}) - assert.Nil(t, err) - assert.NotNil(t, tickers2) - assert.Equal(t, 1, len(tickers2)) - assert.Equal(t, wantedTicker1, tickers2[0]) -} From 7d6940871a4a1373d9d8d0b4aa3a9aa52b91dfc2 Mon Sep 17 00:00:00 2001 From: Maksim Rasputin <133312+madcake@users.noreply.github.com> Date: Thu, 25 Mar 2021 16:01:58 +0700 Subject: [PATCH 89/96] Revert "Remove database requests (#425)" (#433) This reverts commit 4f0124bbb340f85cffa917afe6f99ada575d0732. --- cmd/api/main.go | 4 +- services/controllers/charts/base.go | 29 ++- services/controllers/charts/base_test.go | 227 +++++++++++++++++ services/controllers/info/base.go | 62 +++-- services/controllers/info/base_test.go | 182 ++++++++++++++ services/controllers/rates/base.go | 46 +++- services/controllers/tickers/base.go | 99 +++++++- services/controllers/tickers/base_test.go | 249 +++++++++++++++++++ services/controllers/tickers/rates_test.go | 55 ++++ services/controllers/tickers/tickers_test.go | 94 +++++++ 10 files changed, 1011 insertions(+), 36 deletions(-) create mode 100644 services/controllers/charts/base_test.go create mode 100644 services/controllers/info/base_test.go create mode 100644 services/controllers/tickers/base_test.go create mode 100644 services/controllers/tickers/rates_test.go create mode 100644 services/controllers/tickers/tickers_test.go diff --git a/cmd/api/main.go b/cmd/api/main.go index 443938a2..3f9a0f5c 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -89,8 +89,8 @@ func init() { log.Fatal(err) } - charts = chartscontroller.NewController(redisCache, memoryCache, chartsPriority, m.ChartsAPIs) - info = infocontroller.NewController(memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) + charts = chartscontroller.NewController(redisCache, memoryCache, database, chartsPriority, m.ChartsAPIs, configuration) + info = infocontroller.NewController(database, memoryCache, coinInfoPriority, ratesPriority, m.ChartsAPIs) tickers = tickerscontroller.NewController(database, memoryCache, ratesPriority, tickerPriority, configuration) rates = ratescontroller.NewController(database, memoryCache, ratesPriority, configuration) } diff --git a/services/controllers/charts/base.go b/services/controllers/charts/base.go index 61e417aa..91d1e5ff 100644 --- a/services/controllers/charts/base.go +++ b/services/controllers/charts/base.go @@ -5,10 +5,12 @@ import ( "errors" "fmt" "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db/models" "strings" log "github.com/sirupsen/logrus" + "github.com/trustwallet/watchmarket/db" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -20,26 +22,33 @@ const charts = "charts" type Controller struct { redisCache cache.Provider memoryCache cache.Provider + database db.Instance availableProviders []string api markets.ChartsAPIs + useMemoryCache bool } func NewController( redisCache cache.Provider, memoryCache cache.Provider, + database db.Instance, chartsPriority []string, api markets.ChartsAPIs, + configuration config.Configuration, ) Controller { return Controller{ redisCache, memoryCache, + database, chartsPriority, api, + configuration.RestAPI.UseMemoryCache, } } // ChartsController interface implementation func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart watchmarket.Chart, err error) { + if !c.hasTickers(request.Asset) { return chart, nil } @@ -64,11 +73,25 @@ func (c Controller) HandleChartsRequest(request controllers.ChartRequest) (chart } func (c Controller) hasTickers(assetData controllers.Asset) bool { - if tickers, err := c.getChartsFromMemory(assetData); err != nil { - return false + var tickers []models.Ticker + var err error + + if c.useMemoryCache { + if tickers, err = c.getChartsFromMemory(assetData); err != nil { + return false + } } else { - return len(tickers) > 0 + dbTickers, err := c.database.GetTickers([]controllers.Asset{assetData}) + if err != nil { + return false + } + for _, t := range dbTickers { + if t.ShowOption != 2 { // TODO: 2 to constants + tickers = append(tickers, t) + } + } } + return len(tickers) > 0 } func (c Controller) getChartsFromApi(data controllers.ChartRequest) (ch watchmarket.Chart, err error) { diff --git a/services/controllers/charts/base_test.go b/services/controllers/charts/base_test.go new file mode 100644 index 00000000..03fd6413 --- /dev/null +++ b/services/controllers/charts/base_test.go @@ -0,0 +1,227 @@ +package chartscontroller + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/cache" + "github.com/trustwallet/watchmarket/services/controllers" + "github.com/trustwallet/watchmarket/services/markets" +) + +func TestController_HandleChartsRequest(t *testing.T) { + rate := models.Rate{ + Currency: "USD", + PercentChange24h: 1, + Provider: watchmarket.CoinMarketCap, + Rate: 1, + LastUpdated: time.Now(), + } + rate2 := models.Rate{ + Currency: "USD", + PercentChange24h: 2, + Provider: watchmarket.CoinGecko, + Rate: 2, + LastUpdated: time.Now(), + } + rate3 := models.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: watchmarket.Fixer, + Rate: 6, + LastUpdated: time.Now(), + } + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + } + + ticker714ACG := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + } + + ticker714ABNB := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + } + + db := getDbMock() + + db.WantedTickersError = nil + db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} + db.WantedRatesError = nil + db.WantedRates = []models.Rate{rate, rate2, rate3} + + wCharts := watchmarket.Chart{Provider: watchmarket.CoinMarketCap, Error: "", Prices: []watchmarket.ChartPrice{{Price: 1, Date: 1}, {Price: 3, Date: 3}}} + cm := getChartsMock() + cm.wantedCharts = wCharts + + c := setupController(t, db, getCacheMock(), cm) + assert.NotNil(t, c) + + chart, err := c.HandleChartsRequest(controllers.ChartRequest{ + Asset: controllers.Asset{ + CoinId: 60, + TokenId: "a", + }, + Currency: "USD", + TimeStart: 1577871126, + MaxItems: 64, + }) + assert.Nil(t, err) + + assert.Equal(t, wCharts, chart) +} + +func TestNewController(t *testing.T) { + assert.NotNil(t, setupController(t, getDbMock(), getCacheMock(), getChartsMock())) +} + +func setupController(t *testing.T, d dbMock, ch cache.Provider, cm chartsMock) Controller { + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + c.RestAPI.UseMemoryCache = false + + chartsPriority := []string{watchmarket.CoinMarketCap} + + chartsAPIs := make(markets.ChartsAPIs, 1) + chartsAPIs[cm.GetProvider()] = cm + + controller := NewController(ch, ch, d, chartsPriority, chartsAPIs, c) + assert.NotNil(t, controller) + return controller + +} +func getDbMock() dbMock { + return dbMock{} +} + +type dbMock struct { + WantedRates []models.Rate + WantedTickers []models.Ticker + WantedTickersError error + WantedRatesError error +} + +func (d dbMock) GetRates(currency string) ([]models.Rate, error) { + res := make([]models.Rate, 0) + for _, r := range d.WantedRates { + if r.Currency == currency { + res = append(res, r) + } + } + return res, d.WantedRatesError +} + +func (d dbMock) AddRates(rates []models.Rate) error { + return nil +} + +func (d dbMock) AddTickers(tickers []models.Ticker) error { + return nil +} + +func (d dbMock) GetAllTickers() ([]models.Ticker, error) { + return nil, nil +} + +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) GetAllRates() ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} + +func getCacheMock() cache.Provider { + i := cacheMock{} + return i +} + +type cacheMock struct { +} + +func (c cacheMock) GetID() string { + return "" +} + +func (c cacheMock) GenerateKey(data string) string { + return "" +} + +func (c cacheMock) Get(key string) ([]byte, error) { + return nil, nil +} + +func (c cacheMock) Set(key string, data []byte) error { + return nil +} + +func (c cacheMock) GetWithTime(key string, time int64) ([]byte, error) { + return nil, nil +} + +func (c cacheMock) SetWithTime(key string, data []byte, time int64) error { + return nil +} + +func (c cacheMock) GetLenOfSavedItems() int { + return 0 +} + +func getChartsMock() chartsMock { + cm := chartsMock{} + return cm +} + +type chartsMock struct { + wantedCharts watchmarket.Chart + wantedDetails watchmarket.CoinDetails +} + +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { + return cm.wantedCharts, nil +} + +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { + return cm.wantedDetails, nil +} + +func (cm chartsMock) GetProvider() string { + return watchmarket.CoinMarketCap +} diff --git a/services/controllers/info/base.go b/services/controllers/info/base.go index 0969f713..1a4daef2 100644 --- a/services/controllers/info/base.go +++ b/services/controllers/info/base.go @@ -5,17 +5,18 @@ import ( "errors" "fmt" log "github.com/sirupsen/logrus" - "github.com/trustwallet/golibs/asset" + "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" "github.com/trustwallet/watchmarket/services/markets" - "strings" ) const info = "info" type Controller struct { + database db.Instance cache cache.Provider coinInfoPriority []string ratesPriority []string @@ -23,12 +24,14 @@ type Controller struct { } func NewController( + database db.Instance, cache cache.Provider, coinInfoPriority []string, ratesPriority []string, api markets.ChartsAPIs, ) Controller { return Controller{ + database, cache, coinInfoPriority, ratesPriority, @@ -81,7 +84,7 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller cachedDetails, err := c.cache.Get(key) if err != nil || len(cachedDetails) <= 0 { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + return controllers.InfoResponse{}, errors.New("cache is empty") } var infoResponse controllers.InfoResponse err = json.Unmarshal(cachedDetails, &infoResponse) @@ -89,14 +92,15 @@ func (c Controller) getFromCache(request controllers.DetailsRequest) (controller } func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (controllers.InfoResponse, error) { - key := strings.ToLower(asset.BuildID(request.Asset.CoinId, request.Asset.TokenId)) - rawResult, err := c.cache.Get(key) - if err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + dbTickers, err := c.database.GetTickers([]controllers.Asset{request.Asset}) + + if err != nil || len(dbTickers) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("no tickers in db or db error: %w", err) } - var ticker watchmarket.Ticker - if err = json.Unmarshal(rawResult, &ticker); err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + + ticker, err := c.getTickerDataAccordingToPriority(dbTickers) + if err != nil { + return controllers.InfoResponse{}, err } result := c.getCoinDataFromApi(request.Asset, request.Currency) result.CirculatingSupply = ticker.CirculatingSupply @@ -105,16 +109,16 @@ func (c Controller) getDetailsByPriority(request controllers.DetailsRequest) (co result.TotalSupply = ticker.TotalSupply if request.Currency != watchmarket.DefaultCurrency { - rateRaw, err := c.cache.Get(request.Currency) - var rate watchmarket.Rate - if err != nil { - return controllers.InfoResponse{}, errors.New(watchmarket.ErrNotFound) + rates, err := c.database.GetRates(request.Currency) + if err != nil || len(rates) == 0 { + return controllers.InfoResponse{}, fmt.Errorf("empty db rate or db error: %w", err) } - if err = json.Unmarshal(rateRaw, &rate); err != nil { - return result, err + rate, err := c.getRateDataAccordingToPriority(rates) + if err != nil { + return controllers.InfoResponse{}, err } - result.MarketCap *= 1 / rate.Rate - result.Vol24 *= 1 / rate.Rate + result.MarketCap *= 1 / rate + result.Vol24 *= 1 / rate } return result, nil } @@ -132,3 +136,25 @@ func (c Controller) getCoinDataFromApi(assetData controllers.Asset, currency str } return result } + +func (c Controller) getTickerDataAccordingToPriority(tickers []models.Ticker) (models.Ticker, error) { + for _, p := range c.coinInfoPriority { + for _, t := range tickers { + if t.Provider == p && t.ShowOption != models.NeverShow { + return t, nil + } + } + } + return models.Ticker{}, errors.New("bad ticker or providers") +} + +func (c Controller) getRateDataAccordingToPriority(rates []models.Rate) (float64, error) { + for _, p := range c.ratesPriority { + for _, r := range rates { + if r.Provider == p && r.ShowOption != models.NeverShow { + return r.Rate, nil + } + } + } + return 0, errors.New("bad ticker or providers") +} diff --git a/services/controllers/info/base_test.go b/services/controllers/info/base_test.go new file mode 100644 index 00000000..7565c7e3 --- /dev/null +++ b/services/controllers/info/base_test.go @@ -0,0 +1,182 @@ +package infocontroller + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/cache" + "github.com/trustwallet/watchmarket/services/controllers" + "github.com/trustwallet/watchmarket/services/markets" +) + +func TestController_HandleDetailsRequest(t *testing.T) { + cm := getChartsMock() + wantedD := watchmarket.CoinDetails{ + Provider: watchmarket.CoinMarketCap, + Info: &watchmarket.Info{ + Name: "2", + Website: "2", + SourceCode: "2", + WhitePaper: "2", + Description: "2", + ShortDescription: "2", + Research: "2", + Explorer: "2", + Socials: nil, + }, + } + cm.wantedDetails = wantedD + + db := getDbMock() + db.WantedTickers = []models.Ticker{{CirculatingSupply: 1, TotalSupply: 1, MarketCap: 1, Volume: 1, Provider: "coinmarketcap"}} + db.WantedRates = []models.Rate{{Currency: "RUB", Rate: 10, Provider: "coinmarketcap"}} + c := setupController(t, db, getCacheMock(), cm) + assert.NotNil(t, c) + details, err := c.HandleInfoRequest(controllers.DetailsRequest{ + Asset: controllers.Asset{ + CoinId: 0, + TokenId: "2", + }, + Currency: "RUB", + }) + assert.Nil(t, err) + assert.Equal(t, controllers.InfoResponse{ + Provider: wantedD.Provider, + ProviderURL: wantedD.ProviderURL, + Vol24: 0.1, + MarketCap: 0.1, + CirculatingSupply: 1, + TotalSupply: 1, + Info: wantedD.Info, + }, details) +} + +func TestNewController(t *testing.T) { + assert.NotNil(t, setupController(t, getDbMock(), getCacheMock(), getChartsMock())) +} + +func setupController(t *testing.T, db dbMock, ch cache.Provider, cm chartsMock) Controller { + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + + ratesPriority := []string{"coinmarketcap"} + coinInfoPriority := []string{"coinmarketcap"} + + chartsAPIs := make(markets.ChartsAPIs, 1) + chartsAPIs[cm.GetProvider()] = cm + + controller := NewController(db, ch, coinInfoPriority, ratesPriority, chartsAPIs) + assert.NotNil(t, controller) + return controller + +} + +func getCacheMock() cache.Provider { + i := cacheMock{} + return i +} + +type cacheMock struct { +} + +func (c cacheMock) GetID() string { + return "" +} + +func (c cacheMock) GenerateKey(data string) string { + return "" +} + +func (c cacheMock) Get(key string) ([]byte, error) { + return nil, nil +} + +func (c cacheMock) Set(key string, data []byte) error { + return nil +} + +func (c cacheMock) GetWithTime(key string, time int64) ([]byte, error) { + return nil, nil +} + +func (c cacheMock) SetWithTime(key string, data []byte, time int64) error { + return nil +} + +func (c cacheMock) GetLenOfSavedItems() int { + return 0 +} + +func getChartsMock() chartsMock { + cm := chartsMock{} + return cm +} + +type chartsMock struct { + wantedCharts watchmarket.Chart + wantedDetails watchmarket.CoinDetails +} + +func (cm chartsMock) GetChartData(asset controllers.Asset, currency string, timeStart int64) (watchmarket.Chart, error) { + return cm.wantedCharts, nil +} + +func (cm chartsMock) GetCoinData(asset controllers.Asset, currency string) (watchmarket.CoinDetails, error) { + return cm.wantedDetails, nil +} + +func (cm chartsMock) GetProvider() string { + return "coinmarketcap" +} + +func getDbMock() dbMock { + return dbMock{} +} + +type dbMock struct { + WantedRates []models.Rate + WantedTickers []models.Ticker + WantedTickersError error + WantedRatesError error +} + +func (d dbMock) GetRates(currency string) ([]models.Rate, error) { + res := make([]models.Rate, 0) + for _, r := range d.WantedRates { + if r.Currency == currency { + res = append(res, r) + } + } + return res, d.WantedRatesError +} + +func (d dbMock) AddRates(rates []models.Rate) error { + return nil +} + +func (d dbMock) AddTickers(tickers []models.Ticker) error { + return nil +} + +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) GetAllTickers() ([]models.Ticker, error) { + return nil, nil +} + +func (d dbMock) GetAllRates() ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) GetTickers(asset []controllers.Asset) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} + +func (d dbMock) GetTickersByQueries(tickerQueries []models.TickerQuery) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} diff --git a/services/controllers/rates/base.go b/services/controllers/rates/base.go index adf9f653..0a3a24fd 100644 --- a/services/controllers/rates/base.go +++ b/services/controllers/rates/base.go @@ -4,8 +4,10 @@ import ( "encoding/json" "errors" + log "github.com/sirupsen/logrus" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" @@ -65,13 +67,45 @@ func (c Controller) GetFiatRates() (controllers.FiatRates, error) { } func (c Controller) getRateByCurrency(currency string) (watchmarket.Rate, error) { - rawResult, err := c.dataCache.Get(currency) + if c.configuration.RestAPI.UseMemoryCache { + rawResult, err := c.dataCache.Get(currency) + if err != nil { + return watchmarket.Rate{}, err + } + var result watchmarket.Rate + if err = json.Unmarshal(rawResult, &result); err != nil { + return watchmarket.Rate{}, err + } + return result, nil + } + emptyRate := watchmarket.Rate{} + rates, err := c.database.GetRates(currency) if err != nil { - return watchmarket.Rate{}, err + log.Error(err, "getRateByPriority") + return emptyRate, err } - var result watchmarket.Rate - if err = json.Unmarshal(rawResult, &result); err != nil { - return watchmarket.Rate{}, err + + providers := c.ratesPriority + var result models.Rate +ProvidersLoop: + for _, p := range providers { + for _, r := range rates { + if p == r.Provider { + result = r + break ProvidersLoop + } + } } - return result, nil + + if result.Currency == "" || result.Rate == 0 { + return emptyRate, errors.New(watchmarket.ErrNotFound) + } + + return watchmarket.Rate{ + Currency: result.Currency, + PercentChange24h: result.PercentChange24h, + Provider: result.Provider, + Rate: result.Rate, + Timestamp: result.LastUpdated.Unix(), + }, nil } diff --git a/services/controllers/tickers/base.go b/services/controllers/tickers/base.go index 4dd526b4..547cd805 100644 --- a/services/controllers/tickers/base.go +++ b/services/controllers/tickers/base.go @@ -8,12 +8,14 @@ import ( "github.com/trustwallet/golibs/asset" "github.com/trustwallet/watchmarket/config" "github.com/trustwallet/watchmarket/db" + "github.com/trustwallet/watchmarket/db/models" "github.com/trustwallet/watchmarket/pkg/watchmarket" "github.com/trustwallet/watchmarket/services/cache" "github.com/trustwallet/watchmarket/services/controllers" ) type Controller struct { + database db.Instance cache cache.Provider ratesPriority []string tickersPriority []string @@ -27,6 +29,7 @@ func NewController( configuration config.Configuration, ) Controller { return Controller{ + database, cache, ratesPriority, tickersPriority, @@ -35,12 +38,12 @@ func NewController( } func (c Controller) HandleTickersRequest(request controllers.TickerRequest) (watchmarket.Tickers, error) { - rate, err := c.getCacheRate(strings.ToUpper(request.Currency)) + rate, err := c.getRateByPriority(strings.ToUpper(request.Currency)) if err != nil { return watchmarket.Tickers{}, errors.New(watchmarket.ErrNotFound) } - tickers, err := c.getCacheTickers(request.Assets) + tickers, err := c.getTickersByPriority(request.Assets) if err != nil { return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) } @@ -63,9 +66,90 @@ func (c Controller) filterTickers(tickers watchmarket.Tickers, rate watchmarket. return result } +func (c Controller) getTickersByPriority(assets []controllers.Asset) (watchmarket.Tickers, error) { + if result, err := c.getCachedTickers(assets); err == nil { + return result, nil + } + tickers, err := c.database.GetTickers(assets) + if err != nil { + return nil, err + } + result := make(watchmarket.Tickers, 0) + for _, assetData := range assets { + ticker := findBestTicker(assetData, tickers, c.tickersPriority, c.configuration) + if ticker == nil { + continue + } + result = append(result, watchmarket.Ticker{ + Coin: ticker.Coin, + CoinName: ticker.CoinName, + CoinType: watchmarket.CoinType(ticker.CoinType), + LastUpdate: ticker.LastUpdated, + Price: watchmarket.Price{ + Change24h: ticker.Change24h, + Currency: ticker.Currency, + Provider: ticker.Provider, + Value: ticker.Value, + }, + TokenId: assetData.TokenId, + }) + } + + return result, nil +} + +func findBestTicker(assetData controllers.Asset, tickers []models.Ticker, providers []string, configuration config.Configuration) *models.Ticker { + for _, p := range providers { + for _, ticker := range tickers { + baseCheck := assetData.CoinId == ticker.Coin && strings.ToLower(assetData.TokenId) == ticker.TokenId + + if baseCheck && ticker.ShowOption == models.AlwaysShow { + return &ticker + } + + if baseCheck && p == ticker.Provider && ticker.ShowOption != models.NeverShow && + (watchmarket.IsRespectableValue(ticker.MarketCap, configuration.RestAPI.Tickers.RespsectableMarketCap) || ticker.Provider != "coingecko") && + (watchmarket.IsRespectableValue(ticker.Volume, configuration.RestAPI.Tickers.RespsectableVolume) || ticker.Provider != "coingecko") { + return &ticker + } + } + } + return nil +} + +func (c Controller) getRateByPriority(currency string) (result watchmarket.Rate, err error) { + if result, err := c.getCachedRate(currency); err == nil { + return result, nil + } + + rates, err := c.database.GetRates(currency) + if err != nil { + return result, err + } + isFiat := !watchmarket.IsFiatRate(currency) + + for _, p := range c.ratesPriority { + if isFiat && p != watchmarket.Fixer { + continue + } + for _, r := range rates { + if p == r.Provider { + return watchmarket.Rate{ + Currency: r.Currency, + PercentChange24h: r.PercentChange24h, + Provider: r.Provider, + Rate: r.Rate, + Timestamp: r.LastUpdated.Unix(), + }, nil + } + } + } + return result, errors.New(watchmarket.ErrNotFound) +} + func (c Controller) rateToDefaultCurrency(t watchmarket.Ticker, rate watchmarket.Rate) (watchmarket.Rate, bool) { if t.Price.Currency != watchmarket.DefaultCurrency { - newRate, err := c.getCacheRate(strings.ToUpper(t.Price.Currency)) + newRate, err := c.getRateByPriority(strings.ToUpper(t.Price.Currency)) if err != nil { return watchmarket.Rate{}, false } @@ -89,9 +173,9 @@ func (c Controller) applyRateToTicker(ticker *watchmarket.Ticker, rate watchmark } } -func (c Controller) getCacheTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { +func (c Controller) getCachedTickers(assets []controllers.Asset) (watchmarket.Tickers, error) { if c.cache == nil { - return watchmarket.Tickers{}, errors.New(watchmarket.ErrInternal) + return watchmarket.Tickers{}, errors.New("cache isn't available") } var results watchmarket.Tickers for _, assetData := range assets { @@ -110,9 +194,10 @@ func (c Controller) getCacheTickers(assets []controllers.Asset) (watchmarket.Tic return results, nil } -func (c Controller) getCacheRate(currency string) (result watchmarket.Rate, err error) { +// TODO: Remove duplicates or make method +func (c Controller) getCachedRate(currency string) (result watchmarket.Rate, err error) { if c.cache == nil { - return watchmarket.Rate{}, errors.New(watchmarket.ErrInternal) + return watchmarket.Rate{}, errors.New("cache isn't available") } rawResult, err := c.cache.Get(currency) if err != nil { diff --git a/services/controllers/tickers/base_test.go b/services/controllers/tickers/base_test.go new file mode 100644 index 00000000..e69bc1c7 --- /dev/null +++ b/services/controllers/tickers/base_test.go @@ -0,0 +1,249 @@ +package tickerscontroller + +import ( + "encoding/json" + "errors" + "sort" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/config" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/cache" + "github.com/trustwallet/watchmarket/services/cache/memory" + "github.com/trustwallet/watchmarket/services/controllers" +) + +func TestController_HandleTickersRequest(t *testing.T) { + timeUPD := time.Now() + rate := models.Rate{ + Currency: "USD", + PercentChange24h: 1, + Provider: watchmarket.CoinMarketCap, + Rate: 1, + LastUpdated: timeUPD, + } + rate2 := models.Rate{ + Currency: "USD", + PercentChange24h: 2, + Provider: watchmarket.CoinGecko, + Rate: 2, + LastUpdated: timeUPD, + } + rate3 := models.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: watchmarket.Fixer, + Rate: 6, + LastUpdated: timeUPD, + } + + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + LastUpdated: timeUPD, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + LastUpdated: timeUPD, + } + + ticker714ACG := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + LastUpdated: timeUPD, + } + + ticker714ABNB := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: "binancedex", + Value: 100, + LastUpdated: timeUPD, + } + + db := getDbMock() + + db.WantedTickersError = nil + db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG, ticker714ABNB} + db.WantedRatesError = nil + db.WantedRates = []models.Rate{rate, rate2, rate3} + c := setupController(t, db, false) + assert.NotNil(t, c) + + response, err := c.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) + assert.Nil(t, err) + + wantedTicker1 := watchmarket.Ticker{ + Coin: 60, + CoinName: "ETH", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + }, + TokenId: "a", + LastUpdate: timeUPD, + } + wantedTicker2 := watchmarket.Ticker{ + Coin: 714, + CoinName: "BNB", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + }, + TokenId: "a", + LastUpdate: timeUPD, + } + + wantedResp := controllers.TickerResponse{ + Currency: "USD", + Tickers: []watchmarket.Ticker{wantedTicker2, wantedTicker1}, + } + + sort.Slice(wantedResp.Tickers, func(i, j int) bool { + return wantedResp.Tickers[i].Coin < wantedResp.Tickers[j].Coin + }) + sort.Slice(response, func(i, j int) bool { + return response[i].Coin < response[j].Coin + }) + + assert.Equal(t, wantedResp.Tickers, response) + + controllerWithCache := setupController(t, db, true) + assert.NotNil(t, controllerWithCache) + wantedTicker1Raw, err := json.Marshal(&wantedTicker1) + assert.Nil(t, err) + wantedTicker2Raw, err := json.Marshal(&wantedTicker2) + assert.Nil(t, err) + rateRaw, err := json.Marshal(&watchmarket.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: watchmarket.Fixer, + Rate: 6, + Timestamp: timeUPD.Unix(), + }) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("c60_ta", wantedTicker1Raw) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("c714_ta", wantedTicker2Raw) + assert.Nil(t, err) + err = controllerWithCache.cache.Set("USD", rateRaw) + assert.Nil(t, err) + + response2, err := controllerWithCache.HandleTickersRequest(controllers.TickerRequest{Currency: "USD", Assets: []controllers.Asset{{CoinId: 60, TokenId: "a"}, {CoinId: 714, TokenId: "a"}}}) + assert.Nil(t, err) + + sort.Slice(response2, func(i, j int) bool { + return response2[i].Coin < response2[j].Coin + }) + for i := range wantedResp.Tickers { + assert.True(t, wantedResp.Tickers[i].LastUpdate.Equal(response2[i].LastUpdate)) + wantedResp.Tickers[i].LastUpdate = response2[i].LastUpdate + } + assert.Equal(t, wantedResp.Tickers, response2) +} + +func TestController_HandleTickersRequest_Negative(t *testing.T) { + db := getDbMock() + + db.WantedTickersError = nil + db.WantedRatesError = errors.New("not found") + c := setupController(t, db, false) + assert.NotNil(t, c) + + _, err := c.HandleTickersRequest(controllers.TickerRequest{}) + assert.Equal(t, err, errors.New(watchmarket.ErrNotFound)) +} + +func TestNewController(t *testing.T) { + assert.NotNil(t, setupController(t, getDbMock(), false)) +} + +func setupController(t *testing.T, d dbMock, useMemoryCache bool) Controller { + c, _ := config.Init("../../../config.yml") + assert.NotNil(t, c) + c.RestAPI.UseMemoryCache = useMemoryCache + + ratesPriority := c.Markets.Priority.Rates + tickerPriority := c.Markets.Priority.Tickers + var ch cache.Provider + if useMemoryCache { + ch = memory.Init() + } + controller := NewController(d, ch, ratesPriority, tickerPriority, c) + assert.NotNil(t, controller) + return controller + +} +func getDbMock() dbMock { + return dbMock{} +} + +type dbMock struct { + WantedRates []models.Rate + WantedTickers []models.Ticker + WantedTickersError error + WantedRatesError error +} + +func (d dbMock) GetRates(currency string) ([]models.Rate, error) { + res := make([]models.Rate, 0) + for _, r := range d.WantedRates { + if r.Currency == currency { + res = append(res, r) + } + } + return res, d.WantedRatesError +} + +func (d dbMock) AddRates(rates []models.Rate) error { + return nil +} + +func (d dbMock) GetRatesByProvider(provider string) ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) AddTickers(tickers []models.Ticker) error { + return nil +} + +func (d dbMock) GetAllTickers() ([]models.Ticker, error) { + return nil, nil +} + +func (d dbMock) GetAllRates() ([]models.Rate, error) { + return nil, nil +} + +func (d dbMock) GetTickers(assets []controllers.Asset) ([]models.Ticker, error) { + return d.WantedTickers, d.WantedTickersError +} diff --git a/services/controllers/tickers/rates_test.go b/services/controllers/tickers/rates_test.go new file mode 100644 index 00000000..bf5d371e --- /dev/null +++ b/services/controllers/tickers/rates_test.go @@ -0,0 +1,55 @@ +package tickerscontroller + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" +) + +func TestController_getRateByPriority(t *testing.T) { + now := time.Now() + rate := models.Rate{ + Currency: "USD", + PercentChange24h: 1, + Provider: watchmarket.CoinMarketCap, + Rate: 1, + LastUpdated: now, + } + rate2 := models.Rate{ + Currency: "USD", + PercentChange24h: 2, + Provider: watchmarket.CoinGecko, + Rate: 2, + LastUpdated: now, + } + rate3 := models.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: watchmarket.Fixer, + Rate: 6, + LastUpdated: now, + } + + db := getDbMock() + + db.WantedTickersError = nil + db.WantedRatesError = nil + db.WantedRates = []models.Rate{rate, rate2, rate3} + + c := setupController(t, db, false) + assert.NotNil(t, c) + + r, err := c.getRateByPriority("USD") + assert.Nil(t, err) + + assert.Equal(t, watchmarket.Rate{ + Currency: "USD", + PercentChange24h: 4, + Provider: watchmarket.Fixer, + Rate: 6, + Timestamp: now.Unix(), + }, r) +} diff --git a/services/controllers/tickers/tickers_test.go b/services/controllers/tickers/tickers_test.go new file mode 100644 index 00000000..5e282251 --- /dev/null +++ b/services/controllers/tickers/tickers_test.go @@ -0,0 +1,94 @@ +package tickerscontroller + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/trustwallet/watchmarket/db/models" + "github.com/trustwallet/watchmarket/pkg/watchmarket" + "github.com/trustwallet/watchmarket/services/controllers" +) + +func TestController_getTickersByPriority(t *testing.T) { + ticker60ACMC := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + } + + ticker60ACG := models.Ticker{ + Coin: 60, + CoinName: "ETH", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + } + + ticker714ACG := models.Ticker{ + Coin: 714, + CoinName: "BNB", + TokenId: "a", + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + } + + db := getDbMock() + + db.WantedTickersError = nil + db.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG, ticker714ACG} + c := setupController(t, db, false) + assert.NotNil(t, c) + + tickers, err := c.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}, {CoinId: 714, TokenId: "A"}}) + assert.Nil(t, err) + assert.NotNil(t, tickers) + assert.Equal(t, 2, len(tickers)) + + wantedTicker1 := watchmarket.Ticker{ + Coin: 60, + CoinName: "ETH", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinMarketCap, + Value: 100, + }, + TokenId: "A", + } + wantedTicker2 := watchmarket.Ticker{ + Coin: 714, + CoinName: "BNB", + CoinType: "", + Price: watchmarket.Price{ + Change24h: 10, + Currency: "USD", + Provider: watchmarket.CoinGecko, + Value: 100, + }, + TokenId: "a", + } + var counter int + for _, t := range tickers { + if t == wantedTicker1 || t == wantedTicker2 { + counter++ + } + } + assert.Equal(t, 1, counter) + db2 := getDbMock() + db2.WantedTickers = []models.Ticker{ticker60ACMC, ticker60ACG} + c2 := setupController(t, db2, false) + tickers2, err := c2.getTickersByPriority([]controllers.Asset{{CoinId: 60, TokenId: "A"}}) + assert.Nil(t, err) + assert.NotNil(t, tickers2) + assert.Equal(t, 1, len(tickers2)) + assert.Equal(t, wantedTicker1, tickers2[0]) +} From 98b8162e69d7d1fa96e07fab2a04da7d1fad1b2a Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Fri, 26 Mar 2021 01:50:49 +0800 Subject: [PATCH 90/96] add_BEP2_MVL https://coinmarketcap.com/currencies/mvl/ https://explorer.binance.org/asset/MVL-7B0 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 584aa4a5..ca8b97b7 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -5053,6 +5053,12 @@ const Mapping = `[ "token_id": "0xA849EaaE994fb86Afa73382e9Bd88c2B6b18Dc71", "id": 2982 }, + { + "coin": 714, + "type": "token", + "token_id": "MVL-7B0", + "id": 2982 + }, { "coin": 60, "type": "token", From df75cf6120acf770ee0e77c66e418e59f345ce6e Mon Sep 17 00:00:00 2001 From: zachzwei <35627271+zachzwei@users.noreply.github.com> Date: Fri, 26 Mar 2021 14:43:49 +0800 Subject: [PATCH 91/96] add_BEP20_LINA https://github.com/trustwallet/assets/pull/6084 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index ca8b97b7..f3618e5f 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14176,6 +14176,12 @@ const Mapping = `[ "token_id": "TJvqNiWUN2v2NBG12UhfV7WSvReJkRP3VC", "id": 7096 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x762539b45A1dCcE3D36d080F74d1AED37844b878", + "id": 7102 + }, { "coin": 60, "type": "token", From 93a1114ff727cace4715117d619a9cc2e04e5867 Mon Sep 17 00:00:00 2001 From: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com> Date: Fri, 26 Mar 2021 10:23:13 -0700 Subject: [PATCH 92/96] Add support for CoinGecko Pro API (#434) * Add support for CoinGecko Pro API * Fix tests * Update config.yml --- config.yml | 5 +++-- config/config.go | 1 + services/markets/coingecko/base.go | 5 +++-- services/markets/coingecko/base_test.go | 4 ++-- services/markets/coingecko/charts_test.go | 7 ++++--- services/markets/coingecko/client.go | 16 +++++++++++----- services/markets/coingecko/rates_test.go | 2 +- services/markets/coingecko/tickers_test.go | 2 +- services/markets/markets.go | 6 +++++- 9 files changed, 31 insertions(+), 17 deletions(-) diff --git a/config.yml b/config.yml index e5661fe7..60e48160 100644 --- a/config.yml +++ b/config.yml @@ -14,13 +14,14 @@ markets: widget_api: https://3rdparty-apis.coinmarketcap.com coingecko: - currency: USD api: https://api.coingecko.com/api + key: #key + currency: USD fixer: - currency: USD api: https://data.fixer.io/api key: #key + currency: USD assets: https://raw.githubusercontent.com/trustwallet/assets/master/blockchains # Assets url - details about TW tokens diff --git a/config/config.go b/config/config.go index 91b20ce6..4fb6e2cf 100644 --- a/config/config.go +++ b/config/config.go @@ -30,6 +30,7 @@ type Configuration struct { } `mapstructure:"coinmarketcap"` Coingecko struct { API string `mapstructure:"api"` + Key string `mapstructure:"key"` Currency string `mapstructure:"currency"` } `mapstructure:"coingecko"` Fixer struct { diff --git a/services/markets/coingecko/base.go b/services/markets/coingecko/base.go index df5ae096..282d3cc2 100755 --- a/services/markets/coingecko/base.go +++ b/services/markets/coingecko/base.go @@ -13,13 +13,14 @@ const ( type Provider struct { id string + key string currency string client Client info assets.Client } -func InitProvider(api, currency string, info assets.Client) Provider { - return Provider{id: id, currency: currency, client: NewClient(api, bucketSize), info: info} +func InitProvider(api, key, currency string, info assets.Client) Provider { + return Provider{id: id, key: key, currency: currency, client: NewClient(api, key, bucketSize), info: info} } func (p Provider) GetProvider() string { diff --git a/services/markets/coingecko/base_test.go b/services/markets/coingecko/base_test.go index 258d1cb0..e56c0bba 100755 --- a/services/markets/coingecko/base_test.go +++ b/services/markets/coingecko/base_test.go @@ -23,7 +23,7 @@ var ( ) func TestInitProvider(t *testing.T) { - provider := InitProvider("web.api", "USD", assets.Init("assets.api")) + provider := InitProvider("web.api", "", "USD", assets.Init("assets.api")) assert.NotNil(t, provider) assert.Equal(t, "web.api", provider.client.client.BaseUrl) assert.Equal(t, "USD", provider.currency) @@ -31,7 +31,7 @@ func TestInitProvider(t *testing.T) { } func TestProvider_GetProvider(t *testing.T) { - provider := InitProvider("web.api", "USD", assets.Init("assets.api")) + provider := InitProvider("web.api", "", "USD", assets.Init("assets.api")) assert.Equal(t, watchmarket.CoinGecko, provider.GetProvider()) } diff --git a/services/markets/coingecko/charts_test.go b/services/markets/coingecko/charts_test.go index f6adcdf9..6d61eeb0 100755 --- a/services/markets/coingecko/charts_test.go +++ b/services/markets/coingecko/charts_test.go @@ -2,11 +2,12 @@ package coingecko import ( "encoding/json" - "github.com/trustwallet/watchmarket/services/controllers" "net/http/httptest" "sort" "testing" + "github.com/trustwallet/watchmarket/services/controllers" + "github.com/stretchr/testify/assert" "github.com/trustwallet/watchmarket/services/assets" ) @@ -14,7 +15,7 @@ import ( func TestProvider_GetCoinData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() - provider := InitProvider(server.URL, "USD", assets.Init(server.URL)) + provider := InitProvider(server.URL, "", "USD", assets.Init(server.URL)) data, _ := provider.GetCoinData(controllers.Asset{CoinId: 60}, "USD") rawData, err := json.Marshal(data) assert.Nil(t, err) @@ -24,7 +25,7 @@ func TestProvider_GetCoinData(t *testing.T) { func TestProvider_GetChartData(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() - provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) + provider := InitProvider(server.URL, "", "USD", assets.Init("assets.api")) data, _ := provider.GetChartData(controllers.Asset{CoinId: 60}, "USD", 1577871126) rawData, err := json.Marshal(data) assert.Nil(t, err) diff --git a/services/markets/coingecko/client.go b/services/markets/coingecko/client.go index c9d12425..aa75f28e 100755 --- a/services/markets/coingecko/client.go +++ b/services/markets/coingecko/client.go @@ -16,17 +16,23 @@ import ( type Client struct { client client.Request + key string bucketSize int } -func NewClient(api string, bucketSize int) Client { - c := Client{client: client.InitClient(api, middleware.SentryErrorHandler), bucketSize: bucketSize} +func NewClient(api string, key string, bucketSize int) Client { + c := Client{client: client.InitClient(api, middleware.SentryErrorHandler), key: key, bucketSize: bucketSize} c.client.HttpClient = &http.Client{ Timeout: time.Minute, } return c } +func (c Client) Get(result interface{}, path string, values url.Values) error { + values.Add("x_cg_pro_api_key", c.key) + return c.client.Get(&result, path, values) +} + func (c Client) fetchCharts(id, currency string, timeStart, timeEnd int64) (charts Charts, err error) { values := url.Values{ @@ -35,7 +41,7 @@ func (c Client) fetchCharts(id, currency string, timeStart, timeEnd int64) (char "to": {strconv.FormatInt(timeEnd, 10)}, } - err = c.client.Get(&charts, fmt.Sprintf("/v3/coins/%s/market_chart/range", id), values) + err = c.Get(&charts, fmt.Sprintf("/v3/coins/%s/market_chart/range", id), values) return } @@ -84,11 +90,11 @@ func (c Client) fetchRates(coins Coins, currency string) (prices CoinPrices) { func (c Client) fetchMarkets(ids, currency string) (result CoinPrices, err error) { values := url.Values{"vs_currency": {currency}, "sparkline": {"false"}, "ids": {ids}} - err = c.client.Get(&result, "/v3/coins/markets", values) + err = c.Get(&result, "/v3/coins/markets", values) return } func (c Client) fetchCoins() (result Coins, err error) { - err = c.client.Get(&result, "/v3/coins/list", url.Values{"include_platform": {"true"}}) + err = c.Get(&result, "/v3/coins/list", url.Values{"include_platform": {"true"}}) return } diff --git a/services/markets/coingecko/rates_test.go b/services/markets/coingecko/rates_test.go index 740c1d8b..5932f6c9 100755 --- a/services/markets/coingecko/rates_test.go +++ b/services/markets/coingecko/rates_test.go @@ -15,7 +15,7 @@ import ( func TestProvider_GetRates(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() - provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) + provider := InitProvider(server.URL, "", "USD", assets.Init("assets.api")) data, err := provider.GetRates() assert.Nil(t, err) rawData, err := json.Marshal(data) diff --git a/services/markets/coingecko/tickers_test.go b/services/markets/coingecko/tickers_test.go index 31bbe60c..f59588e9 100755 --- a/services/markets/coingecko/tickers_test.go +++ b/services/markets/coingecko/tickers_test.go @@ -16,7 +16,7 @@ func TestProvider_GetTickers(t *testing.T) { server := httptest.NewServer(createMockedAPI()) defer server.Close() - provider := InitProvider(server.URL, "USD", assets.Init("assets.api")) + provider := InitProvider(server.URL, "", "USD", assets.Init("assets.api")) data, err := provider.GetTickers() assert.Nil(t, err) res, err := json.Marshal(data) diff --git a/services/markets/markets.go b/services/markets/markets.go index 124f29fc..c2104407 100755 --- a/services/markets/markets.go +++ b/services/markets/markets.go @@ -74,7 +74,11 @@ func setupProviders(config config.Configuration, assets assets.Client) Providers config.Markets.Coinmarketcap.Key, config.Markets.Coinmarketcap.Currency, assets) - coingeckoProvider := coingecko.InitProvider(config.Markets.Coingecko.API, config.Markets.Coingecko.Currency, assets) + coingeckoProvider := coingecko.InitProvider( + config.Markets.Coingecko.API, + config.Markets.Coingecko.Key, + config.Markets.Coingecko.Currency, + assets) fixerProvider := fixer.InitProvider(config.Markets.Fixer.API, config.Markets.Fixer.Key, config.Markets.Fixer.Currency) providers := make(Providers, 4) From 23d2f03503301f6a750b109b7f4af3a8f72ed65d Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Thu, 1 Apr 2021 14:57:32 +0800 Subject: [PATCH 93/96] Add Safemars (SAFEMARS) BEP20 (#437) https://coinmarketcap.com/currencies/safemars/ https://www.coingecko.com/en/coins/safemars https://bscscan.com/token/0x3ad9594151886ce8538c1ff615efa2385a8c3a88 --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index f3618e5f..38a95a0d 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14637,5 +14637,11 @@ const Mapping = `[ "type": "token", "token_id": "0x78650B139471520656b9E7aA7A5e9276814a38e9", "id": 8891 + }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x3aD9594151886Ce8538C1ff615EFa2385a8C3A88", + "id": 8966 } ]` From 4ccb23d53bf29c03b19065dbef32da8692cbd29a Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sat, 3 Apr 2021 15:03:54 +0800 Subject: [PATCH 94/96] Add MITX BEP2 pricing (#438) https://www.coingecko.com/en/coins/morpheus-labs https://coinmarketcap.com/currencies/morpheus-labs/ https://www.coingecko.com/en/coins/morpheus-labs --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 38a95a0d..e00e683b 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -4100,6 +4100,12 @@ const Mapping = `[ "token_id": "0x4a527d8fc13C5203AB24BA0944F4Cb14658D1Db6", "id": 2709 }, + { + "coin": 714, + "type": "token", + "token_id": "MITX-CAA", + "id": 2709 + }, { "coin": 60, "type": "token", From c704c115fc353845fed18351cb6d9b2374bf2d42 Mon Sep 17 00:00:00 2001 From: Ian E <29373963+Iamdeadlyz@users.noreply.github.com> Date: Sun, 11 Apr 2021 17:20:13 +0800 Subject: [PATCH 95/96] Add Red Pulse Phoenix Binance (PHB-2DF) BEP2 (#441) https://explorer.binance.org/asset/PHB-2DF https://coinmarketcap.com/currencies/phoenix-global/ https://www.coingecko.com/en/coins/phoenix-global --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index e00e683b..9012f19b 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -2034,6 +2034,12 @@ const Mapping = `[ "token_id": "0xac3211a5025414Af2866FF09c23FC18bc97e79b1", "id": 2110 }, + { + "coin": 714, + "type": "token", + "token_id": "PHB-2DF", + "id": 2112 + }, { "coin": 60, "type": "token", From 1349f659264f9cf990f64774956a705e752b9ed1 Mon Sep 17 00:00:00 2001 From: Andrew M <35627271+zachzwei@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:50:52 +0800 Subject: [PATCH 96/96] add_BEP20_YETH https://coinmarketcap.com/currencies/fyeth-finance/ --- services/markets/coinmarketcap/mapping.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/markets/coinmarketcap/mapping.go b/services/markets/coinmarketcap/mapping.go index 9012f19b..62e02228 100644 --- a/services/markets/coinmarketcap/mapping.go +++ b/services/markets/coinmarketcap/mapping.go @@ -14458,6 +14458,12 @@ const Mapping = `[ "token_id": "0x23396cF899Ca06c4472205fC903bDB4de249D6fC", "id": 7858 }, + { + "coin": 20000714, + "type": "token", + "token_id": "0x77DFb1DaFC92c5Df29996f5528BA1829941cD3Bb", + "id": 7989 + }, { "coin": 20000714, "type": "token",