forked from joaocosta/lib_mysqludf_ta
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.DEV
31 lines (25 loc) · 1.08 KB
/
README.DEV
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
## Docker
time docker build --tag db_test .
docker run --rm \
--name db_test \
-v /root/src:/root/src \
-e "MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1" \
-e "MARIADB_DATABASE=test" \
-e MARIADB_INITDB_SKIP_TZINFO=1 \
db_test
docker exec -ti db_test bash
mariadb -uroot test < sampledb.sql
mariadb -uroot test
SELECT datetime, close, ta_rsi(close,14) FROM EURUSD_86400 LIMIT 10;
# Sample query to test changes to mysqludf_ta to allow calculating running rsi over multiple timeframes
SELECT
datetime,
WEEK(datetime),
CAST(date_format(date_sub(datetime, interval weekday(datetime)+1 DAY), '%Y-%m-%d 00:00:00') AS DATETIME) AS COMMON_DATETIME,
open, close,
FIRST_VALUE(close) OVER (PARTITION BY COMMON_DATETIME ORDER BY datetime) as open_604800,
LAST_VALUE(close) OVER (PARTITION BY COMMON_DATETIME ORDER BY datetime) as close_604800,
round(ta_rsi_win(close, 14) OVER (PARTITION BY COMMON_DATETIME ORDER BY datetime) ,5) AS RSI14
FROM EURUSD_86400 ORDER BY datetime ASC LIMIT 100;
docker rm -f db_test
docker rmi db_test