Oanda APIを使った取引bot。APIのドキュメントはこちら:
https://developer.oanda.com/rest-live-v20/introduction/
-
key.json
Oanda APIの口座IDとトークン{ "live":{ "id":"live-account-id", "token":"live-api-key" }, "demo":{ "id":"demo-account-id", "token":"demo-api-key" } }
-
param.json
通貨ペアや損切ライン等のパラメタ。変更の可能性あり。
{ "Inst":"USD_JOY", "Gran":"M5", "Seconds":300, "Span":12, "Thresh":0.0025, "ProfRate":0.005, "LossRate":-0.005, "Spread":0.016, "Units":10000 }
-
twitter.json
twitterのAPI。ツイート用。{ "API_KEY":"api-key", "API_SECRET":"api-secret", "BEARER":"bearer", "ACCESS_TOKEN":"access-token", "ACCESS_SECRET":"access-secret" }
- trade.json
取引の履歴が出力される
{ "X":[unixTimestamp,...], "Y":[prices,...], "Action":["OPEN","CLOSE",...], "Side":["BUY","SELL",...] }
- balance.json
総利益の推移が出力される
{ "X":[unixTimestamp,...], "Y":[prices,...], "TotalPL":[totalProfit,...] }
- trade.json
- 「必要なファイル」をプロジェクトファイルの直下に配置
- ./bring.shを実行。コンパイルし実行ファイルをプロジェクトファイルの直下にmvしてくれる。
- pm2で起動。
- 修正などで再コンパイルした時は、
pm2 restart your-app-name
を忘れずに。
# 初回起動
pm2 start oanda-bot
pm2 save
# 再起動
pm2 restart oanda-bot
pm2 show "your file name"
pm2 status
pm2 stop "your file name"