0.はじめに
本記事ではテクニカル指標を用いて高精度な仮想通貨の価格を推定します.
対象とした仮想通貨はステラルーメン(XLM)です.
単価が15円前後なので,今後遊び間隔で取引ができると思いこちらを選びました.
*最小サイズが0.1ですので,実際には3円程度でやり取りする予定です.
1. データセット
88967個のXLMのデータを使用します.
2022-07-04 17:38:39,255 __main__: 62 __init__ [ INFO]: Initialization is complete.
2022-07-04 17:39:08,095 __main__: 73 load_datasets [ INFO]: log_file_list : 88967
データの範囲は6月下旬のデータです.
*見にくいので拡大して見てください.
2. データ整形
データセットから特徴量を抽出し整形します.
その結果,データを5889個と1473個のデータに分割します.
2022-07-04 18:14:48,437 main: 245 _creata_train_test [ INFO]: technical_df len : 7362
2022-07-04 18:14:48,439 main: 251 _creata_train_test [ INFO]: train_df len : 5889
2022-07-04 18:14:48,440 main: 252 _creata_train_test [ INFO]: test_df len : 1473
3. 価格推定
推定結果はこのようにぼぼドンピシャに推定できるようになっています.
4.仮想構築
仮想環境の構築
conda create -n CyAzu38 python=3.8
conda activate CyAzu38
必要パッケージをインストール
pip install seaborn
pip install tqdm
pip install download\TA_Lib-0.4.24-cp38-cp38-win_amd64.whl
pip install pycaret
パッケージ一覧
alembic 1.8.0
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.0.5
attrs 21.4.0
backcall 0.2.0
beautifulsoup4 4.11.1
bleach 5.0.1
blis 0.7.8
Boruta 0.3
catalogue 1.0.0
certifi 2022.6.15
cffi 1.15.1
charset-normalizer 2.1.0
click 8.1.3
cloudpickle 2.1.0
colorama 0.4.5
colorlover 0.3.0
cufflinks 0.17.3
cycler 0.11.0
cymem 2.0.6
Cython 0.29.14
databricks-cli 0.17.0
debugpy 1.6.0
decorator 5.1.1
defusedxml 0.7.1
docker 5.0.3
entrypoints 0.4
executing 0.8.3
fastjsonschema 2.15.3
Flask 2.1.2
fonttools 4.33.3
funcy 1.17
future 0.18.2
gensim 3.8.3
gitdb 4.0.9
GitPython 3.1.27
greenlet 1.1.2
htmlmin 0.1.12
idna 3.3
ImageHash 4.2.1
imbalanced-learn 0.7.0
importlib-metadata 4.12.0
importlib-resources 5.8.0
ipykernel 6.15.0
ipython 8.4.0
ipython-genutils 0.2.0
ipywidgets 7.7.1
itsdangerous 2.1.2
jedi 0.18.1
Jinja2 3.1.2
joblib 1.1.0
jsonschema 4.6.1
jupyter-client 7.3.4
jupyter-core 4.10.0
jupyterlab-pygments 0.2.2
jupyterlab-widgets 1.1.1
kiwisolver 1.4.3
kmodes 0.12.1
lightgbm 3.3.2
llvmlite 0.37.0
Mako 1.2.1
MarkupSafe 2.1.1
matplotlib 3.5.2
matplotlib-inline 0.1.3
missingno 0.5.1
mistune 0.8.4
mlflow 1.27.0
mlxtend 0.19.0
multimethod 1.8
murmurhash 1.0.7
nbclient 0.6.6
nbconvert 6.5.0
nbformat 5.4.0
nest-asyncio 1.5.5
networkx 2.8.4
nltk 3.7
notebook 6.4.12
numba 0.54.1
numexpr 2.8.3
numpy 1.19.5
oauthlib 3.2.0
packaging 21.3
pandas 1.4.3
pandas-profiling 3.2.0
pandocfilters 1.5.0
parso 0.8.3
patsy 0.5.2
phik 0.12.2
pickleshare 0.7.5
Pillow 9.2.0
pip 21.2.2
plac 1.1.3
plotly 5.9.0
preshed 3.0.6
prometheus-client 0.14.1
prometheus-flask-exporter 0.20.2
prompt-toolkit 3.0.30
protobuf 4.21.2
psutil 5.9.1
pure-eval 0.2.2
pycaret 2.3.10
pycparser 2.21
pydantic 1.9.1
Pygments 2.12.0
PyJWT 2.4.0
pyLDAvis 3.2.2
pynndescent 0.5.7
pyod 1.0.2
pyparsing 3.0.9
pyrsistent 0.18.1
python-dateutil 2.8.2
pytz 2022.1
PyWavelets 1.3.0
pywin32 227
pywinpty 2.0.5
PyYAML 5.4.1
pyzmq 23.2.0
querystring-parser 1.2.4
regex 2022.6.2
requests 2.28.1
scikit-learn 0.23.2
scikit-plot 0.3.7
scipy 1.5.4
seaborn 0.11.2
Send2Trash 1.8.0
setuptools 61.2.0
six 1.16.0
smart-open 6.0.0
smmap 5.0.0
soupsieve 2.3.2.post1
spacy 2.3.7
SQLAlchemy 1.4.39
sqlparse 0.4.2
srsly 1.0.5
stack-data 0.3.0
statsmodels 0.13.2
TA-Lib 0.4.24
tabulate 0.8.10
tangled-up-in-unicode 0.2.0
tenacity 8.0.1
terminado 0.15.0
textblob 0.17.1
thinc 7.4.5
threadpoolctl 3.1.0
tinycss2 1.1.1
tornado 6.2
tqdm 4.64.0
traitlets 5.3.0
typing_extensions 4.3.0
umap-learn 0.5.3
urllib3 1.26.9
visions 0.7.4
waitress 2.1.2
wasabi 0.9.1
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 1.3.3
Werkzeug 2.1.2
wheel 0.37.1
widgetsnbextension 3.6.1
wincertstore 0.2
wordcloud 1.8.2.2
yellowbrick 1.3.post1
zipp 3.8.0
5.配布コードと配布モデルの使い方
(CyAzu38) CCyAzu>python CythonDemo.py
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Low High Open Close total_vol total_bid_vol \
time2
2022-06-21 23:57:00 16.134 16.151 16.151 16.134 849.46 565.39
2022-06-21 23:58:00 16.130 16.136 16.134 16.135 2746.67 1832.74
2022-06-21 23:59:00 16.124 16.139 16.133 16.139 1914.65 986.43
2022-06-22 00:00:00 16.138 16.154 16.147 16.140 2500.28 1484.01
2022-06-22 00:01:00 16.112 16.150 16.140 16.122 1781.19 1278.39
... ... ... ... ... ... ...
2022-06-29 13:30:00 15.538 15.564 15.538 15.557 1111.20 503.27
2022-06-29 13:31:00 15.541 15.562 15.557 15.541 1091.06 702.86
2022-06-29 13:32:00 15.541 15.591 15.541 15.590 1254.67 388.97
2022-06-29 13:33:00 15.595 15.618 15.595 15.614 3842.93 1312.18
2022-06-29 13:34:00 15.614 15.625 15.614 15.617 660.25 515.43
total_ask_vol
time2
2022-06-21 23:57:00 284.07
2022-06-21 23:58:00 913.93
2022-06-21 23:59:00 928.22
2022-06-22 00:00:00 1016.27
2022-06-22 00:01:00 502.80
... ...
2022-06-29 13:30:00 607.93
2022-06-29 13:31:00 388.20
2022-06-29 13:32:00 865.70
2022-06-29 13:33:00 2530.75
2022-06-29 13:34:00 144.82
[7362 rows x 7 columns]
Transformation Pipeline and Model Successfully Loaded
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Low High Open Close total_vol total_bid_vol \
time2
2022-06-21 23:57:00 16.134 16.151 16.151 16.134 849.46 565.39
2022-06-21 23:58:00 16.130 16.136 16.134 16.135 2746.67 1832.74
2022-06-21 23:59:00 16.124 16.139 16.133 16.139 1914.65 986.43
2022-06-22 00:00:00 16.138 16.154 16.147 16.140 2500.28 1484.01
2022-06-22 00:01:00 16.112 16.150 16.140 16.122 1781.19 1278.39
2022-06-22 00:02:00 16.122 16.126 16.123 16.124 2370.86 1675.97
2022-06-22 00:03:00 16.091 16.124 16.124 16.110 3319.55 1884.16
2022-06-22 00:04:00 16.096 16.116 16.114 16.110 3113.74 1264.03
2022-06-22 00:05:00 16.103 16.110 16.110 16.105 956.01 508.67
2022-06-22 00:06:00 16.101 16.109 16.109 16.107 1197.93 715.58
total_ask_vol Label mid
time2
2022-06-21 23:57:00 284.07 16.019891 16.1425
2022-06-21 23:58:00 913.93 16.019293 16.1330
2022-06-21 23:59:00 928.22 16.019847 16.1315
2022-06-22 00:00:00 1016.27 16.019775 16.1460
2022-06-22 00:01:00 502.80 16.019567 16.1310
2022-06-22 00:02:00 694.89 16.018789 16.1240
2022-06-22 00:03:00 1435.39 16.019141 16.1075
2022-06-22 00:04:00 1849.71 16.019771 16.1060
2022-06-22 00:05:00 447.34 16.019679 16.1065
2022-06-22 00:06:00 482.35 16.019741 16.1050
(CyAzu38) CCyAzu>
配布した.pyファイルを実行してもらえば動くと思います.
実行すると下記のグラフが出力されます.