-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from dakimura/integtests-not-sorted-by-time
add a test case of CSV Import
- Loading branch information
Showing
5 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,12 @@ | |
mktsdb/ | ||
marketstore | ||
*.exe | ||
|
||
# Python Virtual Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,85 @@ | ||
#!/bin/bash | ||
|
||
function exit_if_failed() | ||
{ | ||
if [[ $1 -ne 0 ]]; | ||
then | ||
echo "Failed" | ||
exit 1; | ||
fi | ||
} | ||
|
||
# init data | ||
rm -rf testdata test_ticks.csv && mkdir -p testdata/mktsdb | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
if [ $? -ne 0 ]; then \ | ||
echo "Failed: cannot delete testdata and make testdata/mktsdb directory" | ||
exit 1; | ||
fi | ||
|
||
|
||
# import ticks-example-1.csv/yaml to TEST/1Min/TICK and check if the output of show commands match ticks-example-1-output.csv | ||
marketstore connect -d `pwd`/testdata/mktsdb <<- EOF | ||
\create TEST/1Min/TICK:Symbol/Timeframe/AttributeGroup Bid,Ask/float32 variable | ||
\getinfo TEST/1Min/TICK | ||
\load TEST/1Min/TICK bin/ticks-example-1.csv bin/ticks-example-1.yaml | ||
\o test_ticks.csv | ||
\show TEST/1Min/TICK 1970-01-01 | ||
EOF | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
diff -q bin/ticks-example-1-output.csv test_ticks.csv && echo "Passed" | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
rm -f test_ticks.csv | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
|
||
# import ticks-example-2.csv/yaml to TEST2/1Min/TICK and check if the output of show commands match ticks-example-2-output.csv | ||
marketstore connect -d `pwd`/testdata/mktsdb <<- EOF | ||
\create TEST2/1Min/TICK:Symbol/Timeframe/AttributeGroup Bid,Ask/float32 variable | ||
\load TEST2/1Min/TICK bin/ticks-example-2.csv bin/ticks-example-2.yaml | ||
\o test_ticks.csv | ||
\show TEST2/1Min/TICK 1970-01-01 | ||
EOF | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
diff -q bin/ticks-example-2-output.csv test_ticks.csv && echo "Passed" | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
rm -f test_ticks.csv | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
|
||
# import ticks-example-1.csv/yaml to TEST/1Min/TICK | ||
# and check if the output of show commands match ticks-example-1-output.csv + ticks-example-2-output.csv | ||
marketstore connect -d `pwd`/testdata/mktsdb <<- EOF | ||
\load TEST2/1Min/TICK bin/ticks-example-1.csv bin/ticks-example-1.yaml | ||
\o test_ticks.csv | ||
\show TEST2/1Min/TICK 1970-01-01 | ||
EOF | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
cat bin/ticks-example-1-output.csv bin/ticks-example-2-output.csv > tmp.csv | ||
diff -q tmp.csv test_ticks.csv && echo "Passed" | ||
if [ $? -ne 0 ]; then exit 1; fi | ||
exit_if_failed $? | ||
|
||
rm -f test_ticks.csv | ||
exit_if_failed $? | ||
|
||
|
||
# import ticks-example-not-sorted-by-time.csv/yaml to TEST/1Min/TICK | ||
# and check if the output of show commands match ticks-example-not-sorted-by-time-output.csv | ||
marketstore connect -d `pwd`/testdata/mktsdb <<- EOF | ||
\create TEST/1Min/TICK:Symbol/Timeframe/AttributeGroup Bid,Ask/float32 variable | ||
\getinfo TEST/1Min/TICK | ||
\load TEST/1Min/TICK bin/ticks-example-not-sorted-by-time.csv bin/ticks-example-not-sorted-by-time.yaml | ||
\o test_ticks.csv | ||
\show TEST/1Min/TICK 1970-01-01 | ||
EOF | ||
exit_if_failed $? | ||
|
||
diff -q bin/ticks-example-not-sorted-by-time-output.csv test_ticks.csv && echo "Passed" | ||
exit_if_failed $? | ||
|
||
# remove the temporary files | ||
rm -rf testdata test_ticks.csv tmp.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
2018-11-21 01:23:44 +0000 UTC,112.8,112.8,999998994 | ||
2018-11-21 01:23:45 +0000 UTC,112.82,112.8,99999988 | ||
2018-11-21 01:32:00 +0000 UTC,112.81,112.8,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Epoch ,Bid, Ask | ||
2018-11-21T01:23:44.999999,112.80,112.8 | ||
2018-11-21T01:32:00.000000,112.81,112.8 | ||
2018-11-21T01:23:45.100000,112.82,112.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
firstRowHasColumnNames: true | ||
timeFormat: "2006-01-02T15:04:05.000000" | ||
columnNameMap: | ||
- Epoch | ||
- Bid | ||
- Ask |