forked from InjectiveLabs/sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-examples.sh
executable file
·42 lines (38 loc) · 973 Bytes
/
run-examples.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
runChainExamples(){
examples=$(find -s examples/chain_client_examples -type f -mindepth 1 -name '*.py')
echo "Running all chain examples..."
for example in $examples
do
echo "$example"
python $example
echo "============================================================="
done
}
runExchangeExamples(){
dirs=$(find -s examples/exchange_api_examples -type d -mindepth 1)
for dir in $dirs
do
examples=$(find -s $dir -type f -name '*.py')
echo "Running $dir examples..."
for example in $examples
do
echo $example
# auto kill after 5s to exit streaming examples
(sleep 5 && pkill -f $example) &
python $example
echo "============================================================="
done
done
}
TYPE=$1
case $TYPE in
"chain")
runChainExamples
;;
"exchange")
runExchangeExamples
;;
*)
echo "Missing required argument, must be \"chain\" or \"exchange\""
;;
esac