{"id":4688,"date":"2019-06-28T18:58:12","date_gmt":"2019-06-28T09:58:12","guid":{"rendered":"https:\/\/www.cin-gr.jp\/category_column\/?p=4688"},"modified":"2019-07-01T13:21:56","modified_gmt":"2019-07-01T04:21:56","slug":"post-4688","status":"publish","type":"post","link":"https:\/\/www.cin-gr.jp\/category_column\/2019\/06\/post-4688.html","title":{"rendered":"\u30d3\u30c3\u30c8\u30b3\u30a4\u30f3\u306e\u4fa1\u683c\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0"},"content":{"rendered":"<p>\u30b7\u30b9\u30c6\u30e0\u90e8\u306eN\u3067\u3059\u3002<\/p>\n<p>\u3044\u3064\u3082\u4ed5\u4e8b\u3068\u5168\u7136\u95a2\u4fc2\u306a\u3044\u3053\u3068\u3092\u30d6\u30ed\u30b0\u306b\u66f8\u3044\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u30b5\u30a4\u30c8\u306f\u6c42\u4eba\u30b5\u30a4\u30c8\u3067\u3059\u306e\u3067\u3069\u3046\u3044\u3046\u4ed5\u4e8b\u3057\u3066\u308b\u306e\u304b\uff1f\u3068\u3044\u3046\u3053\u3068\u304c\u898b\u3066\u304f\u3060\u3055\u3063\u3066\u308b\u65b9\u3005\u306b\u5206\u304b\u3089\u306a\u3044\u3068\u99c4\u76ee\u3060\u308d\u3046\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u3053\u306e\u30d6\u30ed\u30b0\u306b\u30b7\u30b9\u30c6\u30e0\u306b\u95a2\u4fc2\u3042\u308b\u3053\u3068\u3092\u66f8\u304f\u3088\u3046\u306b\u30b7\u30b9\u30c6\u30e0\u90e8\u306e\u30e1\u30f3\u30d0\u30fc\u306b\u8a00\u3063\u3066\u6700\u8fd1\u307f\u3093\u306a\u304c\u66f8\u3044\u3066\u304f\u308c\u305f\u306e\u3067\u81ea\u5206\u3082\u4f55\u304b\u66f8\u3053\u3046\u3068\u601d\u3044\u8003\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>\u672a\u7d4c\u9a13\u8005\u3082\u52df\u96c6\u3057\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001\u81ea\u5206\u304c\u672a\u7d4c\u9a13\u8005\u3060\u3063\u305f\u3068\u304d\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u899a\u3048\u3088\u3046\u3068\u601d\u3063\u305f\u52d5\u6a5f\u306f\u306a\u3093\u3060\u3063\u305f\u304b\uff1f<\/p>\n<p>\u8003\u3048\u305f\u3068\u3053\u308d\u3001<span class=\"textRed\">\u30ae\u30e3\u30f3\u30d6\u30eb<\/span>\u3067\u3057\u305f\u3002<\/p>\n<p><span class=\"textBlack\">\u7af6\u99ac\u306e\u904e\u53bb\u306e\u30c7\u30fc\u30bf\u3092\u5927\u91cf\u306b\u96c6\u3081\u308c\u3070\u50be\u5411\u304c\u5206\u304b\u308a\u4e00\u5b9a\u306e\u57fa\u6e96\u3067\u4e88\u60f3\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u304b\uff1f<\/span><\/p>\n<p>\u306a\u3069\u3068\u8003\u3048\u3066\u304a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u7d50\u679c\u306f\u6b8b\u5ff5\u306a\u304c\u3089\u6210\u529f\u306b\u306f\u81f3\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u304a\u91d1\u3092\u7a3c\u3050\u3068\u3044\u3046\u3088\u3046\u306a\u5177\u4f53\u7684\u306a\u76ee\u7684\u304c\u306a\u3044\u3068\u306a\u304b\u306a\u304b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52c9\u5f37\u3057\u3066\u899a\u3048\u3088\u3046\u3068\u3044\u3046\u6c17\u306b\u306a\u3089\u306a\u3044\u3067\u3059\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u306a\u3089\u4f55\u304c\u826f\u3044\u304b\uff1f<\/p>\n<p>\u8003\u3048\u305f\u3068\u3053\u308d<span class=\"textRed\">\u4eee\u60f3\u901a\u8ca8<\/span>\u3068\u304b\u3069\u3046\u3067\u3057\u3087\u3046\u304b\uff1f\u30fb\u30fb\u30fb<\/p>\n<p>\u6b8b\u5ff5\u306a\u304c\u3089\u3001\u4eee\u60f3\u901a\u8ca8\u306e\u767a\u6398(\u30de\u30a4\u30cb\u30f3\u30b0)\u3067\u7a3c\u3050\u306e\u306f\u3082\u3046\u624b\u9045\u308c\u3067\u3059\u3088\u306d\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u3059\u3054\u3044\u5bd2\u3044\u3068\u3053\u308d\u3067\u767a\u96fb\u3057\u3066\u767a\u6398\u3057\u306a\u3044\u3068\u96fb\u6c17\u4ee3\u304c\u7a3c\u3052\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001<span class=\"textBlack\">\u4eee\u60f3\u901a\u8ca8\u306f\u5e02\u5834\u304c\u958b\u304b\u308c\u3066\u304a\u308a\u3001\u7121\u6599\u3067\u4f7f\u3048\u308bAPI\u304c\u3042\u308b\u306e\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u3063\u3066\u81ea\u52d5\u58f2\u8cb7\u3059\u308b\u3053\u3068\u3067\u7a3c\u304e\u304c\u51fa\u305b\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u30fb\u30fb\u30fb\u3002<\/span><\/p>\n<p>\u305f\u3060\u521d\u5fc3\u8005\u304c\u3044\u304d\u306a\u308a\u81ea\u52d5\u58f2\u8cb7\u307e\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u306e\u306f\u5927\u5909\u5371\u967a\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u306f\u3001\u5024\u6bb5\u306e\u52d5\u304d\u3092\u898b\u3066\u4eca\u5f8c\u5024\u6bb5\u304c\u4e0a\u304c\u3063\u3066\u3044\u304f\u304b\uff1f\u4e0b\u304c\u3063\u3066\u3044\u304f\u304b\uff1f\u305d\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u6765\u305f\u304b\uff1f\u306a\u3069\u3092\u30e1\u30fc\u30eb\u3067\u81ea\u5206\u306e\u643a\u5e2f\u306b\u9001\u4fe1\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b89\u5168\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u4eee\u60f3\u901a\u8ca8\u306f\u80e1\u6563\u81ed\u3044\u3068\u601d\u3046\u306e\u3067\u3057\u305f\u3089\u3001MT4\u3068\u3044\u3046\u30bd\u30d5\u30c8\u3092Windows\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u53e3\u5ea7\u3092\u4f5c\u308c\u3070\uff08\u30c7\u30e2\u53e3\u5ea7\u3067\u3082\u3088\u3057\uff09\u5916\u56fd\u70ba\u66ffFX\u306a\u3069\u306e\u4fa1\u683c\u306e\u53d6\u5f97\u3084\u81ea\u52d5\u58f2\u8cb7\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u4f5c\u6210\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\uff08\u8a00\u8a9e\u306fMQ4\u3068\u3044\u3046C++\u306b\u8fd1\u3044\u6587\u6cd5\u306e\u8a00\u8a9e\u3067\u3059\uff09<\/p>\n<p>MQ4\u306f\u3046\u3061\u306e\u4f1a\u793e\u306e\u4ed5\u4e8b\u3068\u306f\u5168\u304f\u95a2\u4fc2\u306a\u3044\u306e\u3067\u89e6\u308c\u307e\u305b\u3093\u304c\u3001\u74b0\u5883\u69cb\u7bc9\u3084\u30c6\u30af\u30cb\u30ab\u30eb\u5206\u6790\u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3044\u308d\u3093\u306a\u624b\u6cd5\u3092\u7814\u7a76\u3059\u308b\u306e\u304c\u5bb9\u6613\u3067\u3059\u3002<\/p>\n<p>\u203b\u305f\u3060\u3001MT4\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u53e3\u5ea7\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u304c\u5e83\u3044\u305f\u3081\u3001\u3084\u308b\u6c17\u306f\u8d77\u304d\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u5916\u56fd\u70ba\u66ffFX\u3067\u3082OANDA\u3068\u3044\u3046\u4f1a\u793e\u306730\u4e07\u5186\u4ee5\u4e0a\u5165\u91d1\u3057\u3066\u53e3\u5ea7\u3092\u4f5c\u308c\u3070\u3001REST API\u304c\u4f7f\u7528\u53ef\u80fd\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u203bREST API\u306fhttp\u3067\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306aAPI\u306e\u3053\u3068\u3067\u3001WEB\u30b5\u30fc\u30d0\u4e0a\u306ephp\u306a\u3069\u304b\u3089\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>WEB API\u3068\u3082\u547c\u3073\u307e\u3059\u3002<\/p>\n<p>(http\u901a\u4fe1\u304c\u53ef\u80fd\u3067\u3042\u308c\u3070\u4f55\u8a00\u8a9e\u3067\u3082\u5229\u7528\u53ef\u80fd\u3067\u3059\uff09<\/p>\n<p><span class=\"textBlack\">\u4eca\u56de\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001WEB\u7cfb\u30d7\u30ed\u30b0\u30e9\u30de\u306b\u8eab\u8fd1\u306aphp\u3068\u5c11\u3057JavaScript\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u30d3\u30c3\u30c8\u30b3\u30a4\u30f3\u306e\u4fa1\u683c\u3092\u53d6\u5f97\u3057\u3066\u5206\u6790\u3059\u308b\u305f\u3081\u306b\u3001\u307e\u305a\u306f\u3069\u3046\u3044\u3046\u74b0\u5883\u3092\u4f5c\u308c\u3070\u3044\u3044\u304b\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/span><\/p>\n<p><span class=\"decorationYellow\">\uff11\uff0ejavascript\u3060\u3051\u3067\u958b\u767a\u3059\u308b<\/span> \u2192 \u4e0d\u53ef\u80fd<\/p>\n<p>\u6b8b\u5ff5\u306a\u304c\u3089\u51fa\u6765\u307e\u305b\u3093\u3002<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308bJavaScript\u306b\u306fajax(XMLHttpRequest)\u3068\u3044\u3046http\u901a\u4fe1\u3092\u884c\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u6b8b\u5ff5\u306a\u304c\u3089\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u554f\u984c\u306b\u3088\u308a\u81ea\u5206\u304c\u7ba1\u7406\u3057\u3066\u3044\u306a\u3044\u30b5\u30fc\u30d0\u306b\u5bfe\u3057\u3066ajax\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u305b\u3093\u3002<\/p>\n<p>\u203b\u521d\u5fc3\u8005\u306b\u306f\u3081\u3061\u3083\u304f\u3061\u3083\u96e3\u3057\u304f\u304a\u3059\u3059\u3081\u3057\u307e\u305b\u3093\u304c\u3001Node.js\u3068\u304b\u3044\u3046\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9js\u306a\u3089\u53ef\u80fd\u3067\u3059\u30fb\u30fb\u30fb\u3002<\/p>\n<p>php\u3067\u3084\u3063\u305f\u307b\u3046\u304c\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><span class=\"decorationYellow\">\uff12\uff0ephp + javascript\u3067\u3084\u308b\u5834\u5408<\/span><\/p>\n<p>\u500b\u4eba\u304c\u3084\u308b\u306e\u306f\u3053\u3063\u3061\u306e\u65b9\u6cd5\u304c\u5b89\u5b9a\u7a3c\u52d5\u3055\u305b\u3084\u3059\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u5b89\u5b9a\u3057\u3066\u7a3c\u52d5\u3092\u76ee\u6307\u3059\u306a\u3089\u3001\u81ea\u5206\u5c02\u7528\u30671\u53f0\u4e38\u3054\u3068\u4f7f\u7528\u53ef\u80fd\u306a\u5c02\u7528\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u3067\u904b\u7528\u3059\u308b\u306e\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u5229\u7528\u6599\u304c\u9ad8\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>kagoya\u30b5\u30fc\u30d0\u304c\u5c02\u7528\u30d7\u30e9\u30f3\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u3060\u3068\u5b89\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u521d\u5fc3\u8005\u3067\u5024\u6bb5\u306e\u30c1\u30a7\u30c3\u30af\u3068\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u3060\u3051\u304f\u3089\u3044\u3067\u5229\u7528\u3059\u308b\u5834\u5408\u306f\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u306e\u5171\u7528\u30d7\u30e9\u30f3\u3067php\u304c\u5229\u7528\u53ef\u80fd\u306a\u5b89\u3044\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u304c\u304a\u91d1\u3092\u7121\u99c4\u306b\u305b\u305a\u7121\u96e3\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u7528\u9014\u3067\u5171\u7528\u30d7\u30e9\u30f3\u3067\u304a\u3059\u3059\u3081\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u306f\u3055\u304f\u3089\u30b5\u30fc\u30d0\u3067\u3059\u3002<\/p>\n<p><span class=\"decorationYellow\">\u30fb\u3055\u304f\u3089\u30b5\u30fc\u30d0<\/span>\uff08\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d77\u52d5\u3059\u308b\u4ed5\u7d44\u307f\u3092\u7d44\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\uff09<\/p>\n<p><span class=\"decorationYellow\">\u30fb\u30b3\u30a2\u30b5\u30fc\u30d0<\/span>\uff08cron\u304c\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002\u3057\u304b\u3057\u6b8b\u5ff5\u306a\u304c\u3089\u30011\u6642\u9593\u306b\u4e00\u56de\u3057\u304b\u8d77\u52d5\u3067\u304d\u306a\u3044\u3067\u3059\u30fb\u30fb\u30fb\uff09<\/p>\n<p>1\u6642\u9593\u306b\u4e00\u56de\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3060\u3051\u306a\u3089\u3070\u3001\u30b3\u30a2\u30b5\u30fc\u30d0\u3067cron\u304b\u3089php\u3092\u8d77\u52d5\u3059\u308b\u306e\u3067\u826f\u3044\u3067\u3059\u304c\u30011\u6642\u9593\u306b\u4e00\u56de\u306e\u5024\u6bb5\u30c1\u30a7\u30c3\u30af\u3067\u306f\u5b9f\u7528\u30ec\u30d9\u30eb\u306b\u306f\u306a\u3089\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u5e74\u95935\u4e07\u5186\u304f\u3089\u3044\u6255\u3063\u3066\u3082\u60dc\u3057\u304f\u306a\u3044\u307b\u3069\u306b\u3001\u304a\u91d1\u304c\u7a3c\u3052\u305d\u3046\u306a\u81ea\u4fe1\u304c\u3064\u3044\u305f\u3089kagoya\u30b5\u30fc\u30d0\u306e\u5c02\u7528\u30d7\u30e9\u30f3\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n<p>cron\u304c1\u5206\u306b1\u56de\u8d77\u52d5\u53ef\u80fd\u3067\u3059\u3002cron\u30671\u5206\u306b\u4e00\u56de\u5024\u6bb5\u3092\u30c1\u30a7\u30c3\u30af\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u3001\u5c02\u7528\u30d7\u30e9\u30f3\u306a\u3089\u3001\u81ea\u5206\u5c02\u7528\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5171\u7528\u30d7\u30e9\u30f3\u306e\u5834\u5408\u3001\u540c\u3058IP\u30a2\u30c9\u30ec\u30b9\u3092\u8907\u6570\u306e\u4eba\u304c\u4f7f\u3063\u3066\u3044\u308b\u305f\u3081\u540c\u3058\u3053\u3068\u3092\u3057\u3066\u3044\u308b\u4eba\u304c\u5c45\u305f\u5834\u5408\u3001\u76f8\u624b\u5074\u306e\u30b5\u30fc\u30d0\u306e(REST API\u63d0\u4f9b\u5074)\u30a2\u30af\u30bb\u30b9\u304c\u6fc0\u3057\u3059\u304e\u308b\u5834\u5408\u306a\u3069\u306b\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u3048\u307e\u3059\u3002<\/p>\n<p>\u8a18\u4e8b\u304c\u3059\u3054\u304f\u9577\u304f\u306a\u308a\u305d\u3046\u306a\u306e\u3067php\u3067REST API\u3092\u547c\u3073\u51fa\u3057\u3066\u3001<span class=\"textRed\">\u30ed\u30fc\u30bd\u30af\u8db3<\/span>\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3060\u3051\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cin-gr.jp\/category_column\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_2.jpg\" alt=\"\" width=\"660\" height=\"405\" class=\"aligncenter size-full wp-image-4689\" srcset=\"https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_2.jpg 660w, https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_2.jpg 147w, https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_2.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/p>\n<p>\u305d\u308c\u304c\u3067\u304d\u308c\u3070\u3001\u3042\u3068\u306f\u81ea\u5b85\u306e\u30d1\u30bd\u30b3\u30f3\u3092\u4ed8\u3051\u3063\u3071\u306a\u3057\u306b\u3057\u3066\u304a\u3044\u3066php\u3068Javascript\u3067\u4f5c\u6210\u3057\u305f\u753b\u9762\u306bJavascript\u306e\u30bf\u30a4\u30de\u30fc\u306e\u51e6\u7406\u3092\u66f8\u3044\u30661\u5206\u3054\u3068\u306b\u81ea\u5206\u304c\u4f5c\u3063\u305fPHP\u3092\u547c\u3073\u51fa\u3059\u306a\u3069\u3067\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d3\u30c3\u30c8\u30b3\u30a4\u30f3\u306e\u5024\u6bb5\u3092\u7121\u6599\u3067\u53d6\u5f97\u3067\u304d\u308bAPI\u306f\u8abf\u3079\u308c\u3070\u8272\u3005\u3042\u308a\u307e\u3059\u3057\u3001\u53d6\u5f15\u53e3\u5ea7\u3092\u4f5c\u308c\u3070\u53e3\u5ea7\u3092\u4f5c\u3063\u305f\u4f1a\u793e\u304c\u63d0\u4f9b\u3059\u308bAPI\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u53e3\u5ea7\u3092\u4f5c\u3089\u305a\u3001\u30a2\u30ab\u30a6\u30f3\u30c8\u60c5\u5831\u306a\u3069\u3082\u4f5c\u3089\u305a\u306b\u3044\u304d\u306a\u308a\u4f7f\u3048\u308b Cryptowatch API \u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>https:\/\/cryptowat.ch\/docs\/api#market-ohlc<\/p>\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u6b8b\u5ff5\u306a\u304c\u3089\u82f1\u8a9e\u3067\u3059\u3002<\/p>\n<p><span class=\"textBlack\">\u4e0b\u8a18\u306ephp\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092WEB\u30b5\u30fc\u30d0\u306b\u304a\u3044\u3066\u5b9f\u884c\u3059\u308c\u3070\u30d3\u30c3\u30c8\u30d5\u30e9\u30a4\u30e4\u30fc\u306e\u30d3\u30c3\u30c8\u30b3\u30a4\u30f3\u3092\u5186\u3067\u8cb7\u3046\u5834\u5408\u306e1\u5206\u8db3\u306e\u30c7\u30fc\u30bf\u304c10\u672c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>Cryptowatch API \u306e ohlc\u3068\u3044\u3046API\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>ohlc\u3068\u306fOHLC \u3068\u306f \u6307\u5b9a\u3057\u305f\u6642\u9593\u5e2f\u306e Open\u4fa1\u683c\u3001High\u4fa1\u683c\u3001Low\u4fa1\u683c\u3001Close\u4fa1\u683c\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.cin-gr.jp\/category_column\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_1.jpg\" alt=\"\" width=\"660\" height=\"366\" class=\"aligncenter size-full wp-image-4690\" srcset=\"https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_1.jpg 660w, https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_1.jpg 160w, https:\/\/cinwp.awscf.net\/cin-gr.jp\/.wpPk8XQ\/wp-content\/uploads\/sites\/3\/2019\/06\/20190628_1.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/p>\n<p>\u3053\u306e\u30d6\u30ed\u30b0\u66f8\u3044\u3066\u307f\u3066\u601d\u3044\u307e\u3057\u305f\u304c\u3001\u3061\u3087\u3063\u3068\u521d\u5fc3\u8005\u306b\u306f\u96e3\u3057\u3059\u304e\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff65\uff65\uff65\u3002<\/p>\n<p>\u3042\u3068\u3001\u76f8\u5834\u306e\u77e5\u8b58\u3082\u306a\u3044\u3068\u3061\u3087\u3063\u3068\u96e3\u3057\u3044\u3067\u3059\u306d\uff65\uff65\uff65\u3002<\/p>\n<p>cryptowatchApi.php<\/p>\n<pre><code>&lt;?php<\/code><\/pre>\n<pre>\r\n\/\/ Cryptowatch API\u3092\u4f7f\u3046\u30af\u30e9\u30b9\r\nclass cryptowatchApi\r\n{\r\n\r\n  public $url          = 'https:\/\/api.cryptowat.ch';\r\n  public $ohlc_returns = 10;\/\/ \u4f55\u672c\u306e\u30ed\u30fc\u30bd\u30af\u8db3\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u304b\uff1f\r\n  public $timeout      = 5; \/\/ http\u3067\u6700\u95775\u79d2\u5f85\u3064\r\n\r\n\r\n  \/\/ REST API\u7528\u306e\u5171\u901a\u95a2\u6570\r\n  \/\/ php curl\u3068\u3044\u3046\u95a2\u6570\u304c\u4f7f\u3048\u308c\u3070\u3001WEB\u30b5\u30fc\u30d0\u304b\u3089\u3001\r\n  \/\/ \u3088\u305d\u306e\u30b5\u30fc\u30d0\u306bhttp\u901a\u4fe1\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\r\n  \/\/ curl\u304c\u7d76\u5bfe\u306bphp\u306b\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u4fdd\u8a3c\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\r\n  \/\/ \u3055\u304f\u3089\u30b5\u30fc\u30d0\u3001\u30b3\u30a2\u30b5\u30fc\u30d0\u3001\u30ab\u30b4\u30e4\u30b5\u30fc\u30d0\u306a\u3089\u3064\u304b\u3048\u307e\u3059\r\n  public function req($method, $path, $aQuery=NULL)\r\n  {\r\n    $this->isRequest = TRUE;\r\n    $timestamp = time();\r\n    if($aQuery&&count($aQuery)) {\r\n      $path .= '?';\r\n      $i = 0;\r\n      foreach($aQuery as $k=>$v) {\r\n        if($i) {\r\n          $path .= '&';\r\n        }\r\n        $path .= $k.'='.$v;\r\n        $i++;\r\n      }\r\n      $body = json_encode($aQuery);\r\n    }\r\n\r\n    $url = $this->url.$path;\r\n    \/\/echo $url; \/\/ dbg\r\n    $curl = curl_init($url);\r\n    $aOptions = array(\r\n        CURLOPT_RETURNTRANSFER=>TRUE \/\/ curl_exec\u306e\u30ea\u30bf\u30fc\u30f3\u304chtml\u306b\u306a\u308b\r\n      , CURLOPT_TIMEOUT=>$this->timeout\r\n      , CURLOPT_HEADER=>TRUE \/\/ http\u30d8\u30c3\u30c0\u4ed8\u304d\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u306b\u306a\u308b\r\n    );\r\n    if($method == 'POST') {\r\n      $aOptions[CURLOPT_HTTPHEADER][] = 'Content-Type: application\/json';\r\n      $aOptions[CURLOPT_POST] = TRUE;\r\n      $aOptions[CURLOPT_SSL_VERIFYPEER] = FALSE; \/\/ \u30aa\u30ec\u30aa\u30ec\u8a3c\u660e\u66f8\u5bfe\u7b56\r\n      $aOptions[CURLOPT_SSL_VERIFYHOST] = FALSE;\r\n      $aOptions[CURLOPT_POSTFIELDS] = $body;\r\n    } else {\r\n      $aOptions[CURLOPT_HTTPGET] = TRUE;\r\n    }\r\n\r\n    curl_setopt_array($curl, $aOptions);\r\n    $http_res = curl_exec($curl);\r\n    $this->http_res_hdr = curl_getinfo($curl); \/\/ 'http_code'\r\n    curl_close($curl);\r\n    return $http_res;\r\n  }\r\n\r\n  \/\/ http\u30d8\u30c3\u30c0\u306e\u30ed\u30b0\u3064\u304d\u306e\u30d5\u30a1\u30a4\u30eb\u304b\u3089\r\n  \/\/ http\u306ebody\u90e8\u5206(html\u306ebody\u3067\u306f\u306a\u3044\uff01)\u3092\u53d6\u5f97\r\n  public function getJsonBody($http_response)\r\n  {\r\n    $http_response = str_replace(\"\\r\", '', $http_response);\r\n    list($http_header, $html) = explode(\"\\n\\n\", $http_response);\r\n    return $html;\r\n  }\r\n\r\n  \/\/ OHLC \u3068\u306f  \u6307\u5b9a\u3057\u305f\u6642\u9593\u5e2f\u306e Open\u4fa1\u683c\u3001High\u4fa1\u683c\u3001Low\u4fa1\u683c\u3001Close\u4fa1\u683c\u306e\u3053\u3068\r\n  \/\/ \u305d\u308c\u3092\u53d6\u5f97\u3057\u307e\u3059\r\n  public function ohlc($Year=NULL, $Month=NULL, $Day=NULL, $Hour=NULL, $Minute=NULL)\r\n  {\r\n    $aQuery = array(); \/\/ REST API\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u914d\u5217\r\n\r\n    \/\/ \u3069\u306e\u6642\u9593\u8db3\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u304b\uff1f\r\n    $periods =     60; \/\/     60 1\u5206\u8db3\r\n    \/\/$periods =    300; \/\/    300 5\u5206\u8db3\r\n    \/\/$periods =    900; \/\/    900 15\u5206\u8db3\r\n    \/\/$periods =   1800; \/\/   1800 30\u5206\u8db3\r\n    \/\/$periods =   3600; \/\/   3600 1\u6642\u9593\u8db3\r\n    \/\/$periods =   7200; \/\/   7200 2\u6642\u9593\u8db3\r\n    \/\/$periods =  14400; \/\/  14400 4\u6642\u9593\u8db3\r\n    \/\/$periods =  21600; \/\/  21600 6\u6642\u9593\u8db3\r\n    \/\/$periods =  43200; \/\/  43200 12\u6642\u9593\u8db3\r\n    \/\/$periods =  86400; \/\/  86400 1\u65e5\u8db3\r\n    \/\/$periods = 259200; \/\/ 259200 3\u65e5\u8db3\r\n    \/\/$periods = 604800; \/\/ 604800 1\u9031\u9593\u8db3\r\n\r\n    \/\/ \u3069\u306e\u6642\u9593\u8db3\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u304b\uff1f\r\n    $aQuery['periods'] = $periods;\r\n\r\n    $Hour   = empty($Hour   ) ? date('G') : $Hour   ; \/\/ \u7701\u7565\u3059\u308b\u3068\u73fe\u5728\u6642\u9593\u3092\u6307\u5b9a\r\n    $Minute = empty($Minute ) ? date('i') : $Minute ; \/\/ \u7701\u7565\u3059\u308b\u3068\u73fe\u5728\u6642\u9593\u3092\u6307\u5b9a\r\n    $Month  = empty($Month  ) ? date('n') : $Month  ; \/\/ \u7701\u7565\u3059\u308b\u3068\u73fe\u5728\u6642\u9593\u3092\u6307\u5b9a\r\n    $Day    = empty($Day    ) ? date('j') : $Day    ; \/\/ \u7701\u7565\u3059\u308b\u3068\u73fe\u5728\u6642\u9593\u3092\u6307\u5b9a\r\n    $Year   = empty($Year   ) ? date('Y') : $Year   ; \/\/ \u7701\u7565\u3059\u308b\u3068\u73fe\u5728\u6642\u9593\u3092\u6307\u5b9a\r\n\r\n    $before = mktime($Hour, $Minute, 0, $Month, $Day, $Year);\r\n    $returns = $this->ohlc_returns;\r\n    \/\/ \u30ad\u30ea\u306e\u3044\u3044\u3068\u3053\u308d\u304b\u3089\u59cb\u307e\u308b\u3088\u3046\u306b\u6574\u5f62\r\n    $before = ceil($before\/($returns*$periods)) * ($returns*$periods);\r\n    $after = $before - $returns*$periods;\r\n\r\n    \/\/ \u671f\u9593\u3092\u6307\u5b9a\r\n    $aQuery['before']  = $before;\r\n    $aQuery['after']   = $after;\r\n\r\n    $exchange = 'bitflyer'; \/\/ \u30d3\u30c3\u30c8\u30d5\u30e9\u30a4\u30e4\u30fc\u53d6\u5f15\u6240\u3092\u6307\u5b9a\r\n    $pair     = 'btcjpy';   \/\/ \u30d3\u30c3\u30c8\u30b3\u30a4\u30f3\u5186\u306e\u76f8\u5834\r\n\r\n    if( $http_response = $this->req('GET', '\/markets\/'.$exchange.'\/'.$pair.'\/ohlc', $aQuery) ) {\r\n        if($this->http_res_hdr['http_code']=='200') {\r\n          \/\/ \u3053\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3057\u3066\u3001\u4fdd\u5b58\u3059\u3079\u304d\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3059\u308c\u3070\u3001\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3067\u304d\u307e\u3059\r\n          \/\/ file_put_contents($http_log_path, $http_response, LOCK_EX);\r\n        } else {\r\n          $this->isReqError = TRUE;\r\n          echo '\u901a\u4fe1\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f http_code:'.$this->http_res_hdr['http_code'];\r\n        }\r\n    } else {\r\n      echo '\u901a\u4fe1\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f';\r\n    }\r\n\r\n    $json = $this->getJsonBody($http_response); \/\/ json\u3068\u3044\u3046\u5f62\u5f0f\u3067\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u308b\r\n\r\n    $aJson = json_decode($json, TRUE); \/\/ json\u3092php\u306e\u914d\u5217\u306b\u5909\u63db\r\n\r\n    return $aJson;\r\n  }\r\n\r\n}\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\/\/ \u4e0a\u8a18\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u5b9f\u88c5\u90e8\u5206\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\n$cryptowatchApi = new cryptowatchApi();\r\n\r\n\/\/ json\u3068\u3044\u3046\u5f62\u5f0f\u3067\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u3066\u3001\u305d\u308c\u3092\uff50\uff48\uff50\u306e\u914d\u5217\u306b\u683c\u7d0d\u3055\u308c\u305f\u72b6\u614b\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\r\n$aJson = $cryptowatchApi->ohlc();\r\n\r\n\/\/ json\u3092\u914d\u5217\u5909\u63db\u3057\u305f\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u304c\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u306e\u304b\u898b\u308b\r\nvar_dump($aJson);\r\n\r\n<\/pre>\n<div class=\"recruitBunnerBox\"><a href=\"\/category_recruit\/programmer.html\"><img loading=\"lazy\" decoding=\"async\" src=\"\/img\/recruit\/insert_text\/img_recruit23.jpg\" alt=\"\" width=\"660\" height=\"371\" \/><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30b7\u30b9\u30c6\u30e0\u90e8\u306eN\u3067\u3059\u3002 \u3044\u3064\u3082\u4ed5\u4e8b\u3068\u5168\u7136\u95a2\u4fc2\u306a\u3044\u3053\u3068\u3092\u30d6\u30ed\u30b0\u306b\u66f8\u3044\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u30b5\u30a4\u30c8\u306f\u6c42\u4eba\u30b5\u30a4\u30c8\u3067\u3059\u306e\u3067\u3069\u3046\u3044\u3046\u4ed5\u4e8b\u3057\u3066\u308b\u306e\u304b\uff1f\u3068\u3044\u3046\u3053\u3068\u304c\u898b\u3066\u304f\u3060\u3055\u3063\u3066\u308b\u65b9\u3005\u306b\u5206\u304b\u3089\u306a\u3044\u3068\u99c4\u76ee\u3060\u308d\u3046\u3068\u3044\u3046\u308f\u3051 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":4690,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[51,52],"class_list":["post-4688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-5","tag-web","tag-se"],"_links":{"self":[{"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/posts\/4688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/comments?post=4688"}],"version-history":[{"count":0,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/posts\/4688\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/media\/4690"}],"wp:attachment":[{"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/media?parent=4688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/categories?post=4688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cin-gr.jp\/category_column\/wp-json\/wp\/v2\/tags?post=4688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}