mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-15 23:16:48 +00:00
* Initial concept for creating price tracking pairs * Completes coverage, even with a slow test * I dont know what point to hook this stuff up * Bit of a broken way of handling tracking pairs * Correctly calculates USD rates against all currencies * Removes dependency on GCT config * Failed currency statistics redesign * initial Update chart to use highcharts * Minor changes to stats * Creats funding stats to handle the stat calculations. Needs more work * tracks USD snapshots and BREAKS THINGS FURTHER * Fixed! * Adds ratio calculations and such, but its WRONG. do it at totals level dummy * End of day basic lint * Remaining lints * USD totals statistics * Minor panic fixes * Printing of funding stats, but its bad * Properly calculates overall benchmark, moves funding stat output * Adds some template charge, removes duplicate fields * New charts! * Darkcharts. funding protection when disabled * Now works with usd tracking/funding disabled! * Attempting to only show working stats based on settings. * Spruces up the goose/reporting * Completes report HTML rendering * lint and test fixes * funding statistics testing * slightly more test coverage * Test coverage * Initial documentation * Fixes tests * Database testing and rendering improvements and breakages * report and cmd rendering, linting. fix comma output. rm gct cfg * PR mode 🎉 Path field, config builder support,testing,linting,docs * minor calculation improvement * Secret lint that did not show up locally * Disable USD tracking for example configs * ShazNitNoScope * Forgotten errors * "" * literally Logarithmically logically renders the date 👀 * Fixes typos, fixes parallel test, fixes chart gui and exporting
78 lines
1.8 KiB
Go
78 lines
1.8 KiB
Go
package csv
|
|
|
|
import (
|
|
"errors"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/backtester/common"
|
|
"github.com/thrasher-corp/gocryptotrader/currency"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
gctkline "github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
|
)
|
|
|
|
const testExchange = "binance"
|
|
|
|
func TestLoadDataCandles(t *testing.T) {
|
|
exch := testExchange
|
|
a := asset.Spot
|
|
p := currency.NewPair(currency.BTC, currency.USDT)
|
|
_, err := LoadData(
|
|
common.DataCandle,
|
|
filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv"),
|
|
exch,
|
|
gctkline.FifteenMin.Duration(),
|
|
p,
|
|
a,
|
|
false)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestLoadDataTrades(t *testing.T) {
|
|
exch := testExchange
|
|
a := asset.Spot
|
|
p := currency.NewPair(currency.BTC, currency.USDT)
|
|
_, err := LoadData(
|
|
common.DataTrade,
|
|
filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv"),
|
|
exch,
|
|
gctkline.FifteenMin.Duration(),
|
|
p,
|
|
a,
|
|
false)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestLoadDataInvalid(t *testing.T) {
|
|
exch := testExchange
|
|
a := asset.Spot
|
|
p := currency.NewPair(currency.BTC, currency.USDT)
|
|
_, err := LoadData(
|
|
-1,
|
|
filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv"),
|
|
exch,
|
|
gctkline.FifteenMin.Duration(),
|
|
p,
|
|
a,
|
|
false)
|
|
if !errors.Is(err, common.ErrInvalidDataType) {
|
|
t.Errorf("received: %v, expected: %v", err, common.ErrInvalidDataType)
|
|
}
|
|
|
|
_, err = LoadData(
|
|
-1,
|
|
filepath.Join("..", "..", "..", "..", "testdata", "binance_BTCUSDT_24h-trades_2020_11_16.csv"),
|
|
exch,
|
|
gctkline.FifteenMin.Duration(),
|
|
p,
|
|
a,
|
|
true)
|
|
if !errors.Is(err, errNoUSDData) {
|
|
t.Errorf("received: %v, expected: %v", err, errNoUSDData)
|
|
}
|
|
}
|