forked from joaocosta/lib_mysqludf_ta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.DEV
30 lines (25 loc) · 1.1 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
## Docker
time docker build --tag db_test .
docker run --rm \
--name db_test \
-v /root/src:/root/src \
-e "MYSQL_ROOT_PASSWORD=root" \
-e "MYSQL_DATABASE=test" \
-e "MYSQL_USER=fx" \
-e "MYSQL_PASSWORD=fx" \
-e MYSQL_INITDB_SKIP_TZINFO=1 \
db_test
docker exec -ti db_test bash
mysql -uroot -proot test < sampledb.sql
mysql -uroot -proot 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;